| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Friends
TeAdo Class Reference

A driver class to a database accessible using ADO library. More...

`#include <TeAdoDB.h>`

Inheritance diagram for TeAdo:

List of all members.

## Public Member Functions

| TeAdo ()
| ~TeAdo ()
virtual bool | newDatabase (const string &database, const string &user, const string &password, const string &host, const int &port=-1, bool terralibModel=true, const std::string &characterSet="")
| Creates a new database and open a connection to it.
virtual bool | connect (const string &host, const string &user, const string &password, const string &database, int port=-1)
| Opens a connection to a database server passing all parameters needed.
virtual bool | connect (const string &fullDatabaseName="")
| Connects using a stored connection string.
virtual void | connection (ADODB::_ConnectionPtr conn)
string | connectionString ()
void | close ()
| Closes the connection.
bool | execute (const string &sql)
| Executes a SQL command that doesnt return a record set. Tipically a data definition comand.
string | escapeSequence (const string &from)
| Escape special characters in a string to be used in a SQL statement.
bool | tableExist (const string &table)
| Verifies if a table exist in the database.
bool | listTables (vector< string > &tableList)
| Returns a list of tables in a database.
bool | columnExist (const string &table, const string &column, TeAttribute &attr)
| Verifies if a table has a column.
bool | allowEmptyString (const string &tableName, const string &column)
| Update a column.
bool | getAttributeList (const string &tableName, TeAttributeList &attList)
| Gets the list of attributes of a table.
virtual bool | createTable (const string &table, TeAttributeList &attr)
| Creates a table.
virtual bool | addColumn (const string &table, TeAttributeRep &rep)
| Adds a column to a table.
virtual bool | alterTable (const string &table, TeAttributeRep &rep, const string &oldColName="")
| Alter a property of a table.
virtual bool | alterTable (const string &oldTableName, const string &newTableName)
| Alter the table name.
virtual bool | deleteColumn (const string &table, const string &colName)
| Deletes a column to a table.
virtual bool | createRelation (const string &relationName, const string &foreignTbl, const string &FTKey, const string &relatedTbl, const string &RTKey, bool cascadeDeletion)
| Creates a reationship between two tables.
TeDBRelationType | existRelation (const string &tableName, const string &relName)
| Checks if a relation exist.
bool | insertProject (TeProject *project)
| Insert information about a project.
bool | insertTable (TeTable &table)
| Saves a table and its contents in the database.
bool | insertBlob (const string &tableName, const string &columnBlob, const string &whereClause, unsigned char *data, int size)
| Saves a large binary objects (BLOB) in a row table.
bool | insertTableInfo (int layerId, TeTable &table, const string &user="")
| Inserts information about an attribute table.
bool | insertRelationInfo (const int tableId, const string &tField, const string &eTable, const string &eField, int &relId)
| Inserts information about a link to an external table.
bool | insertLayer (TeLayer *layer)
| Insert information about a layer.
bool | insertRepresentation (int layerId, TeRepresentation &rep)
| Inserts information about a geometrical representation.
bool | insertView (TeView *view)
| Inserts a view.
virtual bool | insertTheme (TeAbstractTheme *theme)
| Inserts an abstract theme in the database.
virtual bool | insertThemeGroup (TeViewTree *tree)
| Inserts a group of themes in the database.
bool | insertThemeTable (int themeId, int tableId, int relationId, int tableOrder)
| Inserts information about a table used by a theme.
bool | insertViewTree (TeViewTree *tree)
| Recursive inserting of a view tree.
bool | insertLegend (TeLegendEntry *legend)
| Inserts legend in the database.
bool | insertProjection (TeProjection *proj)
| Insert information about a geographical projection.
virtual bool | insertPolygonSet (const string &table, TePolygonSet &ps)
| Inserts a polygon set in a geometry table.
virtual bool | insertPolygon (const string &table, TePolygon &p)
| Inserts a polygon in a geometry table.
bool | updatePolygon (const string &table, TePolygon &p)
| Updates a polygon in a geometry table.
bool | insertLineSet (const string &table, TeLineSet &ls)
bool | insertLine (const string &table, TeLine2D &l)
bool | updateLine (const string &table, TeLine2D &l)
bool | insertPointSet (const string &table, TePointSet &ps)
bool | insertPoint (const string &table, TePoint &p)
bool | updatePoint (const string &table, TePoint &p)
bool | insertTextSet (const string &table, TeTextSet &ts)
bool | insertText (const string &table, TeText &t)
bool | insertArcSet (const string &table, TeArcSet &as)
| Inserts an arc set geometry in the database.
bool | insertArc (const string &table, TeArc &arc)
| Inserts an arc geometry in the database.
bool | insertNodeSet (const string &table, TeNodeSet &ns)
bool | insertNode (const string &table, TeNode &node)
bool | updateNode (const string &table, TeNode &node)
bool | insertCellSet (const string &table, TeCellSet &cs)
bool | insertCell (const string &table, TeCell &c)
bool | ByteArrayToVariant (VARIANT &varArray, unsigned char *bytes, int nbytes)
bool | LineToVariant (VARIANT &varArray, TeLine2D &line)
bool | LinearRingToVariant (VARIANT &varArray, TeLinearRing &ring)
bool | PointsToVariant (VARIANT &varArray, double *points, int npoints)
TeDatabasePortal * | getPortal ()
| Returns a database portal.
bool | insertRasterBlock (const string &table, const string &blockId, const TeCoord2D &ll, const TeCoord2D &ur, unsigned char *buf, unsigned long size, int band=0, unsigned int res=1, unsigned int subband=0)
| Insert a raster block into the database.
string | getSQLTime (const TeTime &time) const
| Gets the date and time following the format MMsDDsYYYYsHHsMMsSS to use with Access.
string | getSQLTemporalWhere (int time1, int time2, TeChronon chr, TeTemporalRelation rel, const string &initialTime, const string &finalTime)
| Return a string SQL to temporal where.
string | concatValues (vector< string > &values, const string &unionString)
| Concat values in a vector using unionString as the join between each value.
string | toUpper (const string &value)
| Returns the SQL function for upper case.
bool | updateBBox (const string &tableName, const string &idName, int idValue, const TeBox &box)
| Update box information in a table that has a set of columns to store a box value.
bool | updateLayerBox (TeLayer *layer)
| Updates the box information of a layer in the corresponding metadata table.
bool | updateLayer (TeLayer *layer)
| Update information about a layer.
Transaction control methods
virtual bool | beginTransaction ()
| Begins a transaction.
virtual bool | commitTransaction ()
| Commits a transaction.
virtual bool | rollbackTransaction ()
| Rollbacks a transaction.

