![]() |
TerraLib 4.1
|
A concrete implementation of a driver to the Firebird SGDB. More...
#include <TeFirebird.h>
Public Member Functions | |
| TeFirebird () | |
| virtual | ~TeFirebird () |
| IBPP::Database | getIBPPFirebird () |
| string | escapeSequence (const string &from) |
| Escape special characters in a string to be used in a SQL statement. | |
| 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. | |
| 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. | |
| bool | showDatabases (const string &host, const string &user, const string &password, vector< string > &dbNames, int port=-1) |
| Show the server databases (only for MySQL, Oracle and PostgreSQL) | |
| void | close () |
| Closes the connection. | |
| bool | tableExist (const string &table) |
| Verifies if a table exist in the database. | |
| bool | columnExist (const string &table, const string &column, TeAttribute &attr) |
| Verifies if a table has a column. | |
| bool | addColumn (const string &table, TeAttributeRep &rep) |
| Adds a column to a table. | |
| bool | createRelation (const string &, const string &, const string &, const string &, const string &, bool) |
| Creates a reationship between two tables. | |
| TeDBRelationType | existRelation (const string &, const string &) |
| Checks if a relation exist. | |
| bool | execute (const string &q) |
| Executes a SQL command that doesnt return a record set. Tipically a data definition comand. | |
| bool | createTable (const string &table, TeAttributeList &attr) |
| Creates a table. | |
| bool | alterTable (const string &tableName, TeAttributeRep &rep, const string &oldColName="") |
| Alter a property of a table. | |
| virtual TeDatabasePortal * | getPortal () |
| Returns a database portal. | |
| bool | insertProjection (TeProjection *proj) |
| Insert information about a geographical projection. | |
| bool | updateProjection (TeProjection *proj) |
| Updates information about a geographical projection. | |
| virtual bool | layerExist (string layerName) |
| Check if a particular layer exists (passing its name) | |
| bool | insertLayer (TeLayer *layer) |
| Insert information about a layer. | |
| bool | updateLayer (TeLayer *layer) |
| Update information about a layer. | |
| bool | insertProject (TeProject *project) |
| Insert information about a project. | |
| bool | insertRepresentation (int layerId, TeRepresentation &rep) |
| Inserts information about a geometrical representation. | |
| bool | insertTable (TeTable &table) |
| Saves a table and its contents in the database. | |
| bool | updateTable (TeTable &table) |
| Updates a table and its contents in the database. | |
| 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 | insertView (TeView *view) |
| Inserts a view. | |
| bool | insertViewTree (TeViewTree *tree) |
| Recursive inserting of a view tree. | |
| bool | insertTheme (TeAbstractTheme *theme) |
| Inserts an abstract theme in the database. | |
| bool | insertThemeGroup (TeViewTree *tree) |
| Inserts a group of themes in the database. | |
| bool | generateLabelPositions (TeTheme *theme, const std::string &objectId="") |
| Generates the label position (x,y) to each object of a theme or of a particular object. | |
| bool | updateTheme (TeAbstractTheme *theme) |
| Updates an asbtract theme in the database. | |
| bool | insertThemeTable (int themeId, int tableId, int relationId, int tableOrder) |
| Inserts information about a table used by a theme. | |
| bool | updateRepresentation (int layerId, TeRepresentation &rep) |
| Updates information about a geometrical representation. | |
| virtual bool | getIndexesFromTable (const string &tableName, std::vector< TeDatabaseIndex > &vecIndexes) |
| Return a TeDatabaseIndex vector from a table. | |
| virtual bool | updateRasterRepresentation (int layerId, TeRasterParams &par, const string &objectId="") |
| Updates the information about the raster geometry associated to an object of a layer. | |
| bool | insertLegend (TeLegendEntry *legend) |
| Inserts legend in the database. | |
| virtual bool | insertPolygon (const string &table, TePolygon &p) |
| Inserts a polygon in a geometry table. | |
| virtual bool | updatePolygon (const string &table, TePolygon &p) |
| Updates a polygon in a geometry table. | |
| virtual bool | insertLine (const string &table, TeLine2D &l) |
| virtual bool | updateLine (const string &table, TeLine2D &l) |
| bool | insertPoint (const string &table, TePoint &p) |
| bool | insertText (const string &table, TeText &t) |
| bool | insertArc (const string &table, TeArc &arc) |
| Inserts an arc geometry in the database. | |
| bool | insertNode (const string &table, TeNode &node) |
| bool | insertCell (const string &table, TeCell &c) |
| 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 |
| Returns a valid SQL time string. | |
| string | getSQLTemporalWhere (int time1, int time2, TeChronon chr, TeTemporalRelation rel, const string &initialTime, const string &finalTime) |
| Return a string SQL to temporal where. | |
| bool | inClauseValues (const string &query, const string &attribute, vector< string > &inClauseVector) |
| Get the values that satisfy the query. | |
| 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. | |
| string | concatValues (vector< string > &values, const string &unionString) |
| Concat values in a vector using unionString as the join between each value. | |
| bool | updateLayerBox (TeLayer *layer) |
| Updates the box information of a layer in the corresponding metadata table. | |
| string | toUpper (const string &value) |
| Returns the SQL function for upper case. | |
| string | getConcatFieldsExpression (const vector< string > &fNamesVec) |
| Concatenate field values. | |
| bool | beginTransaction () |
| Begins a transaction. | |
| bool | commitTransaction () |
| Commits a transaction. | |
| bool | rollbackTransaction () |
| Rollbacks a transaction. | |
| virtual std::string | mapToFirebirdType (const TeAttribute &teRep) const |
| virtual bool | createSpatialIndex (const string &table, const string &columns, TeSpatialIndexType=TeRTREE, short=0, short=0) |
| Implementation of the method that create a spatial index for a spatial table. It create separeted index for each column ascending or descending for best performance in Firebird db. | |
| bool | createAutoIncrement (const std::string &table, const std::string &column) |
| int | getLastGeneratedAutoNumber (const std::string &table) |
| virtual bool | getAttributeList (const string &tableName, TeAttributeList &attList) |
| Gets the list of attributes of a table. | |
Raster Tables | |
Retrieving/Inserting/Modifying/Deleting raster representations in the database. | |
| bool | insertRasterGeometry (const string &tableName, TeRasterParams &par, const string &objectId="") |
| Inserts information about a raster geometry associated to an object. | |
Connection | |
Methods related with connections. | |
| virtual void | setConnection (TeConnection *c) |
| Sets a connection that will be used by database. | |
| virtual TeConnection * | getConnection () |
| Gets the connection used by database. | |
Protected Member Functions | |
| bool | createDescIndex (const string &tableName, const string &indexName, const string &columnsName) |
| Create the indexes for the tables in the conceptual model using Descending order. | |
Protected Attributes | |
| IBPP::Database | firebird_ |
| IBPP::Database | firebird_ref_ |
| IBPP::Transaction | transaction_ |
Friends | |
| class | TeFirebirdPortal |
A concrete implementation of a driver to the Firebird SGDB.
| TeFirebird::TeFirebird | ( | ) |
| TeFirebird::~TeFirebird | ( | ) | [virtual] |
| bool TeFirebird::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.
| bool TeFirebird::alterTable | ( | const string & | tableName, |
| TeAttributeRep & | rep, | ||
| const string & | oldColName = "" |
||
| ) | [virtual] |
Alter a property of a table.
Reimplemented from TeDatabase.
| bool TeFirebird::beginTransaction | ( | ) | [virtual] |
Begins a transaction.
Reimplemented from TeDatabase.
| void TeFirebird::close | ( | ) | [virtual] |
Closes the connection.
Implements TeDatabase.
| bool TeFirebird::columnExist | ( | const string & | table, |
| const string & | column, | ||
| TeAttribute & | attr | ||
| ) | [virtual] |
Verifies if a table has a column.
Implements TeDatabase.
| bool TeFirebird::commitTransaction | ( | ) | [virtual] |
Commits a transaction.
Reimplemented from TeDatabase.
Concat values in a vector using unionString as the join between each value.
Implements TeDatabase.
| bool TeFirebird::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.
| bool TeFirebird::createAutoIncrement | ( | const std::string & | table, |
| const std::string & | column | ||
| ) |
Needs to create a generator for firebird to do auto increment.
The name of the generator is composed by the name of table and the column name.
| bool TeFirebird::createDescIndex | ( | const string & | tableName, |
| const string & | indexName, | ||
| const string & | columnsName | ||
| ) | [protected] |
Create the indexes for the tables in the conceptual model using Descending order.
| bool TeFirebird::createRelation | ( | const string & | relName, |
| const string & | table, | ||
| const string & | fieldName, | ||
| const string & | relatedTable, | ||
| const string & | relatedField, | ||
| bool | cascadeDeletion | ||
| ) | [inline, 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.
| bool TeFirebird::createSpatialIndex | ( | const string & | table, |
| const string & | columns, | ||
| TeSpatialIndexType | = TeRTREE, |
||
| short | = 0, |
||
| short | = 0 |
||
| ) | [virtual] |
Implementation of the method that create a spatial index for a spatial table. It create separeted index for each column ascending or descending for best performance in Firebird db.
Reimplemented from TeDatabase.
| bool TeFirebird::createTable | ( | const string & | table, |
| TeAttributeList & | attr | ||
| ) | [virtual] |
Escape special characters in a string to be used in a SQL statement.
Implements TeDatabase.
| bool TeFirebird::execute | ( | const string & | sql | ) | [virtual] |
Executes a SQL command that doesnt return a record set. Tipically a data definition comand.
Implements TeDatabase.
| TeDBRelationType TeFirebird::existRelation | ( | const string & | tableName, |
| const string & | relName | ||
| ) | [inline, virtual] |
Checks if a relation exist.
| tableName | table where the relashionship exists |
| relName | relationship name |
Implements TeDatabase.
| bool TeFirebird::generateLabelPositions | ( | TeTheme * | theme, |
| const std::string & | objectId = "" |
||
| ) | [virtual] |
Generates the label position (x,y) to each object of a theme or of a particular object.
Reimplemented from TeDatabase.
| bool TeFirebird::getAttributeList | ( | const string & | tableName, |
| TeAttributeList & | attList | ||
| ) | [virtual] |
Gets the list of attributes of a table.
Reimplemented from TeDatabase.
Concatenate field values.
| fNamesVec | vector containing the fields to be concatenated |
Reimplemented from TeDatabase.
| TeConnection * TeFirebird::getConnection | ( | ) | [virtual] |
Gets the connection used by database.
Reimplemented from TeDatabase.
| IBPP::Database TeFirebird::getIBPPFirebird | ( | ) |
| bool TeFirebird::getIndexesFromTable | ( | const string & | tableName, |
| std::vector< TeDatabaseIndex > & | vecIndexes | ||
| ) | [virtual] |
Return a TeDatabaseIndex vector from a table.
Reimplemented from TeDatabase.
| int TeFirebird::getLastGeneratedAutoNumber | ( | const std::string & | table | ) |
| TeDatabasePortal * TeFirebird::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.
| string TeFirebird::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.
Returns a valid SQL time string.
Reimplemented from TeDatabase.
| bool TeFirebird::inClauseValues | ( | const string & | query, |
| const string & | attribute, | ||
| vector< string > & | inClauseVector | ||
| ) | [virtual] |
Get the values that satisfy the query.
Reimplemented from TeDatabase.
Inserts an arc geometry in the database.
Implements TeDatabase.
| bool TeFirebird::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.
| bool TeFirebird::insertLayer | ( | TeLayer * | layer | ) | [virtual] |
Insert information about a layer.
Implements TeDatabase.
| bool TeFirebird::insertLegend | ( | TeLegendEntry * | legend | ) | [virtual] |
Inserts legend in the database.
Implements TeDatabase.
Implements TeDatabase.
Implements TeDatabase.
Implements TeDatabase.
Inserts a polygon in a geometry table.
Implements TeDatabase.
| bool TeFirebird::insertProject | ( | TeProject * | project | ) | [virtual] |
Insert information about a project.
Implements TeDatabase.
| bool TeFirebird::insertProjection | ( | TeProjection * | proj | ) | [virtual] |
Insert information about a geographical projection.
Implements TeDatabase.
| bool TeFirebird::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 TeFirebird::insertRasterGeometry | ( | const string & | tableName, |
| TeRasterParams & | par, | ||
| const string & | objectId = "" |
||
| ) | [virtual] |
Inserts information about a raster geometry associated to an object.
| tableName | name of the table that stores the raster representation |
| par | raster parameters |
| objectId | identification of the object associated to the raster geometry |
Reimplemented from TeDatabase.
| bool TeFirebird::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.
| bool TeFirebird::insertRepresentation | ( | int | layerId, |
| TeRepresentation & | rep | ||
| ) | [virtual] |
Inserts information about a geometrical representation.
Implements TeDatabase.
| bool TeFirebird::insertTable | ( | TeTable & | table | ) | [virtual] |
Saves a table and its contents in the database.
Reimplemented from TeDatabase.
| bool TeFirebird::insertTableInfo | ( | int | layerId, |
| TeTable & | table, | ||
| const string & | user = "" |
||
| ) | [virtual] |
Inserts information about an attribute table.
Implements TeDatabase.
Implements TeDatabase.
| bool TeFirebird::insertTheme | ( | TeAbstractTheme * | theme | ) | [virtual] |
Inserts an abstract theme in the database.
Implements TeDatabase.
| bool TeFirebird::insertThemeGroup | ( | TeViewTree * | tree | ) | [virtual] |
Inserts a group of themes in the database.
Implements TeDatabase.
| bool TeFirebird::insertThemeTable | ( | int | themeId, |
| int | tableId, | ||
| int | relationId, | ||
| int | tableOrder | ||
| ) | [virtual] |
Inserts information about a table used by a theme.
Implements TeDatabase.
| bool TeFirebird::insertView | ( | TeView * | view | ) | [virtual] |
Inserts a view.
Implements TeDatabase.
| bool TeFirebird::insertViewTree | ( | TeViewTree * | tree | ) | [virtual] |
Recursive inserting of a view tree.
Implements TeDatabase.
| bool TeFirebird::layerExist | ( | string | layerName | ) | [virtual] |
Check if a particular layer exists (passing its name)
Reimplemented from TeDatabase.
| std::string TeFirebird::mapToFirebirdType | ( | const TeAttribute & | teRep | ) | const [virtual] |
| bool TeFirebird::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.
| bool TeFirebird::rollbackTransaction | ( | ) | [virtual] |
Rollbacks a transaction.
Reimplemented from TeDatabase.
| void TeFirebird::setConnection | ( | TeConnection * | c | ) | [virtual] |
Sets a connection that will be used by database.
Reimplemented from TeDatabase.
| bool TeFirebird::showDatabases | ( | const string & | , |
| const string & | , | ||
| const string & | , | ||
| vector< string > & | , | ||
| int | = -1 |
||
| ) | [virtual] |
Show the server databases (only for MySQL, Oracle and PostgreSQL)
There is function for this method in Firebird DBMS. It can't list its own databases.
Reimplemented from TeDatabase.
| bool TeFirebird::tableExist | ( | const string & | table | ) | [virtual] |
Verifies if a table exist in the database.
Implements TeDatabase.
Returns the SQL function for upper case.
Implements TeDatabase.
| bool TeFirebird::updateLayer | ( | TeLayer * | layer | ) | [virtual] |
Update information about a layer.
Reimplemented from TeDatabase.
| bool TeFirebird::updateLayerBox | ( | TeLayer * | layer | ) | [virtual] |
Updates the box information of a layer in the corresponding metadata table.
Reimplemented from TeDatabase.
Implements TeDatabase.
Updates a polygon in a geometry table.
Implements TeDatabase.
| bool TeFirebird::updateProjection | ( | TeProjection * | proj | ) | [virtual] |
Updates information about a geographical projection.
Reimplemented from TeDatabase.
| bool TeFirebird::updateRasterRepresentation | ( | int | layerId, |
| TeRasterParams & | par, | ||
| const string & | objectId = "" |
||
| ) | [virtual] |
Updates the information about the raster geometry associated to an object of a layer.
| layerId | layer unique database identification |
| par | raster parameters |
| objectId | identification of the object associated to the raster geometry |
Reimplemented from TeDatabase.
| bool TeFirebird::updateRepresentation | ( | int | layerId, |
| TeRepresentation & | rep | ||
| ) | [virtual] |
Updates information about a geometrical representation.
Reimplemented from TeDatabase.
| bool TeFirebird::updateTable | ( | TeTable & | table | ) | [virtual] |
Updates a table and its contents in the database.
Reimplemented from TeDatabase.
| bool TeFirebird::updateTheme | ( | TeAbstractTheme * | theme | ) | [virtual] |
Updates an asbtract theme in the database.
Reimplemented from TeDatabase.
friend class TeFirebirdPortal [friend] |
IBPP::Database TeFirebird::firebird_ [protected] |
IBPP::Database TeFirebird::firebird_ref_ [protected] |
IBPP::Transaction TeFirebird::transaction_ [protected] |