![]() |
TerraLib 4.1
|
A driver class to a database accessible using ADO library. More...
#include <TeAdoDB.h>
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 |
A driver class to a database accessible using ADO library.
| TeAdo::TeAdo | ( | ) |
| TeAdo::~TeAdo | ( | ) |
| bool TeAdo::addColumn | ( | const string & | table, |
| TeAttributeRep & | rep | ||
| ) | [virtual] |
Adds a column to a table.
| table | table name |
| rep | representation of the column being created |
Implements TeDatabase.
Reimplemented in TeOracle, and TeSqlServer.
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::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.
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.
| 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.
| table | table name |
| attr | table list of attributes |
Implements TeDatabase.
Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.
Deletes a column to a table.
| table | table name |
| colName | name of the column being deleted |
Reimplemented from TeDatabase.
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.
| 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.
Gets the date and time following the format MMsDDsYYYYsHHsMMsSS to use with Access.
Reimplemented from TeDatabase.
Reimplemented in TeOracle, and TeSqlServer.
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.
Implements TeDatabase.
Reimplemented in TeOracle.
Reimplemented from TeDatabase.
Reimplemented in TeOracle.
| bool TeAdo::insertLayer | ( | TeLayer * | layer | ) | [virtual] |
| bool TeAdo::insertLegend | ( | TeLegendEntry * | legend | ) | [virtual] |
Implements TeDatabase.
Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.
Reimplemented from TeDatabase.
Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.
Implements TeDatabase.
Reimplemented in TeOracle.
Reimplemented from TeDatabase.
Reimplemented in TeOracle.
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.
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] |
| 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.
| 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.
Implements TeDatabase.
Reimplemented in TeOracle, TeSqlServer, and TeSqlServerSpatial.
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] |
| 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] |
| bool TeAdo::insertViewTree | ( | TeViewTree * | tree | ) | [virtual] |
| bool TeAdo::LinearRingToVariant | ( | VARIANT & | varArray, |
| TeLinearRing & | ring | ||
| ) |
| bool TeAdo::LineToVariant | ( | VARIANT & | varArray, |
| TeLine2D & | line | ||
| ) |
| bool TeAdo::listTables | ( | vector< string > & | ) | [virtual] |
| 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.
| 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] |
| bool TeAdo::updateLayerBox | ( | TeLayer * | layer | ) | [virtual] |
Updates the box information of a layer in the corresponding metadata table.
Reimplemented from TeDatabase.
Reimplemented in TeOracle.
Implements TeDatabase.
Reimplemented from TeDatabase.
Reimplemented from TeDatabase.
Updates a polygon in a geometry table.
Implements TeDatabase.
friend class TeAdoPortal [friend] |
ADODB::_ConnectionPtr TeAdo::connection_ [protected] |
string TeAdo::connectionString_ [protected] |
date separator
system format for date and time
AM indicator for a 12 hour clock.
PM indicator for a 12 hour clock.
time separator