## Static Public Member Functions

static string | systemDateTimeFormat (string &indAM, string &indPM, string &sepD, string &sepT)

## Public Attributes

string | systemDateTimeFormat_
| system format for date and time
string | systemIndAM_
| AM indicator for a 12 hour clock.
string | systemIndPM_
| PM indicator for a 12 hour clock.
string | systemDateSep_
| date separator
string | systemTimeSep_
| time separator

## Protected Attributes

ADODB::_ConnectionPtr | connection_
string | connectionString_

## Friends

class | TeAdoPortal

## Detailed Description

A driver class to a database accessible using ADO library.

## Constructor & Destructor Documentation

TeAdo::TeAdo | ( |  | ) |

TeAdo::~TeAdo | ( |  | ) |

## Member Function Documentation

bool TeAdo::addColumn | ( | const string & | table,
|  | TeAttributeRep & | rep
| ) |  | `[virtual]`

Adds a column to a table.

Parameters:

  table | table name
  rep | representation of the column being created

Implements TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

bool TeAdo::allowEmptyString | ( | const string & | ,
|  | const string & |
| ) |  | `[virtual]`

Update a column.

Reimplemented from TeDatabase.

bool TeAdo::alterTable | ( | const string & | tableName,
|  | TeAttributeRep & | rep,
|  | const string & | oldColName = `""`
| ) |  | `[virtual]`

