All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Utils.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/postgis/Utils.cpp
22 
23  \brief Utility functions for PostgreSQL.
24 */
25 
26 // TerraLib
27 #include "../common/HexUtils.h"
28 #include "../common/Translator.h"
29 #include "../dataaccess/dataset/DataSet.h"
30 #include "../dataaccess/dataset/DataSetType.h"
31 #include "../datatype/ByteArray.h"
32 #include "EWKBWriter.h"
33 #include "Exception.h"
34 #include "Globals.h"
35 #include "Utils.h"
36 
37 // Boost
38 #include <boost/lexical_cast.hpp>
39 
40 // libpq
41 #include <libpq-fe.h>
42 
43 // helper functions
44 namespace te
45 {
46  namespace pgis
47  {
48  inline bool SetColumnDef(std::string& s, const std::string& tname, const te::dt::SimpleProperty* p, bool justDataType = false)
49  {
50  if(p->isAutoNumber() && p->getType() == te::dt::INT32_TYPE)
51  s += "SERIAL";
52  else if(p->isAutoNumber() && p->getType() == te::dt::INT64_TYPE)
53  s += "BIGSERIAL";
54  else
55  s += tname;
56 
57  if(justDataType)
58  return false;
59 
60  if(p->isRequired())
61  s += " NOT NULL";
62 
63  if(p->getDefaultValue() && (p->isAutoNumber() == false))
64  {
65  s += " DEFAULT '";
66  s += *(p->getDefaultValue());
67  s += "'";
68  }
69 
70  return p->isAutoNumber();
71  }
72 
73  inline void SetColumnDef(std::string& s, const te::dt::NumericProperty* p, bool justDataType = false)
74  {
76 
77  if(p->getPrecision() > 0)
78  {
79  s += "(";
81  s += ", ";
83  s += ")";
84  }
85 
86  if(justDataType)
87  return;
88 
89  if(p->isRequired())
90  s += " NOT NULL";
91 
92  if(p->getDefaultValue())
93  {
94  s += " DEFAULT '";
95  s += *(p->getDefaultValue());
96  s += "'";
97  }
98  }
99 
100  inline void SetColumnDef(std::string& s, const std::string& tname, const te::dt::StringProperty* p, bool justDataType = false)
101  {
102  s += tname;
103 
104  if(p->size() > 0)
105  {
106  s += "(";
107  s += te::common::Convert2String(static_cast<unsigned int>(p->size()));
108  s += ")";
109  }
110 
111  if(justDataType)
112  return;
113 
114  if(p->isRequired())
115  s += " NOT NULL";
116 
117  if(p->getDefaultValue())
118  {
119  s += " DEFAULT '";
120  s += *(p->getDefaultValue());
121  s += "'";
122  }
123  }
124 
125  inline void SetColumnDef(std::string& s, const te::dt::ArrayProperty* p, bool justDataType = false)
126  {
127  te::dt::Property* elementType = p->getElementType();
128  SetColumnDef(s, elementType, true);
129 
130  s += "[]";
131 
132  if(justDataType)
133  return;
134 
135  if(p->isRequired())
136  s += " NOT NULL";
137 
138  if(p->getDefaultValue())
139  {
140  s += " DEFAULT '";
141  s += *(p->getDefaultValue());
142  s += "'";
143  }
144  }
145  }
146 }
147 
148 // Utils implementation
150 {
151  switch(t)
152  {
153  case te::gm::PointType:
154  case te::gm::PointZType:
155  case te::gm::PointZMType:
156  return Globals::sm_pointTypeName;
157 
158  case te::gm::PointMType:
159  return Globals::sm_pointMTypeName;
160 
164  return Globals::sm_lineStringTypeName;
165 
167  return Globals::sm_lineStringMTypeName;
168 
169  case te::gm::PolygonType:
172  return Globals::sm_polygonTypeName;
173 
174  case te::gm::PolygonMType:
175  return Globals::sm_polygonMTypeName;
176 
180  return Globals::sm_geometryCollectionTypeName;
181 
183  return Globals::sm_geometryCollectionMTypeName;
184 
188  return Globals::sm_multiPointTypeName;
189 
191  return Globals::sm_multiPointMTypeName;
192 
196  return Globals::sm_multiLineStringTypeName;
197 
199  return Globals::sm_multiLineStringMTypeName;
200 
204  return Globals::sm_multiPolygonTypeName;
205 
207  return Globals::sm_multiPolygonMTypeName;
208 
209  default:
210  return Globals::sm_geometryTypeName;
211  }
212 }
213 
214 bool te::pgis::SetColumnDef(std::string& s, const te::dt::Property* p, bool justDataType)
215 {
216  int t = p->getType();
217 
218  bool ret = false;
219 
220  switch(t)
221  {
222  case te::dt::CHAR_TYPE:
223  ret = SetColumnDef(s, Globals::sm_charTypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
224  break;
225 
226  case te::dt::INT16_TYPE:
227  ret = SetColumnDef(s, Globals::sm_int2TypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
228  break;
229 
230  case te::dt::INT32_TYPE:
231  ret = SetColumnDef(s, Globals::sm_intTypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
232  break;
233 
234  case te::dt::INT64_TYPE:
235  ret = SetColumnDef(s, Globals::sm_int8TypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
236  break;
237 
239  {
240  SetColumnDef(s, static_cast<const te::dt::NumericProperty*>(p), justDataType);
241  }
242  break;
243 
245  {
246  const te::dt::DateTimeProperty* dtp = static_cast<const te::dt::DateTimeProperty*>(p);
247  if(dtp->getSubType() == te::dt::DATE)
248  SetColumnDef(s, Globals::sm_dateTypeName, dtp, justDataType);
249  else if(dtp->getSubType() == te::dt::TIME_DURATION)
250  SetColumnDef(s, Globals::sm_timeTypeName, dtp, justDataType);
251  else if(dtp->getSubType() == te::dt::TIME_INSTANT)
252  SetColumnDef(s, Globals::sm_timeStampTypeName, dtp, justDataType);
253  else if(dtp->getSubType() == te::dt::TIME_INSTANT_TZ)
254  SetColumnDef(s, Globals::sm_timeStampTZTypeName, dtp, justDataType);
255  }
256  break;
257 
258  case te::dt::FLOAT_TYPE:
259  SetColumnDef(s, Globals::sm_floatTypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
260  break;
261 
262  case te::dt::DOUBLE_TYPE:
263  SetColumnDef(s, Globals::sm_doubleTypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
264  break;
265 
266  case te::dt::STRING_TYPE:
267  {
268  const te::dt::StringProperty* sp = static_cast<const te::dt::StringProperty*>(p);
269 
270  if(sp->getSubType() == te::dt::FIXED_STRING)
271  SetColumnDef(s, Globals::sm_fixedcharTypeName, sp, justDataType);
272  else if(sp->getSubType() == te::dt::VAR_STRING)
273  SetColumnDef(s, Globals::sm_varcharTypeName, sp, justDataType);
274  else
275  SetColumnDef(s, Globals::sm_stringTypeName, sp, justDataType);
276  }
277  break;
278 
280  SetColumnDef(s, Globals::sm_booleanTypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
281  break;
282 
284  SetColumnDef(s, Globals::sm_byteArrayTypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
285  break;
286 
288  SetColumnDef(s, Globals::sm_geometryTypeName, static_cast<const te::dt::SimpleProperty*>(p), justDataType);
289  break;
290 
291  case te::dt::ARRAY_TYPE:
292  SetColumnDef(s, static_cast<const te::dt::ArrayProperty*>(p), justDataType);
293  break;
294 
295  default:
296  throw Exception(TR_PGIS("The informed type could not be mapped to PostgreSQL type system!"));
297  break;
298  }
299 
300  return ret;
301 }
302 
303 void te::pgis::Convert2PostGIS(PGconn* conn, const te::gm::Geometry* g, std::string& output)
304 {
305  std::size_t size = g->getWkbSize() + 4;
306  std::size_t tosize = 0;
307 
308  char* ewkb = new char[size];
309 
310  EWKBWriter::write(g, ewkb);
311  unsigned char* byteArray = PQescapeByteaConn(conn, (unsigned char*)ewkb, size, &tosize);
312  delete [] ewkb;
313 
314  output += "ST_GeomFromEWKB('";
315  output += (char*)byteArray;
316  output += "')";
317 
318  PQfreemem(byteArray);
319 }
320 
321 void te::pgis::ScapeString(PGconn* conn, const std::string& s, std::string& output)
322 {
323  std::size_t length = s.length() ;
324  char* to = new char[2 * length + 1];
325  PQescapeStringConn(conn, to, s.c_str(), length, 0);
326  output += to;
327  delete [] to;
328 }
329 
331  unsigned int pgisGeomTypeOid,
332  unsigned int pgisRasterTypeOid,
333  std::vector<int>& teTypes)
334 {
335  int ncols = PQnfields(result);
336 
337  for(int i = 0; i < ncols; ++i)
338  {
339  std::auto_ptr<te::dt::Property> p(Convert2TerraLib(i, PQfname(result, i), PQftype(result, i),
340  false, 0, false, 0, -1, pgisGeomTypeOid, pgisRasterTypeOid));
341 
342  teTypes.push_back(p->getType());
343  }
344 }
345 
346 std::string te::pgis::MakeConnectionStr(const std::map<std::string, std::string>& dsInfo)
347 {
348  std::map<std::string, std::string>::const_iterator it = dsInfo.find("PG_HOST");
349  std::map<std::string, std::string>::const_iterator it_end = dsInfo.end();
350  std::string connInfo;
351 
352  if(it != it_end)
353  connInfo += " host = " + it->second;
354 
355  it = dsInfo.find("PG_HOST_ADDR");
356 
357  if(it != it_end)
358  connInfo += " hostaddr = " + it->second;
359 
360  it = dsInfo.find("PG_PORT");
361 
362  if(it != it_end)
363  connInfo += " port = " + it->second;
364 
365  it = dsInfo.find("PG_DB_NAME");
366 
367  if(it != it_end)
368  connInfo += " dbname = " + it->second;
369 
370  it = dsInfo.find("PG_USER");
371 
372  if(it != it_end)
373  connInfo += " user = " + it->second;
374 
375  it = dsInfo.find("PG_PASSWORD");
376 
377  if((it != it_end) && (!it->second.empty()))
378  connInfo += " password = " + it->second;
379 
380  it = dsInfo.find("PG_CONNECT_TIMEOUT");
381 
382  if(it != it_end)
383  connInfo += " connect_timeout = " + it->second;
384 
385  it = dsInfo.find("PG_OPTIONS");
386 
387  if(it != it_end)
388  connInfo += " options = " + it->second;
389 
390  it = dsInfo.find("PG_SSL_MODE");
391 
392  if(it != it_end)
393  connInfo += " sslmode = " + it->second;
394 
395  it = dsInfo.find("PG_KRBSRVNAME");
396 
397  if(it != it_end)
398  connInfo += " krbsrvname = " + it->second;
399 
400  it = dsInfo.find("PG_GSSLIB");
401 
402  if(it != it_end)
403  connInfo += " gsslib = " + it->second;
404 
405  return connInfo;
406 }
407 
408 void te::pgis::SplitTableName(const std::string& fullName, const std::string* defaultSchema, std::string& schemaName, std::string& tableName)
409 {
410  assert(defaultSchema);
411 
412 // split schema-name.table-name if needed
413  size_t pos = fullName.find(".");
414 
415  if(pos == std::string::npos)
416  {
417  tableName = fullName;
418  schemaName = *defaultSchema;
419  }
420  else
421  {
422  tableName = fullName.substr(pos + 1);
423  schemaName = fullName.substr(0, pos);
424  }
425 }
426 
427 std::string te::pgis::GetBindableWhereSQL(const std::vector<te::dt::Property*>& properties, const std::size_t offset)
428 {
429  std::string wheresql;
430 
431  const std::size_t size = properties.size();
432 
433  for(std::size_t i = 0; i < size; ++i)
434  {
435  if(i != 0)
436  wheresql += " AND ";
437 
438  wheresql += properties[i]->getName();
439 
440  wheresql += " = $" + boost::lexical_cast<std::string>(i + 1 + offset);
441  }
442 
443  return wheresql;
444 }
445 
446 std::string te::pgis::GetSQLBindValues(std::size_t nproperties)
447 {
448  std::string valueNames("(");
449 
450  for(std::size_t i = 0; i < nproperties; ++i)
451  {
452  if(i != 0)
453  valueNames += ",";
454 
455  valueNames += "$" + boost::lexical_cast<std::string>(i + 1);
456  }
457 
458  valueNames += ")";
459 
460  return valueNames;
461 }
462 
463 std::string te::pgis::GetBindableUpdateSQL(const std::vector<te::dt::Property*>& properties)
464 {
465  std::string sql;
466 
467  const std::size_t size = properties.size();
468 
469  for(std::size_t i = 0; i < size; ++i)
470  {
471  if(i != 0)
472  sql += ", ";
473 
474  sql += properties[i]->getName();
475 
476  sql += " = $" + boost::lexical_cast<std::string>(i + 1);
477  }
478 
479  return sql;
480 }
481 
483 {
484  std::string values("(");
485 
486  const std::size_t np = dt->size();
487 
488  for(std::size_t i = 0; i < np; ++i)
489  {
490  if(i != 0)
491  values += ",";
492 
493  values += GetSQLValue(dt->getProperty(i), i, d, conn);
494  }
495 
496  values += ")";
497 
498  return values;
499 }
500 
501 std::string te::pgis::GetSQLValue(const te::dt::Property* p, std::size_t propertyPos, te::da::DataSet* d, PGconn *conn)
502 {
503  std::string value;
504 
505  switch(p->getType())
506  {
507  case te::dt::CHAR_TYPE :
508  value += d->getChar(propertyPos);
509  break;
510 
511  case te::dt::INT16_TYPE :
512  value += boost::lexical_cast<std::string>(d->getInt16(propertyPos));
513  break;
514 
515  case te::dt::INT32_TYPE :
516  value += boost::lexical_cast<std::string>(d->getInt32(propertyPos));
517  break;
518 
519  case te::dt::INT64_TYPE :
520  value += boost::lexical_cast<std::string>(d->getInt64(propertyPos));
521  break;
522 
523  case te::dt::BOOLEAN_TYPE :
524  value += d->getBool(propertyPos) ? "1" : "0";
525  break;
526 
527  case te::dt::FLOAT_TYPE :
528  value += boost::lexical_cast<std::string>(d->getFloat(propertyPos));
529  break;
530 
531  case te::dt::DOUBLE_TYPE :
532  value += boost::lexical_cast<std::string>(d->getDouble(propertyPos));
533  break;
534 
535  case te::dt::NUMERIC_TYPE :
536  value += d->getNumeric(propertyPos);
537  break;
538 
539  case te::dt::STRING_TYPE :
540  {
541  std::string dvalue = d->getString(propertyPos);
542 
543  char* valueto = new char[dvalue.length() * 2 + 1];
544 
545  int pgerror = 0;
546 
547  PQescapeStringConn(conn, valueto, dvalue.c_str(), dvalue.length(), &pgerror);
548 
549  if(pgerror != 0)
550  {
551  delete [] valueto;
552  throw Exception(TR_PGIS("Could not escape string!"));
553  }
554 
555  value += "'";
556  value += valueto;
557  value += "'";
558 
559  delete [] valueto;
560  }
561  break;
562 
564  {
565  //std::auto_ptr<te::dt::ByteArray> ba(d->getByteArray(propertyPos));
566  //char* hexba = new char[ba->bytesUsed() * 2 + 1];
567  //te::common::Binary2Hex(ba->getData(), ba->bytesUsed(), hexba);
568 
569  //value += "E'\\\\x";
570  //value += hexba;
571  //value += "'";
572 
573  //delete [] hexba;
574 
575  std::auto_ptr<te::dt::ByteArray> ba(d->getByteArray(propertyPos));
576 
577  std::size_t tolen;
578 
579  unsigned char* pgba = PQescapeByteaConn(conn, (const unsigned char*)(ba->getData()), ba->bytesUsed(), &tolen);
580 
581  value += "'";
582  value += (char*)pgba;
583  value += "'";
584 
585  PQfreemem(pgba);
586  }
587  break;
588 
589  case te::dt::GEOMETRY_TYPE :
590  {
591  std::auto_ptr<te::gm::Geometry> geom(d->getGeometry(propertyPos));
592 
593 // get ewkb
594  std::size_t ewkbsize = geom->getWkbSize() + 4;
595 
596  char* ewkb = new char[ewkbsize];
597 
598  EWKBWriter::write(geom.get(), ewkb);
599 
600  char* hewkb = new char[ewkbsize * 2 + 1];
601 
602  te::common::Binary2Hex(ewkb, ewkbsize, hewkb);
603 
604  //value += "GeomFromEWKB(E'\\\\x";
605  value += "'";
606  value += hewkb;
607  value += "'";
608  //value += "')";
609 
610  delete [] ewkb;
611  delete [] hewkb;
612  }
613  break;
614 
615  case te::dt::DATETIME_TYPE :
616  {
617  std::auto_ptr<te::dt::DateTime> dt(d->getDateTime(propertyPos));
618  value += "'";
619  value += dt->toString();
620  value += "'";
621  }
622  break;
623 
624  default :
625  throw Exception(TR_PGIS("The TerraLib data type is not supported by the PostgreSQL driver!"));
626  }
627 
628  return value;
629 }
630 
632 {
633  std::string values;
634 
635  const std::size_t np = dt->size();
636 
637  for(std::size_t i = 0; i < np; ++i)
638  {
639  if(i != 0)
640  values += ",";
641 
642  values += GetSQLValue(dt->getProperty(i), i, d, conn);
643  }
644 
645  values += "\n";
646 
647  return values;
648 }
virtual double getDouble(std::size_t i) const =0
Method for retrieving a double attribute value.
bool isRequired() const
It returns true if the attribute is required, otherwise it returns false.
struct pg_conn PGconn
Definition: Connection.h:45
The type for variable-length multidimensional arrays.
Definition: ArrayProperty.h:45
char * Binary2Hex(const char *s, std::size_t size)
Each char from the array of characters in binary format is converted into a pair of hex characters...
Definition: HexUtils.h:602
An static class with global definitions.
An atomic property like an integer or double.
Property * getProperty(std::size_t i) const
It returns the i-th property.
std::size_t size() const
It returns the number of properties of the CompositeProperty.
std::size_t getWkbSize() const
It returns the size required by a WKB representation for this geometric object.
Definition: Geometry.cpp:133
void Convert2PostGIS(const te::gm::Envelope *e, int srid, std::string &output)
It converts the envelope into a PostGIS BOX3D.
Definition: Utils.h:225
virtual float getFloat(std::size_t i) const =0
Method for retrieving a float attribute value.
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
virtual bool getBool(std::size_t i) const =0
Method for retrieving a boolean attribute value.
StringType getSubType() const
It returns the string property sub type.
virtual std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const =0
Method for retrieving a date and time attribute value.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
virtual boost::int32_t getInt32(std::size_t i) const =0
Method for retrieving a 32-bit integer attribute value (4 bytes long).
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
DateTimeType getSubType() const
It returns the date time property sub type.
std::string GetSQLValue(const te::dt::Property *p, std::size_t propertyPos, te::da::DataSet *d, PGconn *conn)
Definition: Utils.cpp:501
virtual std::string getNumeric(std::size_t i) const =0
Method for retrieving a numeric attribute value.
std::string GetLoadDataRow(const te::da::DataSetType *dt, te::da::DataSet *d, PGconn *conn)
Definition: Utils.cpp:631
An exception class for the PostGIS driver.
Property * getElementType() const
It returns the type of array elements.
Definition: ArrayProperty.h:98
#define TR_PGIS(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
Definition: Config.h:168
virtual boost::int16_t getInt16(std::size_t i) const =0
Method for retrieving a 16-bit integer attribute value (2 bytes long).
te::dt::Property * Convert2TerraLib(unsigned int attNum, const char *attName, unsigned int attType, bool attNotNull, const char *fmt, bool attHasDefault, const char *attDefValue, unsigned int pgisGeomTypeOid, unsigned int pgisRasterTypeOid)
It creates a PropertyType from a PostgreSQL attribute description.
Definition: Utils.h:456
std::string GetBindableWhereSQL(const std::vector< te::dt::Property * > &properties, const std::size_t offset=0)
Given a list of properties it creates an AND connected expression with bindable parameters ($n)...
Definition: Utils.cpp:427
const std::string & GetGeometryName(te::gm::GeomType t)
It returns the geometry names as usual for PostGIS.
Definition: Utils.cpp:149
std::string GetSQLValues(const te::da::DataSetType *dt, te::da::DataSet *d, PGconn *conn)
Definition: Utils.cpp:482
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
std::string GetSQLBindValues(std::size_t nproperties)
Definition: Utils.cpp:446
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
virtual std::auto_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const =0
Method for retrieving a byte array.
virtual char getChar(std::size_t i) const =0
Method for retrieving a signed character attribute value (1 byte long).
std::string * getDefaultValue() const
It returns the default value associated to the property, or NULL if none is associated.
virtual boost::int64_t getInt64(std::size_t i) const =0
Method for retrieving a 64-bit integer attribute value (8 bytes long).
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
Definition: StringUtils.h:51
struct pg_result PGresult
Definition: Connection.h:48
std::size_t size() const
It returns the maximum number of characters for a varying string, or the number of characters for a f...
unsigned int getPrecision() const
It returns the total count of significant digits in the whole number, that is, the number of digits t...
void ScapeString(PGconn *conn, const std::string &s, std::string &output)
It escapes a string for use within an SQL command.
Definition: Utils.cpp:321
A class that models the description of a dataset.
Definition: DataSetType.h:72
TEOGREXPORT te::gm::Geometry * Convert2TerraLib(OGRGeometry *ogrGeom)
It converts the OGR Geometry to TerraLib Geometry.
Definition: Utils.cpp:54
bool SetColumnDef(std::string &s, const std::string &tname, const te::dt::SimpleProperty *p, bool justDataType=false)
Definition: Utils.cpp:48
It models a property definition.
Definition: Property.h:59
Utility functions for PostgreSQL.
The type for arbitrary precison numbers, like numeric(p, q).
int getType() const
It returns the property data type.
Definition: Property.h:143
void SplitTableName(const std::string &fullName, const std::string *defaultSchema, std::string &schemaName, std::string &tableName)
Definition: Utils.cpp:408
unsigned int getScale() const
It returns the count of decimal digits in the fractional part, to the right of the decimal point...
static const std::string sm_numericTypeName
The string literal representation for the numeric type.
Definition: Globals.h:62
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
std::string MakeConnectionStr(const std::map< std::string, std::string > &dsInfo)
Definition: Utils.cpp:346
std::string GetBindableUpdateSQL(const std::vector< te::dt::Property * > &properties)
Given a list of properties it constructs a string with bindable parameters that can be used inside an...
Definition: Utils.cpp:463
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:111
bool isAutoNumber() const
It returns true if the attribute is an autonumber, otherwise it returns false.
An utility class for writing a PostGIS EWKB.