Utils.h File Reference

Utility functions for PostgreSQL. More...

#include "../common/ByteSwapUtils.h"
#include "../common/Globals.h"
#include "../common/StringUtils.h"
#include "../dataaccess/Enums.h"
#include "../datatype/ArrayProperty.h"
#include "../datatype/Date.h"
#include "../datatype/DateTimeProperty.h"
#include "../datatype/NumericProperty.h"
#include "../datatype/SimpleProperty.h"
#include "../datatype/StringProperty.h"
#include "../datatype/TimeDuration.h"
#include "../datatype/TimeInstant.h"
#include "../datatype/TimeInstantTZ.h"
#include "../geometry/Envelope.h"
#include "../geometry/Geometry.h"
#include "../geometry/GeometryProperty.h"
#include "../raster/RasterProperty.h"
#include "Config.h"
#include <cstdlib>
#include <cstring>
#include <vector>
#include <boost/date_time/time_zone_base.hpp>

Go to the source code of this file.

Namespaces

 te
 URI C++ Library.
 
 te::da
 Namespace for the DataAccess API of TerraLib.
 
 te::pgis
 Namespace for the TerraLib PostGIS driver implementation.
 

Typedefs

typedef struct pg_conn PGconn
 
typedef struct pg_result PGresult
 

Functions

void te::pgis::Convert2OGCWKBType (unsigned int &gType)
 It converts the PostGIS geometry type to a pure OGC WKB code. More...
 
void te::pgis::Convert2PostGIS (const te::gm::Envelope *e, int srid, std::string &output)
 It converts the envelope into a PostGIS BOX3D. More...
 
void te::pgis::Convert2PostGIS (PGconn *conn, const te::gm::Geometry *g, std::string &output)
 It converts the geometry into a PostGIS geometry. More...
 
void te::pgis::Convert2PostGISWKBType (unsigned int &gType)
 
te::dt::Propertyte::pgis::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. More...
 
te::dt::Propertyte::pgis::Convert2TerraLib (unsigned int attNum, const char *attName, unsigned int attType, bool attNotNull, const char *fmt, bool attHasDefault, const char *attDefValue, int ndims, unsigned int pgisGeomTypeOid, unsigned int pgisRasterTypeOid)
 It creates a PropertyType from a PostgreSQL attribute description. More...
 
void te::pgis::Convert2TerraLib (PGresult *result, unsigned int pgisGeomTypeOid, unsigned int pgisRasterTypeOid, std::vector< int > &teTypes)
 It creates a data set type from a PostGIS internal result. More...
 
int te::pgis::Date2Julian (int y, int m, const int d)
 It returns a julian date (in seconds) from a gregorian date. More...
 
te::da::FKActionType te::pgis::GetAction (char a)
 It converts the PostgreSQL foreign key modifier to a TerraLib data type. More...
 
std::string te::pgis::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 update query. More...
 
std::string te::pgis::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). More...
 
std::string te::pgis::GetBoxSpatialRelation (te::gm::SpatialRelation rel)
 It converts the spatial relationship to PostGIS dialect. More...
 
te::gm::Envelopete::pgis::GetEnvelope (const char *str)
 It converts the pgType to a valid TerraLib data type. More...
 
const std::string & te::pgis::GetGeometryName (te::gm::GeomType t)
 It returns the geometry names as usual for PostGIS. More...
 
te::da::IndexType te::pgis::GetIndexType (const char *t)
 It converts the PostgreSQL index string to a TerraLib index type. More...
 
std::string te::pgis::GetLoadDataRow (const te::da::DataSetType *dt, te::da::DataSet *d, PGconn *conn)
 
const char * te::pgis::GetPGEncoding (te::common::CharEncoding encoding)
 
std::string te::pgis::GetSpatialRelation (te::gm::SpatialRelation rel)
 It converts the spatial relationship to PostGIS dialect. More...
 
std::string te::pgis::GetSQLBindValues (std::size_t nproperties)
 
std::string te::pgis::GetSQLValue (const te::dt::Property *p, std::size_t propertyPos, te::da::DataSet *d, PGconn *conn)
 
std::string te::pgis::GetSQLValues (const te::da::DataSetType *dt, te::da::DataSet *d, PGconn *conn)
 
te::common::CharEncoding te::pgis::GetTeEncoding (const char *const encoding)
 
te::dt::DateTimete::pgis::Internal2Date (const long dDate)
 It returns a DateTime type from a date loaded by PostgreSQL. More...
 
te::dt::DateTimete::pgis::Internal2Time (boost::int64_t tval)
 It returns a DateTime type from a time loaded by PostgreSQL. More...
 
te::dt::DateTimete::pgis::Internal2TimeStamp (boost::int64_t ival)
 It returns a DateTime type from a timestamp loaded by PostgreSQL. More...
 
te::dt::DateTimete::pgis::Internal2TimeTZ (boost::int64_t tval, int z)
 
void te::pgis::Julian2Date (const int jd, int *year, int *month, int *day)
 It returns a gregorian date from a julian date (in seconds). More...
 
std::string te::pgis::MakeConnectionStr (const std::map< std::string, std::string > &dsInfo)
 
void te::pgis::ScapeString (PGconn *conn, const std::string &s, std::string &output)
 It escapes a string for use within an SQL command. More...
 
bool te::pgis::SetColumnDef (std::string &s, const te::dt::Property *p, bool justDataType=false)
 It writes the PostgreSQL column definition to the output string. More...
 
void te::pgis::SplitTableName (const std::string &fullName, const std::string *defaultSchema, std::string &schemaName, std::string &tableName)
 

Detailed Description

Utility functions for PostgreSQL.

Definition in file Utils.h.

Typedef Documentation

typedef struct pg_conn PGconn

Definition at line 60 of file Utils.h.

typedef struct pg_result PGresult

Definition at line 63 of file Utils.h.