Alter a property of a table.

Reimplemented from TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::alterTable | ( | const string & | oldTableName,
|  | const string & | newTablename
| ) |  | `[virtual]`

Alter the table name.

Reimplemented from TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

bool TeAdo::beginTransaction | ( |  | ) | `[virtual]`

Begins a transaction.

Reimplemented from TeDatabase.

bool TeAdo::ByteArrayToVariant | ( | VARIANT & | varArray,
|  | unsigned char * | bytes,
|  | int | nbytes
| ) |  |

void TeAdo::close | ( |  | ) | `[virtual]`

Closes the connection.

Implements TeDatabase.

bool TeAdo::columnExist | ( | const string & | table,
|  | const string & | column,
|  | TeAttribute & | attr
| ) |  | `[virtual]`

Verifies if a table has a column.

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::commitTransaction | ( |  | ) | `[virtual]`

Commits a transaction.

Reimplemented from TeDatabase.

string TeAdo::concatValues | ( | vector< string > & | values,
|  | const string & | unionString
| ) |  | `[virtual]`

Concat values in a vector using unionString as the join between each value.

Implements TeDatabase.

bool TeAdo::connect | ( | const string & | fullDatabaseName = `""` | ) | `[virtual]`

Connects using a stored connection string.

Reimplemented from TeDatabase.

bool TeAdo::connect | ( | const string & | host,
|  | const string & | user,
|  | const string & | password,
|  | const string & | database,
|  | int | port = `-1`
| ) |  | `[virtual]`

Opens a connection to a database server passing all parameters needed.

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

void TeAdo::connection | ( | ADODB::_ConnectionPtr | conn | ) | `[virtual]`

string TeAdo::connectionString | ( |  | ) | `[inline]`

bool TeAdo::createRelation | ( | const string & | relName,
|  | const string & | table,
|  | const string & | fieldName,
|  | const string & | relatedTable,
|  | const string & | relatedField,
|  | bool | cascadeDeletion
| ) |  | `[virtual]`

Creates a reationship between two tables.

Parameters:

  relName | relationship name
  table | table that will receive the foreign key
  fieldName | column that will be foreign key
  relatedTable | table that exports the foreign key
  relatedField | field that will the exported foreign key
  cascadeDeletion | flag that indicates if the deletion should be propagated

Implements TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

bool TeAdo::createTable | ( | const string & | table,
|  | TeAttributeList & | attr
| ) |  | `[virtual]`

Creates a table.

Parameters:

  table | table name
  attr | table list of attributes

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::deleteColumn | ( | const string & | table,
|  | const string & | colName
| ) |  | `[virtual]`

Deletes a column to a table.

Parameters:

  table | table name
  colName | name of the column being deleted

Reimplemented from TeDatabase.

string TeAdo::escapeSequence | ( | const string & | from | ) | `[virtual]`

Escape special characters in a string to be used in a SQL statement.

Implements TeDatabase.

bool TeAdo::execute | ( | const string & | sql | ) | `[virtual]`

Executes a SQL command that doesnt return a record set. Tipically a data definition comand.

Implements TeDatabase.

TeDBRelationType TeAdo::existRelation | ( | const string & | tableName,
|  | const string & | relName
| ) |  | `[virtual]`

Checks if a relation exist.

Parameters:

  tableName | table where the relashionship exists
  relName | relationship name

Implements TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

bool TeAdo::getAttributeList | ( | const string & | tableName,
|  | TeAttributeList & | attList
| ) |  | `[virtual]`

Gets the list of attributes of a table.

Reimplemented from TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

TeDatabasePortal * TeAdo::getPortal | ( |  | ) | `[virtual]`

Returns a database portal.

A database portal is used to submit queries to the database and to navigate over the resulting record set

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

string TeAdo::getSQLTemporalWhere | ( | int | time1,
|  | int | time2,
|  | TeChronon | chr,
|  | TeTemporalRelation | rel,
|  | const string & | initialTime,
|  | const string & | finalTime
| ) |  | `[virtual]`

