#include <TeDatabase.h>

addGeomRepresentation.cpp, copyLayer.cpp, createDatabase.cpp, createLayer.cpp, createProximityMatrix.cpp, createSTElementSetFromLayer.cpp, createSTElementSetFromTheme.cpp, createTable.cpp, createTheme.cpp, databaseQuery.cpp, databaseSQLQuery.cpp, importDBF.cpp, importGeoTab.cpp, importGridData.cpp, importJPEG.cpp, importMIDMIF.cpp, proxMatrixAndSpatialStatistics.cpp, querierFromLayer.cpp, querierFromTheme.cpp, querierGroupChronon.cpp, querierGroupElement.cpp, querierGroupSpatialRest.cpp, querierWithSpatialRestBox.cpp, querierWithSpatialRestGeometry.cpp, rasterSlicing.cpp, spatialQuery.cpp, spatialQueryAndBuffer.cpp, and themeGrouping.cpp.
Definition at line 118 of file TeDatabase.h.
Tables | |
| Methods related to table manipulation.
| |
| virtual bool | addColumn (const string &table, TeAttributeRep &rep)=0 |
| Adds a column to a table. | |
| virtual bool | allowEmptyString (const string &, const string &) |
| Update a column. | |
| virtual bool | columnExist (const string &table, const string &column, TeAttribute &attr)=0 |
| Verifies if a table has a column. | |
| virtual bool | createRelation (const string &relName, const string &table, const string &fieldName, const string &relatedTable, const string &relatedField, bool cascadeDeletion)=0 |
| Creates a reationship between two tables. | |
| virtual bool | createTable (const string &table, TeAttributeList &attr)=0 |
| Creates a table. | |
| virtual bool | deleteColumn (const string &table, const string &colName) |
| Deletes a column to a table. | |
| virtual bool | deleteRelation (const string &name, const string &table) |
| Removes a relation exist. | |
| virtual bool | deleteTable (const string &table) |
| Deletes a table. Do not allow the deletion of model tables. | |
| virtual bool | dropDatabase (const std::string &) |
| Drop a database. | |
| virtual TeDBRelationType | existRelation (const string &tableName, const string &relName)=0 |
| Checks if a relation exist. | |
| virtual string | getConcatFieldsExpression (const vector< string > &fNamesVec) |
| Concatenate field values. | |
| string | getNewTableName (const string &n) |
| Return a valid name for a table from a initial one. | |
| string | getTableName (int tableId) |
| Return the name of an attribute table given its identifier. | |
| virtual bool | listDatabases (std::vector< std::string > &) |
| Returns a lista of databases. | |
| virtual bool | listTables (vector< string > &) |
| Returns a list of tables in a database. | |
| virtual bool | tableExist (const string &table)=0 |
| Verifies if a table exist in the database. | |
| virtual bool | validTable (TeTable &table) |
| Verifies and modifies the column names of the table. It returns if the table was modified. | |
Non-spatial tables | |
| Retrieving/Inserting/Modifying generic tables in the database. | |
| virtual bool | alterTable (const string &oldTableName, const string &newTablename) |
| Alter the table name. | |
| virtual bool | alterTable (const string &tableName, TeAttributeRep &rep, const string &oldColName="") |
| Alter a property of a table. | |
| virtual bool | deleteLayerTable (int layerId, TeAttrTableType ttype=TeAttrStatic) |
| Deletes all tables, of a particular type, associated to a layer. | |
| virtual bool | getAttrTables (TeAttrTableVector &atts, TeAttrTableType attType=TeAllAttrTypes) |
| Retrieves information about some tables. | |
| virtual bool | insertBlob (const string &tableName, const string &columnBlob, const string &whereClause, const string &fileName) |
| Saves a large binary objects (BLOB) in a row table. | |
| virtual bool | insertBlob (const string &tableName, const string &columnBlob, const string &whereClause, unsigned char *data, int size)=0 |
| Saves a large binary objects (BLOB) in a row table. | |
| virtual bool | insertBlob (const string &tableName, const string &columnBlob, TeAttributeRep &columnId, const string &valueId, const string &fileName) |
| Saves a large binary objects (BLOB) in a row table. | |
| virtual bool | insertBlob (const string &tableName, const string &columnBlob, TeAttributeRep &columnId, const string &valueId, unsigned char *data, int size) |
| Saves a large binary objects (BLOB) in a row table. | |
| virtual bool | insertRelationInfo (const int tableId, const string &tField, const string &rTable, const string &rField, int &relId)=0 |
| Inserts information about a link to an external table. | |
| virtual bool | insertTable (TeTable &table) |
| Saves a table and its contents in the database. | |
| virtual bool | insertTableInfo (int layerId, TeTable &table, const string &user="")=0 |
| Inserts information about an attribute table. | |
| virtual bool | loadTable (const string &tableName, TeTable &table) |
| Retrieves a table and its contents from the database. | |
| virtual bool | loadTableInfo (TeTable &table) |
| Retrieves the metainformation about an attribute table. | |
| virtual bool | selectTable (const string &tableName, const string &criteria, TeTable &table) |
| Retrieves a table (or part of it) accordingly to a criteria written in SQL. | |
| virtual bool | updateTable (TeTable &table) |
| Updates a table and its contents in the database. | |
| virtual bool | updateTableInfo (int layerId, TeTable &table, const string user="") |
| Updates information about an attribute table. | |
Transaction control methods | |
| should be implemented by the drivers that has it.
Default implementation is DO NOTHING. | |
| virtual bool | beginTransaction () |
| Begins a transaction. | |
| virtual bool | commitTransaction () |
| Commits a transaction. | |
| virtual bool | rollbackTransaction () |
| Rollbacks a transaction. | |
functions that generate new geometries | |
| functions that generate new geometries over geometries into the database. | |
| virtual bool | buffer (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIds, TePolygonSet &bufferSet, double dist) |
| Returns the buffers with a specific distance of a geometry set of a geometric table (actGeomTable). | |
| virtual bool | centroid (const string &actGeomTable, TeGeomRep actRep, TePointSet ¢roidSet, TeKeys actIds=vector< string >(), const string &actCollTable="") |
| Returns the centroids of a geometry set of a geometric table (actGeomTable). | |
| virtual bool | convexHull (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIds, TePolygonSet &convexHullSet) |
| Returns the convex geometries of a geometries set of a geometric table (actGeomTable). | |
metric functions | |
| metric functions over geometries into the database. | |
| virtual bool | calculateArea (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIdsIn, double &area) |
| Calculates the area of a geometry set of the geometric table (actGeomTable). | |
| virtual bool | calculateDistance (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &visGeomTable, TeGeomRep visRep, const string &objId2, double &distance) |
| Calculates the distance between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable). | |
| virtual bool | calculateDistance (const string &actGeomTable, TeGeomRep actRep, TeKeys &Ids, double &distance) |
| Calculates the distance between two geometries of the actGeomTable table. | |
| virtual bool | calculateLength (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIdsIn, double &length) |
| Calculates the length of a geometry set of the actGeomTable table. | |
| virtual bool | withinDistance (const string &actGeomTable, TeGeomRep actRep, const TeCoord2D &point, TeKeysToDist &IdsDistOut, const double &max_distance, const string &actCollTable="") |
| Returns the geometries of a geometric table (actGeomTable) that are within a specific distance from a point in memory. | |
Members | |
| Methods to access class private members | |
| virtual void | clear () |
| Clears structures in memory (legendMap, layerMap, viewMap...) used to optimize database access. | |
| string | databaseName () |
| Returns the database name of the connection opened. | |
| string | dbmsName () |
| Returns the Database Management System name. | |
| virtual string | errorMessage () |
| Returns the error message from the server. | |
| virtual int | errorNum () |
| Returns the error number from the server. | |
| string | host () |
| Returns the host name of the connection opened. | |
| TeThemeMap & | invalidThemeMap () |
| Returns the map of invalid themes in the database. | |
| TeLayerMap & | layerMap () |
| Returns the map of layers in the database. | |
| TeLegendEntryMap & | legendMap () |
| Returns the map of legends in the database. | |
| string | password () |
| Returns the user's password of the connection opened. | |
| int | portNumber () |
| Returns the port number of the connection opened. | |
| TeProjectMap & | projectMap () |
| Returns the map of projects in the database. | |
| multiset< int > & | relationMSet () |
| Returns the set of relations between tables. | |
| TeThemeMap & | themeMap () |
| Returns the map of themes in the database. | |
| void | user (string value) |
| Set the current user name to view. | |
| string | user () |
| Return the user name of the connection opened. | |
| TeViewMap & | viewMap () |
| Returns the map of views in the database. | |
Database | |
| Methods related to database and connection creation.
These methods return TRUE when the operation was successfull. Otherwise return FALSE and when possible an error message is captured. | |
| virtual void | close ()=0 |
| Closes the connection. | |
| virtual bool | connect (const string &="") |
| Opens a connection without parameters. When possible, should be implemented by the derived classes. | |
| virtual bool | connect (const string &host, const string &user, const string &password, const string &database, int port=-1)=0 |
| Opens a connection to a database server passing all parameters needed. | |
| virtual string | getDatabaseDescription () |
| Returns a string that the describes the parameters of the database connected. | |
| bool | isConnected () |
| Check if there is an opened connection. | |
| 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="")=0 |
| Creates a new database and open a connection to it. | |
| virtual bool | showDatabases (const string &, const string &, const string &, vector< string > &, int=-1) |
| Show the server databases (only for MySQL, Oracle and PostgreSQL). | |
| static TeDatabase * | DefaultObject (const TeDatabaseFactoryParams &) |
| This is for TeFactory compatibility ( Invalid TeDatabaseFactory requests will try to create an default object using this function ). | |
Geometries | |
| Methods that create tables that store the spatial data | |
| virtual bool | createArcGeometry (const string &tableName, const int &epsgCode=-1) |
| Creates a table for a arc geometries. | |
| virtual bool | createCellGeometry (const string &tableName, const int &epsgCode=-1) |
| Creates a table for cell geometries. | |
| virtual bool | createCollectionTable (const string &tableName) |
| Creates a table to store information about objects in a theme. | |
| virtual bool | createLineGeometry (const string &tableName, const int &epsgCode=-1) |
| Creates a table for line geometries. | |
| virtual bool | createNodeGeometry (const string &tableName, const int &epsgCode=-1) |
| Creates a table for a node geometries. | |
| virtual bool | createPointGeometry (const string &tableName, const int &epsgCode=-1) |
| Creates a table for point geometries. | |
| virtual bool | createPolygonGeometry (const string &tableName, const int &epsgCode=-1) |
| Creates a table for a polygon geometries. | |
| virtual bool | createRasterGeometry (const string &tableName) |
| Creates a table to store raster representations of objects. | |
| virtual bool | createRasterMetadataTable (const string &tableName) |
| Creates a table to store information about raster representation. | |
| virtual bool | createRasterTable (const string &tableName) |
| Creates a table for raster geometries. | |
| virtual bool | createTextGeometry (const string &tableName, const int &epsgCode=-1) |
| Creates a table for a text geometries. | |
Data Model | |
| Methods that create the database model suggested in TerraLib.
Classes in TerraLib materialize the DataModel suggested. | |
| virtual bool | createConceptualModel (bool withIntegrity=true, bool newDatabase=true, bool createIndex=true) |
| Creates the entire TerraLib conceptual model. | |
| virtual bool | createDatabaseTable () |
| Creates a table to store version database information. | |
| virtual bool | createDatumTable () |
| Creates a table to store datum information. | |
| virtual bool | createGroupingTable () |
| Creates a table to store the groupings associated with a theme. | |
| virtual bool | createIndex (const string &tableName, const string &indexName, const string &columnsName) |
| Create the indexes for the tables in the conceptual model. | |
| virtual bool | createLayerTable () |
| Creates a table to store Layers information. | |
| virtual bool | createLayerTableTable () |
| Creates a table to store information about the non-spatial tables associated to this layer. | |
| virtual bool | createLegendTable () |
| Creates a table to store legends. | |
| virtual bool | createProjectionTable () |
| Creates a table to store projectinon information. | |
| virtual bool | createProjectTable () |
| Creates a table to store information about projects: an structure that groups views. | |
| virtual bool | createProjectViewTable () |
| Creates a table to store the relation between project/views information. | |
| virtual bool | createRepresentationTable () |
| Creates a table to store Representations information. | |
| virtual bool | createSRSTable () |
| Creates a table to relate the TerraLib projection with a SRS id. | |
| virtual bool | createTablesRelationTable () |
| Creates a table to store information about the external tables related to non-spatial tables of layers. | |
| virtual bool | createThemeTable () |
| Creates a table to store Themes information. | |
| virtual bool | createThemeTablesTable () |
| Creates a table to store information about the attribute tables used by a theme. | |
| virtual bool | createViewTable () |
| Creates a table to store Views information. | |
| virtual bool | createVisualRasterTable () |
| Creates a table to store raster visual definitions. | |
| virtual bool | createVisualTable () |
| Creates a table to store visual definitions. | |
| virtual bool | defineIntegrity (void) |
| Creates the referencial integrity of the conceptual model. | |
| virtual bool | deleteIndex (const string &tableName, const string &indexName) |
| Delete the index from tables in the conceptual model. | |
| virtual bool | getIndexesFromTable (const string &tableName, std::vector< TeDatabaseIndex > &vecIndexes) |
| Return a TeDatabaseIndex vector from a table. | |
Layers | |
| Retrieving/Inserting/Modifying/Deleting layers in the database. | |
| virtual bool | deleteLayer (int layerId) |
| Delete a particular layer passing its id. | |
| virtual string | getNewLayerName (const string &n) |
| Checks whether a given layer name is valid or already exists in the database. | |
| virtual bool | insertLayer (TeLayer *layer)=0 |
| Insert information about a layer. | |
| virtual bool | layerExist (string layerName) |
| Check if a particular layer exists (passing its name). | |
| virtual bool | layerExist (int id) |
| Check if a particular layer exists (passing its id). | |
| virtual bool | loadLayer (TeLayer *layer, const bool &loadAttrList=true) |
| Load information about a particular layer. | |
| virtual bool | loadLayerSet (const bool &loadAttrList=true) |
| Load information about all layers stored in the database. | |
| virtual bool | loadLayerTable (TeLayer *layer, const bool &loadAttrList=true) |
| Load layer tables. | |
| virtual bool | updateLayer (TeLayer *layer) |
| Update information about a layer. | |
Themes | |
| Retrieving/Inserting/Modifying/Deleting themes and group of themes in the database. | |
| virtual bool | deleteLegend (int themeId) |
| Erases the legends of a theme identified by themeId. | |
| virtual bool | deleteTheme (int themeId) |
| Erases the theme identified by themeId. | |
| virtual bool | deleteThemeGroup (int themeId) |
| Erases the theme group identified by themeId. | |
| virtual 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. | |
| virtual string | getNewThemeName (const string &n) |
| Checks whether a given theme name is valid or already exists in the database. | |
| virtual bool | insertGrouping (int themeId, const TeGrouping &grouping) |
| Inserts information about a grouping used in a theme. | |
| virtual bool | insertTheme (TeAbstractTheme *theme)=0 |
| Inserts an abstract theme in the database. | |
| virtual bool | insertThemeGroup (TeViewTree *tree)=0 |
| Inserts a group of themes in the database. | |
| virtual bool | insertThemeTable (int themeId, int tableId, int relationId, int tableOrder)=0 |
| Inserts information about a table used by a theme. | |
| bool | insertThemeTable (TeTheme *theme, TeTable &inputTable) |
| Inserts information about a table used by a theme. | |
| virtual bool | loadExternalThemes (std::vector< TeAbstractTheme * > &vecExternalThemes) |
| Loads several external themes from the database. Created for otimization. | |
| virtual bool | loadTheme (TeAbstractTheme *theme, const bool &loadAttrList=true, const string &visualClass="tevisual") |
| Loads a theme from the database. | |
| virtual bool | loadThemes (std::vector< TeAbstractTheme * > &vecThemes, const bool &loadAttrList, const std::string &userName, const bool &loadMetadata=true, const string &visualType="tevisual") |
| Loads several themes from the database. Created for otimization. | |
| virtual bool | loadThemeTable (TeTheme *theme, const bool &loadAttrList=true) |
| Loads all attribute tables of a theme. | |
| bool | removeThemeTable (TeTheme *theme, int tableOrder) |
| Removes a table from the theme. | |
| virtual bool | themeExist (const std::string &viewName, const std::string &userName, const std::string &themeName) |
| Check whether a given theme from a specific view already exists in the database. | |
| virtual bool | themeExist (string themeName) |
| Check whether a given theme already exists in the database. | |
| virtual bool | updateGrouping (int themeId, const TeGrouping &grouping) |
| Updates information about a grouping used in a theme. | |
| virtual bool | updateTheme (TeAbstractTheme *theme) |
| Updates an asbtract theme in the database. | |
| virtual bool | updateThemeTable (TeTheme *theme) |
| Updates information about the tables used by a theme. | |
Project | |
| Methods related to the manipulation of projects | |
| virtual bool | deleteProject (int projectId) |
| Delete a project from the database. | |
| virtual bool | deleteProjectViewRel (int projectId, int viewId) |
| Deletes a project/view relation. | |
| virtual bool | insertProject (TeProject *project)=0 |
| Insert information about a project. | |
| virtual bool | insertProjectViewRel (int projectId, int viewId) |
| Insert a project/view relation. | |
| virtual bool | loadProject (TeProject *project) |
| Load information about a particular project. | |
| virtual bool | loadProjectSet () |
| Load information about all projects stored in the database. | |
| virtual bool | projectExist (const string &projectName) |
| Check whether a given project already exists in the database (it is not case sensitive). | |
| virtual bool | updateProject (TeProject *project) |
| Update information about a project. | |
Projection | |
| Accessing/Inserting/Modifying projection information into the database. | |
| virtual bool | deleteProjection (const unsigned int &projId) |
| Removes a projection from the database. | |
| virtual bool | insertProjection (TeProjection *proj)=0 |
| Insert information about a geographical projection. | |
| virtual bool | insertSRSId (TeProjection *proj, int srsId) |
| Insert relation between TerraLib projection and a SRS id. | |
| virtual TeProjection * | loadProjection (int id) |
| Retrieves information about a geographical projection identified by its database id. | |
| virtual TeProjection * | loadProjectionFromSRSId (int srsid) |
| Retrieves information about a geographical projection identified by its srs id. | |
| virtual bool | updateProjection (TeProjection *proj) |
| Updates information about a geographical projection. | |
| virtual bool | updateSRSId (TeProjection *proj, int srsId) |
| Updates information about a geographical projection SRS id. | |
Views | |
| Retrieving/Inserting/Modifying/Deleting views in the database. | |
| virtual bool | deleteView (int viewId) |
| Delete a view. | |
| virtual bool | insertView (TeView *view)=0 |
| Inserts a view. | |
| virtual bool | insertViewTree (TeViewTree *tree)=0 |
| Recursive inserting of a view tree. | |
| virtual bool | loadView (TeView *view, const bool &loadAttrList=true, const string &visualClass="tevisual") |
| Load a view. | |
| virtual bool | loadViewSet (const string &user, const bool &loadAttrList=true, const string &visualClass="tevisual") |
| Loads a set of views belonging to a user. | |
| virtual TeViewTree * | loadViewTree (TeView *view, int id, const bool &loadAttrList=true, const string &visualClass="tevisual") |
| Recursive load view tree. | |
| virtual bool | updateView (TeView *view) |
| Updates a view. | |
| virtual bool | updateViewTree (TeViewTree *tree) |
| Recusive updating of a view tree. | |
| virtual bool | viewExist (string viewName) |
| Check whether a given view already exists in the database. | |
Query | |
| Methods related to query the database | |
| virtual bool | execute (const string &sql)=0 |
| Executes a SQL command that doesnt return a record set. Tipically a data definition comand. | |
| virtual TeDatabasePortal * | getPortal ()=0 |
| Returns a database portal. | |
| virtual bool | inClauseValues (const string &query, const string &attribute, vector< string > &inClauseVector) |
| Get the values that satisfy the query. | |
set functions | |
| functions of set: union, intersection, difference and symmetrical difference. | |
| virtual bool | geomDifference (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &visGeomTable, TeGeomRep visRep, const string &objId2, TeGeometryVect &geomVect) |
| Returns the difference between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable). | |
| virtual bool | geomDifference (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &objId2, TeGeometryVect &geomVect) |
| Returns the difference between two geometries of a geometric table (actGeomTable). | |
| virtual bool | geomIntersection (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &visGeomTable, TeGeomRep visRep, const string &objId2, TeGeometryVect &geomVect) |
| Returns the intersection between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable). | |
| virtual bool | geomIntersection (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIds, TeGeometryVect &geomVect) |
| Returns the intersection between two geometries of a geometric table (actGeomTable). | |
| virtual bool | geomUnion (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &visGeomTable, TeGeomRep visRep, const string &objId2, TeGeometryVect &geomVect) |
| Returns the union between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable). | |
| virtual bool | geomUnion (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIds, TeGeometryVect &geomVect) |
| Returns the union between geometries of a geometric table (actGeomTable). | |
| virtual bool | geomXOr (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &visGeomTable, TeGeomRep visRep, const string &objId2, TeGeometryVect &geomVect) |
| Returns the symmetrical difference between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable). | |
| virtual bool | geomXOr (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &objId2, TeGeometryVect &geomVect) |
| Returns the symmetrical difference between two geometries of a geometric table (actGeomTable). | |
Connection | |
| Methods related with connections. | |
| virtual TeConnection * | getConnection () |
| Gets the connection used by database. | |
| virtual void | setConnection (TeConnection *c) |
| Sets a connection that will be used by database. | |
Raster Tables | |
| Retrieving/Inserting/Modifying/Deleting raster representations in the database. | |
| virtual string | getRasterTable (int layerId, const string &objectId) |
| Returns the name of the table where the raster geometry associated to an object of a leyr. | |
| virtual bool | insertRasterGeometry (const string &tableName, TeRasterParams &par, const string &objectId="") |
| Inserts information about a raster geometry associated to an object. | |
| virtual bool | insertRasterMetadata (const string &tableName, int geomId, TeRasterParams &par) |
| Inserts metadata information about a particular raster geometry. | |
| virtual bool | updateRasterMetadata (const string &tableName, int geomId, TeRasterParams &par) |
| Updates metadata information about a particular raster geometry. | |
| virtual bool | updateRasterRepresentation (int layerId, TeRasterParams &par, const string &objectId="") |
| Updates the information about the raster geometry associated to an object of a layer. | |
specifics SQLs | |
| return SQL strings | |
| virtual string | getSQLAutoNumber (const string &table) |
| Return the database function in SQL to generate autonumber values. | |
| virtual string | getSQLBoxSelect (const string &tableName, TeGeomRep rep) |
| Return a string SQL to be used in the clause SELECT to select the box (lower_x, lower_y, upper_x, upper_y). | |
| virtual string | getSQLBoxWhere (const string &table1, const string &table2, TeGeomRep rep2, TeGeomRep rep1=TePOLYGONS) |
| Return a string that describes a where clause in SQL to return the geometries of the table2 that are inside the geometries box of the table1 (table1 must have lower_x, lower_y. | |
| virtual string | getSQLBoxWhere (const TeBox &box, const TeGeomRep rep, const std::string &tableName, const std::string &columnName) |
| Return a string that describes a where clause in SQL to return the geometries inside the box. | |
| virtual string | getSQLBoxWhere (const TeBox &box, const TeGeomRep rep, const std::string &tableName) |
| Return a string that describes a where clause in SQL to return the geometries inside the box. | |
| virtual std::string | getSQLOrderBy (const TeGeomRep &rep) const |
| virtual string | getSQLStatistics (TeGroupingAttr &attrs) |
| Return a string SQL to calculate the statistics of some attributes. | |
| virtual string | getSQLTemporalFunction (TeChronon chr, const string &colName) |
| Returns a SQL temporal expression applied to a column. | |
| virtual string | getSQLTemporalWhere (int, int, TeChronon, TeTemporalRelation, const string &, const string &) |
| Return a string SQL to temporal where. | |
| virtual string | getSQLTemporalWhere (const string &temporalRest) |
| Return a string SQL to temporal where. | |
| virtual string | getSQLTemporalWhere (TeTimeInterval &, TeTemporalRelation, const string &, const string &) |
| Return a string SQL to temporal where. | |
| virtual string | getSQLTime (const TeTime &) const |
| Returns a valid SQL time string. | |
Arc | |
| Accessing/Inserting/Modifying Arc geometries into the database. | |
| virtual bool | insertArc (const string &table, TeArc &arc)=0 |
| Inserts an arc geometry in the database. | |
| virtual bool | insertArcSet (const string &table, TeArcSet &as) |
| Inserts an arc set geometry in the database. | |
| virtual bool | loadArcSet (const string &table, const string &geoid, TeArcSet &as) |
| Loads an arc geometry from the database that has the specified object id (geoid). | |
| virtual bool | updateArc (const string &table, TeArc &arc) |
| Updates an arc geometry in the database. | |
| virtual bool | updateArcSet (const string &table, TeArcSet &as) |
| Updates arc set geometry in the database. | |
Cell | |
| Accessing/Inserting/Modifying Cell geometries into the database. | |
| virtual bool | insertCell (const string &table, TeCell &c)=0 |
| virtual bool | insertCellSet (const string &table, TeCellSet &cs) |
| virtual bool | loadCellSet (const int &layerId, const string &table, const string &geoid, TeCellSet &cs) |
| virtual bool | locateCell (const string &table, TeCoord2D &pt, TeCell &c, const double &tol=0.0) |
| virtual bool | selectCellSet (const int &layerId, const string &table, const string &criteria, TeCellSet &cs) |
| virtual bool | updateCell (const string &table, TeCell &c) |
| virtual bool | updateCellSet (const string &table, TeCellSet &cs) |
Datum | |
| Accessing/Inserting/Modifying datum information into the database. | |
| virtual bool | insertDatum (const TeDatum &datum) |
| Insert information about a datum. | |
| virtual bool | loadDatum (TeDatum &datum) |
| Retrieves information about a datum projection identified by its name. | |
| virtual bool | loadDatumSet () |
| Loads the set of datum defined on database. | |
| virtual void | populateDatumTable () |
| Populates the datum table with a set of pre-defined datums. | |
| virtual bool | updateDatum (const TeDatum &datum) |
| Updates information about a datum. | |
Legend | |
| Retrieving/Inserting/Modifying/Deleting legends in the database. | |
| virtual bool | insertLegend (TeLegendEntry *legend)=0 |
| Inserts legend in the database. | |
| virtual bool | loadLegend (TeAbstractTheme *theme, const string &visualClass="tevisual") |
| virtual bool | updateLegend (vector< TeLegendEntry > &legVec) |
| virtual bool | updateLegend (TeLegendEntry *legend) |
| Updates legend entries in the database. | |
| virtual bool | updateVisual (vector< TeLegendEntry > &legVec) |
| virtual bool | updateVisual (TeLegendEntry *legend) |
Line | |
| Accessing/Inserting/Modifying Line geometries into the database. | |
| virtual bool | insertLine (const string &table, TeLine2D &l)=0 |
| virtual bool | insertLineSet (const string &table, TeLineSet &ls) |
| virtual TeDatabasePortal * | loadLineSet (const string &table, TeBox &box) |
| virtual bool | loadLineSet (const string &table, TeBox &box, TeLineSet &linSet) |
| virtual bool | loadLineSet (TeTheme *theme, TeLineSet &ls) |
| virtual bool | loadLineSet (const string &table, const string &geoid, TeLineSet &ls) |
| virtual bool | locateLine (const string &table, TeCoord2D &pt, TeLine2D &line, const double &tol=0.0) |
| virtual bool | locateLineSet (const string &table, TeCoord2D &pt, TeLineSet &ls, const double &tol=0.0) |
| virtual bool | selectLineSet (const string &table, const string &criteria, TeLineSet &ls) |
| virtual bool | updateLine (const string &table, TeLine2D &l)=0 |
| virtual bool | updateLineSet (const string &table, TeLineSet &ls) |
Node | |
| Accessing/Inserting/Modifying Node geometries into the database. | |
| virtual bool | insertNode (const string &table, TeNode &node)=0 |
| virtual bool | insertNodeSet (const string &table, TeNodeSet &ns) |
| virtual bool | loadNodeSet (const string &table, const string &geoid, TeNodeSet &ps) |
| virtual bool | updateNode (const string &table, TeNode &node) |
| virtual bool | updateNodeSet (const string &table, TeNodeSet &ns) |
Point | |
| Accessing/Inserting/Modifying Point geometries into the database. | |
| virtual bool | insertPoint (const string &table, TePoint &p)=0 |
| virtual bool | insertPointSet (const string &table, TePointSet &ps) |
| virtual bool | loadPointSet (TeTheme *theme, TePointSet &ps) |
| virtual bool | loadPointSet (const string &table, const string &geoid, TePointSet &ps) |
| virtual TeDatabasePortal * | loadPointSet (const string &table, TeBox &box) |
| virtual bool | loadPointSet (const string &table, TeBox &box, TePointSet &ps) |
| virtual bool | locatePoint (const string &table, TeCoord2D &pt, TePoint &point, const double &tol=0.0) |
| virtual bool | locatePointSet (const string &table, TeCoord2D &pt, TePointSet &pointSet, const double &tol=0.0) |
| virtual bool | selectPointSet (const string &table, const string &criteria, TePointSet &ps) |
| virtual bool | updatePoint (const string &table, TePoint &p) |
| virtual bool | updatePointSet (const string &table, TePointSet &ps) |
Polygon | |
| Accessing/Inserting/Modifying polygon geometries into the database | |
| virtual bool | insertPolygon (const string &table, TePolygon &p)=0 |
| Inserts a polygon in a geometry table. | |
| virtual bool | insertPolygonSet (const string &table, TePolygonSet &ps) |
| Inserts a polygon set in a geometry table. | |
| virtual TeDatabasePortal * | loadPolygonSet (const string &table, TeBox &box) |
| Returns a database portal to iterate over the polygons that are inside a given box. | |
| virtual bool | loadPolygonSet (const string &table, TeBox &box, TePolygonSet &ps) |
| Returns all polygons inside a given box. | |
| virtual bool | loadPolygonSet (const string &table, const string &geoid, TePolygonSet &ps) |
| Returns all polygons that represents objects of a particular geoid. | |
| virtual bool | loadPolygonSet (TeTheme *theme, TePolygonSet &ps) |
| Returns all polygons that represents objects of a particular theme. | |
| virtual bool | locatePolygon (const string &table, TeCoord2D &pt, TePolygon &polygon, const double &tol=0.0) |
| Returns the first polygon that contais a given coordinate. | |
| virtual bool | locatePolygonSet (const string &table, TeCoord2D &pt, double tol, TePolygonSet &polygons) |
| Returns the polygons that contains a give coordinate. | |
| virtual bool | selectPolygonSet (const string &table, const string &criteria, TePolygonSet &ps) |
| Returns all polygons in a table given a criteria expressed as an SQL where statement. | |
| virtual bool | updatePolygon (const string &table, TePolygon &p)=0 |
| Updates a polygon in a geometry table. | |
| virtual bool | updatePolygonSet (const string &table, TePolygonSet &ps) |
| Updates a polygon set in a geometry table. | |
Representation | |
| Retrieving/Inserting/Modifying/Deleting representations in the database. | |
| virtual bool | insertRepresentation (int layerId, TeRepresentation &rep)=0 |
| Inserts information about a geometrical representation. | |
| virtual bool | updateLayerBox (TeLayer *layer) |
| Updates the box information of a layer in the corresponding metadata table. | |
| virtual bool | updateRepresentation (int layerId, TeRepresentation &rep) |
| Updates information about a geometrical representation. | |
Text | |
| Accessing/Inserting/Modifying Text geometries into the database. | |
| virtual bool | insertText (const string &table, TeText &t)=0 |
| virtual bool | insertTextSet (const string &table, TeTextSet &ts) |
| virtual bool | loadTextSet (const string &table, const string &geoid, TeTextSet &ts) |
| virtual bool | locateText (const string &table, TeCoord2D &pt, TeText &text, const double &tol=0.0) |
| virtual bool | locateTextSet (const string &table, TeCoord2D &pt, TeTextSet &textSet, const double &tol=0.0) |
| virtual bool | selectTextSet (const string &table, const string &criteria, TeTextSet &ts) |
| virtual bool | updateText (const string &table, TeText &t) |
| virtual bool | updateTextSet (const string &table, TeTextSet &ts) |
Spatial Operations with raster data | |
| spatial operations over raster data into the database. | |
| virtual bool | mask (const string &rasterTable, TePolygon &poly, const string &nameLayerOut, TeStrategicIterator st) |
| Clips a raster data from a geometry in memory (poly). | |
| virtual bool | mask (const string &rasterTable, const string &actGeomTable, const string &objId, const string &nameLayerOut, TeStrategicIterator st) |
| Clips a raster data from a geometry of a geometric table (actGeomTable). | |
| virtual bool | zonal (const string &rasterTable, TePolygon &poly, TeStatisticsDimensionVect &result, const bool &useDummy=true) |
| Returns the statistics of a raster data region inside a geometry in memory. | |
| virtual bool | zonal (const string &rasterTable, const string &actGeomTable, const string &actCollTable, TeObjectStatistics &result, const bool &useDummy=true) |
| Returns the statistics of raster data regions inside a geometry set of a geometric table (actGeomTable). | |
| virtual bool | zonal (const string &rasterTable, const string &actGeomTable, TeKeys &Ids, TeObjectStatistics &result, const bool &useDummy=true) |
| Returns the statistics of raster data regions inside a geometry set of a geometric table (actGeomTable). | |
topologic relation query | |
| topologic relation query over geometries into the database. | |
| virtual bool | spatialRelation (const string &actGeomTable, TeGeomRep actRep, TeGeometry *geom, TeKeys &actIdsOut, int relate, const string &actCollTable="") |
| Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a geometry in memory (geom). | |
| virtual bool | spatialRelation (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIdsIn, const string &visGeomTable, TeGeomRep visRep, TeKeys &visIdsOut, int relate, const string &visCollTable="", TeDatabase *=0) |
| Returns the geometries of a geometric table (visGeomTable) that have a specific spatial relation (relate) with a subset of geometries of other geometric table (actGeomTable). | |
| virtual bool | spatialRelation (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIdsIn, TeKeys &actIdsOut, int relate, const string &actCollTable="") |
| Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a subset of geometries of this table (actGeomTable). | |
| virtual bool | spatialRelation (const string &actGeomTable, TeGeomRep actRep, TeGeometry *geom, TeDatabasePortal *portal, int relate, const string &actCollTable="") |
| Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a geometry in memory (geom). | |
| virtual bool | spatialRelation (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIdsIn, const string &visGeomTable, TeGeomRep visRep, TeDatabasePortal *portal, int relate, const string &visCollTable="") |
| Returns the geometries of a geometric table (visGeomTable) that have a specific spatial relation (relate) with a subset of geometries of other geometric table (actGeomTable). | |
| virtual bool | spatialRelation (const string &actGeomTable, TeGeomRep actRep, TeKeys &actIdsIn, TeDatabasePortal *portal, int relate, const string &actCollTable="") |
| Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a subset of geometries of this table (actGeomTable). | |
Public Member Functions | |
| virtual string | concatValues (vector< string > &values, const string &unionString)=0 |
| Concat values in a vector using unionString as the join between each value. | |
| virtual bool | createLUTTable (const string &name) |
| Creates a lookup table (used for pallete raster representations). | |
| virtual bool | createSpatialIndex (const string &table, const string &columns, TeSpatialIndexType=TeRTREE, short=0, short=0) |
| Creates a spatial index for a spatial table. In order to get correct column names to index, see getSpatialIdxColumn method. | |
| virtual bool | dropDBView (const string &dbViewName) |
| Drops a database view. | |
| virtual string | escapeSequence (const string &from)=0 |
| Escape special characters in a string to be used in a SQL statement. | |
| virtual bool | getAttributeList (const string &tableName, TeAttributeList &attList) |
| Gets the list of attributes of a table. | |
| virtual std::string | getClientEncoding () |
| Gets the client encoding. | |
| virtual bool | getEncodingList (const std::string &, const std::string &, const std::string &, const int &, std::vector< std::string > &) |
| Retrives the list of available character sets. | |
| virtual bool | getEncodingList (std::vector< std::string > &) |
| Retrives the list of available character sets. | |
| virtual bool | getMBRGeom (string tableGeom, string object_id, TeBox &box, string colGeom) |
| Return the box of a specific geometry (object_id). | |
| virtual bool | getMBRSelectedObjects (string geomTable, string colGeom, string fromClause, string whereClause, string afterWhereClause, TeGeomRep repType, TeBox &bout, const double &tol=0.0) |
| Return the box of a select objects set. | |
| virtual string | getSpatialIdxColumn (TeGeomRep rep) |
| Returns the name of the column that wiil be the spatially indexed, for a given type of geometry table. | |
| virtual TeBox | getThemeBox (TeTheme *theme) |
| Returns theme box. | |
| virtual bool | insertMetadata (const string &, const string &, double, double, TeBox &, short=0) |
| Creates a spatial metadata for a spatial table. It is implemented only in spatial databases. | |
| virtual 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)=0 |
| Insert a raster block into the database. | |
| virtual bool | insertRasterVisual (int themeId, TeRasterVisual *rasterVisual) |
| Insert raster visual. | |
| virtual bool | insertVisual (TeLegendEntry *legend) |
| Inserts the entire visual of a Legend. | |
| virtual string | leftString (const string &, const int &) |
| Returns the SQL function for substring that starts from left to right with informed length. | |
| virtual TeRaster * | loadLayerRaster (int layerId, const string &objectId="", const char &mode= 'r') |
| Returns the raster associated to a layer. | |
| virtual bool | loadRasterLUT (TeRasterParams *par) |
| Loads a look up table associated to a raster and fills its parameters. | |
| virtual bool | loadVersionStamp (string &version) |
| Read and returns the terralib version from the database. | |
| map< int, map < string, string > > & | mapThemeAlias () |
| Returns the container of legend title alias. | |
| virtual bool | nearestNeighbors (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &visGeomTable, const string &visCollTable, TeGeomRep visRep, TeDatabasePortal *portal, int numRes=1) |
| Returns the nearest neighbors of a geometric table (visGeomTable) of a specific geometry of other geometric table (actGeomTable). | |
| virtual bool | nearestNeighbors (const string &actGeomTable, const string &actCollTable, TeGeomRep actRep, const string &objId1, TeDatabasePortal *portal, int numRes=1) |
| Returns the nearest neighbors of a specific geometry of a geometric table (actGeomTable). | |
| virtual bool | nearestNeighbors (const string &actGeomTable, TeGeomRep actRep, const string &objId1, const string &visGeomTable, const string &visCollTable, TeGeomRep visRep, TeKeys &visIdsOut, int numRes=1) |
| Returns the nearest neighbors of a geometric table (visGeomTable) of a specific geometry of other geometric table (actGeomTable). | |
| virtual bool | nearestNeighbors (const string &actGeomTable, const string &actCollTable, TeGeomRep actRep, const string &objId1, TeKeys &actIdsOut, int numRes=1) |
| Returns the nearest neighbors of a specific geometry of a geometric table (actGeomTable). | |
| virtual TeDatabase & | operator= (const TeDatabase &other) |
| Assignment operator. | |
| virtual bool | operator== (const TeDatabase &other) const |
| Operator ==. | |
| virtual bool | removeGeometry (const string &tableName, const TeGeomRep &rep, const int &geomId) |
| Removes a geometry from the given tableName. | |
| virtual bool | setClientEncoding (const std::string &) |
| Sets the client encoding. | |
| TeDatabase () | |
| Empty constructor. | |
| virtual string | toUpper (const string &value)=0 |
| Returns the SQL function for upper case. | |
| virtual bool | updateBBox (const string &tableName, const string &keyColumnName, int keyValue, const TeBox &box) |
| Update box information in a table that has a set of columns to store a box value. | |
| virtual bool | updateVersionStamp (const string &version) |
| Write the given version as the terralib version in the database. | |
| virtual | ~TeDatabase () |
| Destructor. | |
Protected Member Functions | |
| void | alterTableInfoInMemory (const string &updatedTableName, string oldTableName="") |
| Update metadata about an attribute table that had its name or columns changed. | |
Protected Attributes | |
| std::string | database_ |
| database name | |
| std::string | dbmsName_ |
| DBMS name (Ado, MySQL, Postgres, OracleSpatial). | |
| std::string | errorMessage_ |
| error message | |
| int | errorNumber_ |
| error number | |
| std::string | host_ |
| host name of the database server | |
| bool | isConnected_ |
| indicates if the connection is open | |
| TeSharedPtr < TeMetaModelCache > | metaModel_ |
| Meta model: Layers, Themes, Views... | |
| std::string | password_ |
| user password | |
| int | portNumber_ |
| port number | |
| int | transactionCounter_ |
| counts how many nested transactions have been opened | |
| std::string | user_ |
| user name | |
Private Member Functions | |
| TeDatabase (const TeDatabase &other) | |
| TeDatabase::TeDatabase | ( | ) |
Definition at line 67 of file TeDatabase.cpp.
References metaModel_, and TeSharedPtr< T >::reset().
00067 : 00068 isConnected_ (false), 00069 host_(""), 00070 user_(""), 00071 password_(""), 00072 database_(""), 00073 portNumber_(-1), 00074 errorNumber_(0), 00075 errorMessage_(""), 00076 transactionCounter_(0) 00077 { 00078 metaModel_.reset(new TeMetaModelCache); 00079 }
| TeDatabase::~TeDatabase | ( | ) | [virtual] |
| TeDatabase::TeDatabase | ( | const TeDatabase & | other | ) | [private] |
| virtual bool TeDatabase::addColumn | ( | const string & | table, | |
| TeAttributeRep & | rep | |||
| ) | [pure virtual] |
| table | table name | |
| rep | representation of the column being created |
Implemented in TeAdo, TeOracle, TeSqlServer, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by TeAddressLocator::addCompleteNameColumn(), TeAddressLocator::addReportColumn(), TeAddressLocator::createAddressMetadataTable(), insertRasterGeometry(), loadLayerRaster(), main(), TeUpdateDBFromSet(), updateDB20To30(), updateDB302To310(), updateDB30To301(), updateDB3201To331(), updateDB320To3201(), and updateDB331To400().
Reimplemented in TeAdo.
Definition at line 301 of file TeDatabase.h.
Referenced by updateDB20To30().
Reimplemented in TeAdo, TeOracle, TeSqlServer, TeOCIOracle, TePostgreSQL, and TeSQLite.
Definition at line 2491 of file TeDatabase.cpp.
References alterTableInfoInMemory(), and execute().
02492 { 02493 string sql = " ALTER TABLE "+ oldTableName +" RENAME "+ newTablename; 02494 if(!execute(sql)) 02495 return false; 02496 02497 //update te_layer_table 02498 sql = " UPDATE te_layer_table "; 02499 sql += " SET attr_table = '"+ newTablename +"'"; 02500 sql += " WHERE attr_table = '"+ oldTableName +"'"; 02501 execute(sql); 02502 02503 //update te_tables_relation 02504 sql = " UPDATE te_tables_relation "; 02505 sql += " SET external_table_name = '"+ newTablename +"'"; 02506 sql += " WHERE external_table_name = '"+ oldTableName +"'"; 02507 execute(sql); 02508 02509 alterTableInfoInMemory(newTablename, oldTableName); 02510 return true; 02511 }
| bool TeDatabase::alterTable | ( | const string & | tableName, | |
| TeAttributeRep & | rep, | |||
| const string & | oldColName = "" | |||
| ) | [virtual] |
Reimplemented in TeAdo, TeOracle, TeSqlServer, TeSqlServerSpatial, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Definition at line 2364 of file TeDatabase.cpp.
References alterTableInfoInMemory(), errorMessage_, execute(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), getPortal(), TeAttributeRep::name_, TeAttributeRep::numChar_, TeDatabasePortal::query(), tableExist(), Te2String(), TeBLOB, TeCHARACTER, TeDATETIME, TeINT, TeREAL, TeSTRING, and TeAttributeRep::type_.
Referenced by updateDB301To302(), updateDB302To310(), updateDB310To311(), and updateDB3201To331().
02365 { 02366 if(!tableExist(tableName)) 02367 return false; 02368 02369 string tab; 02370 02371 if(oldColName.empty()) 02372 { 02373 tab = " ALTER TABLE " + tableName + " MODIFY "; 02374 tab += rep.name_ +" "; 02375 } 02376 else 02377 { 02378 tab = " ALTER TABLE " + tableName + " CHANGE "; 02379 tab += oldColName +" "+ rep.name_ +" "; 02380 } 02381 02382 switch (rep.type_) 02383 { 02384 case TeSTRING: 02385 tab += "VARCHAR(" + Te2String(rep.numChar_) + ") "; 02386 break; 02387 02388 case TeREAL: 02389 tab += "DOUBLE(24, 15)"; 02390 break; 02391 02392 case TeINT: 02393 tab += "INT"; 02394 break; 02395 02396 case TeDATETIME: 02397 tab += "DATETIME"; 02398 break; 02399 02400 case TeCHARACTER: 02401 tab += "CHAR"; 02402 break; 02403 02404 case TeBLOB: 02405 tab += "LONGBLOB"; 02406 break; 02407 02408 default: 02409 tab += "VARCHAR(" + Te2String(rep.numChar_) + ") "; 02410 break; 02411 } 02412 02413 tab += " NULL "; 02414 02415 if(!execute(tab)) 02416 { 02417 if(errorMessage_.empty()) 02418 errorMessage_ = "Error alter table " + tableName + " !"; 02419 return false; 02420 } 02421 02422 string tableId; 02423 TeDatabasePortal* portal = getPortal(); 02424 string sql = "SELECT table_id FROM te_layer_table WHERE attr_table = '" + tableName + "'"; 02425 if(portal->query(sql) && portal->fetchRow()) 02426 tableId = portal->getData(0); 02427 02428 delete portal; 02429 02430 if(tableId.empty() == false) 02431 { 02432 if(oldColName.empty() == false) // column name changed 02433 { 02434 // update relation 02435 sql = "UPDATE te_tables_relation SET related_attr = '" + rep.name_ + "'"; 02436 sql += " WHERE related_table_id = " + tableId; 02437 sql += " AND related_attr = '" + oldColName + "'"; 02438 if(execute(sql) == false) 02439 return false; 02440 02441 sql = "UPDATE te_tables_relation SET external_attr = '" + rep.name_ + "'"; 02442 sql += " WHERE external_table_name = '" + tableName + "'"; 02443 sql += " AND external_attr = '" + oldColName + "'"; 02444 if(execute(sql) == false) 02445 return false; 02446 02447 // update grouping 02448 sql = "UPDATE te_grouping SET grouping_attr = '" + tableName + "." + rep.name_ + "'"; 02449 sql += " WHERE grouping_attr = '" + tableName + "." + oldColName + "'"; 02450 if(execute(sql) == false) 02451 return false; 02452 } 02453 else // column type changed 02454 { 02455 // delete relation 02456 sql = "DELETE FROM te_tables_relation WHERE (related_table_id = " + tableId; 02457 sql += " AND related_attr = '" + rep.name_ + "')"; 02458 sql += " OR (external_table_name = '" + tableName + "'"; 02459 sql += " AND external_attr = '" + rep.name_ + "')"; 02460 if(execute(sql) == false) 02461 return false; 02462 02463 // delete grouping 02464 TeDatabasePortal* portal = getPortal(); 02465 sql = "SELECT theme_id FROM te_grouping WHERE grouping_attr = '" + tableName + "." + oldColName + "'"; 02466 if(portal->query(sql) && portal->fetchRow()) 02467 { 02468 string themeId = portal->getData(0); 02469 02470 sql = "DELETE FROM te_legend WHERE theme_id = " + themeId + " AND group_id >= 0"; 02471 if(execute(sql) == false) 02472 { 02473 delete portal; 02474 return false; 02475 } 02476 } 02477 delete portal; 02478 02479 sql = "DELETE FROM te_grouping"; 02480 sql += " WHERE grouping_attr = '" + tableName + "." + oldColName + "'"; 02481 if(execute(sql) == false) 02482 return false; 02483 } 02484 } 02485 02486 alterTableInfoInMemory(tableName); 02487 return true; 02488 }
| void TeDatabase::alterTableInfoInMemory | ( | const string & | updatedTableName, | |
| string | oldTableName = "" | |||
| ) | [protected] |
Definition at line 134 of file TeDatabase.cpp.
References TeTheme::attrTables(), TeTheme::loadAliasVector(), TeTheme::loadAttrLists(), loadTableInfo(), TeTheme::loadTablesJoin(), metaModel_, TeConvertToUpperCase(), and TeTHEME.
Referenced by TePostgreSQL::addColumn(), TeOCIOracle::addColumn(), TeMySQL::addColumn(), TeFirebird::addColumn(), TeSqlServer::addColumn(), TeOracle::addColumn(), TeAdo::addColumn(), TePostgreSQL::alterTable(), TeOCIOracle::alterTable(), TeMySQL::alterTable(), TeFirebird::alterTable(), alterTable(), TeSqlServerSpatial::alterTable(), TeSqlServer::alterTable(), TeOracle::alterTable(), TeAdo::alterTable(), deleteColumn(), and TeAdo::deleteColumn().
00135 { 00136 //update table in memory 00137 TeTable updatedTable(updatedTableName); 00138 loadTableInfo(updatedTable); 00139 if(oldTableName.empty()) 00140 oldTableName = updatedTableName; 00141 00142 TeLayerMap::iterator itLayer = metaModel_->layerMap().begin(); 00143 while(itLayer!=metaModel_->layerMap().end()) 00144 { 00145 TeAttrTableVector::iterator itAttr = itLayer->second->attrTables().begin(); 00146 while(itAttr!=itLayer->second->attrTables().end()) 00147 { 00148 if(TeConvertToUpperCase(itAttr->name())==TeConvertToUpperCase(oldTableName)) 00149 { 00150 (*itAttr)=updatedTable; 00151 break; 00152 } 00153 ++itAttr; 00154 } 00155 ++itLayer; 00156 } 00157 TeThemeMap::iterator itTheme = metaModel_->themeMap().begin(); 00158 while(itTheme!=metaModel_->themeMap().end()) 00159 { 00160 if(itTheme->second->getProductId() != TeTHEME) 00161 { 00162 ++itTheme; 00163 continue; 00164 } 00165 00166 TeTheme* theme = static_cast<TeTheme*>(itTheme->second); 00167 00168 TeAttrTableVector::iterator itAttr = theme->attrTables().begin(); 00169 while(itAttr!=theme->attrTables().end()) 00170 { 00171 if(TeConvertToUpperCase(itAttr->name())==TeConvertToUpperCase(oldTableName)) 00172 { 00173 (*itAttr)=updatedTable; 00174 theme->loadAliasVector(); 00175 theme->loadAttrLists(); 00176 theme->loadTablesJoin(); 00177 break; 00178 } 00179 ++itAttr; 00180 } 00181 ++itTheme; 00182 } 00183 return; 00184 }
| bool TeDatabase::beginTransaction | ( | void | ) | [virtual] |
Reimplemented in TeAdo, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Definition at line 10130 of file TeDatabase.cpp.
References transactionCounter_.
Referenced by TeAbstractTheme::copyTo(), TeGTM::importRoutes(), TeGTM::importRoutes2(), TeGTM::importTracklogs(), TeGTM::importTracklogs2(), TeGTM::importWaypoints(), insertArcSet(), insertCellSet(), insertLineSet(), insertNodeSet(), insertPointSet(), insertPolygonSet(), insertTable(), insertTextSet(), TeCopyViewNode(), TeImportShape(), TeImportShapeGeometry(), updateArcSet(), updateCellSet(), updateDBVersion(), updateLineSet(), updateNodeSet(), updatePointSet(), updatePolygonSet(), updateTable(), and updateTextSet().
10131 { 10132 transactionCounter_++; 10133 return true; 10134 }
| bool TeDatabase::buffer | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIds, | |||
| TePolygonSet & | bufferSet, | |||
| double | dist | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the geometric table | |
| actIds | identifiers of the geometry set of the actGeomTable table | |
| bufferSet | the returned buffers | |
| dist | the distance of the buffers |
Reimplemented in TeOracleSpatial.
Definition at line 8221 of file TeDatabase.cpp.
References TeGetBuffer().
Referenced by main().
08222 { 08223 return (TeGetBuffer(actGeomTable, actRep, actIds, this, bufferSet, dist)); 08224 }
| bool TeDatabase::calculateArea | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIdsIn, | |||
| double & | area | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the geometric table | |
| actIdsIn | identifiers of the geometry set of the actGeomTable table | |
| area | the returned area value |
Reimplemented in TeOracleSpatial.
Definition at line 8190 of file TeDatabase.cpp.
References TeGetArea().
08191 { 08192 return (TeGetArea(actGeomTable, actRep, actIdsIn, this, area)); 08193 }
| bool TeDatabase::calculateDistance | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | visGeomTable, | |||
| TeGeomRep | visRep, | |||
| const string & | objId2, | |||
| double & | distance | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| objId1 | identifier of the geometry of the actGeomTable table | |
| visGeomTable | geometric table name | |
| visRep | geometric representation of the visGeomTable table | |
| objId2 | identifier of the geometry of the visGeomTable table | |
| distance | the returned distance value |
Reimplemented in TeOracleSpatial.
Definition at line 8208 of file TeDatabase.cpp.
| bool TeDatabase::calculateDistance | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | Ids, | |||
| double & | distance | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the geometric table | |
| Ids | identifiers of the two geometries of the actGeomTable table | |
| distance | the returned distance value |
Reimplemented in TeOracleSpatial.
Definition at line 8202 of file TeDatabase.cpp.
References TeGetDistance().
08203 { 08204 return (TeGetDistance(actGeomTable, actRep, Ids, this, distance)); 08205 }
| bool TeDatabase::calculateLength | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIdsIn, | |||
| double & | length | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the geometric table | |
| actIdsIn | identifiers of the geometry set of the actGeomTable table | |
| length | the returned length value |
Reimplemented in TeOracleSpatial.
Definition at line 8196 of file TeDatabase.cpp.
References TeGetLength().
08197 { 08198 return (TeGetLength(actGeomTable, actRep, actIdsIn, this, length)); 08199 }
| bool TeDatabase::centroid | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TePointSet & | centroidSet, | |||
| TeKeys | actIds = vector<string>(), |
|||
| const string & | actCollTable = "" | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the geometric table | |
| centroidSet | the returned centroids | |
| actIds | identifiers of the geometry set of the actGeomTable table | |
| actCollTable | collection table name associated with the actGeomTable table |
Reimplemented in TeOracleSpatial.
Definition at line 8227 of file TeDatabase.cpp.
References TeGetCentroid().
Referenced by main().
08228 { 08229 return (TeGetCentroid(actGeomTable, actRep, this, centroidSet, actIds, actCollTable)); 08230 }
| void TeDatabase::clear | ( | ) | [virtual] |
Definition at line 3548 of file TeDatabase.cpp.
References metaModel_.
Referenced by TeOCIOracle::close(), loadExternalThemes(), TeExternalTheme::loadMetadata(), TePieBar::locate(), TeDBConnectionsPool::removeDatabase(), and updateDB320To3201().
03549 { 03550 metaModel_->clear(); 03551 }
| virtual void TeDatabase::close | ( | ) | [pure virtual] |
Implemented in TeAdo, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by main(), TeDBConnectionsPool::removeDatabase(), TeFillCellAggregateOperation(), TeFillCellCategoryCountPercentageRasterOperation(), TeFillCellConnectionOperation(), TeFillCellNonSpatialOperation(), TeFillCellNonSpatialRasterOperation(), TeFillCellSpatialOperation(), and testCoverage().
| virtual bool TeDatabase::columnExist | ( | const string & | table, | |
| const string & | column, | |||
| TeAttribute & | attr | |||
| ) | [pure virtual] |
Implemented in TeAdo, TeOracle, TeSqlServer, TeSqlServerSpatial, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by TeAddressLocator::addCompleteNameColumn(), TeAddressLocator::createAddressMetadataTable(), deleteColumn(), insertRasterGeometry(), loadLayerRaster(), PostgreSQLUpdateDB302To310(), TeUpdateDBFromSet(), updateDB20To30(), updateDB302To310(), updateDB30To301(), updateDB311To320(), updateDB3201To331(), updateDB320To3201(), and updateDB331To400().
| bool TeDatabase::commitTransaction | ( | void | ) | [virtual] |
Reimplemented in TeAdo, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Definition at line 10137 of file TeDatabase.cpp.
References transactionCounter_.
Referenced by TeAbstractTheme::copyTo(), TeGTM::importRoutes(), TeGTM::importRoutes2(), TeGTM::importTracklogs(), TeGTM::importTracklogs2(), TeGTM::importWaypoints(), insertArcSet(), insertCellSet(), insertLineSet(), insertNodeSet(), insertPointSet(), insertPolygonSet(), insertTable(), insertTextSet(), TeCopyViewNode(), TeImportShape(), TeImportShapeGeometry(), updateArcSet(), updateCellSet(), updateDBVersion(), updateLineSet(), updateNodeSet(), updatePointSet(), updatePolygonSet(), updateTable(), and updateTextSet().
10138 { 10139 transactionCounter_ = max(transactionCounter_-1, 0); 10140 return true; 10141 }
| virtual string TeDatabase::concatValues | ( | vector< string > & | values, | |
| const string & | unionString | |||
| ) | [pure virtual] |
Implemented in TeAdo, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by TeAddressLocator::mountPatternWhereSQL().
| virtual bool TeDatabase::connect | ( | const string & | host, | |
| const string & | user, | |||
| const string & | password, | |||
| const string & | database, | |||
| int | port = -1 | |||
| ) | [pure virtual] |
Implemented in TeAdo, TeOracle, TeSqlServer, TeSqlServerSpatial, TeFirebird, TeMySQL, TeOCIOracle, TeOracleSpatial, TePostGIS, TePostgreSQL, and TeSQLite.
Referenced by main(), and testCoverage().
| bool TeDatabase::convexHull | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIds, | |||
| TePolygonSet & | convexHullSet | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the geometric table | |
| actIds | identifiers of the geometry set of the actGeomTable table | |
| convexHullSet | the returned convex geometries |
Reimplemented in TeOracleSpatial.
Definition at line 8233 of file TeDatabase.cpp.
References TeGetConvexHull().
08234 { 08235 return (TeGetConvexHull(actGeomTable, actRep, actIds, this, convexHullSet)); 08236 }
| bool TeDatabase::createArcGeometry | ( | const string & | tableName, | |
| const int & | epsgCode = -1 | |||
| ) | [virtual] |
Definition at line 9894 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addGeometry().
09895 { 09896 if(table.empty()) 09897 return false; 09898 09899 TeAttributeList attList; 09900 09901 {TeAttribute attGeomId; 09902 attGeomId.rep_.name_ = "geom_id"; 09903 attGeomId.rep_.type_ = TeUNSIGNEDINT; 09904 attGeomId.rep_.isAutoNumber_ = true; 09905 attGeomId.rep_.isPrimaryKey_ = true; 09906 attGeomId.rep_.null_ = false; 09907 attList.push_back(attGeomId);} 09908 09909 {TeAttribute attObjId; 09910 attObjId.rep_.name_ = "object_id"; 09911 attObjId.rep_.type_ = TeSTRING; 09912 attObjId.rep_.numChar_ = 255; 09913 attObjId.rep_.null_ = false; 09914 attList.push_back(attObjId);} 09915 09916 {TeAttribute attFromNode; 09917 attFromNode.rep_.name_ = "from_node"; 09918 attFromNode.rep_.type_ = TeINT; 09919 attFromNode.rep_.null_ = false; 09920 attList.push_back(attFromNode);} 09921 09922 {TeAttribute attToNode; 09923 attToNode.rep_.name_ = "to_node"; 09924 attToNode.rep_.type_ = TeINT; 09925 attToNode.rep_.null_ = false; 09926 attList.push_back(attToNode);} 09927 09928 if(!createTable(table, attList)) 09929 return false; 09930 09931 string idxName = "te_idx_" + table + "_obj"; 09932 09933 if(!createIndex(table, idxName, "object_id")) 09934 return false; 09935 09936 idxName = "te_idx_" + table + "_from"; 09937 09938 if(!createIndex(table, idxName, "from_node")) 09939 return false; 09940 09941 idxName = "te_idx_" + table + "_to"; 09942 09943 return createIndex(table, idxName, "to_node"); 09944 }
| bool TeDatabase::createCellGeometry | ( | const string & | tableName, | |
| const int & | epsgCode = -1 | |||
| ) | [virtual] |
Definition at line 9946 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::epsgCode_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeCELLTYPE, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addGeometry().
09947 { 09948 if(table.empty()) 09949 return false; 09950 09951 TeAttributeList attList; 09952 09953 {TeAttribute attGeomId; 09954 attGeomId.rep_.name_ = "geom_id"; 09955 attGeomId.rep_.type_ = TeUNSIGNEDINT; 09956 attGeomId.rep_.isAutoNumber_ = true; 09957 attGeomId.rep_.isPrimaryKey_ = true; 09958 attGeomId.rep_.null_ = false; 09959 attList.push_back(attGeomId);} 09960 09961 {TeAttribute attObjId; 09962 attObjId.rep_.name_ = "object_id"; 09963 attObjId.rep_.type_ = TeSTRING; 09964 attObjId.rep_.numChar_ = 255; 09965 attObjId.rep_.null_ = false; 09966 attList.push_back(attObjId);} 09967 09968 {TeAttribute attSpatial; 09969 attSpatial.rep_.name_ = "spatial_data"; 09970 attSpatial.rep_.type_ = TeCELLTYPE; 09971 attSpatial.rep_.epsgCode_ = epsgCode; 09972 attList.push_back(attSpatial);} 09973 09974 if(!createTable(table, attList)) 09975 return false; 09976 09977 string idxName = "te_idx_" + table + "obj"; 09978 09979 if(!createIndex(table, idxName, "object_id")) 09980 return false; 09981 09982 idxName = "te_idx_" + table + "_lc"; 09983 09984 return createIndex(table, idxName, "row_number, col_number"); 09985 }
Definition at line 2167 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::decimals_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, and TeAttributeRep::type_.
Referenced by TeTheme::save(), and TeExternalTheme::save().
02168 { 02169 if(tableName.empty()) 02170 return false; 02171 02172 TeAttributeList attList; 02173 02174 {TeAttribute attCObjId; 02175 attCObjId.rep_.name_ = "c_object_id"; 02176 attCObjId.rep_.type_ = TeSTRING; 02177 attCObjId.rep_.numChar_ = 255; 02178 attCObjId.rep_.isPrimaryKey_ = true; 02179 attCObjId.rep_.null_ = false; 02180 attList.push_back(attCObjId);} 02181 02182 {TeAttribute attCLegendId; 02183 attCLegendId.rep_.name_ = "c_legend_id"; 02184 attCLegendId.rep_.type_ = TeINT; 02185 attList.push_back(attCLegendId);} 02186 02187 {TeAttribute attLabelX; 02188 attLabelX.rep_.name_ = "label_x"; 02189 attLabelX.rep_.type_ = TeREAL; 02190 attLabelX.rep_.decimals_ = 15; 02191 attList.push_back(attLabelX);} 02192 02193 {TeAttribute attLabelY; 02194 attLabelY.rep_.name_ = "label_y"; 02195 attLabelY.rep_.type_ = TeREAL; 02196 attLabelY.rep_.decimals_ = 15; 02197 attList.push_back(attLabelY);} 02198 02199 {TeAttribute attCLegendOwn; 02200 attCLegendOwn.rep_.name_ = "c_legend_own"; 02201 attCLegendOwn.rep_.type_ = TeINT; 02202 attList.push_back(attCLegendOwn);} 02203 02204 {TeAttribute attCObjStatus; 02205 attCObjStatus.rep_.name_ = "c_object_status"; 02206 attCObjStatus.rep_.type_ = TeINT; 02207 attList.push_back(attCObjStatus);} 02208 02209 if(!createTable(tableName, attList)) 02210 return false; 02211 02212 string collectionId; 02213 unsigned int pos = tableName.rfind("_"); 02214 if ( (pos != std::string::npos ) && (pos+1<tableName.size()) ) 02215 collectionId = tableName.substr(pos+1); 02216 02217 string idxName = "te_idx_c" + collectionId + "_clegid"; 02218 02219 if(!createIndex(tableName, idxName, "c_legend_id")) 02220 return false; 02221 02222 idxName = "te_idx_c" + collectionId + "_clegown"; 02223 02224 return createIndex(tableName, idxName, "c_legend_own"); 02225 }
| bool TeDatabase::createConceptualModel | ( | bool | withIntegrity = true, |
|
| bool | newDatabase = true, |
|||
| bool | createIndex = true | |||
| ) | [virtual] |
Definition at line 425 of file TeDatabase.cpp.
References createDatabaseTable(), createDatumTable(), createGroupingTable(), createLayerTable(), createLayerTableTable(), createLegendTable(), createProjectionTable(), createProjectTable(), createProjectViewTable(), createRepresentationTable(), createSRSTable(), createTablesRelationTable(), createThemeTable(), createThemeTablesTable(), createViewTable(), createVisualRasterTable(), createVisualTable(), defineIntegrity(), execute(), populateDatumTable(), and TeDBVERSION.
Referenced by TeSQLite::newDatabase(), TePostgreSQL::newDatabase(), TePostGIS::newDatabase(), and TeFirebird::newDatabase().
00426 { 00427 bool status = true; 00428 bool createMainTables = false; 00429 00430 if (!this->tableExist("te_datum")) 00431 { 00432 status = this->createDatumTable(); 00433 if (!status) 00434 return false; 00435 createMainTables = true; 00436 populateDatumTable(); 00437 } 00438 00439 if (!this->tableExist("te_projection")) 00440 { 00441 status = this->createProjectionTable(); 00442 if (!status) 00443 return false; 00444 createMainTables = true; 00445 } 00446 00447 if (!this->tableExist("te_srs")) 00448 { 00449 status = this->createSRSTable(); 00450 if (!status) 00451 return false; 00452 createMainTables = true; 00453 } 00454 00455 if (!this->tableExist("te_layer")) 00456 { 00457 status = this->createLayerTable(); 00458 if (!status) 00459 return false; 00460 createMainTables = true; 00461 } 00462 00463 if (!this->tableExist("te_layer_table")) 00464 { 00465 status = this->createLayerTableTable(); 00466 if (!status) 00467 return false; 00468 createMainTables = true; 00469 } 00470 00471 if (!this->tableExist("te_tables_relation")) 00472 { 00473 status = this->createTablesRelationTable(); 00474 if (!status) 00475 return false; 00476 createMainTables = true; 00477 } 00478 00479 if (!this->tableExist("te_representation")) 00480 { 00481 status = this->createRepresentationTable(); 00482 if (!status) 00483 return false; 00484 createMainTables = true; 00485 } 00486 00487 if (!this->tableExist("te_theme")) 00488 { 00489 status = this->createThemeTable(); 00490 if (!status) 00491 return false; 00492 createMainTables = true; 00493 } 00494 00495 if (!this->tableExist("te_view")) 00496 { 00497 status = this->createViewTable(); 00498 if (!status) 00499 return false; 00500 createMainTables = true; 00501 } 00502 00503 if (!this->tableExist("te_grouping")) 00504 { 00505 status = this->createGroupingTable(); 00506 if (!status) 00507 return false; 00508 } 00509 00510 if (!this->tableExist("te_theme_table")) 00511 { 00512 status = this->createThemeTablesTable(); 00513 if (!status) 00514 return false; 00515 } 00516 00517 if (!this->tableExist("te_legend")) 00518 { 00519 status = this->createLegendTable(); 00520 if (!status) 00521 return false; 00522 } 00523 00524 if (!this->tableExist("te_visual")) 00525 { 00526 status = this->createVisualTable(); 00527 if (!status) 00528 return false; 00529 } 00530 00531 if (!this->tableExist("te_visual_raster")) 00532 { 00533 status = this->createVisualRasterTable(); 00534 if (!status) 00535 return false; 00536 } 00537 00538 if (!this->tableExist("te_database")) 00539 { 00540 status = this->createDatabaseTable(); 00541 if (!status) 00542 return false; 00543 } 00544 00545 if (!this->tableExist("te_project")) 00546 { 00547 status = this->createProjectTable(); 00548 if (!status) 00549 return false; 00550 } 00551 00552 if (!this->tableExist("te_project_view")) 00553 { 00554 status = this->createProjectViewTable(); 00555 if (!status) 00556 return false; 00557 } 00558 if (newDatabase || createMainTables) 00559 { 00560 string ins = "INSERT INTO te_database (db_version) VALUES ('" + TeDBVERSION + "')"; 00561 if (!execute(ins)) 00562 return false; 00563 } 00564 00565 if (withIntegrity) 00566 status = defineIntegrity(); 00567 00568 return status; 00569 }
| bool TeDatabase::createDatabaseTable | ( | ) | [virtual] |
Definition at line 592 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDATETIME, TeSTRING, and TeAttributeRep::type_.
Referenced by createConceptualModel().
00593 { 00594 TeAttributeList attList; 00595 00596 {TeAttribute attDBVersion; 00597 attDBVersion.rep_.name_ = "db_version"; 00598 attDBVersion.rep_.type_ = TeSTRING; 00599 attDBVersion.rep_.numChar_ = 50; 00600 attDBVersion.rep_.isPrimaryKey_ = true; 00601 attDBVersion.rep_.null_ = false; 00602 attList.push_back(attDBVersion);} 00603 00604 {TeAttribute attDBCreation; 00605 attDBCreation.rep_.name_ = "db_creation"; 00606 attDBCreation.rep_.type_ = TeDATETIME; 00607 attList.push_back(attDBCreation);} 00608 00609 return createTable("te_database", attList); 00610 }
| bool TeDatabase::createDatumTable | ( | ) | [virtual] |
Definition at line 669 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, tableExist(), TeREAL, TeSTRING, and TeAttributeRep::type_.
Referenced by createConceptualModel(), and updateDB400To412().
00670 { 00671 if(tableExist("te_datum")) 00672 { 00673 return true; 00674 } 00675 00676 TeAttributeList attList; 00677 00678 {TeAttribute attDatumName; 00679 attDatumName.rep_.name_ = "name"; 00680 attDatumName.rep_.type_ = TeSTRING; 00681 attDatumName.rep_.numChar_ = 50; 00682 attDatumName.rep_.isPrimaryKey_ = true; 00683 attDatumName.rep_.isAutoNumber_ = false; 00684 attDatumName.rep_.null_ = false; 00685 attList.push_back(attDatumName);} 00686 00687 {TeAttribute attRadius; 00688 attRadius.rep_.name_ = "radius"; 00689 attRadius.rep_.type_ = TeREAL; 00690 attRadius.rep_.decimals_ = 15; 00691 attRadius.rep_.defaultValue_ = "0.0"; 00692 attList.push_back(attRadius);} 00693 00694 {TeAttribute attFlattening; 00695 attFlattening.rep_.name_ = "flattening"; 00696 attFlattening.rep_.type_ = TeREAL; 00697 attFlattening.rep_.decimals_ = 15; 00698 attFlattening.rep_.defaultValue_ = "0.0"; 00699 attList.push_back(attFlattening);} 00700 00701 {TeAttribute attDX; 00702 attDX.rep_.name_ = "dx"; 00703 attDX.rep_.type_ = TeREAL; 00704 attDX.rep_.decimals_ = 15; 00705 attDX.rep_.defaultValue_ = "0.0"; 00706 attList.push_back(attDX);} 00707 00708 {TeAttribute attDY; 00709 attDY.rep_.name_ = "dy"; 00710 attDY.rep_.type_ = TeREAL; 00711 attDY.rep_.decimals_ = 15; 00712 attDY.rep_.defaultValue_ = "0.0"; 00713 attList.push_back(attDY);} 00714 00715 {TeAttribute attDZ; 00716 attDZ.rep_.name_ = "dz"; 00717 attDZ.rep_.type_ = TeREAL; 00718 attDZ.rep_.decimals_ = 15; 00719 attDZ.rep_.defaultValue_ = "0.0"; 00720 attList.push_back(attDZ);} 00721 00722 return createTable("te_datum", attList); 00723 }
| bool TeDatabase::createGroupingTable | ( | ) | [virtual] |
Definition at line 1733 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01734 { 01735 TeAttributeList attList; 01736 01737 {TeAttribute attThemeId; 01738 attThemeId.rep_.name_ = "theme_id"; 01739 attThemeId.rep_.type_ = TeUNSIGNEDINT; 01740 attThemeId.rep_.isPrimaryKey_ = true; 01741 attThemeId.rep_.null_ = false; 01742 attList.push_back(attThemeId);} 01743 01744 {TeAttribute attGNumber; 01745 attGNumber.rep_.name_ = "grouping_number"; 01746 attGNumber.rep_.type_ = TeUNSIGNEDINT; 01747 attList.push_back(attGNumber);} 01748 01749 {TeAttribute attGAttr; 01750 attGAttr.rep_.name_ = "grouping_attr"; 01751 attGAttr.rep_.type_ = TeSTRING; 01752 attGAttr.rep_.numChar_ = 255; 01753 attList.push_back(attGAttr);} 01754 01755 {TeAttribute attGAttrType; 01756 attGAttrType.rep_.name_ = "grouping_attr_type"; 01757 attGAttrType.rep_.type_ = TeUNSIGNEDINT; 01758 attList.push_back(attGAttrType);} 01759 01760 {TeAttribute attGMode; 01761 attGMode.rep_.name_ = "grouping_mode"; 01762 attGMode.rep_.type_ = TeUNSIGNEDINT; 01763 attList.push_back(attGMode);} 01764 01765 {TeAttribute attGNormAttr; 01766 attGNormAttr.rep_.name_ = "grouping_norm_attr"; 01767 attGNormAttr.rep_.type_ = TeSTRING; 01768 attGNormAttr.rep_.numChar_ = 255; 01769 attList.push_back(attGNormAttr);} 01770 01771 {TeAttribute attGStdDev; 01772 attGStdDev.rep_.name_ = "grouping_std_dev"; 01773 attGStdDev.rep_.type_ = TeREAL; 01774 attGStdDev.rep_.decimals_ = 15; 01775 attGStdDev.rep_.defaultValue_ = "0.0"; 01776 attList.push_back(attGStdDev);} 01777 01778 {TeAttribute attGPrec; 01779 attGPrec.rep_.name_ = "grouping_precision"; 01780 attGPrec.rep_.type_ = TeUNSIGNEDINT; 01781 attList.push_back(attGPrec);} 01782 01783 {TeAttribute attGFunc; 01784 attGFunc.rep_.name_ = "grouping_function"; 01785 attGFunc.rep_.type_ = TeSTRING; 01786 attGFunc.rep_.numChar_ = 20; 01787 attList.push_back(attGFunc);} 01788 01789 {TeAttribute attGChronon; 01790 attGChronon.rep_.name_ = "grouping_chronon"; 01791 attGChronon.rep_.type_ = TeUNSIGNEDINT; 01792 attList.push_back(attGChronon);} 01793 01794 return createTable("te_grouping", attList); 01795 }
| bool TeDatabase::createIndex | ( | const string & | tableName, | |
| const string & | indexName, | |||
| const string & | columnsName | |||
| ) | [virtual] |
Definition at line 572 of file TeDatabase.cpp.
References execute().
Referenced by createArcGeometry(), createCellGeometry(), TeTheme::createCollectionAuxTable(), createCollectionTable(), createGPMMetadataTable(), createKernelMetadataTable(), createLayerTable(), createLayerTableTable(), createLegendTable(), createLineGeometry(), createNeighbourhoodTable(), createNodeGeometry(), createPointGeometry(), createPolygonGeometry(), createRasterGeometry(), createRasterTable(), createRepresentationTable(), TeFirebird::createSpatialIndex(), createSpatialIndex(), createTextGeometry(), TeSqlServerSpatial::createTextGeometry(), createThemeTable(), createThemeTablesTable(), and createViewTable().
00573 { 00574 string sql = "CREATE INDEX " + indexName + " ON " + tableName + "(" + columnsName + ")"; 00575 return execute (sql); 00576 }
| bool TeDatabase::createLayerTable | ( | ) | [virtual] |
Definition at line 843 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDATETIME, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
00844 { 00845 TeAttributeList attList; 00846 00847 {TeAttribute attLayerId; 00848 attLayerId.rep_.name_ = "layer_id"; 00849 attLayerId.rep_.type_ = TeUNSIGNEDINT; 00850 attLayerId.rep_.isPrimaryKey_ = true; 00851 attLayerId.rep_.isAutoNumber_ = true; 00852 attLayerId.rep_.null_ = false; 00853 attList.push_back(attLayerId);} 00854 00855 {TeAttribute attProjectionId; 00856 attProjectionId.rep_.name_ = "projection_id"; 00857 attProjectionId.rep_.type_ = TeUNSIGNEDINT; 00858 attProjectionId.rep_.null_ = false; 00859 attList.push_back(attProjectionId);} 00860 00861 {TeAttribute attName; 00862 attName.rep_.name_ = "name"; 00863 attName.rep_.type_ = TeSTRING; 00864 attName.rep_.numChar_ = 255; 00865 attName.rep_.null_ = false; 00866 attList.push_back(attName);} 00867 00868 {TeAttribute attLowerX; 00869 attLowerX.rep_.name_ = "lower_x"; 00870 attLowerX.rep_.type_ = TeREAL; 00871 attLowerX.rep_.decimals_ = 15; 00872 attLowerX.rep_.defaultValue_ = "0.0"; 00873 attList.push_back(attLowerX);} 00874 00875 {TeAttribute attLowerY; 00876 attLowerY.rep_.name_ = "lower_y"; 00877 attLowerY.rep_.type_ = TeREAL; 00878 attLowerY.rep_.decimals_ = 15; 00879 attLowerY.rep_.defaultValue_ = "0.0"; 00880 attList.push_back(attLowerY);} 00881 00882 {TeAttribute attUpperX; 00883 attUpperX.rep_.name_ = "upper_x"; 00884 attUpperX.rep_.type_ = TeREAL; 00885 attUpperX.rep_.decimals_ = 15; 00886 attUpperX.rep_.defaultValue_ = "0.0"; 00887 attList.push_back(attUpperX);} 00888 00889 {TeAttribute attUpperY; 00890 attUpperY.rep_.name_ = "upper_y"; 00891 attUpperY.rep_.type_ = TeREAL; 00892 attUpperY.rep_.decimals_ = 15; 00893 attUpperY.rep_.defaultValue_ = "0.0"; 00894 attList.push_back(attUpperY);} 00895 00896 {TeAttribute attInitialTime; 00897 attInitialTime.rep_.name_ = "initial_time"; 00898 attInitialTime.rep_.type_ = TeDATETIME; 00899 attList.push_back(attInitialTime);} 00900 00901 {TeAttribute attFinalTime; 00902 attFinalTime.rep_.name_ = "final_time"; 00903 attFinalTime.rep_.type_ = TeDATETIME; 00904 attList.push_back(attFinalTime);} 00905 00906 {TeAttribute attEditionTime; 00907 attEditionTime.rep_.name_ = "edition_time"; 00908 attEditionTime.rep_.type_ = TeDATETIME; 00909 attList.push_back(attEditionTime);} 00910 00911 if(!createTable("te_layer", attList)) 00912 return false; 00913 00914 string idxName = "te_idx_layer_proj"; 00915 00916 if(!createIndex("te_layer", idxName, "projection_id")) 00917 return false; 00918 00919 idxName = "te_idx_layer_name"; 00920 00921 return createIndex("te_layer", idxName, "name"); 00922 }
| bool TeDatabase::createLayerTableTable | ( | ) | [virtual] |
Definition at line 924 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDATETIME, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
00925 { 00926 TeAttributeList attList; 00927 00928 {TeAttribute attTableId; 00929 attTableId.rep_.name_ = "table_id"; 00930 attTableId.rep_.type_ = TeUNSIGNEDINT; 00931 attTableId.rep_.isPrimaryKey_ = true; 00932 attTableId.rep_.isAutoNumber_ = true; 00933 attTableId.rep_.null_ = false; 00934 attList.push_back(attTableId);} 00935 00936 {TeAttribute attLayerId; 00937 attLayerId.rep_.name_ = "layer_id"; 00938 attLayerId.rep_.type_ = TeUNSIGNEDINT; 00939 attList.push_back(attLayerId);} 00940 00941 {TeAttribute attTable; 00942 attTable.rep_.name_ = "attr_table"; 00943 attTable.rep_.type_ = TeSTRING; 00944 attTable.rep_.numChar_ = 255; 00945 attTable.rep_.null_ = false; 00946 attList.push_back(attTable);} 00947 00948 {TeAttribute attUniqueID; 00949 attUniqueID.rep_.name_ = "unique_id"; 00950 attUniqueID.rep_.type_ = TeSTRING; 00951 attUniqueID.rep_.numChar_ = 255; 00952 attList.push_back(attUniqueID);} 00953 00954 {TeAttribute attLink; 00955 attLink.rep_.name_ = "attr_link"; 00956 attLink.rep_.type_ = TeSTRING; 00957 attLink.rep_.numChar_ = 255; 00958 attList.push_back(attLink);} 00959 00960 {TeAttribute attAttrInitialTime; 00961 attAttrInitialTime.rep_.name_ = "attr_initial_time"; 00962 attAttrInitialTime.rep_.type_ = TeSTRING; 00963 attAttrInitialTime.rep_.numChar_ = 255; 00964 attList.push_back(attAttrInitialTime);} 00965 00966 {TeAttribute attAttrFinalTime; 00967 attAttrFinalTime.rep_.name_ = "attr_final_time"; 00968 attAttrFinalTime.rep_.type_ = TeSTRING; 00969 attAttrFinalTime.rep_.numChar_ = 255; 00970 attList.push_back(attAttrFinalTime);} 00971 00972 {TeAttribute attTimeUnit; 00973 attTimeUnit.rep_.name_ = "attr_time_unit"; 00974 attTimeUnit.rep_.type_ = TeUNSIGNEDINT; 00975 attList.push_back(attTimeUnit);} 00976 00977 {TeAttribute attTableType; 00978 attTableType.rep_.name_ = "attr_table_type"; 00979 attTableType.rep_.type_ = TeUNSIGNEDINT; 00980 attList.push_back(attTableType);} 00981 00982 {TeAttribute attUserName; 00983 attUserName.rep_.name_ = "user_name"; 00984 attUserName.rep_.type_ = TeSTRING; 00985 attUserName.rep_.numChar_ = 255; 00986 attList.push_back(attUserName);} 00987 00988 {TeAttribute attInitialTime; 00989 attInitialTime.rep_.name_ = "initial_time"; 00990 attInitialTime.rep_.type_ = TeDATETIME; 00991 attList.push_back(attInitialTime);} 00992 00993 {TeAttribute attFinalTime; 00994 attFinalTime.rep_.name_ = "final_time"; 00995 attFinalTime.rep_.type_ = TeDATETIME; 00996 attList.push_back(attFinalTime);} 00997 00998 if(!createTable("te_layer_table", attList)) 00999 return false; 01000 01001 string idxName = "te_idx_layertable_layer"; 01002 01003 if(!createIndex("te_layer_table", idxName, "layer_id")) 01004 return false; 01005 01006 idxName = "te_idx_layertable_att"; 01007 01008 return createIndex("te_layer_table", idxName, "attr_table"); 01009 }
| bool TeDatabase::createLegendTable | ( | ) | [virtual] |
Definition at line 1849 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01850 { 01851 TeAttributeList attList; 01852 01853 {TeAttribute attLegendId; 01854 attLegendId.rep_.name_ = "legend_id"; 01855 attLegendId.rep_.type_ = TeUNSIGNEDINT; 01856 attLegendId.rep_.isPrimaryKey_ = true; 01857 attLegendId.rep_.isAutoNumber_ = true; 01858 attLegendId.rep_.null_ = false; 01859 attList.push_back(attLegendId); } 01860 01861 {TeAttribute attThemeId; 01862 attThemeId.rep_.name_ = "theme_id"; 01863 attThemeId.rep_.type_ = TeUNSIGNEDINT; 01864 attThemeId.rep_.null_ = false; 01865 attList.push_back(attThemeId);} 01866 01867 {TeAttribute attGId; 01868 attGId.rep_.name_ = "group_id"; 01869 attGId.rep_.type_ = TeINT; 01870 attList.push_back(attGId);} 01871 01872 {TeAttribute attNObjs; 01873 attNObjs.rep_.name_ = "num_objs"; 01874 attNObjs.rep_.type_ = TeUNSIGNEDINT; 01875 attList.push_back(attNObjs);} 01876 01877 {TeAttribute attLValue; 01878 attLValue.rep_.name_ = "lower_value"; 01879 attLValue.rep_.type_ = TeSTRING; 01880 attLValue.rep_.numChar_ = 255; 01881 attList.push_back(attLValue);} 01882 01883 {TeAttribute attUValue; 01884 attUValue.rep_.name_ = "upper_value"; 01885 attUValue.rep_.type_ = TeSTRING; 01886 attUValue.rep_.numChar_ = 255; 01887 attList.push_back(attUValue);} 01888 01889 {TeAttribute attLabel; 01890 attLabel.rep_.name_ = "label"; 01891 attLabel.rep_.type_ = TeSTRING; 01892 attLabel.rep_.numChar_ = 255; 01893 attList.push_back(attLabel);} 01894 01895 if(!createTable("te_legend", attList)) 01896 return false; 01897 01898 string idxName = "te_idx_legend_theme"; 01899 01900 return createIndex("te_legend", idxName, "theme_id"); 01901 }
| bool TeDatabase::createLineGeometry | ( | const string & | tableName, | |
| const int & | epsgCode = -1 | |||
| ) | [virtual] |
Definition at line 9822 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::epsgCode_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeLINE2DTYPE, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addGeometry().
09823 { 09824 if(tableName.empty()) 09825 return false; 09826 09827 TeAttributeList attList; 09828 09829 {TeAttribute attGeomId; 09830 attGeomId.rep_.name_ = "geom_id"; 09831 attGeomId.rep_.type_ = TeUNSIGNEDINT; 09832 attGeomId.rep_.isAutoNumber_ = true; 09833 attGeomId.rep_.isPrimaryKey_ = true; 09834 attGeomId.rep_.null_ = false; 09835 attList.push_back(attGeomId);} 09836 09837 {TeAttribute attObjId; 09838 attObjId.rep_.name_ = "object_id"; 09839 attObjId.rep_.type_ = TeSTRING; 09840 attObjId.rep_.numChar_ = 255; 09841 attObjId.rep_.null_ = false; 09842 attList.push_back(attObjId);} 09843 09844 {TeAttribute attSpatial; 09845 attSpatial.rep_.name_ = "spatial_data"; 09846 attSpatial.rep_.type_ = TeLINE2DTYPE; 09847 attSpatial.rep_.epsgCode_ = epsgCode; 09848 attList.push_back(attSpatial);} 09849 09850 if(!createTable(tableName, attList)) 09851 return false; 09852 09853 string idxName = "te_idx_" + tableName + "_obj"; 09854 09855 return createIndex(tableName, idxName, "object_id"); 09856 }
Definition at line 1102 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDecoderDatabase::saveLUTTable().
01103 { 01104 if(name.empty()) 01105 return false; 01106 01107 TeAttributeList attList; 01108 01109 {TeAttribute attIndexId; 01110 attIndexId.rep_.name_ = "index_id"; 01111 attIndexId.rep_.type_ = TeUNSIGNEDINT; 01112 attIndexId.rep_.isPrimaryKey_ = true; 01113 attIndexId.rep_.null_ = false; 01114 attList.push_back(attIndexId);} 01115 01116 {TeAttribute attRVal; 01117 attRVal.rep_.name_ = "r_val"; 01118 attRVal.rep_.type_ = TeUNSIGNEDINT; 01119 attRVal.rep_.null_ = false; 01120 attList.push_back(attRVal);} 01121 01122 {TeAttribute attGVal; 01123 attGVal.rep_.name_ = "g_val"; 01124 attGVal.rep_.type_ = TeUNSIGNEDINT; 01125 attGVal.rep_.null_ = false; 01126 attList.push_back(attGVal);} 01127 01128 {TeAttribute attBVal; 01129 attBVal.rep_.name_ = "b_val"; 01130 attBVal.rep_.type_ = TeUNSIGNEDINT; 01131 attBVal.rep_.null_ = false; 01132 attList.push_back(attBVal);} 01133 01134 {TeAttribute attName; 01135 attName.rep_.name_ = "class_name"; 01136 attName.rep_.type_ = TeSTRING; 01137 attName.rep_.numChar_ = 255; 01138 attList.push_back(attName);} 01139 01140 return createTable(name, attList); 01141 }
| bool TeDatabase::createNodeGeometry | ( | const string & | tableName, | |
| const int & | epsgCode = -1 | |||
| ) | [virtual] |
Definition at line 10068 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::epsgCode_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeNODETYPE, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addGeometry().
10069 { 10070 if(table.empty()) 10071 return false; 10072 10073 TeAttributeList attList; 10074 10075 {TeAttribute attGeomId; 10076 attGeomId.rep_.name_ = "geom_id"; 10077 attGeomId.rep_.type_ = TeUNSIGNEDINT; 10078 attGeomId.rep_.isAutoNumber_ = true; 10079 attGeomId.rep_.isPrimaryKey_ = true; 10080 attGeomId.rep_.null_ = false; 10081 attList.push_back(attGeomId);} 10082 10083 {TeAttribute attObjId; 10084 attObjId.rep_.name_ = "object_id"; 10085 attObjId.rep_.type_ = TeSTRING; 10086 attObjId.rep_.numChar_ = 255; 10087 attObjId.rep_.null_ = false; 10088 attList.push_back(attObjId);} 10089 10090 {TeAttribute attSpatial; 10091 attSpatial.rep_.name_ = "spatial_data"; 10092 attSpatial.rep_.type_ = TeNODETYPE; 10093 attSpatial.rep_.epsgCode_ = epsgCode; 10094 attList.push_back(attSpatial);} 10095 10096 if(!createTable(table, attList)) 10097 return false; 10098 10099 string idxName = "te_idx_" + table + "_obj"; 10100 10101 return createIndex(table, idxName, "object_id"); 10102 }
| bool TeDatabase::createPointGeometry | ( | const string & | tableName, | |
| const int & | epsgCode = -1 | |||
| ) | [virtual] |
Definition at line 9858 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::epsgCode_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TePOINTTYPE, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addGeometry().
09859 { 09860 if(table.empty()) 09861 return false; 09862 09863 TeAttributeList attList; 09864 09865 {TeAttribute attGeomId; 09866 attGeomId.rep_.name_ = "geom_id"; 09867 attGeomId.rep_.type_ = TeUNSIGNEDINT; 09868 attGeomId.rep_.isAutoNumber_ = true; 09869 attGeomId.rep_.isPrimaryKey_ = true; 09870 attGeomId.rep_.null_ = false; 09871 attList.push_back(attGeomId);} 09872 09873 {TeAttribute attObjId; 09874 attObjId.rep_.name_ = "object_id"; 09875 attObjId.rep_.type_ = TeSTRING; 09876 attObjId.rep_.numChar_ = 255; 09877 attObjId.rep_.null_ = false; 09878 attList.push_back(attObjId);} 09879 09880 {TeAttribute attSpatial; 09881 attSpatial.rep_.name_ = "spatial_data"; 09882 attSpatial.rep_.type_ = TePOINTTYPE; 09883 attSpatial.rep_.epsgCode_ = epsgCode; 09884 attList.push_back(attSpatial);} 09885 09886 if(!createTable(table, attList)) 09887 return false; 09888 09889 string idxName = "te_idx_" + table + "_obj"; 09890 09891 return createIndex(table, idxName, "object_id"); 09892 }
| bool TeDatabase::createPolygonGeometry | ( | const string & | tableName, | |
| const int & | epsgCode = -1 | |||
| ) | [virtual] |
Definition at line 9786 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::epsgCode_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TePOLYGONTYPE, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addGeometry().
09787 { 09788 if(tableName.empty()) 09789 return false; 09790 09791 TeAttributeList attList; 09792 09793 {TeAttribute attGeomId; 09794 attGeomId.rep_.name_ = "geom_id"; 09795 attGeomId.rep_.type_ = TeUNSIGNEDINT; 09796 attGeomId.rep_.isAutoNumber_ = true; 09797 attGeomId.rep_.isPrimaryKey_ = true; 09798 attGeomId.rep_.null_ = false; 09799 attList.push_back(attGeomId);} 09800 09801 {TeAttribute attObjId; 09802 attObjId.rep_.name_ = "object_id"; 09803 attObjId.rep_.type_ = TeSTRING; 09804 attObjId.rep_.numChar_ = 255; 09805 attObjId.rep_.null_ = false; 09806 attList.push_back(attObjId);} 09807 09808 {TeAttribute attSpatial; 09809 attSpatial.rep_.name_ = "spatial_data"; 09810 attSpatial.rep_.type_ = TePOLYGONTYPE; 09811 attSpatial.rep_.epsgCode_ = epsgCode; 09812 attList.push_back(attSpatial);} 09813 09814 if(!createTable(tableName, attList)) 09815 return false; 09816 09817 string idxName = "te_idx_" + tableName + "_obj"; 09818 09819 return createIndex(tableName, idxName, "object_id"); 09820 }
| bool TeDatabase::createProjectionTable | ( | ) | [virtual] |
Definition at line 726 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
00727 { 00728 TeAttributeList attList; 00729 00730 {TeAttribute attProjectId; 00731 attProjectId.rep_.name_ = "projection_id"; 00732 attProjectId.rep_.type_ = TeUNSIGNEDINT; 00733 attProjectId.rep_.isPrimaryKey_ = true; 00734 attProjectId.rep_.isAutoNumber_ = true; 00735 attProjectId.rep_.null_ = false; 00736 attList.push_back(attProjectId);} 00737 00738 {TeAttribute attName; 00739 attName.rep_.name_ = "name"; 00740 attName.rep_.type_ = TeSTRING; 00741 attName.rep_.numChar_ = 50; 00742 attName.rep_.null_ = false; 00743 attList.push_back(attName);} 00744 00745 {TeAttribute attLong0; 00746 attLong0.rep_.name_ = "long0"; 00747 attLong0.rep_.type_ = TeREAL; 00748 attLong0.rep_.decimals_ = 15; 00749 attLong0.rep_.defaultValue_ = "0.0"; 00750 attList.push_back(attLong0);} 00751 00752 {TeAttribute attLat0; 00753 attLat0.rep_.name_ = "lat0"; 00754 attLat0.rep_.type_ = TeREAL; 00755 attLat0.rep_.decimals_ = 15; 00756 attLat0.rep_.defaultValue_ = "0.0"; 00757 attList.push_back(attLat0);} 00758 00759 {TeAttribute attOffX; 00760 attOffX.rep_.name_ = "offx"; 00761 attOffX.rep_.type_ = TeREAL; 00762 attOffX.rep_.decimals_ = 15; 00763 attOffX.rep_.defaultValue_ = "0.0"; 00764 attList.push_back(attOffX);} 00765 00766 {TeAttribute attOffY; 00767 attOffY.rep_.name_ = "offy"; 00768 attOffY.rep_.type_ = TeREAL; 00769 attOffY.rep_.decimals_ = 15; 00770 attOffY.rep_.defaultValue_ = "0.0"; 00771 attList.push_back(attOffY);} 00772 00773 {TeAttribute attSlat1; 00774 attSlat1.rep_.name_ = "stlat1"; 00775 attSlat1.rep_.type_ = TeREAL; 00776 attSlat1.rep_.decimals_ = 15; 00777 attSlat1.rep_.defaultValue_ = "0.0"; 00778 attList.push_back(attSlat1);} 00779 00780 {TeAttribute attSlat2; 00781 attSlat2.rep_.name_ = "stlat2"; 00782 attSlat2.rep_.type_ = TeREAL; 00783 attSlat2.rep_.decimals_ = 15; 00784 attSlat2.rep_.defaultValue_ = "0.0"; 00785 attList.push_back(attSlat2);} 00786 00787 {TeAttribute attUnit; 00788 attUnit.rep_.name_ = "unit"; 00789 attUnit.rep_.type_ = TeSTRING; 00790 attUnit.rep_.numChar_ = 50; 00791 attUnit.rep_.null_ = false; 00792 attList.push_back(attUnit);} 00793 00794 {TeAttribute attScale; 00795 attScale.rep_.name_ = "scale"; 00796 attScale.rep_.type_ = TeREAL; 00797 attScale.rep_.decimals_ = 15; 00798 attScale.rep_.defaultValue_ = "0.0"; 00799 attList.push_back(attScale);} 00800 00801 {TeAttribute attHemis; 00802 attHemis.rep_.name_ = "hemis"; 00803 attHemis.rep_.type_ = TeINT; 00804 attHemis.rep_.null_ = false; 00805 attList.push_back(attHemis);} 00806 00807 {TeAttribute attDatum; 00808 attDatum.rep_.name_ = "datum"; 00809 attDatum.rep_.type_ = TeSTRING; 00810 attDatum.rep_.numChar_ = 50; 00811 attDatum.rep_.null_ = false; 00812 attList.push_back(attDatum);} 00813 00814 return createTable("te_projection", attList); 00815 }
| bool TeDatabase::createProjectTable | ( | ) | [virtual] |
Definition at line 613 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel(), and updateDB311To320().
00614 { 00615 TeAttributeList attList; 00616 00617 {TeAttribute attProjectId; 00618 attProjectId.rep_.name_ = "project_id"; 00619 attProjectId.rep_.type_ = TeUNSIGNEDINT; 00620 attProjectId.rep_.isAutoNumber_ = true; 00621 attProjectId.rep_.isPrimaryKey_ = true; 00622 attProjectId.rep_.null_ = false; 00623 attList.push_back(attProjectId);} 00624 00625 {TeAttribute attName; 00626 attName.rep_.name_ = "name"; 00627 attName.rep_.type_ = TeSTRING; 00628 attName.rep_.numChar_ = 50; 00629 attName.rep_.null_ = false; 00630 attList.push_back(attName);} 00631 00632 {TeAttribute attDescription; 00633 attDescription.rep_.name_ = "description"; 00634 attDescription.rep_.type_ = TeSTRING; 00635 attDescription.rep_.numChar_ = 255; 00636 attDescription.rep_.null_ = true; 00637 attList.push_back(attDescription);} 00638 00639 {TeAttribute attCurrentView; 00640 attCurrentView.rep_.name_ = "current_view"; 00641 attCurrentView.rep_.type_ = TeINT; 00642 attList.push_back(attCurrentView);} 00643 00644 return createTable("te_project", attList); 00645 }
| bool TeDatabase::createProjectViewTable | ( | ) | [virtual] |
Definition at line 648 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttribute::rep_, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel(), and updateDB311To320().
00649 { 00650 TeAttributeList attList; 00651 00652 {TeAttribute attProjectId; 00653 attProjectId.rep_.name_ = "project_id"; 00654 attProjectId.rep_.type_ = TeUNSIGNEDINT; 00655 attProjectId.rep_.isPrimaryKey_ = true; 00656 attProjectId.rep_.null_ = false; 00657 attList.push_back(attProjectId);} 00658 00659 {TeAttribute attViewId; 00660 attViewId.rep_.name_ = "view_id"; 00661 attViewId.rep_.type_ = TeUNSIGNEDINT; 00662 attViewId.rep_.isPrimaryKey_ = true; 00663 attViewId.rep_.null_ = false; 00664 attList.push_back(attViewId);} 00665 00666 return createTable("te_project_view", attList); 00667 }
Definition at line 1390 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addRasterFileGeometry(), and TeLayer::addRasterGeometry().
01391 { 01392 if(tableName.empty()) 01393 return false; 01394 01395 TeAttributeList attList; 01396 01397 {TeAttribute attGeomId; 01398 attGeomId.rep_.name_ = "geom_id"; 01399 attGeomId.rep_.type_ = TeUNSIGNEDINT; 01400 attGeomId.rep_.isAutoNumber_ = true; 01401 attGeomId.rep_.isPrimaryKey_ = true; 01402 attGeomId.rep_.null_ = false; 01403 attList.push_back(attGeomId);} 01404 01405 {TeAttribute attObjId; 01406 attObjId.rep_.name_ = "object_id"; 01407 attObjId.rep_.type_ = TeSTRING; 01408 attObjId.rep_.numChar_ = 255; 01409 attObjId.rep_.null_ = false; 01410 attList.push_back(attObjId);} 01411 01412 {TeAttribute attRasterTable; 01413 attRasterTable.rep_.name_ = "raster_table"; 01414 attRasterTable.rep_.type_ = TeSTRING; 01415 attRasterTable.rep_.numChar_ = 255; 01416 attRasterTable.rep_.null_ = false; 01417 attList.push_back(attRasterTable);} 01418 01419 {TeAttribute attLutTable; 01420 attLutTable.rep_.name_ = "lut_table"; 01421 attLutTable.rep_.type_ = TeSTRING; 01422 attLutTable.rep_.numChar_ = 255; 01423 attList.push_back(attLutTable);} 01424 01425 {TeAttribute attResX; 01426 attResX.rep_.name_ = "res_x"; 01427 attResX.rep_.type_ = TeREAL; 01428 attResX.rep_.decimals_ = 15; 01429 attResX.rep_.defaultValue_ = "0.0"; 01430 attList.push_back(attResX);} 01431 01432 {TeAttribute attResY; 01433 attResY.rep_.name_ = "res_y"; 01434 attResY.rep_.type_ = TeREAL; 01435 attResY.rep_.decimals_ = 15; 01436 attResY.rep_.defaultValue_ = "0.0"; 01437 attList.push_back(attResY);} 01438 01439 {TeAttribute attNumBands; 01440 attNumBands.rep_.name_ = "num_bands"; 01441 attNumBands.rep_.type_ = TeINT; 01442 attList.push_back(attNumBands);} 01443 01444 {TeAttribute attNumCols; 01445 attNumCols.rep_.name_ = "num_cols"; 01446 attNumCols.rep_.type_ = TeINT; 01447 attList.push_back(attNumCols);} 01448 01449 {TeAttribute attNumRows; 01450 attNumRows.rep_.name_ = "num_rows"; 01451 attNumRows.rep_.type_ = TeINT; 01452 attList.push_back(attNumRows);} 01453 01454 {TeAttribute attBlockHeight; 01455 attBlockHeight.rep_.name_ = "block_height"; 01456 attBlockHeight.rep_.type_ = TeINT; 01457 attList.push_back(attBlockHeight);} 01458 01459 {TeAttribute attBlockWidth; 01460 attBlockWidth.rep_.name_ = "block_width"; 01461 attBlockWidth.rep_.type_ = TeINT; 01462 attList.push_back(attBlockWidth);} 01463 01464 {TeAttribute attLowerX; 01465 attLowerX.rep_.name_ = "lower_x"; 01466 attLowerX.rep_.type_ = TeREAL; 01467 attLowerX.rep_.decimals_ = 15; 01468 attLowerX.rep_.defaultValue_ = "0.0"; 01469 attList.push_back(attLowerX);} 01470 01471 {TeAttribute attLowerY; 01472 attLowerY.rep_.name_ = "lower_y"; 01473 attLowerY.rep_.type_ = TeREAL; 01474 attLowerY.rep_.decimals_ = 15; 01475 attLowerY.rep_.defaultValue_ = "0.0"; 01476 attList.push_back(attLowerY);} 01477 01478 {TeAttribute attUpperX; 01479 attUpperX.rep_.name_ = "upper_x"; 01480 attUpperX.rep_.type_ = TeREAL; 01481 attUpperX.rep_.decimals_ = 15; 01482 attUpperX.rep_.defaultValue_ = "0.0"; 01483 attList.push_back(attUpperX);} 01484 01485 {TeAttribute attUpperY; 01486 attUpperY.rep_.name_ = "upper_y"; 01487 attUpperY.rep_.type_ = TeREAL; 01488 attUpperY.rep_.decimals_ = 15; 01489 attUpperY.rep_.defaultValue_ = "0.0"; 01490 attList.push_back(attUpperY);} 01491 01492 {TeAttribute attTilingType; 01493 attTilingType.rep_.name_ = "tiling_type"; 01494 attTilingType.rep_.type_ = TeINT; 01495 attList.push_back(attTilingType);} 01496 01497 if(!createTable(tableName, attList)) 01498 return false; 01499 01500 string idxName = "te_idx_" + tableName; 01501 01502 return createIndex(tableName, idxName, "object_id"); 01503 }
Definition at line 1292 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addRasterFileGeometry(), and TeLayer::addRasterGeometry().
01293 { 01294 if(tableName.empty()) 01295 return false; 01296 01297 TeAttributeList attList; 01298 01299 {TeAttribute attGeomId; 01300 attGeomId.rep_.name_ = "geom_id"; 01301 attGeomId.rep_.type_ = TeUNSIGNEDINT; 01302 attGeomId.rep_.isPrimaryKey_ = true; 01303 attGeomId.rep_.null_ = false; 01304 attList.push_back(attGeomId);} 01305 01306 {TeAttribute attBandId; 01307 attBandId.rep_.name_ = "band_id"; 01308 attBandId.rep_.type_ = TeUNSIGNEDINT; 01309 attBandId.rep_.isPrimaryKey_ = true; 01310 attBandId.rep_.null_ = false; 01311 attList.push_back(attBandId);} 01312 01313 {TeAttribute attMinValue; 01314 attMinValue.rep_.name_ = "min_value"; 01315 attMinValue.rep_.type_ = TeREAL; 01316 attMinValue.rep_.decimals_ = 15; 01317 attMinValue.rep_.defaultValue_ = "0.0"; 01318 attList.push_back(attMinValue);} 01319 01320 {TeAttribute attMaxValue; 01321 attMaxValue.rep_.name_ = "max_value"; 01322 attMaxValue.rep_.type_ = TeREAL; 01323 attMaxValue.rep_.decimals_ = 15; 01324 attMaxValue.rep_.defaultValue_ = "0.0"; 01325 attList.push_back(attMaxValue);} 01326 01327 {TeAttribute attNumBits; 01328 attNumBits.rep_.name_ = "num_bits"; 01329 attNumBits.rep_.type_ = TeINT; 01330 attList.push_back(attNumBits);} 01331 01332 {TeAttribute attDatatype; 01333 attDatatype.rep_.name_ = "data_type"; 01334 attDatatype.rep_.type_ = TeINT; 01335 attList.push_back(attDatatype);} 01336 01337 {TeAttribute attPhotoType; 01338 attPhotoType.rep_.name_ = "photometric_type"; 01339 attPhotoType.rep_.type_ = TeINT; 01340 attList.push_back(attPhotoType);} 01341 01342 {TeAttribute attCompressType; 01343 attCompressType.rep_.name_ = "compression_type"; 01344 attCompressType.rep_.type_ = TeINT; 01345 attList.push_back(attCompressType);} 01346 01347 {TeAttribute attDummy; 01348 attDummy.rep_.name_ = "dummy"; 01349 attDummy.rep_.type_ = TeREAL; 01350 attDummy.rep_.decimals_ = 15; 01351 attList.push_back(attDummy);} 01352 01353 {TeAttribute attName; 01354 attName.rep_.name_ = "band_name"; 01355 attName.rep_.type_ = TeSTRING; 01356 attName.rep_.numChar_ = 255; 01357 attList.push_back(attName);} 01358 01359 return createTable(tableName, attList); 01360 }
Definition at line 1362 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeRASTERTYPE, TeSTRING, and TeAttributeRep::type_.
Referenced by TeLayer::addRasterGeometry(), TeDecoderDatabase::create(), and TeDecoderDatabase::init().
01363 { 01364 if(tableName.empty()) 01365 return false; 01366 01367 TeAttributeList attList; 01368 01369 {TeAttribute attGeomId; 01370 attGeomId.rep_.name_ = "block_id"; 01371 attGeomId.rep_.type_ = TeSTRING; 01372 attGeomId.rep_.numChar_ = 50; 01373 attGeomId.rep_.isPrimaryKey_ = true; 01374 attGeomId.rep_.null_ = false; 01375 attList.push_back(attGeomId);} 01376 01377 {TeAttribute attSpatialData; 01378 attSpatialData.rep_.name_ = "spatial_data"; 01379 attSpatialData.rep_.type_ = TeRASTERTYPE; 01380 attList.push_back(attSpatialData);} 01381 01382 if(!createTable(tableName, attList)) 01383 return false; 01384 01385 string idxName = "te_idx_" + tableName + "_b"; 01386 01387 return createIndex(tableName, idxName, "band_id"); 01388 }
| virtual bool TeDatabase::createRelation | ( | const string & | relName, | |
| const string & | table, | |||
| const string & | fieldName, | |||
| const string & | relatedTable, | |||
| const string & | relatedField, | |||
| bool | cascadeDeletion | |||
| ) | [pure virtual] |
| 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 |
Implemented in TeAdo, TeOracle, TeSqlServer, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by TeAddressLocator::createAddressMetadataTable(), createAppThemeTable(), createChartParamsTable(), TeFileTheme::createFileThemeTable(), createGPMMetadataTable(), TeSFSTheme::createSFSThemeTable(), createTeLayerMetadata(), createTeTableMetadata(), defineIntegrity(), updateDB20To30(), updateDB320To3201(), and updateDB400To412().
| bool TeDatabase::createRepresentationTable | ( | ) | [virtual] |
Definition at line 1185 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDATETIME, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01186 { 01187 TeAttributeList attList; 01188 01189 {TeAttribute attRepresId; 01190 attRepresId.rep_.name_ = "repres_id"; 01191 attRepresId.rep_.type_ = TeUNSIGNEDINT; 01192 attRepresId.rep_.isAutoNumber_ = true; 01193 attRepresId.rep_.isPrimaryKey_ = true; 01194 attRepresId.rep_.null_ = false; 01195 attList.push_back(attRepresId);} 01196 01197 {TeAttribute attLayerId; 01198 attLayerId.rep_.name_ = "layer_id"; 01199 attLayerId.rep_.type_ = TeUNSIGNEDINT; 01200 attLayerId.rep_.null_ = false; 01201 attList.push_back(attLayerId);} 01202 01203 {TeAttribute attGeomType; 01204 attGeomType.rep_.name_ = "geom_type"; 01205 attGeomType.rep_.type_ = TeINT; 01206 attGeomType.rep_.null_ = false; 01207 attList.push_back(attGeomType);} 01208 01209 {TeAttribute attGeomTable; 01210 attGeomTable.rep_.name_ = "geom_table"; 01211 attGeomTable.rep_.type_ = TeSTRING; 01212 attGeomTable.rep_.numChar_ = 255; 01213 attGeomTable.rep_.null_ = false; 01214 attList.push_back(attGeomTable);} 01215 01216 {TeAttribute attDescription; 01217 attDescription.rep_.name_ = "description"; 01218 attDescription.rep_.type_ = TeSTRING; 01219 attDescription.rep_.numChar_ = 255; 01220 attList.push_back(attDescription);} 01221 01222 {TeAttribute attLowerX; 01223 attLowerX.rep_.name_ = "lower_x"; 01224 attLowerX.rep_.type_ = TeREAL; 01225 attLowerX.rep_.decimals_ = 15; 01226 attLowerX.rep_.defaultValue_ = "0.0"; 01227 attList.push_back(attLowerX);} 01228 01229 {TeAttribute attLowerY; 01230 attLowerY.rep_.name_ = "lower_y"; 01231 attLowerY.rep_.type_ = TeREAL; 01232 attLowerY.rep_.decimals_ = 15; 01233 attLowerY.rep_.defaultValue_ = "0.0"; 01234 attList.push_back(attLowerY);} 01235 01236 {TeAttribute attUpperX; 01237 attUpperX.rep_.name_ = "upper_x"; 01238 attUpperX.rep_.type_ = TeREAL; 01239 attUpperX.rep_.decimals_ = 15; 01240 attUpperX.rep_.defaultValue_ = "0.0"; 01241 attList.push_back(attUpperX);} 01242 01243 {TeAttribute attUpperY; 01244 attUpperY.rep_.name_ = "upper_y"; 01245 attUpperY.rep_.type_ = TeREAL; 01246 attUpperY.rep_.decimals_ = 15; 01247 attUpperY.rep_.defaultValue_ = "0.0"; 01248 attList.push_back(attUpperY);} 01249 01250 {TeAttribute attResX; 01251 attResX.rep_.name_ = "res_x"; 01252 attResX.rep_.type_ = TeREAL; 01253 attResX.rep_.decimals_ = 15; 01254 attResX.rep_.defaultValue_ = "0.0"; 01255 attList.push_back(attResX);} 01256 01257 {TeAttribute attResY; 01258 attResY.rep_.name_ = "res_y"; 01259 attResY.rep_.type_ = TeREAL; 01260 attResY.rep_.decimals_ = 15; 01261 attResY.rep_.defaultValue_ = "0.0"; 01262 attList.push_back(attResY);} 01263 01264 {TeAttribute attNumCols; 01265 attNumCols.rep_.name_ = "num_cols"; 01266 attNumCols.rep_.type_ = TeINT; 01267 attList.push_back(attNumCols);} 01268 01269 {TeAttribute attNumRows; 01270 attNumRows.rep_.name_ = "num_rows"; 01271 attNumRows.rep_.type_ = TeINT; 01272 attList.push_back(attNumRows);} 01273 01274 {TeAttribute attInitialTime; 01275 attInitialTime.rep_.name_ = "initial_time"; 01276 attInitialTime.rep_.type_ = TeDATETIME; 01277 attList.push_back(attInitialTime);} 01278 01279 {TeAttribute attFinalTime; 01280 attFinalTime.rep_.name_ = "final_time"; 01281 attFinalTime.rep_.type_ = TeDATETIME; 01282 attList.push_back(attFinalTime);} 01283 01284 if(!createTable("te_representation", attList)) 01285 return false; 01286 01287 string idxName = "te_idx_representation"; 01288 01289 return createIndex("te_representation", idxName, "layer_id"); 01290 }
| bool TeDatabase::createSpatialIndex | ( | const string & | table, | |
| const string & | columns, | |||
| TeSpatialIndexType | = TeRTREE, |
|||
| short | = 0, |
|||
| short | = 0 | |||
| ) | [virtual] |
Reimplemented in TeSqlServerSpatial, TeFirebird, TeOracleSpatial, TePostGIS, and TePostgreSQL.
Definition at line 5582 of file TeDatabase.cpp.
References createIndex().
Referenced by TeGTM::importRoutes(), TeGTM::importRoutes2(), TeGTM::importTracklogs(), TeGTM::importTracklogs2(), TeGTM::importWaypoints(), PostgreSQLUpdateDB302To310(), TeCopyExternThemeToLayer(), TeCopyLayerToLayer(), TeCopyThemeToLayer(), TeImportBNA(), TeImportGEO(), TeImportMIF(), TeImportRaster(), TeImportShape(), and TeReadCSVFile().
05583 { 05584 string idxName = "sp_idx_" + table; 05585 return createIndex(table, idxName, columns); 05586 }
| bool TeDatabase::createSRSTable | ( | ) | [virtual] |
Definition at line 817 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttribute::rep_, tableExist(), TeINT, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel(), and updateDB400To412().
00818 { 00819 if(tableExist("te_srs")) 00820 { 00821 return true; 00822 } 00823 00824 TeAttributeList attList; 00825 00826 {TeAttribute attProjectId; 00827 attProjectId.rep_.name_ = "projection_id"; 00828 attProjectId.rep_.type_ = TeUNSIGNEDINT; 00829 attProjectId.rep_.isPrimaryKey_ = true; 00830 attProjectId.rep_.isAutoNumber_ = false; 00831 attProjectId.rep_.null_ = false; 00832 attList.push_back(attProjectId);} 00833 00834 {TeAttribute attSRSId; 00835 attSRSId.rep_.name_ = "srs_id"; 00836 attSRSId.rep_.type_ = TeINT; 00837 attSRSId.rep_.null_ = false; 00838 attList.push_back(attSRSId);} 00839 00840 return createTable("te_srs", attList); 00841 }
| virtual bool TeDatabase::createTable | ( | const string & | table, | |
| TeAttributeList & | attr | |||
| ) | [pure virtual] |
| table | table name | |
| attr | table list of attributes |
Implemented in TeAdo, TeOracle, TeSqlServer, TeSqlServerSpatial, TeFirebird, TeMySQL, TeOCIOracle, TeOracleSpatial, TePostGIS, TePostgreSQL, and TeSQLite.
Referenced by TeAddressLocator::createAddressMetadataTable(), createAppThemeTable(), createArcGeometry(), TeLayer::createAttributeTable(), createCellGeometry(), createChartParamsTable(), TeTheme::createCollectionAuxTable(), createCollectionTable(), createCoverageLayerTable(), createCoverageMetadataTable(), createCoverageTable(), createDatabaseTable(), createDatumTable(), TeDBConnectionsPool::createDBConnectionTable(), TeExternalTheme::createExternalThemeTable(), TeFileTheme::createFileThemeTable(), createGPMMetadataTable(), createGroupingTable(), createKernelMetadataTable(), createLayerMediaTable(), createLayerTable(), createLayerTableTable(), createLegendTable(), createLineGeometry(), createLUTTable(), createMediaTable(), createNeighbourhoodTable(), createNodeGeometry(), createPointGeometry(), createPolygonGeometry(), createProjectionTable(), createProjectTable(), createProjectViewTable(), createRasterGeometry(), createRasterMetadataTable(), createRasterTable(), createRepresentationTable(), TeSFSTheme::createSFSThemeTable(), createSRSTable(), createTablesRelationTable(), createTeLayerMetadata(), createTeTableMetadata(), createTextGeometry(), createThemeTable(), createThemeTablesTable(), createViewTable(), createVisualRasterTable(), createVisualTable(), main(), TeLayer::saveAttributeTable(), TeCopyDatabase(), TeCopyViewNode(), TeImportCSVFile(), TeImportDBFTable(), updateDB20To30(), and updateDB310To311().
| bool TeDatabase::createTablesRelationTable | ( | ) | [virtual] |
Definition at line 1143 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01144 { 01145 TeAttributeList attList; 01146 01147 {TeAttribute attRelationId; 01148 attRelationId.rep_.name_ = "relation_id"; 01149 attRelationId.rep_.type_ = TeUNSIGNEDINT; 01150 attRelationId.rep_.isAutoNumber_ = true; 01151 attRelationId.rep_.isPrimaryKey_ = true; 01152 attRelationId.rep_.null_ = false; 01153 attList.push_back(attRelationId);} 01154 01155 {TeAttribute attRelatedTableId; 01156 attRelatedTableId.rep_.name_ = "related_table_id"; 01157 attRelatedTableId.rep_.type_ = TeINT; 01158 attRelatedTableId.rep_.null_ = false; 01159 attList.push_back(attRelatedTableId);} 01160 01161 {TeAttribute attRelatedAttr; 01162 attRelatedAttr.rep_.name_ = "related_attr"; 01163 attRelatedAttr.rep_.type_ = TeSTRING; 01164 attRelatedAttr.rep_.numChar_ = 255; 01165 attRelatedAttr.rep_.null_ = false; 01166 attList.push_back(attRelatedAttr);} 01167 01168 {TeAttribute attExternalTableName; 01169 attExternalTableName.rep_.name_ = "external_table_name"; 01170 attExternalTableName.rep_.type_ = TeSTRING; 01171 attExternalTableName.rep_.numChar_ = 255; 01172 attExternalTableName.rep_.null_ = false; 01173 attList.push_back(attExternalTableName);} 01174 01175 {TeAttribute attExternalAttr; 01176 attExternalAttr.rep_.name_ = "external_attr"; 01177 attExternalAttr.rep_.type_ = TeSTRING; 01178 attExternalAttr.rep_.numChar_ = 255; 01179 attExternalAttr.rep_.null_ = false; 01180 attList.push_back(attExternalAttr);} 01181 01182 return createTable("te_tables_relation", attList); 01183 }
| bool TeDatabase::createTextGeometry | ( | const string & | tableName, | |
| const int & | epsgCode = -1 | |||
| ) | [virtual] |
Definition at line 9987 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeLayer::addGeometry().
09988 { 09989 if(table.empty()) 09990 return false; 09991 09992 TeAttributeList attList; 09993 09994 {TeAttribute attGeomId; 09995 attGeomId.rep_.name_ = "geom_id"; 09996 attGeomId.rep_.type_ = TeUNSIGNEDINT; 09997 attGeomId.rep_.isAutoNumber_ = true; 09998 attGeomId.rep_.isPrimaryKey_ = true; 09999 attGeomId.rep_.null_ = false; 10000 attList.push_back(attGeomId);} 10001 10002 {TeAttribute attObjId; 10003 attObjId.rep_.name_ = "object_id"; 10004 attObjId.rep_.type_ = TeSTRING; 10005 attObjId.rep_.numChar_ = 255; 10006 attObjId.rep_.null_ = false; 10007 attList.push_back(attObjId);} 10008 10009 {TeAttribute attX; 10010 attX.rep_.name_ = "x"; 10011 attX.rep_.type_ = TeREAL; 10012 attX.rep_.decimals_ = 15; 10013 attX.rep_.defaultValue_ = "0.0"; 10014 attList.push_back(attX);} 10015 10016 {TeAttribute attY; 10017 attY.rep_.name_ = "y"; 10018 attY.rep_.type_ = TeREAL; 10019 attY.rep_.decimals_ = 15; 10020 attY.rep_.defaultValue_ = "0.0"; 10021 attList.push_back(attY);} 10022 10023 {TeAttribute attTextValue; 10024 attTextValue.rep_.name_ = "text_value"; 10025 attTextValue.rep_.type_ = TeSTRING; 10026 attTextValue.rep_.numChar_ = 255; 10027 attList.push_back(attTextValue);} 10028 10029 {TeAttribute attAngle; 10030 attAngle.rep_.name_ = "angle"; 10031 attAngle.rep_.type_ = TeREAL; 10032 attAngle.rep_.decimals_ = 15; 10033 attAngle.rep_.defaultValue_ = "0.0"; 10034 attList.push_back(attAngle);} 10035 10036 {TeAttribute attHeight; 10037 attHeight.rep_.name_ = "height"; 10038 attHeight.rep_.type_ = TeREAL; 10039 attHeight.rep_.decimals_ = 15; 10040 attHeight.rep_.defaultValue_ = "0.0"; 10041 attList.push_back(attHeight);} 10042 10043 {TeAttribute attAlignVert; 10044 attAlignVert.rep_.name_ = "alignment_vert"; 10045 attAlignVert.rep_.type_ = TeREAL; 10046 attAlignVert.rep_.decimals_ = 15; 10047 attList.push_back(attAlignVert);} 10048 10049 {TeAttribute attAlignHoriz; 10050 attAlignHoriz.rep_.name_ = "alignment_horiz"; 10051 attAlignHoriz.rep_.type_ = TeREAL; 10052 attAlignHoriz.rep_.decimals_ = 15; 10053 attList.push_back(attAlignHoriz);} 10054 10055 if(!createTable(table, attList)) 10056 return false; 10057 10058 string idxName = "te_idx_" + table + "_obj"; 10059 10060 if(!createIndex(table, idxName, "object_id")) 10061 return false; 10062 10063 idxName = "te_idx_" + table + "_pos"; 10064 10065 return createIndex(table, idxName, "x, y"); 10066 }
| bool TeDatabase::createThemeTable | ( | ) | [virtual] |
Definition at line 1588 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDATETIME, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01589 { 01590 TeAttributeList attList; 01591 01592 {TeAttribute attThemeId; 01593 attThemeId.rep_.name_ = "theme_id"; 01594 attThemeId.rep_.type_ = TeUNSIGNEDINT; 01595 attThemeId.rep_.isPrimaryKey_ = true; 01596 attThemeId.rep_.isAutoNumber_ = true; 01597 attThemeId.rep_.null_ = false; 01598 attList.push_back(attThemeId);} 01599 01600 {TeAttribute attLayerId; 01601 attLayerId.rep_.name_ = "layer_id"; 01602 attLayerId.rep_.type_ = TeUNSIGNEDINT; 01603 attList.push_back(attLayerId);} 01604 01605 {TeAttribute attViewId; 01606 attViewId.rep_.name_ = "view_id"; 01607 attViewId.rep_.type_ = TeUNSIGNEDINT; 01608 attViewId.rep_.null_ = false; 01609 attList.push_back(attViewId);} 01610 01611 {TeAttribute attName; 01612 attName.rep_.name_ = "name"; 01613 attName.rep_.type_ = TeSTRING; 01614 attName.rep_.numChar_ = 255; 01615 attName.rep_.null_ = false; 01616 attList.push_back(attName);} 01617 01618 {TeAttribute attParentId; 01619 attParentId.rep_.name_ = "parent_id"; 01620 attParentId.rep_.type_ = TeUNSIGNEDINT; 01621 attParentId.rep_.null_ = false; 01622 attList.push_back(attParentId);} 01623 01624 {TeAttribute attPriority; 01625 attPriority.rep_.name_ = "priority"; 01626 attPriority.rep_.type_ = TeUNSIGNEDINT; 01627 attPriority.rep_.null_ = false; 01628 attList.push_back(attPriority);} 01629 01630 {TeAttribute attNodeType; 01631 attNodeType.rep_.name_ = "node_type"; 01632 attNodeType.rep_.type_ = TeUNSIGNEDINT; 01633 attNodeType.rep_.null_ = false; 01634 attList.push_back(attNodeType);} 01635 01636 {TeAttribute attMinScale; 01637 attMinScale.rep_.name_ = "min_scale"; 01638 attMinScale.rep_.type_ = TeREAL; 01639 attMinScale.rep_.decimals_ = 15; 01640 attList.push_back(attMinScale);} 01641 01642 {TeAttribute attMaxScale; 01643 attMaxScale.rep_.name_ = "max_scale"; 01644 attMaxScale.rep_.type_ = TeREAL; 01645 attMaxScale.rep_.decimals_ = 15; 01646 attList.push_back(attMaxScale);} 01647 01648 {TeAttribute attGenAttWhere; 01649 attGenAttWhere.rep_.name_ = "generate_attribute_where"; 01650 attGenAttWhere.rep_.type_ = TeSTRING; 01651 attGenAttWhere.rep_.numChar_ = 0; 01652 attList.push_back(attGenAttWhere);} 01653 01654 {TeAttribute attGenSpatWhere; 01655 attGenSpatWhere.rep_.name_ = "generate_spatial_where"; 01656 attGenSpatWhere.rep_.type_ = TeSTRING; 01657 attGenSpatWhere.rep_.numChar_ = 0; 01658 attList.push_back(attGenSpatWhere);} 01659 01660 {TeAttribute attGenTempWhere; 01661 attGenTempWhere.rep_.name_ = "generate_temporal_where"; 01662 attGenTempWhere.rep_.type_ = TeSTRING; 01663 attGenTempWhere.rep_.numChar_ = 0; 01664 attList.push_back(attGenTempWhere);} 01665 01666 {TeAttribute attCollectionT; 01667 attCollectionT.rep_.name_ = "collection_table"; 01668 attCollectionT.rep_.type_ = TeSTRING; 01669 attCollectionT.rep_.numChar_ = 255; 01670 attList.push_back(attCollectionT);} 01671 01672 {TeAttribute attVisiRep; 01673 attVisiRep.rep_.name_ = "visible_rep"; 01674 attVisiRep.rep_.type_ = TeINT; 01675 attList.push_back(attVisiRep);} 01676 01677 {TeAttribute attEnableVis; 01678 attEnableVis.rep_.name_ = "enable_visibility"; 01679 attEnableVis.rep_.type_ = TeINT; 01680 attList.push_back(attEnableVis);} 01681 01682 {TeAttribute attLowerX; 01683 attLowerX.rep_.name_ = "lower_x"; 01684 attLowerX.rep_.type_ = TeREAL; 01685 attLowerX.rep_.decimals_ = 15; 01686 attLowerX.rep_.defaultValue_ = "0.0"; 01687 attList.push_back(attLowerX);} 01688 01689 {TeAttribute attLowerY; 01690 attLowerY.rep_.name_ = "lower_y"; 01691 attLowerY.rep_.type_ = TeREAL; 01692 attLowerY.rep_.decimals_ = 15; 01693 attLowerY.rep_.defaultValue_ = "0.0"; 01694 attList.push_back(attLowerY);} 01695 01696 {TeAttribute attUpperX; 01697 attUpperX.rep_.name_ = "upper_x"; 01698 attUpperX.rep_.type_ = TeREAL; 01699 attUpperX.rep_.decimals_ = 15; 01700 attUpperX.rep_.defaultValue_ = "0.0"; 01701 attList.push_back(attUpperX);} 01702 01703 {TeAttribute attUpperY; 01704 attUpperY.rep_.name_ = "upper_y"; 01705 attUpperY.rep_.type_ = TeREAL; 01706 attUpperY.rep_.decimals_ = 15; 01707 attUpperY.rep_.defaultValue_ = "0.0"; 01708 attList.push_back(attUpperY);} 01709 01710 {TeAttribute attCreationTime; 01711 attCreationTime.rep_.name_ = "creation_time"; 01712 attCreationTime.rep_.type_ = TeDATETIME; 01713 attList.push_back(attCreationTime);} 01714 01715 if(!createTable("te_theme", attList)) 01716 return false; 01717 01718 string idxName = "te_idx_theme_view_id"; 01719 01720 if(!createIndex("te_theme", idxName, "view_id")) 01721 return false; 01722 01723 idxName = "te_idx_theme_name"; 01724 01725 if(!createIndex("te_theme", idxName, "name")) 01726 return false; 01727 01728 idxName = "te_idx_theme_layer_id"; 01729 01730 return createIndex("te_theme", idxName, "layer_id"); 01731 }
| bool TeDatabase::createThemeTablesTable | ( | ) | [virtual] |
Definition at line 1797 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttribute::rep_, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01798 { 01799 TeAttributeList attList; 01800 01801 {TeAttribute attThemeTableId; 01802 attThemeTableId.rep_.name_ = "theme_table_id"; 01803 attThemeTableId.rep_.type_ = TeUNSIGNEDINT; 01804 attThemeTableId.rep_.isPrimaryKey_ = true; 01805 attThemeTableId.rep_.isAutoNumber_ = true; 01806 attThemeTableId.rep_.null_ = false; 01807 attList.push_back(attThemeTableId);} 01808 01809 {TeAttribute attThemeId; 01810 attThemeId.rep_.name_ = "theme_id"; 01811 attThemeId.rep_.type_ = TeUNSIGNEDINT; 01812 attThemeId.rep_.null_ = false; 01813 attList.push_back(attThemeId);} 01814 01815 {TeAttribute attTableId; 01816 attTableId.rep_.name_ = "table_id"; 01817 attTableId.rep_.type_ = TeUNSIGNEDINT; 01818 attTableId.rep_.null_ = false; 01819 attList.push_back(attTableId);} 01820 01821 {TeAttribute attRelationId; 01822 attRelationId.rep_.name_ = "relation_id"; 01823 attRelationId.rep_.type_ = TeUNSIGNEDINT; 01824 attList.push_back(attRelationId);} 01825 01826 {TeAttribute attTableOrderId; 01827 attTableOrderId.rep_.name_ = "table_order"; 01828 attTableOrderId.rep_.type_ = TeUNSIGNEDINT; 01829 attList.push_back(attTableOrderId);} 01830 01831 if(!createTable("te_theme_table", attList)) 01832 return false; 01833 01834 string idxName = "te_idx_theme_table_id"; 01835 01836 if(!createIndex("te_theme_table", idxName, "table_id")) 01837 return false; 01838 01839 idxName = "te_idx_theme_relat_id"; 01840 01841 if(!createIndex("te_theme_table", idxName, "relation_id")) 01842 return false; 01843 01844 idxName = "te_idx_themetable_theme"; 01845 01846 return createIndex("te_theme_table", idxName, "theme_id"); 01847 }
| bool TeDatabase::createViewTable | ( | ) | [virtual] |
Definition at line 1505 of file TeDatabase.cpp.
References createIndex(), createTable(), TeAttributeRep::decimals_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01506 { 01507 TeAttributeList attList; 01508 01509 {TeAttribute attViewId; 01510 attViewId.rep_.name_ = "view_id"; 01511 attViewId.rep_.type_ = TeUNSIGNEDINT; 01512 attViewId.rep_.isPrimaryKey_ = true; 01513 attViewId.rep_.isAutoNumber_ = true; 01514 attViewId.rep_.null_ = false; 01515 attList.push_back(attViewId);} 01516 01517 {TeAttribute attProjectionId; 01518 attProjectionId.rep_.name_ = "projection_id"; 01519 attProjectionId.rep_.type_ = TeUNSIGNEDINT; 01520 attProjectionId.rep_.null_ = false; 01521 attList.push_back(attProjectionId);} 01522 01523 {TeAttribute attName; 01524 attName.rep_.name_ = "name"; 01525 attName.rep_.type_ = TeSTRING; 01526 attName.rep_.numChar_ = 255; 01527 attName.rep_.null_ = false; 01528 attList.push_back(attName);} 01529 01530 {TeAttribute attUserName; 01531 attUserName.rep_.name_ = "user_name"; 01532 attUserName.rep_.type_ = TeSTRING; 01533 attUserName.rep_.numChar_ = 255; 01534 attList.push_back(attUserName);} 01535 01536 {TeAttribute attVisibility; 01537 attVisibility.rep_.name_ = "visibility"; 01538 attVisibility.rep_.type_ = TeINT; 01539 attList.push_back(attVisibility);} 01540 01541 {TeAttribute attLowerX; 01542 attLowerX.rep_.name_ = "lower_x"; 01543 attLowerX.rep_.type_ = TeREAL; 01544 attLowerX.rep_.decimals_ = 15; 01545 attList.push_back(attLowerX);} 01546 01547 {TeAttribute attLowerY; 01548 attLowerY.rep_.name_ = "lower_y"; 01549 attLowerY.rep_.type_ = TeREAL; 01550 attLowerY.rep_.decimals_ = 15; 01551 attList.push_back(attLowerY);} 01552 01553 {TeAttribute attUpperX; 01554 attUpperX.rep_.name_ = "upper_x"; 01555 attUpperX.rep_.type_ = TeREAL; 01556 attUpperX.rep_.decimals_ = 15; 01557 attList.push_back(attUpperX);} 01558 01559 {TeAttribute attUpperY; 01560 attUpperY.rep_.name_ = "upper_y"; 01561 attUpperY.rep_.type_ = TeREAL; 01562 attUpperY.rep_.decimals_ = 15; 01563 attList.push_back(attUpperY);} 01564 01565 {TeAttribute attCurrentTheme; 01566 attCurrentTheme.rep_.name_ = "current_theme"; 01567 attCurrentTheme.rep_.type_ = TeINT; 01568 attList.push_back(attCurrentTheme);} 01569 01570 if(!createTable("te_view", attList)) 01571 return false; 01572 01573 string idxName = "te_idx_view_projid"; 01574 01575 if(!createIndex("te_view", idxName, "projection_id")) 01576 return false; 01577 01578 idxName = "te_idx_view_name"; 01579 01580 if(!createIndex("te_view", idxName, "name")) 01581 return false; 01582 01583 idxName = "te_idx_view_user_name"; 01584 01585 return createIndex("te_view", idxName, "user_name"); 01586 }
| bool TeDatabase::createVisualRasterTable | ( | ) | [virtual] |
Definition at line 2038 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::decimals_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
02039 { 02040 TeAttributeList attList; 02041 02042 {TeAttribute attThemeId; 02043 attThemeId.rep_.name_ = "theme_id"; 02044 attThemeId.rep_.type_ = TeUNSIGNEDINT; 02045 attThemeId.rep_.isPrimaryKey_ = true; 02046 attThemeId.rep_.null_ = false; 02047 attList.push_back(attThemeId);} 02048 02049 {TeAttribute attBandIn; 02050 attBandIn.rep_.name_ = "band_in"; 02051 attBandIn.rep_.type_ = TeUNSIGNEDINT; 02052 attBandIn.rep_.isPrimaryKey_ = true; 02053 attBandIn.rep_.null_ = false; 02054 attList.push_back(attBandIn);} 02055 02056 {TeAttribute attBandOut; 02057 attBandOut.rep_.name_ = "band_out"; 02058 attBandOut.rep_.type_ = TeUNSIGNEDINT; 02059 attList.push_back(attBandOut);} 02060 02061 {TeAttribute attTransfType; 02062 attTransfType.rep_.name_ = "transf_type"; 02063 attTransfType.rep_.type_ = TeINT; 02064 attList.push_back(attTransfType);} 02065 02066 {TeAttribute attParam1; 02067 attParam1.rep_.name_ = "param1"; 02068 attParam1.rep_.type_ = TeREAL; 02069 attParam1.rep_.decimals_ = 15; 02070 attList.push_back(attParam1);} 02071 02072 {TeAttribute attParam2; 02073 attParam2.rep_.name_ = "param2"; 02074 attParam2.rep_.type_ = TeREAL; 02075 attParam2.rep_.decimals_ = 15; 02076 attList.push_back(attParam2);} 02077 02078 {TeAttribute attLutTable; 02079 attLutTable.rep_.name_ = "lut_table"; 02080 attLutTable.rep_.type_ = TeSTRING; 02081 attLutTable.rep_.numChar_ = 255; 02082 attList.push_back(attLutTable);} 02083 02084 return createTable("te_visual_raster", attList); 02085 }
| bool TeDatabase::createVisualTable | ( | ) | [virtual] |
Definition at line 1903 of file TeDatabase.cpp.
References createTable(), TeAttributeRep::decimals_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by createConceptualModel().
01904 { 01905 TeAttributeList attList; 01906 01907 {TeAttribute attLegendId; 01908 attLegendId.rep_.name_ = "legend_id"; 01909 attLegendId.rep_.type_ = TeUNSIGNEDINT; 01910 attLegendId.rep_.isPrimaryKey_ = true; 01911 attLegendId.rep_.null_ = false; 01912 attList.push_back(attLegendId);} 01913 01914 {TeAttribute attGeomType; 01915 attGeomType.rep_.name_ = "geom_type"; 01916 attGeomType.rep_.type_ = TeUNSIGNEDINT; 01917 attGeomType.rep_.isPrimaryKey_ = true; 01918 attGeomType.rep_.null_ = false; 01919 attList.push_back(attGeomType);} 01920 01921 {TeAttribute attSymbId; 01922 attSymbId.rep_.name_ = "symb_id"; 01923 attSymbId.rep_.type_ = TeINT; 01924 attList.push_back(attSymbId);} 01925 01926 {TeAttribute attRed; 01927 attRed.rep_.name_ = "red"; 01928 attRed.rep_.type_ = TeUNSIGNEDINT; 01929 attList.push_back(attRed);} 01930 01931 {TeAttribute attGreen; 01932 attGreen.rep_.name_ = "green"; 01933 attGreen.rep_.type_ = TeUNSIGNEDINT; 01934 attList.push_back(attGreen);} 01935 01936 {TeAttribute attBlue; 01937 attBlue.rep_.name_ = "blue"; 01938 attBlue.rep_.type_ = TeUNSIGNEDINT; 01939 attList.push_back(attBlue);} 01940 01941 {TeAttribute attTransp; 01942 attTransp.rep_.name_ = "transparency"; 01943 attTransp.rep_.type_ = TeUNSIGNEDINT; 01944 attList.push_back(attTransp);} 01945 01946 {TeAttribute attWidth; 01947 attWidth.rep_.name_ = "width"; 01948 attWidth.rep_.type_ = TeUNSIGNEDINT; 01949 attList.push_back(attWidth);} 01950 01951 {TeAttribute attContourSymbId; 01952 attContourSymbId.rep_.name_ = "contour_symb_id"; 01953 attContourSymbId.rep_.type_ = TeINT; 01954 attList.push_back(attContourSymbId);} 01955 01956 {TeAttribute attContourRed; 01957 attContourRed.rep_.name_ = "contour_red"; 01958 attContourRed.rep_.type_ = TeUNSIGNEDINT; 01959 attList.push_back(attContourRed);} 01960 01961 {TeAttribute attContourGreen; 01962 attContourGreen.rep_.name_ = "contour_green"; 01963 attContourGreen.rep_.type_ = TeUNSIGNEDINT; 01964 attList.push_back(attContourGreen);} 01965 01966 {TeAttribute attContourBlue; 01967 attContourBlue.rep_.name_ = "contour_blue"; 01968 attContourBlue.rep_.type_ = TeUNSIGNEDINT; 01969 attList.push_back(attContourBlue);} 01970 01971 {TeAttribute attContourTransp; 01972 attContourTransp.rep_.name_ = "contour_transp"; 01973 attContourTransp.rep_.type_ = TeUNSIGNEDINT; 01974 attList.push_back(attContourTransp);} 01975 01976 {TeAttribute attContourWidth; 01977 attContourWidth.rep_.name_ = "contour_width"; 01978 attContourWidth.rep_.type_ = TeUNSIGNEDINT; 01979 attList.push_back(attContourWidth);} 01980 01981 {TeAttribute attSizeValue; 01982 attSizeValue.rep_.name_ = "size_value"; 01983 attSizeValue.rep_.type_ = TeUNSIGNEDINT; 01984 attList.push_back(attSizeValue);} 01985 01986 {TeAttribute attPtAngle; 01987 attPtAngle.rep_.name_ = "pt_angle"; 01988 attPtAngle.rep_.type_ = TeUNSIGNEDINT; 01989 attList.push_back(attPtAngle);} 01990 01991 {TeAttribute attFamily; 01992 attFamily.rep_.name_ = "family"; 01993 attFamily.rep_.type_ = TeSTRING; 01994 attFamily.rep_.numChar_ = 255; 01995 attList.push_back(attFamily);} 01996 01997 {TeAttribute attBold; 01998 attBold.rep_.name_ = "bold"; 01999 attBold.rep_.type_ = TeUNSIGNEDINT; 02000 attList.push_back(attBold);} 02001 02002 {TeAttribute attItalic; 02003 attItalic.rep_.name_ = "italic"; 02004 attItalic.rep_.type_ = TeUNSIGNEDINT; 02005 attList.push_back(attItalic);} 02006 02007 {TeAttribute attAlignVert; 02008 attAlignVert.rep_.name_ = "alignment_vert"; 02009 attAlignVert.rep_.type_ = TeREAL; 02010 attAlignVert.rep_.decimals_ = 15; 02011 attList.push_back(attAlignVert);} 02012 02013 {TeAttribute attAlignHoriz; 02014 attAlignHoriz.rep_.name_ = "alignment_horiz"; 02015 attAlignHoriz.rep_.type_ = TeREAL; 02016 attAlignHoriz.rep_.decimals_ = 15; 02017 attList.push_back(attAlignHoriz);} 02018 02019 {TeAttribute attTabSize; 02020 attTabSize.rep_.name_ = "tab_size"; 02021 attTabSize.rep_.type_ = TeUNSIGNEDINT; 02022 attList.push_back(attTabSize);} 02023 02024 {TeAttribute attLineSpace; 02025 attLineSpace.rep_.name_ = "line_space"; 02026 attLineSpace.rep_.type_ = TeUNSIGNEDINT; 02027 attList.push_back(attLineSpace);} 02028 02029 {TeAttribute attFixedSize; 02030 attFixedSize.rep_.name_ = "fixed_size"; 02031 attFixedSize.rep_.type_ = TeUNSIGNEDINT; 02032 attList.push_back(attFixedSize);} 02033 02034 return createTable("te_visual", attList); 02035 }
| string TeDatabase::databaseName | ( | ) | [inline] |
Definition at line 185 of file TeDatabase.h.
References database_.
Referenced by TeDBConnectionsPool::getDatabaseIdx(), TeMySQL::getIndexesFromTable(), TeFirebird::getIndexesFromTable(), TeDBConnectionsPool::insertDatabase(), TeDBConnectionsPool::removeDatabase(), and TeDBConnectionsPool::saveExternalDBConnection().
00186 { return database_; }
| string TeDatabase::dbmsName | ( | ) | [inline] |
Definition at line 189 of file TeDatabase.h.
Referenced by countNumGeometries(), TeDBConnectionsPool::getDatabaseIdx(), TeQuerierDBStr1::initGeomPortal(), TeQuerierDBStr1::initPortal(), TeDBConnectionsPool::insertDatabase(), insertInfo2Blob(), insertMedia(), loadExternalThemes(), populateAppThemeTable(), TeTheme::populateCollection(), TeDBConnectionsPool::removeDatabase(), TeDBConnectionsPool::saveExternalDBConnection(), TeGeoOpAggregation(), TeGetArea(), TeGetBuffer(), TeGetCentroid(), TeGetConvexHull(), TeGetDistance(), TeGetLength(), TeGetOverlay(), TeGetWithinDistance(), TePlotObjects(), TePlotSelectedObjects(), TePlotTexts(), TeTopologicalRelation(), updateDB20To30(), updateDB302To310(), and TeQtGrid::writeCell().
00190 { return dbmsName_; }
| static TeDatabase* TeDatabase::DefaultObject | ( | const TeDatabaseFactoryParams & | ) | [inline, static] |
Definition at line 266 of file TeDatabase.h.
00267 { 00268 std::cout << std::endl << "TeDatabase::DefaultObject - " << 00269 " - Trying to create an invalid TeDatabase default object." << 00270 std::endl; 00271 throw; 00272 00273 return 0; 00274 };
| bool TeDatabase::defineIntegrity | ( | void | ) | [virtual] |
Reimplemented in TeMySQL.
Definition at line 343 of file TeDatabase.cpp.
References createRelation(), existRelation(), and TeNoRelation.
Referenced by createConceptualModel().
00344 { 00345 if (existRelation("te_layer","fk_layer_proj_id") == TeNoRelation ) 00346 if (!createRelation("fk_layer_proj_id", "te_layer", "projection_id", "te_projection", "projection_id", false)) 00347 return false; 00348 00349 if (existRelation("te_representation","fk_rep_layer_id") == TeNoRelation ) 00350 if (!createRelation("fk_rep_layer_id", "te_representation", "layer_id", "te_layer", "layer_id", true)) 00351 return false; 00352 00353 if (existRelation("te_view","fk_view_proj_id") == TeNoRelation ) 00354 if (!createRelation("fk_view_proj_id", "te_view", "projection_id", "te_projection", "projection_id", false)) 00355 return false; 00356 00357 if (existRelation("te_view", "fk_view_current_theme") == TeNoRelation ) 00358 if (!createRelation("fk_view_current_theme", "te_view", "current_theme", "te_theme", "theme_id", false)) 00359 return false; 00360 00361 if (existRelation("te_theme","fk_theme_layer_id") == TeNoRelation ) 00362 if (!createRelation("fk_theme_layer_id", "te_theme", "layer_id", "te_layer", "layer_id", true)) 00363 return false; 00364 00365 if (existRelation("te_theme","fk_theme_view_id") == TeNoRelation ) 00366 if (!createRelation("fk_theme_view_id", "te_theme", "view_id", "te_view", "view_id", true)) 00367 return false; 00368 00369 if (existRelation("te_theme_table","fk_thmtable_theme_id") == TeNoRelation ) 00370 if (!createRelation("fk_thmtable_theme_id", "te_theme_table", "theme_id", "te_theme", "theme_id", true)) 00371 return false; 00372 00373 if (existRelation("te_theme_table","fk_thmtable_lytable_id") == TeNoRelation ) 00374 if (!createRelation("fk_thmtable_lytable_id", "te_theme_table", "table_id", "te_layer_table", "table_id", false)) 00375 return false; 00376 00377 if (existRelation("te_theme_table","fk_thmtable_relation_id") == TeNoRelation ) 00378 if (!createRelation("fk_thmtable_relation_id", "te_theme_table", "relation_id", "te_tables_relation", "relation_id", false)) 00379 return false; 00380 00381 if (existRelation("te_grouping","fk_group_theme_id") == TeNoRelation ) 00382 if (!createRelation("fk_group_theme_id", "te_grouping", "theme_id", "te_theme", "theme_id", true)) 00383 return false; 00384 00385 if (existRelation("te_legend","fk_legend_theme_id") == TeNoRelation ) 00386 if (!createRelation("fk_legend_theme_id", "te_legend", "theme_id", "te_theme", "theme_id", true)) 00387 return false; 00388 00389 if (existRelation("te_visual","fk_visual_legend_id") == TeNoRelation ) 00390 if (!createRelation("fk_visual_legend_id", "te_visual", "legend_id", "te_legend", "legend_id", true)) 00391 return false; 00392 00393 if (existRelation("te_layer_table","fk_laytable_layer_id") == TeNoRelation ) 00394 if (!createRelation ("fk_laytable_layer_id", "te_layer_table", "layer_id", "te_layer", "layer_id", true)) 00395 return false; 00396 00397 if (existRelation("te_tables_relation","fk_tabrelation_laytable_id") == TeNoRelation ) 00398 if (!createRelation("fk_tabrelation_laytable_id", "te_tables_relation", "related_table_id", "te_layer_table", "table_id", true)) 00399 return false; 00400 00401 if (existRelation("te_visual_raster","fk_visrast_theme_id") == TeNoRelation ) 00402 if (!createRelation("fk_visrast_theme_id", "te_visual_raster", "theme_id", "te_theme", "theme_id", true)) 00403 return false; 00404 00405 if (existRelation("te_project_view","fk_projectview_project_id") == TeNoRelation ) 00406 if (!createRelation("fk_projectview_project_id", "te_project_view", "project_id", "te_project", "project_id", true)) 00407 return false; 00408 00409 if (existRelation("te_project_view","fk_projectview_view_id") == TeNoRelation ) 00410 if (!createRelation("fk_projectview_view_id", "te_project_view", "view_id", "te_view", "view_id", true)) 00411 return false; 00412 00413 if (existRelation("te_projection","fk_proj_datum_name") == TeNoRelation ) 00414 if (!createRelation("fk_proj_datum_name", "te_projection", "datum", "te_datum", "name", false)) 00415 return false; 00416 00417 if (existRelation("te_srs","fk_srs_proj_id") == TeNoRelation ) 00418 if (!createRelation("fk_srs_proj_id", "te_srs", "projection_id", "te_projection", "projection_id", true)) 00419 return false; 00420 00421 return true; 00422 }
| table | table name | |
| colName | name of the column being deleted |
Reimplemented in TeAdo.
Definition at line 289 of file TeDatabase.cpp.
References alterTableInfoInMemory(), columnExist(), execute(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), getPortal(), TeDatabasePortal::query(), and tableExist().
Referenced by updateDB20To30(), updateDB30To301(), updateDB311To320(), updateDB320To3201(), and updateDB400To412().
00290 { 00291 if(!tableExist(table)) 00292 return false; 00293 TeAttribute attr; 00294 if (!columnExist(table,colName,attr)) 00295 return true; 00296 string drop = "ALTER TABLE "+ table +" DROP COLUMN "+ colName; 00297 if(execute(drop) == false) 00298 return false; 00299 00300 string tableId; 00301 TeDatabasePortal* portal = getPortal(); 00302 string sql = "SELECT table_id FROM te_layer_table WHERE attr_table = '" + table + "'"; 00303 if(portal->query(sql) && portal->fetchRow()) 00304 tableId = portal->getData(0); 00305 00306 delete portal; 00307 if(tableId.empty() == false) 00308 { 00309 // delete relation 00310 sql = "DELETE FROM te_tables_relation WHERE (related_table_id = " + tableId; 00311 sql += " AND related_attr = '" + colName + "')"; 00312 sql += " OR (external_table_name = '" + table + "'"; 00313 sql += " AND external_attr = '" + colName + "')"; 00314 if(execute(sql) == false) 00315 return false; 00316 00317 // delete grouping 00318 TeDatabasePortal* portal = getPortal(); 00319 sql = "SELECT theme_id FROM te_grouping WHERE grouping_attr = '" + table + "." + colName + "'"; 00320 if(portal->query(sql) && portal->fetchRow()) 00321 { 00322 string themeId = portal->getData(0); 00323 00324 sql = "DELETE FROM te_legend WHERE theme_id = " + themeId + " AND group_id >= 0"; 00325 if(execute(sql) == false) 00326 { 00327 delete portal; 00328 return false; 00329 } 00330 } 00331 delete portal; 00332 00333 sql = "DELETE FROM te_grouping"; 00334 sql += " WHERE grouping_attr = '" + table + "." + colName + "'"; 00335 if(execute(sql) == false) 00336 return false; 00337 } 00338 alterTableInfoInMemory(table); 00339 return true; 00340 }
Reimplemented in TeMySQL.
Definition at line 579 of file TeDatabase.cpp.
References execute().
00580 { 00581 string sql = "DROP INDEX " + indexName; 00582 return execute(sql); 00583 }
| bool TeDatabase::deleteLayer | ( | int | layerId | ) | [virtual] |
Reimplemented in TeOracle, TeSqlServer, and TeOCIOracle.
Definition at line 5833 of file TeDatabase.cpp.
References deleteLayerTable(), deleteProjection(), deleteTable(), deleteTheme(), execute(), existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), TeDatabasePortal::getData(), TeDatabasePortal::getInt(), getPortal(), TeViewNode::id(), TeTheme::layer(), metaModel_, TeDatabasePortal::query(), tableExist(), Te2String(), TeRASTER, TeRASTERFILE, TeRICascadeDeletion, and TeTHEME.
Referenced by TeAddressLocator::addressGeocode(), TeGTM::importGTM(), TeCoverageImportLayer(), TeCreateCells(), TeImportBNA(), TeImportGEO(), TeImportGeometriesToLayer(), TeImportMIF(), TeImportRaster(), and TeImportShape().
05834 { 05835 TeDatabasePortal* portal = this->getPortal(); 05836 if (!portal) 05837 return false; 05838 05839 string sql = "SELECT projection_id FROM te_layer WHERE layer_id = "; 05840 sql += Te2String(layerId); 05841 05842 if (!portal->query(sql)) 05843 { 05844 delete portal; 05845 return false; 05846 } 05847 05848 if (!portal->fetchRow()) 05849 { 05850 delete portal; 05851 return false; 05852 } 05853 05854 int projId = portal->getInt("projection_id"); 05855 portal->freeResult(); 05856 05857 // Get all representations that are associated to this layer 05858 sql = "SELECT * FROM te_representation WHERE layer_id = "+ Te2String(layerId); 05859 if (!portal->query (sql)) 05860 { 05861 delete portal; 05862 return false; 05863 } 05864 05865 while (portal->fetchRow()) 05866 { 05867 // Save the name of the geometry table 05868 string geomTable = portal->getData("geom_table"); 05869 05870 // Delete lut table 05871 TeGeomRep rep = TeGeomRep(portal->getInt("geom_type")); 05872 if (rep == TeRASTER || rep == TeRASTERFILE) 05873 { 05874 if(!this->tableExist(geomTable)) 05875 { 05876 continue; 05877 } 05878 05879 TeDatabasePortal* portal2 = this->getPortal(); 05880 sql = "SELECT lut_table, raster_table FROM " + geomTable; 05881 string tabName; 05882 if (!portal2->query (sql)) 05883 { 05884 delete portal2; 05885 continue; 05886 } 05887 05888 while (portal2->fetchRow()) 05889 { 05890 // remove lut table 05891 tabName = portal2->getData(0); 05892 if (!tabName.empty() && this->tableExist(tabName)) 05893 { 05894 sql = "DROP TABLE " + tabName; 05895 this->execute(sql); 05896 } 05897 // remove raster table 05898 tabName = portal2->getData(1); 05899 if (!tabName.empty() && this->tableExist(tabName)) 05900 { 05901 //sql = "DROP TABLE " + tabName; 05902 //this->execute(sql); 05903 deleteTable(tabName); 05904 } 05905 } 05906 delete portal2; 05907 // remove raster metadata table 05908 tabName = geomTable + "_metadata"; 05909 if (!tabName.empty() && this->tableExist(tabName)) 05910 { 05911 //sql = "DROP TABLE " + tabName; 05912 //this->execute(sql); 05913 deleteTable(tabName); 05914 } 05915 } 05916 if (this->tableExist(geomTable)) 05917 { 05918 //sql = "DROP TABLE " + geomTable; 05919 //if (!this->execute(sql) ) 05920 if(!deleteTable(geomTable)) 05921 { 05922 delete portal; 05923 return false; 05924 } 05925 } 05926 } 05927 portal->freeResult(); 05928 05929 if (existRelation("te_representation","fk_rep_layer_id") != TeRICascadeDeletion) 05930 { 05931 // Delete entries into representations table 05932 sql = "DELETE FROM te_representation WHERE layer_id = " +Te2String(layerId); 05933 if (!this->execute(sql) ) 05934 { 05935 delete portal; 05936 return false; 05937 } 05938 } 05939 05940 // delete layer themes 05941 sql = "SELECT theme_id FROM te_theme WHERE layer_id=" + Te2String(layerId); 05942 if (!portal->query (sql)) 05943 { 05944 delete portal; 05945 return false; 05946 } 05947 05948 int themeId; 05949 while (portal->fetchRow()) 05950 { 05951 themeId = portal->getInt("theme_id"); 05952 this->deleteTheme(themeId); 05953 } 05954 05955 //Delete attributes tables 05956 if(!deleteLayerTable(layerId)) 05957 return false; 05958 05959 sql = "DELETE FROM te_layer WHERE layer_id=" + Te2String(layerId); 05960 if (!this->execute(sql)) 05961 { 05962 delete portal; 05963 return false; 05964 } 05965 05966 if(!deleteProjection(projId)) 05967 { 05968 delete portal; 05969 return false; 05970 } 05971 05972 // remove all the items� themes associated to the layer to be removed 05973 TeThemeMap::iterator it; 05974 for (it = metaModel_->themeMap().begin(); it != metaModel_->themeMap().end();) 05975 { 05976 if(it->second->getProductId() != TeTHEME) 05977 { 05978 ++it; 05979 continue; 05980 } 05981 TeTheme *theme = static_cast<TeTheme*> (it->second); 05982 ++it; 05983 if (theme && theme->layer() && (theme->layer()->id() == layerId)) 05984 { 05985 metaModel_->themeMap().erase(theme->id()); 05986 delete theme; 05987 } 05988 } 05989 // delete layer and its entry in the layer map 05990 TeLayer* layer = metaModel_->layerMap()[layerId]; 05991 metaModel_->layerMap().erase(layerId); 05992 delete layer; 05993 05994 delete portal; 05995 return true; 05996 }
| bool TeDatabase::deleteLayerTable | ( | int | layerId, | |
| TeAttrTableType | ttype = TeAttrStatic | |||
| ) | [virtual] |
Definition at line 6000 of file TeDatabase.cpp.
References deleteTable(), execute(), existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), getPortal(), TeDatabasePortal::query(), tableExist(), Te2String(), and TeRICascadeDeletion.
Referenced by TeOCIOracle::deleteLayer(), deleteLayer(), TeSqlServer::deleteLayer(), and TeOracle::deleteLayer().
06001 { 06002 TeDatabasePortal* portal = this->getPortal(); 06003 if(!portal) 06004 return false; 06005 06006 //tables of the type 1 can be relationed with other layer ??? Conferir 06007 string query = "SELECT attr_table, table_id FROM te_layer_table WHERE layer_id = " + Te2String(layerId); 06008 query += " AND attr_table_type = " + Te2String(static_cast<int>(ttype)); 06009 if(!portal->query(query)) 06010 { 06011 delete portal; 06012 return false; 06013 } 06014 06015 vector<int> tableIds; 06016 string attrTable; 06017 string tableId; 06018 string drop; 06019 while (portal->fetchRow()) 06020 { 06021 attrTable = portal->getData(0); 06022 tableId = portal->getData(1); 06023 if(tableExist(attrTable)) 06024 { 06025 if(!deleteTable(attrTable)) 06026 { 06027 delete portal; 06028 return false; 06029 } 06030 } 06031 tableIds.push_back(atoi(tableId.c_str())); 06032 06033 if(tableExist("te_address_locator")) 06034 { 06035 string del = "DELETE FROM te_address_locator WHERE table_id = "+ tableId; 06036 execute(del); 06037 } 06038 } 06039 06040 delete portal; 06041 string del; 06042 if (existRelation("te_tables_relation","fk_tabrelation_laytable_id") != TeRICascadeDeletion) 06043 { 06044 for (unsigned int i=0; i<tableIds.size();i++) 06045 { 06046 del = "DELETE FROM te_tables_relation WHERE relation_id = " + Te2String(tableIds[i]); 06047 if (!execute (del)) 06048 return false; 06049 } 06050 } 06051 del = "DELETE FROM te_layer_table WHERE layer_id = " + Te2String(layerId); 06052 if (!execute (del)) 06053 return false; 06054 return true; 06055 }
| bool TeDatabase::deleteLegend | ( | int | themeId | ) | [virtual] |
Definition at line 5090 of file TeDatabase.cpp.
References execute(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), getPortal(), TeAbstractTheme::legend(), metaModel_, NULL, TeDatabasePortal::query(), tableExist(), and Te2String().
Referenced by TeTheme::deleteGrouping(), TeExternalTheme::deleteGrouping(), generateCountLegends(), TeTheme::saveGrouping(), TeFirebird::updateTheme(), and updateTheme().
05091 { 05092 // If there is a collection table update legend of the objects in it 05093 TeDatabasePortal* portal = this->getPortal(); 05094 if(!portal) 05095 return false; 05096 string sel = "SELECT collection_table FROM te_theme WHERE theme_id = " + Te2String(themeId); 05097 string TC; 05098 if (portal->query(sel) && portal->fetchRow()) 05099 TC = portal->getData(0); 05100 delete portal; 05101 05102 if (!TC.empty() && this->tableExist(TC)) 05103 { 05104 string up = "UPDATE " + TC + " SET c_legend_id = 0"; 05105 if (!execute(up)) 05106 return false; 05107 } 05108 05109 // Delete visual of the legends 05110 string del = "DELETE FROM te_visual WHERE legend_id IN "; 05111 del += "(SELECT legend_id FROM te_legend WHERE theme_id = " + Te2String(themeId); 05112 del += " AND group_id > -1)"; 05113 if (!execute(del)) 05114 return false; 05115 05116 del = "DELETE FROM te_legend WHERE theme_id = " + Te2String(themeId); 05117 del += " AND group_id > -1"; 05118 if (!execute(del)) 05119 return false; 05120 05121 // Delete from memory the legends of the theme 05122 unsigned int i; 05123 TeAbstractTheme *theme = metaModel_->themeMap()[themeId]; 05124 if(theme == NULL) 05125 { 05126 theme = metaModel_->invalidThemeMap()[themeId]; 05127 if(theme == NULL) 05128 { 05129 return false; 05130 } 05131 } 05132 TeLegendEntryVector& legendVector = theme->legend(); 05133 for (i = 0; i < legendVector.size(); ++i) 05134 metaModel_->legendMap().erase(legendVector[i].id()); 05135 legendVector.clear(); 05136 05137 //delete grouping 05138 del = "DELETE FROM te_grouping WHERE theme_id =" + Te2String(themeId); 05139 if (!execute (del)) 05140 return false; 05141 05142 return true; 05143 }
| bool TeDatabase::deleteProject | ( | int | projectId | ) | [virtual] |
Definition at line 9707 of file TeDatabase.cpp.
References errorMessage_, metaModel_, and Te2String().
09708 { 09709 string sql = "DELETE FROM te_project_view WHERE project_id =" + Te2String(projectId); 09710 if (!this->execute (sql)) 09711 { 09712 this->errorMessage_ = "Error deleting project/view relation"; 09713 return false; 09714 } 09715 sql = "DELETE FROM te_project WHERE project_id =" + Te2String(projectId); 09716 if (!this->execute (sql)) 09717 { 09718 this->errorMessage_ = "Error deleting te_project entry"; 09719 return false; 09720 } 09721 09722 // delete project and its entry in the project map 09723 TeProject* proj = metaModel_->projectMap()[projectId]; 09724 metaModel_->projectMap().erase(projectId); 09725 if(proj) 09726 delete proj; 09727 return true; 09728 }
| bool TeDatabase::deleteProjection | ( | const unsigned int & | projId | ) | [virtual] |
Definition at line 6879 of file TeDatabase.cpp.
References Te2String().
Referenced by deleteLayer(), deleteView(), TeSFSTheme::eraseMetadata(), and TeFileTheme::eraseMetadata().
06880 { 06881 // delete layer projection 06882 std::string sql = "DELETE FROM te_projection WHERE projection_id = "+ Te2String(projId); 06883 if (!this->execute(sql)) 06884 { 06885 return false; 06886 } 06887 06888 sql = "DELETE FROM te_srs WHERE projection_id = " + Te2String(projId); 06889 if (!this->execute (sql)) 06890 { 06891 return false; 06892 } 06893 06894 return true; 06895 }
| bool TeDatabase::deleteProjectViewRel | ( | int | projectId, | |
| int | viewId | |||
| ) | [virtual] |
Definition at line 9744 of file TeDatabase.cpp.
References errorMessage_, and Te2String().
09745 { 09746 string sql ="DELETE FROM te_project_view WHERE project_id = "; 09747 sql += Te2String(projectId); 09748 sql += " AND view_id = "; 09749 sql += Te2String(viewId); 09750 if (!this->execute (sql)) 09751 { 09752 this->errorMessage_ = "Error removing project/view relation"; 09753 return false; 09754 } 09755 return true; 09756 }
| name | relationship name | |
| table | table where the relashionship exists |
Definition at line 10105 of file TeDatabase.cpp.
References execute().
10106 { 10107 string relation = "ALTER TABLE " + table + " DROP "; 10108 relation += " CONSTRAINT " + name; 10109 return execute(relation); 10110 }
Reimplemented in TeOracle, TeSqlServer, TeOCIOracle, and TePostgreSQL.
Definition at line 254 of file TeDatabase.cpp.
References errorMessage_, execute(), and tableExist().
Referenced by deleteLayer(), deleteLayerTable(), TeLayer::removeGeometry(), TeImportCSVFile(), and updateDB320To3201().
00255 { 00256 // int f = table.find ("te_collection", std::string::npos); 00257 int f = table.find ("te_collection"); 00258 00259 if( table=="te_theme" || 00260 table=="te_layer" || 00261 table=="te_representation" || 00262 table=="te_tables_relation" || 00263 table=="te_layer_table" || 00264 table=="te_raster_metadata" || 00265 table=="te_datum" || 00266 table=="te_projection" || 00267 table=="te_view" || 00268 table=="te_legend" || 00269 table=="te_visual" || 00270 table=="te_database" || 00271 f == 0) 00272 { 00273 errorMessage_ = "Não é possível deletar tabelas do modelo!"; 00274 return false; 00275 } 00276 00277 string del = "DROP TABLE " + table; 00278 if(tableExist(table)) 00279 { 00280 if(!execute(del)) 00281 return false; 00282 } 00283 00284 return true; 00285 }
| bool TeDatabase::deleteTheme | ( | int | themeId | ) | [virtual] |
Reimplemented in TeSqlServer.
Definition at line 4886 of file TeDatabase.cpp.
References TeAbstractTheme::eraseMetadata(), execute(), existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), TeDatabasePortal::getData(), TeDatabasePortal::getInt(), TeRasterTransform::getLutTableName(), getPortal(), invalidThemeMap(), TeAbstractTheme::legend(), legendMap(), TeDatabasePortal::query(), TeAbstractTheme::rasterVisual(), TeView::remove(), Te2String(), TeNoRelation, TeRICascadeDeletion, themeMap(), and viewMap().
Referenced by deleteAppTheme(), TeOCIOracle::deleteLayer(), deleteLayer(), TeOracle::deleteLayer(), deleteView(), TeTheme::save(), TeSFSTheme::save(), TeFileTheme::save(), TeExternalTheme::save(), TeFileTheme::saveMetadata(), and TeCreateThemeFromTheme().
04887 { 04888 TeAbstractTheme* tema; 04889 bool themeWasFound = false; 04890 TeThemeMap::iterator it; 04891 04892 it = invalidThemeMap().find(themeId); 04893 if (it != invalidThemeMap().end()) 04894 { 04895 themeWasFound = true; 04896 tema = it->second; 04897 invalidThemeMap().erase(themeId); 04898 } 04899 04900 if (themeWasFound == false) 04901 { 04902 it = themeMap().find(themeId); 04903 if(it != themeMap().end()) 04904 { 04905 themeWasFound = true; 04906 tema = it->second; 04907 themeMap().erase(themeId); 04908 } 04909 } 04910 04911 if (themeWasFound == false) 04912 return false; 04913 04914 if(!tema->eraseMetadata(this)) 04915 return false; 04916 04917 string sql; 04918 // delete the collection table associated to this theme 04919 TeDatabasePortal* portal = this->getPortal(); 04920 if(!portal) 04921 return false; 04922 04923 sql = "SELECT collection_table FROM te_theme WHERE theme_id = " + Te2String(themeId); 04924 if (!portal->query(sql) ||!portal->fetchRow()) 04925 { 04926 delete portal; 04927 return false; 04928 } 04929 string colTab = portal->getData("collection_table"); 04930 //delete collection table 04931 if (this->tableExist(colTab)) 04932 { 04933 sql = "DROP TABLE " + colTab; 04934 if (!this->execute(sql) ) 04935 { 04936 delete portal; 04937 return false; 04938 } 04939 } 04940 //delete auxiliar collection table 04941 if (this->tableExist(colTab +"_aux")) 04942 { 04943 sql = "DROP TABLE " +colTab +"_aux"; 04944 if (!this->execute(sql) ) 04945 { 04946 delete portal; 04947 return false; 04948 } 04949 } 04950 portal->freeResult(); 04951 04952 //delete the visual associated to this theme 04953 if (existRelation("te_visual","fk_visual_legend_id") != TeRICascadeDeletion) 04954 { 04955 sql = "SELECT legend_id FROM te_legend WHERE theme_id = " + Te2String(themeId); 04956 if (!portal->query(sql)) 04957 { 04958 delete portal; 04959 return false; 04960 } 04961 string wherec; 04962 int c = 0; 04963 while (portal->fetchRow()) 04964 { 04965 if (c) 04966 wherec += ","; 04967 c++; 04968 wherec += portal->getData(0); 04969 } 04970 portal->freeResult(); 04971 if (!wherec.empty()) 04972 { 04973 sql = "DELETE FROM te_visual WHERE legend_id IN (" + wherec + ")"; 04974 if (!this->execute(sql)) 04975 { 04976 delete portal; 04977 return false; 04978 } 04979 } 04980 } 04981 04982 //delete lut table from current raster visual, if it exist 04983 if(tema->rasterVisual()) 04984 { 04985 if(!tema->rasterVisual()->getLutTableName().empty()) 04986 { 04987 std::string lutTableName = tema->rasterVisual()->getLutTableName(); 04988 04989 if (this->tableExist(lutTableName)) 04990 { 04991 if(!this->deleteTable(lutTableName)) 04992 return false; 04993 } 04994 } 04995 } 04996 04997 //delete all visuals of raster associated to this theme 04998 if (existRelation("te_visual_raster","fk_visrast_theme_id") != TeRICascadeDeletion) 04999 { 05000 sql = "DELETE FROM te_visual_raster WHERE theme_id =" + Te2String(themeId); 05001 if (!this->execute (sql)) 05002 { 05003 delete portal; 05004 return false; 05005 } 05006 } 05007 05008 //delete all legends associated to this theme 05009 if (existRelation("te_legend","fk_legend_theme_id") != TeRICascadeDeletion) 05010 { 05011 sql = "DELETE FROM te_legend WHERE theme_id =" + Te2String(themeId); 05012 if (!this->execute (sql)) 05013 { 05014 delete portal; 05015 return false; 05016 } 05017 } 05018 05019 //select the view of this theme 05020 sql = "SELECT view_id FROM te_theme WHERE theme_id = " + Te2String(themeId); 05021 portal->freeResult(); 05022 if(!portal->query(sql) || !portal->fetchRow()) 05023 { 05024 delete portal; 05025 return false; 05026 } 05027 05028 //delete theme of the view tree 05029 int viewId = portal->getInt("view_id"); 05030 delete portal; 05031 05032 //delete the tables associated to this theme 05033 if (existRelation("te_theme_table","fk_thmtable_theme_id") != TeRICascadeDeletion) 05034 { 05035 sql = "DELETE FROM te_theme_table WHERE theme_id =" + Te2String(themeId); 05036 if (!this->execute (sql)) 05037 return false; 05038 } 05039 05040 //delete the grouping 05041 if (existRelation("te_grouping","fk_group_theme_id") != TeRICascadeDeletion) 05042 { 05043 sql = "DELETE FROM te_grouping WHERE theme_id =" + Te2String(themeId); 05044 if (!this->execute (sql)) 05045 return false; 05046 } 05047 05048 // delete raster visual 05049 if (existRelation("te_visual_raster","fk_visrast_theme_id") == TeNoRelation ) 05050 { 05051 sql = "DELETE FROM te_visual_raster WHERE theme_id =" + Te2String(themeId); 05052 if (!this->execute (sql)) 05053 return false; 05054 } 05055 05056 sql = " UPDATE te_view SET current_theme = NULL WHERE current_theme = "+ Te2String(themeId); 05057 this->execute(sql); 05058 05059 // delete the theme 05060 sql = " DELETE FROM te_theme WHERE theme_id = " + Te2String(themeId); 05061 if (!this->execute (sql)) 05062 return false; 05063 05064 //delete in the maps 05065 TeView* view = viewMap()[viewId]; 05066 if (view) //this view exists 05067 view->remove(themeId); 05068 05069 unsigned int i; 05070 TeLegendEntryVector& legendVector = tema->legend(); 05071 for (i = 0; i < legendVector.size(); ++i) 05072 legendMap().erase(legendVector[i].id()); 05073 05074 delete tema; 05075 return true; 05076 }
| bool TeDatabase::deleteThemeGroup | ( | int | themeId | ) | [virtual] |
Definition at line 5079 of file TeDatabase.cpp.
References Te2String().
05080 { 05081 string sql; 05082 // delete the theme 05083 sql = "DELETE FROM te_grouping WHERE theme_id = " + Te2String(themeId); 05084 if (!this->execute (sql)) 05085 return false; 05086 return true; 05087 }
| bool TeDatabase::deleteView | ( | int | viewId | ) | [virtual] |
Reimplemented in TeSqlServer.
Definition at line 3554 of file TeDatabase.cpp.
References deleteProjection(), deleteTheme(), existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), TeDatabasePortal::getData(), TeDatabasePortal::getInt(), getPortal(), metaModel_, TeDatabasePortal::query(), Te2String(), and TeRICascadeDeletion.
Referenced by TeProject::deleteView().
03555 { 03556 TeDatabasePortal* portal = this->getPortal(); 03557 03558 // view projection should be deleted manually 03559 string sql = "SELECT projection_id FROM te_view WHERE view_id=" + Te2String(viewId); 03560 portal->freeResult(); 03561 if (!portal->query(sql)) 03562 { 03563 delete portal; 03564 return false; 03565 } 03566 if (!portal->fetchRow()) 03567 { 03568 delete portal; 03569 return false; 03570 } 03571 int projId = portal->getInt("projection_id"); 03572 portal->freeResult(); 03573 03574 // delete themes belonging to this view 03575 sql = "SELECT theme_id FROM te_theme WHERE view_id=" + Te2String(viewId); 03576 if (!portal->query(sql)) 03577 { 03578 delete portal; 03579 return false; 03580 } 03581 while (portal->fetchRow()) 03582 { 03583 int id = atoi(portal->getData(0)); 03584 if(deleteTheme(id) == false) 03585 { 03586 delete portal; 03587 return false; 03588 } 03589 } 03590 03591 //delete the entries in the project relation 03592 if (existRelation("te_project_view","fk_projectview_view_id") != TeRICascadeDeletion) 03593 { 03594 sql = "DELETE FROM te_project_view WHERE view_id =" + Te2String(viewId); 03595 if (!this->execute (sql)) 03596 return false; 03597 } 03598 03599 // delete view 03600 sql = "DELETE FROM te_view WHERE view_id = " + Te2String(viewId); 03601 if (!this->execute (sql)) 03602 { 03603 delete portal; 03604 return false; 03605 } 03606 03607 if(!deleteProjection(projId)) 03608 { 03609 delete portal; 03610 return false; 03611 } 03612 03613 // Delete the view and its themes 03614 TeView* view = metaModel_->viewMap()[viewId]; 03615 metaModel_->viewMap().erase(viewId); 03616 delete view; 03617 delete portal; 03618 return true; 03619 }
| virtual bool TeDatabase::dropDatabase | ( | const std::string & | ) | [inline, virtual] |
Reimplemented in TeSqlServer, TeMySQL, and TePostgreSQL.
Definition at line 292 of file TeDatabase.h.
Definition at line 10113 of file TeDatabase.cpp.
References execute().
10114 { 10115 string del = "DROP VIEW " + dbViewName; 10116 return (execute(del)); 10117 }
| virtual string TeDatabase::errorMessage | ( | ) | [inline, virtual] |
Reimplemented in TeMySQL, TePostgreSQL, and TeSQLite.
Definition at line 162 of file TeDatabase.h.
References errorMessage_.
Referenced by TeQtGridSource::changePortalQuery(), deletePointedObjects(), TeDBConnectionsPool::getConnectionInfo(), insertObjectIntoCollection(), main(), populateDatabase(), TeQtGridSource::reloadPortal(), TeQtGridSource::setCell(), TeQtGridSource::setPortal(), TeImportShape(), updateDB20To30(), updateDB301To302(), updateDB302To310(), updateDB30To301(), updateDB310To311(), updateDB311To320(), updateDB3201To331(), updateDB320To3201(), updateDB331To400(), and updateDB400To412().
00163 { return errorMessage_; }
| virtual int TeDatabase::errorNum | ( | ) | [inline, virtual] |
Reimplemented in TeMySQL.
Definition at line 166 of file TeDatabase.h.
Referenced by TeTheme::populateCollection().
00167 { return errorNumber_; }
Implemented in TeAdo, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by TeAddressLocator::addCompleteNameColumn(), generateInClauses(), insertTable(), TeAddressLocator::mountExactWhereSQL(), TeAddressLocator::mountLikeWhereSQL(), TeAddressLocator::mountPatternWhereSQL(), TeTheme::saveLegendInCollection(), TeExternalTheme::saveLegendInCollection(), TeFileTheme::saveMetadata(), updateLegend(), updateRow(), updateTable(), updateTheme(), and TeQtGrid::writeCell().
Implemented in TeAdo, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by TeAddressLocator::addCompleteNameColumn(), TeLayer::addRasterFileGeometry(), TeLayer::addRasterGeometry(), TeAddressLocator::addressGeocode(), alterTable(), TeAddressLocator::convertColumnNameToUpper(), TeExternalTheme::copyRemoteCollection(), TeTheme::createCollectionAuxTable(), createConceptualModel(), createIndex(), TeAddressLocator::deleteAddressMetadata(), deleteAppTheme(), deleteChartParams(), deleteColumn(), TeDBConnectionsPool::deleteExternalDBConnection(), deleteGPMTable(), TeTheme::deleteGrouping(), TeExternalTheme::deleteGrouping(), deleteIndex(), deleteLayer(), deleteLayerTable(), deleteLegend(), deletePointedObjects(), deleteRelation(), deleteTable(), deleteTextVisual(), deleteTheme(), dropDBView(), TeSFSTheme::eraseMetadata(), TeFileTheme::eraseMetadata(), TeExternalTheme::eraseMetadata(), fillCoverageMetadataTable(), generateCountLegends(), generateLabelPositions(), generateTextUsingCentroid(), TeDecoderDatabase::init(), TeAddressLocator::insertAddressMetadata(), insertAppTheme(), insertChartParams(), insertDatum(), insertGrouping(), insertInfo2Blob(), insertKernelMetadata(), insertMedia(), insertMediaObjLayer(), insertObjectIntoCollection(), insertRasterGeometry(), insertRow(), insertSRSId(), insertTable(), insertToCoverageLayerTable(), insertToCoverageTable(), insertVisual(), loadLayerRaster(), populateAppThemeTable(), TeTheme::populateCollection(), TeTheme::populateCollectionAux(), PostgreSQLUpdateDB302To310(), TeLayer::removeGeometry(), removeGeometry(), TeQtGrid::removePointingColorSlot(), TeQtGrid::removeQueryColorSlot(), removeThemeTable(), saveCentroidLabel(), TeDBConnectionsPool::saveExternalDBConnection(), TeTheme::saveGrouping(), TeTheme::saveLegendInCollection(), TeExternalTheme::saveLegendInCollection(), TeDecoderDatabase::saveLUTTable(), TeSFSTheme::saveMetadata(), TeFileTheme::saveMetadata(), TeExternalTheme::saveMetadata(), saveObjectStatus(), TeQtGridSource::setCell(), setDefaultMedia(), TeLayer::setProjection(), TeCopyExternThemeToLayer(), TeCopyLayerToLayer(), TeCopyThemeToLayer(), TeCreateThemeFromTheme(), TeKeepStatistics(), TePlotObjects(), TeAddressLocator::updateAddressMetadata(), TeAddressLocator::updateAddressTable(), updateAppTheme(), updateBBox(), updateDatum(), updateDB20To30(), updateDB301To302(), updateDB302To310(), updateDB30To301(), updateDB310To311(), updateDB3201To331(), updateDB320To3201(), updateDBVersion(), updateGridColor(), updateGrouping(), updateKernelMetadata(), updateLayerBox(), updateLegend(), updateMediaDescription(), updatePieBarLocation(), updatePointLocation(), updateProjection(), updateRasterRepresentation(), updateRepresentation(), updateRow(), updateSRSId(), updateTable(), updateTableInfo(), updateTheme(), TeAbstractTheme::updateThemeCreationTime(), updateThemeTable(), updateVersionStamp(), updateVisual(), and TeQtGrid::writeCell().
| virtual TeDBRelationType TeDatabase::existRelation | ( | const string & | tableName, | |
| const string & | relName | |||
| ) | [pure virtual] |
| tableName | table where the relashionship exists | |
| relName | relationship name |
Implemented in TeAdo, TeOracle, TeSqlServer, TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Referenced by defineIntegrity(), deleteAppTheme(), deleteLayer(), deleteLayerTable(), deleteTheme(), and deleteView().
| bool TeDatabase::generateLabelPositions | ( | TeTheme * | theme, | |
| const std::string & | objectId = "" | |||
| ) | [virtual] |
Reimplemented in TeOracle, TeSqlServer, TeSqlServerSpatial, TeFirebird, TeMySQL, TeOCIOracle, TeOracleSpatial, TePostGIS, TePostgreSQL, and TeSQLite.
Definition at line 4673 of file TeDatabase.cpp.
References TeTheme::collectionTable(), execute(), TeTheme::layer(), tableExist(), TeCELLS, TeLINES, TePOINTS, and TePOLYGONS.
Referenced by TeTheme::generateLabelPositions().
04674 { 04675 string piebar, geomTable, upd; 04676 string collTable = theme->collectionTable(); 04677 04678 if((collTable.empty()) || (!tableExist(collTable))) 04679 return false; 04680 04681 if (theme->layer()->hasGeometry(TeCELLS) ) 04682 { 04683 geomTable = theme->layer()->tableName(TeCELLS); 04684 04685 piebar = "SELECT label_x, label_y, lower_x, lower_y, upper_x, upper_y"; 04686 piebar += " FROM " + collTable + " LEFT JOIN " + geomTable; 04687 piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id"; 04688 if (!objectId.empty()) 04689 upd += " WHERE " + collTable + ".c_object_id = '" + objectId + "'"; 04690 04691 upd = " UPDATE (" + piebar + ") SET"; 04692 upd += " label_x = lower_x + (upper_x-lower_x)/2,"; 04693 upd += " label_y = lower_y + (upper_y-lower_y)/2"; 04694 04695 04696 if(!execute(upd)) 04697 return false; 04698 } 04699 04700 if( theme->layer()->hasGeometry(TePOLYGONS)) 04701 { 04702 geomTable = theme->layer()->tableName(TePOLYGONS); 04703 04704 piebar = "SELECT label_x, label_y, lower_x, lower_y, upper_x, upper_y"; 04705 piebar += " FROM " + collTable + " LEFT JOIN " + geomTable; 04706 piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id"; 04707 piebar += " WHERE label_x is null OR label_y is null"; 04708 if (!objectId.empty()) 04709 upd += " AND " + collTable + ".c_object_id = '" + objectId + "'"; 04710 piebar += " ORDER BY c_object_id ASC, ext_max ASC"; 04711 04712 upd = " UPDATE (" + piebar + ") SET"; 04713 upd += " label_x = lower_x + (upper_x-lower_x)/2,"; 04714 upd += " label_y = lower_y + (upper_y-lower_y)/2"; 04715 04716 if(!execute(upd)) 04717 return false; 04718 } 04719 04720 if (theme->layer()->hasGeometry(TePOINTS)) 04721 { 04722 geomTable = theme->layer()->tableName(TePOINTS); 04723 04724 piebar = "SELECT label_x, label_y, x, y"; 04725 piebar += " FROM " + collTable + " LEFT JOIN " + geomTable; 04726 piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id"; 04727 piebar += " WHERE label_x is null OR label_y is null"; 04728 if (!objectId.empty()) 04729 upd += " AND " + collTable + ".c_object_id = '" + objectId + "'"; 04730 04731 upd = " UPDATE (" + piebar + ") SET"; 04732 upd += " label_x = x,"; 04733 upd += " label_y = y"; 04734 04735 if(!execute(upd)) 04736 return false; 04737 } 04738 04739 if(theme->layer()->hasGeometry(TeLINES)) 04740 { 04741 geomTable = theme->layer()->tableName(TeLINES); 04742 04743 piebar = "SELECT label_x, label_y, lower_x, lower_y, upper_x, upper_y"; 04744 piebar += " FROM " + collTable + " LEFT JOIN " + geomTable; 04745 piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id"; 04746 piebar += " WHERE label_x is null OR label_y is null"; 04747 if (!objectId.empty()) 04748 upd += " AND " + collTable + ".c_object_id = '" + objectId + "'"; 04749 piebar += " ORDER BY c_object_id ASC, ext_max ASC"; 04750 04751 upd = " UPDATE (" + piebar + ") SET"; 04752 upd += " label_x = lower_x + (upper_x-lower_x)/2,"; 04753 upd += " label_y = lower_y + (upper_y-lower_y)/2"; 04754 04755 if(!execute(upd)) 04756 return false; 04757 } 04758 return true; 04759 }
| bool TeDatabase::geomDifference | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | visGeomTable, | |||
| TeGeomRep | visRep, | |||
| const string & | objId2, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| objId1 | identifier of a geometry of the actGeomTable table | |
| visGeomTable | geometric table name | |
| visRep | geometric representation of the visGeomTable table | |
| objId2 | identifier of other geometry of the visGeomTable table | |
| geomVect | the returned difference |
Reimplemented in TeOracleSpatial.
Definition at line 8286 of file TeDatabase.cpp.
| bool TeDatabase::geomDifference | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | objId2, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| objId1 | identifier of a geometry of the actGeomTable table | |
| objId2 | identifier of other geometry of the actGeomTable table | |
| geomVect | the returned difference |
Reimplemented in TeOracleSpatial.
Definition at line 8275 of file TeDatabase.cpp.
References TeDIFFERENCE, and TeGetOverlay().
08276 { 08277 TeKeys actIds; 08278 actIds.push_back(objId1); 08279 actIds.push_back(objId2); 08280 08281 return (TeGetOverlay(actGeomTable, actRep, actIds, this, geomVect, TeDIFFERENCE)); 08282 08283 }
| bool TeDatabase::geomIntersection | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | visGeomTable, | |||
| TeGeomRep | visRep, | |||
| const string & | objId2, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| objId1 | identifier of a geometry of the actGeomTable table | |
| visGeomTable | geometric table name | |
| visRep | geometric representation of the visGeomTable table | |
| objId2 | identifier of other geometry of the visGeomTable table | |
| geomVect | the returned intersection |
Reimplemented in TeOracleSpatial.
Definition at line 8269 of file TeDatabase.cpp.
| bool TeDatabase::geomIntersection | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIds, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| actIds | identifiers of the geometry set of the actGeomTable table | |
| geomVect | the returned intersection |
Reimplemented in TeOracleSpatial.
Definition at line 8263 of file TeDatabase.cpp.
References TeGetOverlay(), and TeINTERSECTION.
08264 { 08265 return (TeGetOverlay(actGeomTable, actRep, actIds, this, geomVect, TeINTERSECTION)); 08266 }
| bool TeDatabase::geomUnion | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | visGeomTable, | |||
| TeGeomRep | visRep, | |||
| const string & | objId2, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| objId1 | identifier of a geometry of the actGeomTable table | |
| visGeomTable | geometric table name | |
| visRep | geometric representation of the visGeomTable table | |
| objId2 | identifier of other geometry of the visGeomTable table | |
| geomVect | the returned union |
Reimplemented in TeOracleSpatial.
Definition at line 8298 of file TeDatabase.cpp.
| bool TeDatabase::geomUnion | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIds, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| actIds | identifiers of the geometry set of the actGeomTable table | |
| geomVect | the returned union |
Reimplemented in TeOracleSpatial.
Definition at line 8292 of file TeDatabase.cpp.
References TeGetOverlay(), and TeUNION.
08293 { 08294 return (TeGetOverlay(actGeomTable, actRep, actIds, this, geomVect, TeUNION)); 08295 }
| bool TeDatabase::geomXOr | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | visGeomTable, | |||
| TeGeomRep | visRep, | |||
| const string & | objId2, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| objId1 | identifier of a geometry of the actGeomTable table | |
| visGeomTable | geometric table name | |
| visRep | geometric representation of the visGeomTable table | |
| objId2 | identifier of other geometry of the visGeomTable table | |
| geomVect | the returned symmetrical difference |
Reimplemented in TeOracleSpatial.
Definition at line 8310 of file TeDatabase.cpp.
| bool TeDatabase::geomXOr | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | objId2, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual] |
| actGeomTable | geometric table name | |
| actRep | geometric representation of the actGeomTable table | |
| objId1 | identifier of a geometry of the actGeomTable table | |
| objId2 | identifier of other geometry of the actGeomTable table | |
| geomVect | the returned symmetrical difference |
Reimplemented in TeOracleSpatial.
Definition at line 8304 of file TeDatabase.cpp.
| bool TeDatabase::getAttributeList | ( | const string & | tableName, | |
| TeAttributeList & | attList | |||
| ) | [virtual] |
Reimplemented in TeAdo, TeOracle, TeSqlServer, TeFirebird, TeOCIOracle, TePostgreSQL, and TeSQLite.
Definition at line 9236 of file TeDatabase.cpp.
References TeDatabasePortal::getAttributeList(), getPortal(), TeDatabasePortal::query(), and tableExist().
Referenced by TePostgreSQL::getAttributeList(), TeFirebird::getAttributeList(), TeSqlServer::getAttributeList(), TeAdo::getAttributeList(), getAttrTables(), TeSFSTheme::getQueryPortal(), TeQtGrid::init(), TeQuerierDBStr3::initPortal(), TeQuerierDBStr1::initPortal(), TeQtGrid::initPortal(), TeTheme::loadAttrLists(), loadLayer(), loadLayerSet(), loadLayerTable(), TeSFSTheme::loadMetadata(), loadTableInfo(), loadThemeTable(), TeCreateBasicDynamicCellTable(), and TeGeoOpAggregation().
09237 { 09238 if(!tableExist(tableName)) 09239 { 09240 return false; 09241 } 09242 09243 TeDatabasePortal* portal = this->getPortal(); 09244 if (!portal) 09245 return false; 09246 09247 string sql = "SELECT * FROM " + tableName + " WHERE 1=2"; 09248 if (!portal->query(sql)) 09249 { 09250 delete portal; 09251 return false; 09252 } 09253 else 09254 attList = portal->getAttributeList(); 09255 delete portal; 09256 return true; 09257 }
| bool TeDatabase::getAttrTables | ( | TeAttrTableVector & | atts, | |
| TeAttrTableType | attType = TeAllAttrTypes | |||
| ) | [virtual] |
Definition at line 2578 of file TeDatabase.cpp.
References errorMessage_, TeDatabasePortal::fetchRow(), getAttributeList(), TeDatabasePortal::getAttrTable(), getPortal(), TeTable::name(), TeDatabasePortal::query(), TeTable::setAttributeList(), Te2String(), and TeAllAttrTypes.
Referenced by main(), TeCopyDatabase(), TeCopyViewNode(), and updateDB301To302().
02579 { 02580 TeDatabasePortal* portal = this->getPortal(); 02581 if(!portal) 02582 { 02583 this->errorMessage_ = "N�o foi poss�vel abrir portal para o banco"; 02584 return false; 02585 } 02586 02587 // Get layer tables 02588 string get = " SELECT * FROM te_layer_table"; 02589 if (attType != TeAllAttrTypes) 02590 get += " WHERE attr_table_type = " + Te2String(attType); 02591 if (!portal->query(get)) 02592 { 02593 delete portal; 02594 return false; 02595 } 02596 02597 while (portal->fetchRow()) 02598 { 02599 TeTable attTable; 02600 if(!portal->getAttrTable(attTable)) 02601 { 02602 delete portal; 02603 return false; 02604 } 02605 02606 TeAttributeList attrList; 02607 getAttributeList(attTable.name(), attrList); 02608 02609 attTable.setAttributeList(attrList); 02610 02611 atts.push_back(attTable); 02612 } 02613 delete portal; 02614 return (atts.size() > 0); 02615 }
| virtual std::string TeDatabase::getClientEncoding | ( | ) | [inline, virtual] |
| fNamesVec | vector containing the fields to be concatenated |
Reimplemented in TeFirebird, and TeMySQL.
Definition at line 4872 of file TeDatabase.cpp.
Referenced by TeTheme::getItemVector(), and TeTheme::getObjects().
04873 { 04874 string concatExp; 04875 for (unsigned int i = 0; i < fNamesVec.size(); ++i) 04876 { 04877 if (i != 0) 04878 concatExp += " & "; 04879 concatExp += fNamesVec[i]; 04880 } 04881 return concatExp; 04882 }
| TeConnection * TeDatabase::getConnection | ( | ) | [virtual] |
Reimplemented in TeFirebird, and TePostgreSQL.
Definition at line 113 of file TeDatabase.cpp.
Referenced by TeConnectionPool::getFreeConnection().
| string TeDatabase::getDatabaseDescription | ( | ) | [virtual] |
Definition at line 119 of file TeDatabase.cpp.
References database_, dbmsName_, host_, password_, portNumber_, and user_.
00120 { 00121 std::stringstream desc; 00122 const char sep = ';'; 00123 00124 desc << dbmsName_; 00125 desc << sep << host_; 00126 desc << sep << portNumber_; 00127 desc << sep << database_; 00128 desc << sep << user_; 00129 desc << sep << password_; 00130 00131 return desc.str(); 00132 }
| virtual bool TeDatabase::getEncodingList | ( | const std::string & | , | |
| const std::string & | , | |||
| const std::string & | , | |||
| const int & | , | |||
| std::vector< std::string > & | ||||
| ) | [inline, virtual] |
Reimplemented in TeMySQL, TePostGIS, and TePostgreSQL.
Definition at line 1581 of file TeDatabase.h.
| virtual bool TeDatabase::getEncodingList | ( | std::vector< std::string > & | ) | [inline, virtual] |
| bool TeDatabase::getIndexesFromTable | ( | const string & | tableName, | |
| std::vector< TeDatabaseIndex > & | vecIndexes | |||
| ) | [virtual] |
Reimplemented in TeFirebird, TeMySQL, TeOCIOracle, TePostgreSQL, and TeSQLite.
Definition at line 586 of file TeDatabase.cpp.
| bool TeDatabase::getMBRGeom | ( | string | tableGeom, | |
| string | object_id, | |||
| TeBox & | box, | |||
| string | colGeom | |||
| ) | [virtual] |
Reimplemented in TeOracleSpatial, TePostGIS, and TePostgreSQL.
Definition at line 9080 of file TeDatabase.cpp.
References TeDatabasePortal::fetchRow(), TeDatabasePortal::getDouble(), getPortal(), MAX, MIN, TeDatabasePortal::query(), and TeMAXFLOAT.
09081 { 09082 double xmin = TeMAXFLOAT; 09083 double xmax = -TeMAXFLOAT; 09084 double ymin = TeMAXFLOAT; 09085 double ymax = -TeMAXFLOAT; 09086 09087 TeDatabasePortal* portal = getPortal(); 09088 if(!portal) 09089 return false; 09090 09091 string sel = "SELECT lower_x, upper_x, lower_y, upper_y FROM " + tableGeom; 09092 sel += " WHERE object_id = '" + object_id + "'"; 09093 09094 if(!portal->query(sel)) 09095 { 09096 delete portal; 09097 return false; 09098 } 09099 09100 bool b = portal->fetchRow(); 09101 if(!b) 09102 { 09103 delete portal; 09104 return false; 09105 } 09106 09107 while(b) 09108 { 09109 xmin = MIN(xmin, portal->getDouble(0)); 09110 xmax = MAX(xmax, portal->getDouble(1)); 09111 ymin = MIN(ymin, portal->getDouble(2)); 09112 ymax = MAX(ymax, portal->getDouble(3)); 09113 b = portal->fetchRow(); 09114 } 09115 09116 TeBox bb(xmin, ymin, xmax, ymax); 09117 box = bb; 09118 delete portal; 09119 return true; 09120 }
| bool TeDatabase::getMBRSelectedObjects | ( | string | geomTable, | |
| string | colGeom, | |||
| string | fromClause, | |||
| string | whereClause, | |||
| string | afterWhereClause, | |||
| TeGeomRep | repType, | |||
| TeBox & | bout, | |||
| const double & | tol = 0.0 | |||
| ) | [virtual] |
Reimplemented in TeSqlServerSpatial, TeOracleSpatial, TePostGIS, and TePostgreSQL.
Definition at line 9123 of file TeDatabase.cpp.
References TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), getPortal(), TeDatabasePortal::query(), TeCELLS, TeLINES, TePOINTS, TePOLYGONS, TeTEXT, and updateBox().
Referenced by TePostgreSQL::getMBRSelectedObjects(), TePostGIS::getMBRSelectedObjects(), getThemeBox(), objBoxInCanvas(), and updateDB320To3201().
09124 { 09125 string fields; 09126 string query; 09127 bool status = false; 09128 09129 TeBox box; 09130 bout = box; 09131 09132 TeDatabasePortal* portal = this->getPortal(); 09133 09134 switch(repType) 09135 { 09136 case TePOLYGONS: 09137 case TeLINES: 09138 case TeCELLS: 09139 fields = "MIN(lower_x), MIN(lower_y), MAX(upper_x), MAX(upper_y)"; 09140 query = " SELECT " + fields; 09141 query += " FROM " + fromClause; 09142 if (!whereClause.empty()) 09143 query += " WHERE " + whereClause; 09144 if (!afterWhereClause.empty()) 09145 query += afterWhereClause; 09146 09147 if (portal->query (query)) 09148 { 09149 bool b = portal->fetchRow(); 09150 while(b) 09151 { 09152 string vxmin = portal->getData(0); 09153 string vymin = portal->getData(1); 09154 string vxmax = portal->getData(2); 09155 string vymax = portal->getData(3); 09156 if(vxmin.empty() || vymin.empty() || vxmax.empty() || vymax.empty()) 09157 { 09158 b = portal->fetchRow(); 09159 continue; 09160 } 09161 double xmin = atof(vxmin.c_str()); 09162 double ymin = atof(vymin.c_str()); 09163 double xmax = atof(vxmax.c_str()); 09164 double ymax = atof(vymax.c_str()); 09165 TeBox ibox(xmin, ymin, xmax, ymax); 09166 updateBox (bout, ibox); 09167 b = portal->fetchRow(); 09168 status = true; 09169 } 09170 } 09171 break; 09172 09173 case TePOINTS: 09174 case TeTEXT: 09175 fields = "MIN(x), MIN(y), MAX(x), MAX(y)"; 09176 query = " SELECT " + fields; 09177 query += " FROM " + fromClause; 09178 if (!whereClause.empty()) 09179 query += " WHERE " + whereClause; 09180 if (!afterWhereClause.empty()) 09181 query += afterWhereClause; 09182 09183 if (portal->query (query)) 09184 { 09185 bool b = portal->fetchRow(); 09186 while(b) 09187 { 09188 string vxmin = portal->getData(0); 09189 string vymin = portal->getData(1); 09190 string vxmax = portal->getData(2); 09191 string vymax = portal->getData(3); 09192 if(vxmin.empty() || vymin.empty() || vxmax.empty() || vymax.empty()) 09193 { 09194 b = portal->fetchRow(); 09195 continue; 09196 } 09197 double xmin = atof(vxmin.c_str()); 09198 double ymin = atof(vymin.c_str()); 09199 double xmax = atof(vxmax.c_str()); 09200 double ymax = atof(vymax.c_str()); 09201 09202 TeBox ibox; 09203 if (xmin == xmax) { 09204 ibox.x1_ = xmin - tol; 09205 ibox.x2_ = xmax + tol; 09206 } 09207 else{ 09208 ibox.x1_ = xmin; 09209 ibox.x2_ = xmax; 09210 } 09211 if (ymin == ymax) { 09212 ibox.y1_ = ymin - tol; 09213 ibox.y2_ = ymax + tol; 09214 } 09215 else { 09216 ibox.y1_ = ymin; 09217 ibox.y2_ = ymax; 09218 } 09219 updateBox (bout, ibox); 09220 b = portal->fetchRow(); 09221 status = true; 09222 } 09223 } 09224 break; 09225 09226 09227 default: 09228 status = false; 09229 break; 09230 } 09231 delete portal; 09232 return status; 09233 }