Return a string SQL to temporal where.

Reimplemented from TeDatabase.

string TeAdo::getSQLTime | ( | const TeTime & | time | ) | const`[virtual]`

Gets the date and time following the format MMsDDsYYYYsHHsMMsSS to use with Access.

Reimplemented from TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

bool TeAdo::insertArc | ( | const string & | table,
|  | TeArc & | arc
| ) |  | `[virtual]`

Inserts an arc geometry in the database.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertArcSet | ( | const string & | table,
|  | TeArcSet & | as
| ) |  | `[virtual]`

Inserts an arc set geometry in the database.

Reimplemented from TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertBlob | ( | const string & | tableName,
|  | const string & | columnBlob,
|  | const string & | whereClause,
|  | unsigned char * | data,
|  | int | size
| ) |  | `[virtual]`

Saves a large binary objects (BLOB) in a row table.

Implements TeDatabase.

bool TeAdo::insertCell | ( | const string & | table,
|  | TeCell & | c
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertCellSet | ( | const string & | table,
|  | TeCellSet & | cs
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertLayer | ( | TeLayer * | layer | ) | `[virtual]`

Insert information about a layer.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertLegend | ( | TeLegendEntry * | legend | ) | `[virtual]`

Inserts legend in the database.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertLine | ( | const string & | table,
|  | TeLine2D & | l
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertLineSet | ( | const string & | table,
|  | TeLineSet & | ls
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertNode | ( | const string & | table,
|  | TeNode & | node
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertNodeSet | ( | const string & | table,
|  | TeNodeSet & | ns
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertPoint | ( | const string & | table,
|  | TePoint & | p
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertPointSet | ( | const string & | table,
|  | TePointSet & | ps
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertPolygon | ( | const string & | table,
|  | TePolygon & | p
| ) |  | `[virtual]`

Inserts a polygon in a geometry table.

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertPolygonSet | ( | const string & | table,
|  | TePolygonSet & | ps
| ) |  | `[virtual]`

Inserts a polygon set in a geometry table.

Reimplemented from TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertProject | ( | TeProject * | project | ) | `[virtual]`

Insert information about a project.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertProjection | ( | TeProjection * | proj | ) | `[virtual]`

Insert information about a geographical projection.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertRasterBlock | ( | const string & | table,
|  | const string & | blockId,
|  | const TeCoord2D & | ll,
|  | const TeCoord2D & | ur,
|  | unsigned char * | buf,
|  | unsigned long | size,
|  | int | band = `0`,
|  | unsigned int | res = `1`,
|  | unsigned int | subband = `0`
| ) |  | `[virtual]`

Insert a raster block into the database.

Parameters:

  table | table name
  blockId | block unique identifier
  ll | block lower left coordinate
  ur | block upper right coordinate
  buf | block binary data
  size | block size
  band | block band
  res | block resolution factor
  subband | sub band definitiion

Implements TeDatabase.

bool TeAdo::insertRelationInfo | ( | const int | tableId,
|  | const string & | tField,
|  | const string & | rTable,
|  | const string & | rField,
|  | int & | relId
| ) |  | `[virtual]`

Inserts information about a link to an external table.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertRepresentation | ( | int | layerId,
|  | TeRepresentation & | rep
| ) |  | `[virtual]`

Inserts information about a geometrical representation.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertTable | ( | TeTable & | table | ) | `[virtual]`

Saves a table and its contents in the database.

Reimplemented from TeDatabase.

Reimplemented in TeSqlServer.

bool TeAdo::insertTableInfo | ( | int | layerId,
|  | TeTable & | table,
|  | const string & | user = `""`
| ) |  | `[virtual]`

Inserts information about an attribute table.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertText | ( | const string & | table,
|  | TeText & | t
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertTextSet | ( | const string & | table,
|  | TeTextSet & | ts
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.

bool TeAdo::insertTheme | ( | TeAbstractTheme * | theme | ) | `[virtual]`

Inserts an abstract theme in the database.

Implements TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

bool TeAdo::insertThemeGroup | ( | TeViewTree * | tree | ) | `[virtual]`

Inserts a group of themes in the database.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertThemeTable | ( | int | themeId,
|  | int | tableId,
|  | int | relationId,
|  | int | tableOrder
| ) |  | `[virtual]`

Inserts information about a table used by a theme.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertView | ( | TeView * | view | ) | `[virtual]`

Inserts a view.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::insertViewTree | ( | TeViewTree * | tree | ) | `[virtual]`

Recursive inserting of a view tree.

Implements TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::LinearRingToVariant | ( | VARIANT & | varArray,
|  | TeLinearRing & | ring
| ) |  |

bool TeAdo::LineToVariant | ( | VARIANT & | varArray,
|  | TeLine2D & | line
| ) |  |

bool TeAdo::listTables | ( | vector< string > & |  | ) | `[virtual]`

Returns a list of tables in a database.

Reimplemented from TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::newDatabase | ( | const string & | database,
|  | const string & | user,
|  | const string & | password,
|  | const string & | host,
|  | const int & | port = `-1`,
|  | bool | terralibModel = `true`,
|  | const std::string & | characterSet = `""`
| ) |  | `[virtual]`

Creates a new database and open a connection to it.

Implements TeDatabase.

Reimplemented in TeSqlServer.

bool TeAdo::PointsToVariant | ( | VARIANT & | varArray,
|  | double * | points,
|  | int | npoints
| ) |  |

bool TeAdo::rollbackTransaction | ( |  | ) | `[virtual]`

Rollbacks a transaction.

Reimplemented from TeDatabase.

string TeAdo::systemDateTimeFormat | ( | string & | indAM,
|  | string & | indPM,
|  | string & | sepD,
|  | string & | sepT
| ) |  | `[static]`

bool TeAdo::tableExist | ( | const string & | table | ) | `[virtual]`

Verifies if a table exist in the database.

Implements TeDatabase.

Reimplemented in TeOracle, and TeSqlServer.

string TeAdo::toUpper | ( | const string & | value | ) | `[virtual]`

Returns the SQL function for upper case.

Implements TeDatabase.

Reimplemented in TeSqlServer.

bool TeAdo::updateBBox | ( | const string & | tableName,
|  | const string & | keyColumnName,
|  | int | keyValue,
|  | const TeBox & | box
| ) |  | `[virtual]`

Update box information in a table that has a set of columns to store a box value.

Reimplemented from TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::updateLayer | ( | TeLayer * | layer | ) | `[virtual]`

Update information about a layer.

Reimplemented from TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::updateLayerBox | ( | TeLayer * | layer | ) | `[virtual]`

Updates the box information of a layer in the corresponding metadata table.

Reimplemented from TeDatabase.

Reimplemented in TeOracle.

bool TeAdo::updateLine | ( | const string & | table,
|  | TeLine2D & | l
| ) |  | `[virtual]`

Implements TeDatabase.

bool TeAdo::updateNode | ( | const string & | table,
|  | TeNode & | node
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

bool TeAdo::updatePoint | ( | const string & | table,
|  | TePoint & | p
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

bool TeAdo::updatePolygon | ( | const string & | table,
|  | TePolygon & | p
| ) |  | `[virtual]`

Updates a polygon in a geometry table.

Implements TeDatabase.

## Friends And Related Function Documentation

friend class TeAdoPortal`[friend]`

## Member Data Documentation

ADODB::_ConnectionPtr TeAdo::connection_`[protected]`

string TeAdo::connectionString_`[protected]`

string TeAdo::systemDateSep_

date separator

string TeAdo::systemDateTimeFormat_

system format for date and time

string TeAdo::systemIndAM_

AM indicator for a 12 hour clock.

string TeAdo::systemIndPM_

PM indicator for a 12 hour clock.

string TeAdo::systemTimeSep_

time separator

The documentation for this class was generated from the following files:

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/ado/TeAdoDB.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/ado/TeAdoDB.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines