#include <TePostgreSQL.h>

Definition at line 57 of file TePostgreSQL.h.
Tables | |
| Methods related to table manipulation.
| |
| virtual bool | allowEmptyString (const string &, const string &) |
| Update a column. | |
| 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 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 | validTable (TeTable &table) |
| Verifies and modifies the column names of the table. It returns if the table was modified. | |
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 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 bool | connect (const string &="") |
| Opens a connection without parameters. When possible, should be implemented by the derived classes. | |
| virtual string | getDatabaseDescription () |
| Returns a string that the describes the parameters of the database connected. | |
| bool | isConnected () |
| Check if there is an opened connection. | |
| 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. | |
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 | 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. | |
Non-spatial tables | |
| Retrieving/Inserting/Modifying generic tables in the database. | |
| 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, 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 | 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 | updateTableInfo (int layerId, TeTable &table, const string user="") |
| Updates information about an attribute table. | |
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 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. | |
| 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 | 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 | 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 | 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. | |
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 | 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 std::string | getSQLOrderBy (const TeGeomRep &rep) const |
| virtual string | getSQLTemporalFunction (TeChronon chr, const string &colName) |
| Returns a SQL temporal expression applied to a column. | |
| virtual string | getSQLTemporalWhere (const string &temporalRest) |
| Return a string SQL to temporal where. | |
Query | |
| Methods related to query the database | |
| virtual bool | inClauseValues (const string &query, const string &attribute, vector< string > &inClauseVector) |
| Get the values that satisfy the query. | |
Arc | |
| Accessing/Inserting/Modifying Arc geometries into 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 | insertCellSet (const string &table, TeCellSet &cs) |
| virtual bool | loadCellSet (const int &layerId, const string &table, const string &geoid, TeCellSet &cs) |
| virtual bool | selectCellSet (const int &layerId, const string &table, const string &criteria, TeCellSet &cs) |
| 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. | |
Line | |
| Accessing/Inserting/Modifying Line geometries into the database. | |
| virtual bool | insertLineSet (const string &table, TeLineSet &ls) |
| virtual bool | loadLineSet (TeTheme *theme, TeLineSet &ls) |
| virtual bool | loadLineSet (const string &table, const string &geoid, TeLineSet &ls) |
| 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 | updateLineSet (const string &table, TeLineSet &ls) |
Node | |
| Accessing/Inserting/Modifying Node geometries into the database. | |
| virtual bool | insertNodeSet (const string &table, TeNodeSet &ns) |
| virtual bool | loadNodeSet (const string &table, const string &geoid, TeNodeSet &ps) |
| virtual bool | updateNodeSet (const string &table, TeNodeSet &ns) |
Point | |
| Accessing/Inserting/Modifying Point geometries into the database. | |
| 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 | 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 | updatePointSet (const string &table, TePointSet &ps) |
Polygon | |
| Accessing/Inserting/Modifying polygon geometries into the database | |
| virtual bool | insertPolygonSet (const string &table, TePolygonSet &ps) |
| Inserts a polygon set in a geometry table. | |
| 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 | 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 | updatePolygonSet (const string &table, TePolygonSet &ps) |
| Updates a polygon set in a geometry table. | |
Text | |
| Accessing/Inserting/Modifying Text geometries into the database. | |
| 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) |
Legend | |
| Retrieving/Inserting/Modifying/Deleting legends 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) |
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). | |
Representation | |
| Retrieving/Inserting/Modifying/Deleting representations in the database. | |
| 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. | |
Public Member Functions | |
| virtual bool | addColumn (const string &table, TeAttributeRep &rep) |
| Adds an attribute field. | |
| bool | alterTable (const string &oldTableName, const string &newTableName) |
| Alter a table name. | |
| bool | alterTable (const string &tableName, TeAttributeRep &rep, const string &oldColName="") |
| Alter a property of a table. | |
| bool | beginTransaction () |
| Begins a transaction. | |
| void | close (void) |
| Closes the conection. | |
| bool | columnExist (const string &table, const string &column, TeAttribute &attr) |
| Verifies if a table has a column. | |
| bool | commitTransaction () |
| Commits a transaction. | |
| string | concatValues (vector< string > &values, const string &unionString) |
| Concat values in a vector using unionString as the join between each value. | |
| virtual bool | connect (pg_conn *conn) |
| virtual bool | connect (const string &host, const string &user, const string &password, const string &database, int port=-1) |
| Opens a conection to a database server. | |
| virtual bool | createLUTTable (const string &name) |
| Creates a lookup table (used for pallete raster representations). | |
| bool | createRelation (const string &relName, const string &table, const string &fieldName, const string &relatedTable, const string &relatedField, bool cascadeDeletion) |
| Creates a reationship between two tables. | |
| virtual bool | createSpatialIndex (const string &table, const string &column, TeSpatialIndexType type=TeRTREE, short level=0, short tile=0) |
| Creates a spatial index on column table. | |
| virtual bool | createTable (const string &table, TeAttributeList &attr) |
| Creates a generic table. | |
| virtual bool | deleteTable (const string &table) |
| Deletes a table. Do not allow the deletion of model tables. | |
| virtual bool | dropDatabase (const std::string &databaseName) |
| Drop a database. | |
| virtual bool | dropDBView (const string &dbViewName) |
| Drops a database view. | |
| string | errorMessage () |
| Returns the error message from the server. | |
| bool | execute (const string &sql) |
| Executes a SQL command that doesnt return a record set tipically a data definition comand. | |
| TeDBRelationType | existRelation (const string &tableName, const string &relName) |
| Checks if a relation exist. | |
| virtual bool | generateLabelPositions (TeTheme *theme, const std::string &objectId="") |
| Generate the label position (x,y) to each object of a theme. | |
| virtual bool | getAttributeList (const string &tableName, TeAttributeList &attList) |
| Gets the list of attributes of a table. | |
| string | getAutoNumberSQL (const string &table) |
| Return the database function to generate autonumber values. | |
| virtual std::string | getClientEncoding () |
| Gets the client encoding. | |
| virtual bool | getEncodingList (const std::string &host, const std::string &user, const std::string &password, const int &port, std::vector< std::string > &vecEncodingList) |
| Retrives the list of available character sets. | |
| virtual bool | getEncodingList (std::vector< std::string > &vecEncodingList) |
| Retrives the list of available character sets. | |
| virtual bool | getIndexesFromTable (const string &tableName, std::vector< TeDatabaseIndex > &vecIndexes) |
| Return a TeDatabaseIndex vector from a table. | |
| virtual bool | getMBRGeom (string tableGeom, string object_id, TeBox &box, string colGeom) |
| Returns 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 TeDatabasePortal * | getPortal () |
| Returns a portal associated to this database. | |
| 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 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) |
| Returns a string that describes a where clause to return the geometries of the table2 that are inside the geometries box of the table1. | |
| virtual string | getSQLBoxWhere (const TeBox &box, const TeGeomRep rep, const std::string &tableName) |
| Return a string that describes a where clause to return the geometries inside the box. | |
| string | getSQLStatistics (TeGroupingAttr &attrs) |
| Return a string SQL to calculate the statistics to each cell through database functions. | |
| string | getSQLTemporalWhere (int time1, int time2, TeChronon chr, TeTemporalRelation rel, const string &initialTime, const string &finalTime) |
| Return a string SQL to temporal where. | |
| string | getSQLTemporalWhere (TeTimeInterval &timeInterval, TeTemporalRelation timeOperator, const string &initialTime, const string &finalTime) |
| Return a string SQL to temporal where. | |
| string | getSQLTime (const TeTime &t) const |
| Decodes a time structure into a time string that PostgreSQL can understand. | |
| virtual TeBox | getThemeBox (TeTheme *theme) |
| Returns theme box. | |
| bool | insertArc (const string &table, TeArc &arc) |
| Inserts an arc. | |
| bool | insertBlob (const string &tableName, const string &columnBlob, const string &whereClause, unsigned char *data, int size) |
| Saves a large binary objects (BLOB) in a row table. | |
| virtual bool | insertCell (const string &table, TeCell &c) |
| Inserts a cell. | |
| bool | insertLayer (TeLayer *layer) |
| Insert information about a layer. | |
| bool | insertLegend (TeLegendEntry *legend) |
| Inserts legend information. | |
| virtual bool | insertLine (const string &table, TeLine2D &l) |
| Inserts a line. | |
| 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 | insertNode (const string &table, TeNode &node) |
| Inserts a node. | |
| virtual bool | insertPoint (const string &table, TePoint &p) |
| Inserts a point. | |
| virtual bool | insertPolygon (const string &table, TePolygon &p) |
| Inserts a polygon. | |
| bool | insertProject (TeProject *proj) |
| Insert information about a project. | |
| bool | insertProjection (TeProjection *proj) |
| Insert information about a geographical projection. | |
| 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) |
| Insert a raster block into the database. | |
| virtual bool | insertRasterVisual (int themeId, TeRasterVisual *rasterVisual) |
| Insert raster visual. | |
| bool | insertRelationInfo (const int tableId, const string &tField, const string &rTable, const string &rField, int &relId) |
| Inserts information about a link to an external table. | |
| bool | insertRepresentation (int layerId, TeRepresentation &rep) |
| Insert information about a geometrical representation. | |
| bool | insertTable (TeTable &table) |
| Saves a table and its contents in the database. | |
| bool | insertTableInfo (int layerId, TeTable &table, const string &user="") |
| Insert information about a table related to a layer. | |
| bool | insertText (const string &table, TeText &t) |
| Inserts text. | |
| bool | insertTheme (TeAbstractTheme *theme) |
| Inserts theme information. | |
| bool | insertThemeGroup (TeViewTree *tree) |
| Inserts a theme group. | |
| bool | insertThemeTable (int themeId, int tableId, int relationId, int tableOrder) |
| Inserts information about a table used by a theme. | |
| bool | insertView (TeView *view) |
| Inserts information about a view. | |
| bool | insertViewTree (TeViewTree *tree) |
| Inserts view tree information. | |
| virtual bool | insertVisual (TeLegendEntry *legend) |
| Inserts the entire visual of a Legend. | |
| string | leftString (const string &name, const int &length) |
| Returns the SQL function for substring that starts from left to right with informed length. | |
| virtual bool | listDatabases (std::vector< std::string > &databaseList) |
| Returns a lista of databases. | |
| bool | listTables (vector< string > &tableList) |
| Returns a list of tables in a database. | |
| virtual TeRaster * | loadLayerRaster (int layerId, const string &objectId="", const char &mode= 'r') |
| Returns the raster associated to a layer. | |
| virtual TeDatabasePortal * | loadLineSet (const string &table, TeBox &box) |
| virtual bool | loadLineSet (const string &table, TeBox &box, TeLineSet &linSet) |
| 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 | 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. | |
| virtual bool | locateCell (const string &table, TeCoord2D &pt, TeCell &c, const double &tol=0.0) |
| virtual bool | locateLine (const string &table, TeCoord2D &pt, TeLine2D &line, const double &tol=0.0) |
| Locates a line. | |
| virtual bool | locatePoint (const string &table, TeCoord2D &pt, TePoint &point, const double &tol=0.0) |
| Locates a point. | |
| 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. | |
| 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 bool | newDatabase (const string &database, const string &user, const string &password, const string &host, const int &port=-1, bool terralibModel=true, const std::string &characterSet="") |
| Creates a new database based on "template1" and open a connection to the new one. | |
| 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. | |
| bool | rollbackTransaction () |
| Rollbacks a transaction. | |
| virtual bool | setClientEncoding (const std::string &characterSet) |
| Sets the client encoding. | |
| virtual bool | showDatabases (const string &host, const string &user, const string &password, vector< string > &dbNames, int port=-1) |
| Show the server databases (only for MySQL, Oracle and PostgreSQL). | |
| bool | tableExist (const string &table) |
| Verifies if a table exist. | |
| TePostgreSQL () | |
| Constructor. | |
| string | toUpper (const string &value) |
| 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 | updateCell (const string &table, TeCell &c) |
| virtual bool | updateLine (const string &table, TeLine2D &l) |
| Updates a line. | |
| virtual bool | updateNode (const string &table, TeNode &node) |
| virtual bool | updatePoint (const string &table, TePoint &p) |
| virtual bool | updatePolygon (const string &table, TePolygon &p) |
| Updates a polygon. | |
| bool | updateTable (TeTable &table) |
| Updates a table and its contents in the database. | |
| virtual bool | updateVersionStamp (const string &version) |
| Write the given version as the terralib version in the database. | |
| virtual | ~TePostgreSQL () |
| Destructor. | |
Protected Member Functions | |
| void | alterTableInfoInMemory (const string &updatedTableName, string oldTableName="") |
| Update metadata about an attribute table that had its name or columns changed. | |
| string | escapeSequence (const string &from) |
| Escape special characters in a string to be used in a SQL statement. | |
| virtual void | getInsertRasterBlock (const string &table, const string &blockId, const TeCoord2D &ll, const TeCoord2D &ur, const int &band, const unsigned int &res, const unsigned int &subband, char *buf, const unsigned long &size, string &sql) |
| Returns a string with insert of a raster block. | |
| virtual void | getUpdateRasterBlock (const string &table, const string &blockId, const TeCoord2D &ll, const TeCoord2D &ur, const int &band, const unsigned int &res, const unsigned int &subband, char *buf, const unsigned long &size, string &sql) |
| Returns a string with update of a raster block. | |
| bool | realConnect (const string &host, const string &user, const string &password, const string &database, int port=-1) |
| Opens a conection to a database server. | |
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 | gistBoxOps_ |
| Choose GIST OPERATOR beteween PostgreSQL 8.0 and 8.1. | |
| 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 | |
| TePGConnection * | tepg_connection_ |
| Connection to a PostgreSQL server. | |
| TePGConnection * | tepg_connection_ref |
| int | transactionCounter_ |
| Keeps the number of opened transactions. | |
| std::string | user_ |
| user name | |
Friends | |
| class | TePostgreSQLPortal |
| TePostgreSQL::TePostgreSQL | ( | ) |
Definition at line 67 of file TePostgreSQL.cpp.
References TeDatabase::dbmsName_, TeDatabase::errorMessage_, gistBoxOps_, tepg_connection_, and tepg_connection_ref.
00067 : 00068 TeDatabase(), 00069 transactionCounter_(0) 00070 { 00071 errorMessage_ = ""; 00072 gistBoxOps_ = ""; 00073 dbmsName_ = "PostgreSQL"; 00074 tepg_connection_ = new TePGConnection(); 00075 tepg_connection_ref = tepg_connection_; 00076 }
| TePostgreSQL::~TePostgreSQL | ( | ) | [virtual] |
Definition at line 78 of file TePostgreSQL.cpp.
References close(), TeDatabase::isConnected_, and tepg_connection_ref.
00079 { 00080 if(isConnected_) 00081 close(); 00082 delete tepg_connection_ref; 00083 }
| bool TePostgreSQL::addColumn | ( | const string & | table, | |
| TeAttributeRep & | rep | |||
| ) | [virtual] |
Implements TeDatabase.
Definition at line 757 of file TePostgreSQL.cpp.
References TeDatabase::alterTableInfoInMemory(), TeAttributeRep::defaultValue_, TeDatabase::errorMessage_, TeAttributeRep::isAutoNumber_, TeAttributeRep::name_, TeAttributeRep::numChar_, Te2String(), TeBLOB, TeBOOLEAN, TeDATETIME, TeGetExtension(), TeINT, TeREAL, TeSTRING, and TeAttributeRep::type_.
00758 { 00759 errorMessage_ = ""; 00760 00761 string field = TeGetExtension(rep.name_.c_str()); 00762 if(field.empty()) 00763 field = rep.name_; 00764 00765 string new_column = "ALTER TABLE " + table + " ADD COLUMN " + field + " "; 00766 switch(rep.type_) 00767 { 00768 case TeSTRING: if(rep.numChar_ > 0) 00769 { 00770 new_column += "VARCHAR(" + Te2String(rep.numChar_) + ")"; 00771 } 00772 else 00773 { 00774 new_column += "TEXT"; 00775 } 00776 00777 break; 00778 case TeREAL: new_column += "FLOAT8"; 00779 break; 00780 case TeBOOLEAN: new_column += "BOOLEAN"; 00781 break; 00782 case TeINT: new_column += (rep.isAutoNumber_ ? "SERIAL" : "INTEGER"); 00783 break; 00784 case TeDATETIME: new_column += "TIMESTAMP(0)"; 00785 break; 00786 case TeBLOB: //new_column += "OID"; 00787 new_column += "BYTEA"; 00788 break; 00789 default: new_column += "VARCHAR"; 00790 break; 00791 } 00792 00793 if(!rep.defaultValue_.empty()) 00794 { 00795 new_column += " DEFAULT "; 00796 00797 new_column += rep.defaultValue_; 00798 00799 } 00800 00801 00802 00803 if(!this->execute(new_column)) 00804 return false; 00805 00806 alterTableInfoInMemory(table); 00807 00808 return true; 00809 }
| virtual bool TeDatabase::allowEmptyString | ( | const string & | , | |
| const string & | ||||
| ) | [inline, virtual, inherited] |
Reimplemented in TeAdo.
Definition at line 301 of file TeDatabase.h.
Referenced by updateDB20To30().
| bool TePostgreSQL::alterTable | ( | const string & | oldTableName, | |
| const string & | newTableName | |||
| ) | [virtual] |
Reimplemented from TeDatabase.
Definition at line 1402 of file TePostgreSQL.cpp.
References TeDatabase::alterTableInfoInMemory(), and execute().
01403 { 01404 string sql = " ALTER TABLE \""+ oldTableName +"\" RENAME TO "+ newTableName; 01405 if(!this->execute(sql)) 01406 return false; 01407 01408 //update te_layer_table 01409 sql = " UPDATE te_layer_table "; 01410 sql += " SET attr_table = '"+ newTableName +"'"; 01411 sql += " WHERE attr_table = '"+ oldTableName +"'"; 01412 execute(sql); 01413 01414 //update te_tables_relation 01415 sql = " UPDATE te_tables_relation "; 01416 sql += " SET external_table_name = '"+ newTableName +"'"; 01417 sql += " WHERE external_table_name = '"+ oldTableName +"'"; 01418 execute(sql); 01419 01420 alterTableInfoInMemory(newTableName, oldTableName); 01421 return true; 01422 }
| bool TePostgreSQL::alterTable | ( | const string & | tableName, | |
| TeAttributeRep & | rep, | |||
| const string & | oldColName = "" | |||
| ) | [virtual] |
Reimplemented from TeDatabase.
Definition at line 1268 of file TePostgreSQL.cpp.
References TeDatabase::alterTableInfoInMemory(), TeDatabase::errorMessage_, execute(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), getPortal(), TeAttributeRep::isAutoNumber_, TeAttributeRep::name_, TeAttributeRep::numChar_, TeDatabasePortal::query(), tableExist(), Te2String(), TeBLOB, TeBOOLEAN, TeCHARACTER, TeDATETIME, TeINT, TeREAL, TeSTRING, and TeAttributeRep::type_.
01269 { 01270 if(!tableExist(tableName)) 01271 return false; 01272 01273 string tab; 01274 01275 if(!oldColName.empty()) 01276 { 01277 tab = " ALTER TABLE " + tableName + " RENAME COLUMN "; 01278 tab += oldColName + " TO " + rep.name_; 01279 } 01280 else 01281 { 01282 tab = " ALTER TABLE " + tableName + " ALTER COLUMN "; 01283 tab += rep.name_ + " TYPE "; 01284 01285 switch (rep.type_) 01286 { 01287 case TeSTRING: 01288 if(rep.numChar_ > 0) 01289 { 01290 tab += "VARCHAR(" + Te2String(rep.numChar_) + ") "; 01291 } 01292 else 01293 { 01294 tab += "TEXT "; 01295 } 01296 break; 01297 01298 case TeREAL: 01299 tab += "FLOAT8"; 01300 break; 01301 01302 case TeINT: 01303 tab += (rep.isAutoNumber_ ? "SERIAL" : "INTEGER"); 01304 break; 01305 01306 case TeDATETIME: 01307 tab += "TIMESTAMP(0)"; 01308 break; 01309 01310 case TeCHARACTER: 01311 tab += "CHAR"; 01312 break; 01313 case TeBOOLEAN: 01314 tab += "BOOLEAN"; 01315 break; 01316 01317 case TeBLOB: 01318 tab += "BYTEA"; 01319 break; 01320 01321 default: 01322 tab += "VARCHAR(" + Te2String(rep.numChar_) + ") "; 01323 break; 01324 } 01325 } 01326 01327 if(!execute(tab)) 01328 { 01329 if(errorMessage_.empty()) 01330 errorMessage_ = "Error alter table " + tableName + " !"; 01331 01332 return false; 01333 } 01334 01335 string tableId; 01336 TeDatabasePortal* portal = getPortal(); 01337 string sql = "SELECT table_id FROM te_layer_table WHERE attr_table = '" + tableName + "'"; 01338 if(portal->query(sql) && portal->fetchRow()) 01339 tableId = portal->getData(0); 01340 01341 delete portal; 01342 01343 if(tableId.empty() == false) 01344 { 01345 if(oldColName.empty() == false) // column name changed 01346 { 01347 // update relation 01348 sql = "UPDATE te_tables_relation SET related_attr = '" + rep.name_ + "'"; 01349 sql += " WHERE related_table_id = " + tableId; 01350 sql += " AND related_attr = '" + oldColName + "'"; 01351 if(execute(sql) == false) 01352 return false; 01353 01354 sql = "UPDATE te_tables_relation SET external_attr = '" + rep.name_ + "'"; 01355 sql += " WHERE external_table_name = '" + tableName + "'"; 01356 sql += " AND external_attr = '" + oldColName + "'"; 01357 if(execute(sql) == false) 01358 return false; 01359 01360 // update grouping 01361 sql = "UPDATE te_grouping SET grouping_attr = '" + tableName + "." + rep.name_ + "'"; 01362 sql += " WHERE grouping_attr = '" + tableName + "." + oldColName + "'"; 01363 if(execute(sql) == false) 01364 return false; 01365 } 01366 else // column type changed 01367 { 01368 // delete relation 01369 sql = "DELETE FROM te_tables_relation WHERE (related_table_id = " + tableId; 01370 sql += " AND related_attr = '" + rep.name_ + "')"; 01371 sql += " OR (external_table_name = '" + tableName + "'"; 01372 sql += " AND external_attr = '" + rep.name_ + "')"; 01373 if(execute(sql) == false) 01374 return false; 01375 01376 // delete grouping 01377 TeDatabasePortal* portal = getPortal(); 01378 sql = "SELECT theme_id FROM te_grouping WHERE grouping_attr = '" + tableName + "." + oldColName + "'"; 01379 if(portal->query(sql) && portal->fetchRow()) 01380 { 01381 string themeId = portal->getData(0); 01382 01383 sql = "DELETE FROM te_legend WHERE theme_id = " + themeId + " AND group_id >= 0"; 01384 if(execute(sql) == false) 01385 { 01386 delete portal; 01387 return false; 01388 } 01389 } 01390 delete portal; 01391 01392 sql = "DELETE FROM te_grouping"; 01393 sql += " WHERE grouping_attr = '" + tableName + "." + oldColName + "'"; 01394 if(execute(sql) == false) 01395 return false; 01396 } 01397 } 01398 alterTableInfoInMemory(tableName); 01399 return true; 01400 }
| void TeDatabase::alterTableInfoInMemory | ( | const string & | updatedTableName, | |
| string | oldTableName = "" | |||
| ) | [protected, inherited] |
Definition at line 134 of file TeDatabase.cpp.
References TeTheme::attrTables(), TeTheme::loadAliasVector(), TeTheme::loadAttrLists(), TeDatabase::loadTableInfo(), TeTheme::loadTablesJoin(), TeDatabase::metaModel_, TeConvertToUpperCase(), and TeTHEME.
Referenced by addColumn(), TeOCIOracle::addColumn(), TeMySQL::addColumn(), TeFirebird::addColumn(), TeSqlServer::addColumn(), TeOracle::addColumn(), TeAdo::addColumn(), alterTable(), TeOCIOracle::alterTable(), TeMySQL::alterTable(), TeFirebird::alterTable(), TeDatabase::alterTable(), TeSqlServerSpatial::alterTable(), TeSqlServer::alterTable(), TeOracle::alterTable(), TeAdo::alterTable(), TeDatabase::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 TePostgreSQL::beginTransaction | ( | void | ) | [virtual] |
Reimplemented from TeDatabase.
Definition at line 3786 of file TePostgreSQL.cpp.
References TePGConnection::beginTransaction(), tepg_connection_, and transactionCounter_.
Referenced by insertTable(), and updateTable().
03787 { 03788 transactionCounter_++; 03789 03790 if (transactionCounter_ > 1) 03791 return true; 03792 else 03793 return tepg_connection_->beginTransaction(); 03794 }
| bool TeDatabase::buffer | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIds, | |||
| TePolygonSet & | bufferSet, | |||
| double | dist | |||
| ) | [virtual, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
Definition at line 3548 of file TeDatabase.cpp.
References TeDatabase::metaModel_.
Referenced by TeOCIOracle::close(), TeDatabase::loadExternalThemes(), TeExternalTheme::loadMetadata(), TePieBar::locate(), TeDBConnectionsPool::removeDatabase(), and updateDB320To3201().
03549 { 03550 metaModel_->clear(); 03551 }
| void TePostgreSQL::close | ( | void | ) | [virtual] |
Implements TeDatabase.
Definition at line 360 of file TePostgreSQL.cpp.
References TePGConnection::close(), TeDatabase::errorMessage_, TeDatabase::isConnected_, tepg_connection_, and transactionCounter_.
Referenced by connect(), TePostGIS::connect(), getEncodingList(), TePostGIS::getEncodingList(), newDatabase(), TePostGIS::newDatabase(), realConnect(), and ~TePostgreSQL().
00361 { 00362 errorMessage_ = ""; 00363 00364 tepg_connection_->close(); 00365 isConnected_ = false; 00366 transactionCounter_ = 0; 00367 00368 return; 00369 }
| bool TePostgreSQL::columnExist | ( | const string & | table, | |
| const string & | column, | |||
| TeAttribute & | attr | |||
| ) | [virtual] |
Implements TeDatabase.
Definition at line 499 of file TePostgreSQL.cpp.
References TeDatabase::errorMessage_, TePGRecordset::getData(), TePGRecordset::getInt(), TeAttributeRep::name_, TeAttributeRep::numChar_, TePGRecordset::open(), TePGRecordset::recordCount(), TeAttribute::rep_, TeBLOB, TeCHARACTER, TeDATETIME, TeINT, tepg_connection_, TeREAL, TeSTRING, TeUNKNOWN, and TeAttributeRep::type_.
00500 { 00501 errorMessage_ = ""; 00502 00503 TePGRecordset rec; 00504 00505 string sql = "SELECT atttypid, attname, atttypmod, attlen FROM pg_class, pg_attribute "; 00506 sql += "WHERE lower(pg_class.relname) = lower('" + table + "') AND "; 00507 sql += " pg_class.oid = pg_attribute.attrelid AND "; 00508 sql += " pg_attribute.attname = lower('" + column + "')"; 00509 00510 if(!rec.open(sql, tepg_connection_)) 00511 return false; 00512 00513 if(rec.recordCount() > 0) 00514 { 00515 attr.rep_.name_ = rec.getData("attname"); 00516 00517 Oid nType = static_cast<Oid>(rec.getInt("atttypid")); 00518 switch(nType) 00519 { 00520 case 16: //BOOL 00521 case 20: //INT8 00522 case 21: //INT2 00523 case 23: //INT4 00524 case 26: //OID 00525 attr.rep_.type_ = TeINT; 00526 attr.rep_.numChar_ = 15; 00527 break; 00528 00529 case 700 : //float4 -> float(p) 00530 case 701 : //float8 -> float(p) 00531 case 790 : //money -> decimal(9, 2) 00532 case 1700: //numeric -> numeric(p, s) 00533 attr.rep_.type_ = TeREAL; 00534 attr.rep_.numChar_ = 15; 00535 break; 00536 00537 case 1082: //date -> date 00538 case 1083: //time -> time 00539 case 1114: //timestamp 00540 case 1186: //interval 00541 case 1266: // 00542 attr.rep_.type_ = TeDATETIME; 00543 attr.rep_.numChar_ = rec.getInt("attlen"); 00544 break; 00545 00546 //case 26: //OID 00547 case 17: //bytea 00548 attr.rep_.type_ = TeBLOB; 00549 attr.rep_.numChar_ = 0; 00550 break; 00551 case 1042: 00552 attr.rep_.type_ = TeCHARACTER; 00553 attr.rep_.numChar_ = rec.getInt("atttypmod") - 4; 00554 break; 00555 00556 case 1043: //varchar(n) 00557 attr.rep_.type_ = TeSTRING; 00558 attr.rep_.numChar_ = rec.getInt("atttypmod") - 4; 00559 break; 00560 00561 case 25: //text 00562 attr.rep_.type_ = TeSTRING; 00563 break; 00564 00565 default: 00566 attr.rep_.type_ = TeUNKNOWN; 00567 attr.rep_.numChar_ = 0; 00568 break; 00569 } 00570 00571 return true; 00572 } 00573 00574 return false; 00575 }
| bool TePostgreSQL::commitTransaction | ( | void | ) | [virtual] |
Reimplemented from TeDatabase.
Definition at line 3796 of file TePostgreSQL.cpp.
References TePGConnection::commitTransaction(), tepg_connection_, and transactionCounter_.
Referenced by insertTable(), and updateTable().
03797 { 03798 transactionCounter_--; 03799 03800 if (transactionCounter_ > 0) 03801 return true; 03802 else 03803 return tepg_connection_->commitTransaction(); 03804 }
| string TePostgreSQL::concatValues | ( | vector< string > & | values, | |
| const string & | unionString | |||
| ) | [virtual] |
Implements TeDatabase.
Definition at line 3492 of file TePostgreSQL.cpp.
03493 { 03494 string concat = ""; 03495 03496 for(unsigned int i = 0; i < values.size(); ++i) 03497 { 03498 if(i != 0) 03499 { 03500 concat += " || "; 03501 03502 if(!unionString.empty()) 03503 { 03504 concat += "'"; 03505 concat += unionString; 03506 concat += "'"; 03507 concat += " || "; 03508 } 03509 } 03510 03511 concat += values[i]; 03512 } 03513 03514 return concat; 03515 }
| bool TePostgreSQL::connect | ( | pg_conn * | conn | ) | [virtual] |
Definition at line 244 of file TePostgreSQL.cpp.
References TePGConnection::c_ptr(), TePGRecordset::close(), close(), TeDatabase::database_, TePGConnection::dbname(), TeDatabase::errorMessage_, execute(), gistBoxOps_, TePGRecordset::open(), TePGConnection::open(), TeDatabase::password_, TePGRecordset::recordCount(), tepg_connection_, and TePGRecordset::value().
00245 { 00246 this->close(); 00247 00248 if(tepg_connection_->open(conn)) 00249 { 00250 TePGRecordset rec; 00251 00252 string sql = "SELECT postgis_version()"; 00253 00254 if(rec.open(sql.c_str(), tepg_connection_) && rec.recordCount() > 0) 00255 { 00256 rec.close(); 00257 00258 this->close(); 00259 00260 errorMessage_ = "PostGIS extension found! Please use a PostGIS driver!"; 00261 00262 return false; 00263 } 00264 00265 // see if RTree GiST is present for box: it must be present 00266 int version = PQserverVersion(tepg_connection_->c_ptr()); 00267 if(version >= 80100) 00268 { 00269 gistBoxOps_ = "box_ops"; 00270 if(version >= 90000) 00271 { 00272 //modification because of the new default bytea type 00273 execute("set bytea_output = 'escape'"); 00274 } 00275 return true; 00276 } 00277 00278 sql = "SELECT opcname FROM pg_opclass WHERE (opcname = 'gist_box_ops') ORDER BY opcname DESC"; 00279 00280 if(rec.open(sql.c_str(), tepg_connection_) && rec.recordCount() > 0) 00281 { 00282 gistBoxOps_ = rec.value(0); 00283 rec.close(); 00284 00285 // host_ = tepg_connection_->.dbHost(); 00286 // user_ = tepg_connection_->dbUser(); 00287 password_ = ""; 00288 database_ = tepg_connection_->dbname(); 00289 00290 return true; 00291 } 00292 00293 rec.close(); 00294 00295 this->close(); 00296 00297 errorMessage_ = "GiST extension not found! Please, install R-Tree GiST in your database and try again!"; 00298 } 00299 return false; 00300 }
| bool TePostgreSQL::connect | ( | const string & | host, | |
| const string & | user, | |||
| const string & | password, | |||
| const string & | database, | |||
| int | port = -1 | |||
| ) | [virtual] |
Implements TeDatabase.
Reimplemented in TePostGIS.
Definition at line 189 of file TePostgreSQL.cpp.
References TePGConnection::c_ptr(), close(), TePGRecordset::close(), TeDatabase::errorMessage_, execute(), gistBoxOps_, TePGRecordset::open(), realConnect(), TePGRecordset::recordCount(), tepg_connection_, and TePGRecordset::value().
Referenced by TePostgreSQLFactory::build(), getEncodingList(), and newDatabase().
00190 { 00191 if(TePostgreSQL::realConnect(host, user, password, database, port)) 00192 { 00193 // see if PostGIS is present 00194 TePGRecordset rec; 00195 00196 string sql = "SELECT postgis_version()"; 00197 00198 if(rec.open(sql.c_str(), tepg_connection_) && rec.recordCount() > 0) 00199 { 00200 rec.close(); 00201 00202 this->close(); 00203 00204 errorMessage_ = "PostGIS extension found! Please use a PostGIS driver!"; 00205 00206 return false; 00207 } 00208 00209 // see if RTree GiST is present for box: it must be present 00210 int version = PQserverVersion(tepg_connection_->c_ptr()); 00211 if(version >= 80100) 00212 { 00213 gistBoxOps_ = "box_ops"; 00214 if(version >= 90000) 00215 { 00216 //modification because of the new default bytea type 00217 execute("set bytea_output = 'escape'"); 00218 } 00219 return true; 00220 } 00221 00222 sql = "SELECT opcname FROM pg_opclass WHERE (opcname = 'gist_box_ops') ORDER BY opcname DESC"; 00223 00224 if(rec.open(sql.c_str(), tepg_connection_) && rec.recordCount() > 0) 00225 { 00226 gistBoxOps_ = rec.value(0); 00227 rec.close(); 00228 00229 return true; 00230 } 00231 00232 rec.close(); 00233 00234 this->close(); 00235 00236 errorMessage_ = "GiST extension not found! Please, install R-Tree GiST in your database and try again!"; 00237 00238 return false; 00239 } 00240 00241 return false; 00242 }
| bool TeDatabase::convexHull | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| TeKeys & | actIds, | |||
| TePolygonSet & | convexHullSet | |||
| ) | [virtual, inherited] |
| 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, inherited] |
Definition at line 9894 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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, inherited] |
Definition at line 9946 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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 TeDatabase::createIndex(), TeDatabase::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, inherited] |
Definition at line 425 of file TeDatabase.cpp.
References TeDatabase::createDatabaseTable(), TeDatabase::createDatumTable(), TeDatabase::createGroupingTable(), TeDatabase::createLayerTable(), TeDatabase::createLayerTableTable(), TeDatabase::createLegendTable(), TeDatabase::createProjectionTable(), TeDatabase::createProjectTable(), TeDatabase::createProjectViewTable(), TeDatabase::createRepresentationTable(), TeDatabase::createSRSTable(), TeDatabase::createTablesRelationTable(), TeDatabase::createThemeTable(), TeDatabase::createThemeTablesTable(), TeDatabase::createViewTable(), TeDatabase::createVisualRasterTable(), TeDatabase::createVisualTable(), TeDatabase::defineIntegrity(), TeDatabase::execute(), TeDatabase::populateDatumTable(), and TeDBVERSION.
Referenced by TeSQLite::newDatabase(), 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, inherited] |
Definition at line 592 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDATETIME, TeSTRING, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 669 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDatabase::tableExist(), TeREAL, TeSTRING, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 1733 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::decimals_, TeAttributeRep::defaultValue_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 572 of file TeDatabase.cpp.
References TeDatabase::execute().
Referenced by TeDatabase::createArcGeometry(), TeDatabase::createCellGeometry(), TeTheme::createCollectionAuxTable(), TeDatabase::createCollectionTable(), createGPMMetadataTable(), createKernelMetadataTable(), TeDatabase::createLayerTable(), TeDatabase::createLayerTableTable(), TeDatabase::createLegendTable(), TeDatabase::createLineGeometry(), createNeighbourhoodTable(), TeDatabase::createNodeGeometry(), TeDatabase::createPointGeometry(), TeDatabase::createPolygonGeometry(), TeDatabase::createRasterGeometry(), TeDatabase::createRasterTable(), TeDatabase::createRepresentationTable(), TeFirebird::createSpatialIndex(), TeDatabase::createSpatialIndex(), TeDatabase::createTextGeometry(), TeSqlServerSpatial::createTextGeometry(), TeDatabase::createThemeTable(), TeDatabase::createThemeTablesTable(), and TeDatabase::createViewTable().
00573 { 00574 string sql = "CREATE INDEX " + indexName + " ON " + tableName + "(" + columnsName + ")"; 00575 return execute (sql); 00576 }
| bool TeDatabase::createLayerTable | ( | ) | [virtual, inherited] |
Definition at line 843 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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 TeDatabase::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, inherited] |
Definition at line 924 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeDATETIME, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 1849 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 9822 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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 TeDatabase::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, inherited] |
Definition at line 10068 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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, inherited] |
Definition at line 9858 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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, inherited] |
Definition at line 9786 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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, inherited] |
Definition at line 726 of file TeDatabase.cpp.
References TeDatabase::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 TeDatabase::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, inherited] |
Definition at line 613 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 648 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttribute::rep_, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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 TeDatabase::createIndex(), TeDatabase::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 TeDatabase::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 TeDatabase::createIndex(), TeDatabase::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 }
| bool TePostgreSQL::createRelation | ( | const string & | relName, | |
| const string & | table, | |||
| const string & | fieldName, | |||
| const string & | relatedTable, | |||
| const string & | relatedField, | |||
| bool | cascadeDeletion | |||
| ) | [virtual] |
Implements TeDatabase.
Definition at line 811 of file TePostgreSQL.cpp.
References TeDatabase::errorMessage_, and execute().
00812 { 00813 errorMessage_ = ""; 00814 00815 string alter = "ALTER TABLE " + table + " ADD CONSTRAINT " + relName + " "; 00816 alter += "FOREIGN KEY (" + fieldName + ") "; 00817 alter += "REFERENCES " + relatedTable + "(" + relatedField + ") "; 00818 00819 if(cascadeDeletion) 00820 alter += " ON DELETE CASCADE"; 00821 00822 return execute(alter); 00823 }
| bool TeDatabase::createRepresentationTable | ( | ) | [virtual, inherited] |
Definition at line 1185 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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 TeDatabase::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 TePostgreSQL::createSpatialIndex | ( | const string & | table, | |
| const string & | column, | |||
| TeSpatialIndexType | type = TeRTREE, |
|||
| short | level = 0, |
|||
| short | tile = 0 | |||
| ) | [virtual] |
Reimplemented from TeDatabase.
Reimplemented in TePostGIS.
Definition at line 3557 of file TePostgreSQL.cpp.
References execute(), and gistBoxOps_.
03558 { 03559 string create = "CREATE INDEX sp_idx_gist_" + table + " ON " + table + " USING GIST (" + column + " " + gistBoxOps_ + ")"; 03560 03561 return this->execute(create); 03562 }
| bool TeDatabase::createSRSTable | ( | ) | [virtual, inherited] |
Definition at line 817 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttribute::rep_, TeDatabase::tableExist(), TeINT, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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 }
| bool TePostgreSQL::createTable | ( | const string & | table, | |
| TeAttributeList & | attr | |||
| ) | [virtual] |
Implements TeDatabase.
Reimplemented in TePostGIS.
Definition at line 577 of file TePostgreSQL.cpp.
References TeDatabase::errorMessage_, execute(), Te2String(), TeBLOB, TeBOOLEAN, TeCELLSETTYPE, TeCELLTYPE, TeCHARACTER, TeDATETIME, TeINT, TeLINE2DTYPE, TeLINESETTYPE, TeNODESETTYPE, TeNODETYPE, TePOINTSETTYPE, TePOINTTYPE, TePOLYGONSETTYPE, TePOLYGONTYPE, TeRASTERTYPE, TeREAL, TeSTRING, TeTEXTSETTYPE, TeTEXTTYPE, and TeUNSIGNEDINT.
00578 { 00579 errorMessage_ = ""; 00580 00581 bool first = true; 00582 00583 TeAttributeList::iterator it = attr.begin(); 00584 00585 string createTable ="CREATE TABLE " + table +" ("; 00586 00587 string type; 00588 00589 string pkeys; 00590 00591 while(it != attr.end()) 00592 { 00593 switch ((*it).rep_.type_) 00594 { 00595 case TeSTRING: if((*it).rep_.numChar_ > 0) 00596 { 00597 type = "VARCHAR(" + Te2String((*it).rep_.numChar_) + ")"; 00598 } 00599 else 00600 { 00601 type = "TEXT"; 00602 } 00603 break; 00604 00605 case TeREAL: type = "FLOAT8"; 00606 break; 00607 00608 case TeINT: 00609 case TeUNSIGNEDINT: 00610 type = ((*it).rep_.isAutoNumber_) ? "SERIAL" : "INTEGER"; 00611 break; 00612 00613 case TeBLOB: //type = "OID"; 00614 type = "BYTEA"; 00615 break; 00616 00617 case TeDATETIME: type = "TIMESTAMP(0)"; 00618 break; 00619 00620 case TeCHARACTER: type = "CHAR(" + (((*it).rep_.numChar_ == 0)? std::string("1") : Te2String((*it).rep_.numChar_)) + ") "; 00621 break; 00622 00623 case TeBOOLEAN: type = "BOOLEAN"; 00624 break; 00625 00626 case TePOINTTYPE: 00627 case TePOINTSETTYPE: 00628 if(!first) 00629 createTable += ", "; 00630 else 00631 first = false; 00632 00633 createTable += " spatial_box BOX NOT NULL,"; 00634 createTable += " x FLOAT8 DEFAULT 0.0,"; 00635 createTable += " y FLOAT8 DEFAULT 0.0 "; 00636 ++it; 00637 continue; 00638 00639 case TeLINE2DTYPE: 00640 case TeLINESETTYPE: 00641 if(!first) 00642 createTable += ", "; 00643 else 00644 first = false; 00645 00646 createTable += " num_coords INTEGER NOT NULL,"; 00647 createTable += " spatial_box BOX NOT NULL,"; 00648 createTable += " ext_max FLOAT8 NOT NULL,"; 00649 createTable += " spatial_data POLYGON "; 00650 ++it; 00651 continue; 00652 00653 case TePOLYGONTYPE: 00654 case TePOLYGONSETTYPE: 00655 if(!first) 00656 createTable += ", "; 00657 else 00658 first = false; 00659 00660 createTable += " num_coords INTEGER NOT NULL,"; 00661 createTable += " num_holes INTEGER NOT NULL,"; 00662 createTable += " parent_id INTEGER NOT NULL,"; 00663 createTable += " spatial_box BOX NOT NULL,"; 00664 createTable += " ext_max FLOAT8 NOT NULL,"; 00665 createTable += " spatial_data POLYGON "; 00666 ++it; 00667 continue; 00668 00669 case TeCELLTYPE: 00670 case TeCELLSETTYPE: 00671 if(!first) 00672 createTable += ", "; 00673 else 00674 first = false; 00675 00676 createTable += " spatial_box BOX NOT NULL,"; 00677 createTable += " col_number INTEGER NOT NULL,"; 00678 createTable += " row_number INTEGER NOT NULL "; 00679 ++it; 00680 continue; 00681 00682 case TeRASTERTYPE: 00683 if(!first) 00684 createTable += ", "; 00685 else 00686 first = false; 00687 00688 createTable += " block_box BOX NOT NULL,"; 00689 createTable += " band_id INTEGER NOT NULL,"; 00690 createTable += " resolution_factor INTEGER NOT NULL,"; 00691 createTable += " subband INTEGER NOT NULL,"; 00692 createTable += " spatial_data BYTEA,"; 00693 createTable += " block_size INTEGER NOT NULL "; 00694 ++it; 00695 continue; 00696 00697 case TeNODETYPE: 00698 case TeNODESETTYPE: 00699 if(!first) 00700 createTable += ", "; 00701 else 00702 first = false; 00703 00704 createTable += " spatial_box BOX NOT NULL,"; 00705 createTable += " x FLOAT8 DEFAULT 0.0,"; 00706 createTable += " y FLOAT8 DEFAULT 0.0 "; 00707 ++it; 00708 continue; 00709 00710 case TeTEXTTYPE: 00711 case TeTEXTSETTYPE: 00712 00713 default: type += "VARCHAR(" + Te2String((*it).rep_.numChar_) + ")"; 00714 break; 00715 } 00716 00717 if(!((*it).rep_.defaultValue_.empty())) 00718 type += " DEFAULT '" + (*it).rep_.defaultValue_ + "' "; 00719 00720 if(!((*it).rep_.null_)) 00721 type += " NOT NULL "; 00722 00723 if(!first) 00724 createTable += ", "; 00725 else 00726 first = false; 00727 00728 createTable += (*it).rep_.name_ + " "; 00729 createTable += type; 00730 00731 // check if column is part of primary key 00732 if((*it).rep_.isPrimaryKey_ && (*it).rep_.type_ != TeBLOB ) 00733 { 00734 if(!pkeys.empty()) 00735 pkeys += ", "; 00736 00737 pkeys += (*it).rep_.name_; 00738 } 00739 00740 ++it; 00741 } 00742 00743 if(!pkeys.empty()) 00744 { string pk = ", PRIMARY KEY("; 00745 pk += pkeys; 00746 pk += ")"; 00747 00748 createTable += pk; 00749 } 00750 00751 00752 createTable += ");"; 00753 00754 return execute(createTable); 00755 }
| bool TeDatabase::createTablesRelationTable | ( | ) | [virtual, inherited] |
Definition at line 1143 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 9987 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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, inherited] |
Definition at line 1588 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::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 TeDatabase::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, inherited] |
Definition at line 1797 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::createTable(), TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttribute::rep_, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 1505 of file TeDatabase.cpp.
References TeDatabase::createIndex(), TeDatabase::createTable(), TeAttributeRep::decimals_, TeAttributeRep::isAutoNumber_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 2038 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::decimals_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
Definition at line 1903 of file TeDatabase.cpp.
References TeDatabase::createTable(), TeAttributeRep::decimals_, TeAttributeRep::isPrimaryKey_, TeAttributeRep::name_, TeAttributeRep::null_, TeAttributeRep::numChar_, TeAttribute::rep_, TeINT, TeREAL, TeSTRING, TeUNSIGNEDINT, and TeAttributeRep::type_.
Referenced by TeDatabase::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, inherited] |
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, inherited] |
Definition at line 189 of file TeDatabase.h.
Referenced by countNumGeometries(), TeDBConnectionsPool::getDatabaseIdx(), TeQuerierDBStr1::initGeomPortal(), TeQuerierDBStr1::initPortal(), TeDBConnectionsPool::insertDatabase(), insertInfo2Blob(), insertMedia(), TeDatabase::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, inherited] |
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, inherited] |
Reimplemented in TeMySQL.
Definition at line 343 of file TeDatabase.cpp.
References TeDatabase::createRelation(), TeDatabase::existRelation(), and TeNoRelation.
Referenced by TeDatabase::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 TeDatabase::alterTableInfoInMemory(), TeDatabase::columnExist(), TeDatabase::execute(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), TeDatabase::getPortal(), TeDatabasePortal::query(), and TeDatabase::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 }
| bool TeDatabase::deleteIndex | ( | const string & | tableName, | |
| const string & | indexName | |||
| ) | [virtual, inherited] |
Reimplemented in TeMySQL.
Definition at line 579 of file TeDatabase.cpp.
References TeDatabase::execute().
00580 { 00581 string sql = "DROP INDEX " + indexName; 00582 return execute(sql); 00583 }
| bool TeDatabase::deleteLayer | ( | int | layerId | ) | [virtual, inherited] |
Reimplemented in TeOracle, TeSqlServer, and TeOCIOracle.
Definition at line 5833 of file TeDatabase.cpp.
References TeDatabase::deleteLayerTable(), TeDatabase::deleteProjection(), TeDatabase::deleteTable(), TeDatabase::deleteTheme(), TeDatabase::execute(), TeDatabase::existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), TeDatabasePortal::getData(), TeDatabasePortal::getInt(), TeDatabase::getPortal(), TeViewNode::id(), TeTheme::layer(), TeDatabase::metaModel_, TeDatabasePortal::query(), TeDatabase::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, inherited] |
Definition at line 6000 of file TeDatabase.cpp.
References TeDatabase::deleteTable(), TeDatabase::execute(), TeDatabase::existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), TeDatabase::getPortal(), TeDatabasePortal::query(), TeDatabase::tableExist(), Te2String(), and TeRICascadeDeletion.
Referenced by TeOCIOracle::deleteLayer(), TeDatabase::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, inherited] |
Definition at line 5090 of file TeDatabase.cpp.
References TeDatabase::execute(), TeDatabasePortal::fetchRow(), TeDatabasePortal::getData(), TeDatabase::getPortal(), TeAbstractTheme::legend(), TeDatabase::metaModel_, NULL, TeDatabasePortal::query(), TeDatabase::tableExist(), and Te2String().
Referenced by TeTheme::deleteGrouping(), TeExternalTheme::deleteGrouping(), generateCountLegends(), TeTheme::saveGrouping(), TeFirebird::updateTheme(), and TeDatabase::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, inherited] |
Definition at line 9707 of file TeDatabase.cpp.
References TeDatabase::errorMessage_, TeDatabase::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, inherited] |
Definition at line 6879 of file TeDatabase.cpp.
References Te2String().
Referenced by TeDatabase::deleteLayer(), TeDatabase::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, inherited] |
Definition at line 9744 of file TeDatabase.cpp.
References TeDatabase::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 TeDatabase::execute().
10106 { 10107 string relation = "ALTER TABLE " + table + " DROP "; 10108 relation += " CONSTRAINT " + name; 10109 return execute(relation); 10110 }
Reimplemented from TeDatabase.
Definition at line 443 of file TePostgreSQL.cpp.
References TePGRecordset::close(), TeDatabase::errorMessage_, execute(), TePGRecordset::getData(), TePGRecordset::open(), TePGRecordset::recordCount(), and tepg_connection_.
00444 { 00445 int f = table.find ("te_collection"); 00446 00447 if( table=="te_theme" || 00448 table=="te_layer" || 00449 table=="te_representation" || 00450 table=="te_tables_relation" || 00451 table=="te_layer_table" || 00452 table=="te_raster_metadata" || 00453 table=="te_projection" || 00454 table=="te_view" || 00455 table=="te_legend" || 00456 table=="te_visual" || 00457 table=="te_database" || 00458 f == 0) 00459 { 00460 errorMessage_ = "N�o � poss�vel deletar tabelas do modelo!"; 00461 return false; 00462 } 00463 00464 if (table.empty()) 00465 return false; 00466 00467 errorMessage_ = ""; 00468 00469 std::string sql = "SELECT relname, relkind FROM pg_class WHERE lower(relname) = lower('" + table + "')"; 00470 00471 TePGRecordset rec; 00472 if(!rec.open(sql, tepg_connection_)) 00473 return false; 00474 00475 if(rec.recordCount() == 0) 00476 { 00477 return false; 00478 } 00479 00480 std::string dbTableName = rec.getData(0); 00481 std::string kind = rec.getData(1); 00482 00483 rec.close(); 00484 00485 std::string del = "DROP TABLE \"" + dbTableName + "\""; 00486 if(kind == "v") 00487 { 00488 del = "DROP VIEW \"" + dbTableName + "\""; 00489 } 00490 00491 if(!execute(del)) 00492 { 00493 return false; 00494 } 00495 00496 return true; 00497 }
| bool TeDatabase::deleteTheme | ( | int | themeId | ) | [virtual, inherited] |
Reimplemented in TeSqlServer.
Definition at line 4886 of file TeDatabase.cpp.
References TeAbstractTheme::eraseMetadata(), TeDatabase::execute(), TeDatabase::existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), TeDatabasePortal::getData(), TeDatabasePortal::getInt(), TeRasterTransform::getLutTableName(), TeDatabase::getPortal(), TeDatabase::invalidThemeMap(), TeAbstractTheme::legend(), TeDatabase::legendMap(), TeDatabasePortal::query(), TeAbstractTheme::rasterVisual(), TeView::remove(), Te2String(), TeNoRelation, TeRICascadeDeletion, TeDatabase::themeMap(), and TeDatabase::viewMap().
Referenced by deleteAppTheme(), TeOCIOracle::deleteLayer(), TeDatabase::deleteLayer(), TeOracle::deleteLayer(), TeDatabase::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, inherited] |
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, inherited] |
Reimplemented in TeSqlServer.
Definition at line 3554 of file TeDatabase.cpp.
References TeDatabase::deleteProjection(), TeDatabase::deleteTheme(), TeDatabase::existRelation(), TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), TeDatabasePortal::getData(), TeDatabasePortal::getInt(), TeDatabase::getPortal(), TeDatabase::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 }
| bool TePostgreSQL::dropDatabase | ( | const std::string & | databaseName | ) | [virtual] |
Reimplemented from TeDatabase.
Definition at line 411 of file TePostgreSQL.cpp.
References TeDatabase::errorMessage_, execute(), TePGConnection::state(), TeConvertToUpperCase(), and tepg_connection_.
00412 { 00413 std::string sql; 00414 if( TeConvertToUpperCase(this->database_) == TeConvertToUpperCase(databaseName) ) 00415 { 00416 errorMessage_="Impossible drop the current database"; 00417 return false; 00418 } 00419 00420 if(tepg_connection_->state() == false) return false; 00421 errorMessage_.clear(); 00422 sql="DROP DATABASE " + databaseName; 00423 return this->execute(sql); 00424 }
Definition at line 10113 of file TeDatabase.cpp.
References TeDatabase::execute().
10114 { 10115 string del = "DROP VIEW " + dbViewName; 10116 return (execute(del)); 10117 }
| string TePostgreSQL::errorMessage | ( | ) | [virtual] |
Reimplemented from TeDatabase.
Definition at line 115 of file TePostgreSQL.cpp.
References TePGConnection::err_msg(), TeDatabase::errorMessage_, and tepg_connection_.
Referenced by newDatabase(), and TePostGIS::newDatabase().
00116 { 00117 if(errorMessage_.empty()) 00118 return tepg_connection_->err_msg(); 00119 else 00120 return errorMessage_; 00121 00122 }
| virtual int TeDatabase::errorNum | ( | ) | [inline, virtual, inherited] |
Reimplemented in TeMySQL.
Definition at line 166 of file TeDatabase.h.
Referenced by TeTheme::populateCollection().
00167 { return errorNumber_; }
Implements TeDatabase.
Definition at line 3764 of file TePostgreSQL.cpp.
References aux, and TePGConnection::escapeString().
Referenced by insertArc(), insertCell(), TePostGIS::insertCell(), insertLegend(), insertLine(), TePostGIS::insertLine(), insertNode(), TePostGIS::insertNode(), insertPoint(), TePostGIS::insertPoint(), insertPolygon(), TePostGIS::insertPolygon(), insertTable(), insertText(), insertTheme(), TePostGIS::updateCell(), updateLine(), TePostGIS::updateLine(), updateNode(), TePostGIS::updateNode(), updatePoint(), TePostGIS::updatePoint(), updatePolygon(), TePostGIS::updatePolygon(), and updateTable().
03765 { 03766 size_t newLen = 0; 03767 03768 03769 char* aux = TePGConnection::escapeString(from.c_str(), from.length(), newLen); 03770 03771 string str = aux; 03772 03773 delete [] aux; 03774 03775 return str; 03776 }
Implements TeDatabase.
Definition at line 851 of file TePostgreSQL.cpp.
References TePGConnection::exec_cmd(), and tepg_connection_.
Referenced by alterTable(), connect(), TePostGIS::connect(), createRelation(), createSpatialIndex(), TePostGIS::createSpatialIndex(), createTable(), TePostGIS::createTable(), deleteTable(), dropDatabase(), generateLabelPositions(), TePostGIS::generateLabelPositions(), insertBlob(), insertRasterBlock(), insertTable(), newDatabase(), TePostGIS::newDatabase(), TePostGIS::removeGeometry(), setClientEncoding(), and updateTable().
00852 { 00853 try 00854 { 00855 this->tepg_connection_->exec_cmd(sql); 00856 } 00857 00858 catch(...) 00859 { 00860 return false; 00861 } 00862 00863 return true; 00864 }
| TeDBRelationType TePostgreSQL::existRelation | ( | const string & | tableName, | |
| const string & | relName | |||
| ) | [virtual] |
Implements TeDatabase.
Definition at line 825 of file TePostgreSQL.cpp.
References TePGRecordset::close(), TeDatabase::errorMessage_, TePGRecordset::getData(), TePGRecordset::recordCount(), TeNoRelation, tepg_connection_, TeRICascadeDeletion, and TeRINoCascadeDeletion.
00826 { 00827 errorMessage_ = ""; 00828 std::string sql = "select confdeltype from pg_constraint where conname = '" + relName + "'"; 00829 00830 TeDBRelationType resp = TeNoRelation; 00831 00832 TePGRecordset r(sql, tepg_connection_); 00833 if(r.recordCount() > 0) 00834 { 00835 std::string delType = r.getData(0); 00836 if(delType == "c") 00837 { 00838 resp = TeRICascadeDeletion; 00839 } 00840 else 00841 { 00842 resp = TeRINoCascadeDeletion; 00843 } 00844 } 00845 00846 r.close(); 00847 00848 return resp; 00849 }
| bool TePostgreSQL::generateLabelPositions | ( | TeTheme * | theme, | |
| const std::string & | objectId = "" | |||
| ) | [virtual] |
Reimplemented from TeDatabase.
Reimplemented in TePostGIS.
Definition at line 1995 of file TePostgreSQL.cpp.
References TeTheme::collectionTable(), execute(), TeTheme::layer(), tableExist(), TeCELLS, TeLINES, TePOINTS, and TePOLYGONS.
01996 { 01997 string geomTable, upd; 01998 string collTable = theme->collectionTable(); 01999 02000 if((collTable.empty()) || (!tableExist(collTable))) 02001 return false; 02002 02003 if(theme->layer()->hasGeometry(TeCELLS) || 02004 theme->layer()->hasGeometry(TePOLYGONS) || 02005 theme->layer()->hasGeometry(TeLINES)) 02006 { 02007 geomTable = theme->layer()->tableName(TeCELLS); 02008 02009 if(geomTable.empty()) 02010 { 02011 geomTable = theme->layer()->tableName(TePOLYGONS); 02012 if(geomTable.empty()) 02013 { 02014 geomTable = theme->layer()->tableName(TeLINES); 02015 02016 if(geomTable.empty()) 02017 return false; 02018 } 02019 } 02020 02021 string lower_x = "(((" + geomTable + ".spatial_box[1])[0]))"; 02022 string lower_y = "(((" + geomTable + ".spatial_box[1])[1]))"; 02023 string upper_x = "(((" + geomTable + ".spatial_box[0])[0]))"; 02024 string upper_y = "(((" + geomTable + ".spatial_box[0])[1]))"; 02025 02026 upd = " UPDATE " + collTable + " SET "; 02027 upd += " label_x = (SELECT MAX(" + lower_x + " + (" + upper_x; 02028 upd += " - " + lower_x + ") / 2.0) "; 02029 upd += "FROM " + geomTable + " WHERE object_id = c_object_id), "; 02030 02031 upd += " label_y = (SELECT MAX(" + lower_y + " + (" + upper_y; 02032 upd += " - " + lower_y + ") / 2.0) "; 02033 upd += "FROM " + geomTable + " WHERE object_id = c_object_id) "; 02034 02035 upd += " WHERE (label_x IS NULL) OR (label_y IS NULL)"; 02036 } 02037 else if(theme->layer()->hasGeometry(TePOINTS)) 02038 { 02039 geomTable = theme->layer()->tableName(TePOINTS); 02040 02041 upd = " UPDATE " + collTable + " SET "; 02042 upd += " label_x = (SELECT MAX(x)"; 02043 upd += " FROM " + geomTable + " WHERE object_id = c_object_id), "; 02044 02045 02046 upd += " label_y = (SELECT MAX(y)"; 02047 upd += " FROM " + geomTable + " WHERE object_id = c_object_id) "; 02048 02049 upd += " WHERE (label_x IS NULL) OR (label_y IS NULL)"; 02050 } 02051 02052 if (!upd.empty()) 02053 { 02054 if (!objectId.empty()) 02055 { 02056 upd += " AND c_object_id='"+objectId+"'"; 02057 } 02058 if(!execute(upd)) 02059 return false; 02060 } 02061 02062 return true; 02063 }
| bool TeDatabase::geomDifference | ( | const string & | actGeomTable, | |
| TeGeomRep | actRep, | |||
| const string & | objId1, | |||
| const string & | visGeomTable, | |||
| TeGeomRep | visRep, | |||
| const string & | objId2, | |||
| TeGeometryVect & | geomVect | |||
| ) | [virtual, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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, inherited] |
| 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 TePostgreSQL::getAttributeList | ( | const string & | tableName, | |
| TeAttributeList & | attList | |||
| ) | [virtual] |
Reimplemented from TeDatabase.
Definition at line 3992 of file TePostgreSQL.cpp.
References TePGRecordset::close(), columnName(), TeDatabase::errorMessage_, TeDatabasePortal::fetchRow(), TeDatabasePortal::freeResult(), TeDatabasePortal::getAttributeList(), TeDatabase::getAttributeList(), TeDatabasePortal::getData(), TePGRecordset::getData(), getPortal(), TePGRecordset::open(), TeDatabasePortal::query(), TePGRecordset::recordCount(), TeConvertToUpperCase(), tepg_connection_, and toUpper().
03993 { 03994 //recupera o nome da tabela da forma que ela esta salva no banco. 03995 if (tableName.empty()) 03996 return false; 03997 03998 errorMessage_ = ""; 03999 04000 string sql = "SELECT relname FROM pg_class WHERE lower(relname) = lower('" + tableName + "')"; 04001 TePGRecordset rec; 04002 if(!rec.open(sql, tepg_connection_) || rec.recordCount() == 0) 04003 { 04004 rec.close(); 04005 TeDatabase::getAttributeList(tableName, attList); 04006 return false; 04007 } 04008 04009 std::string tableNameDB = rec.getData(0); 04010 04011 rec.close(); 04012 04013 //em seguida recupera a lista de atributos 04014 TeDatabasePortal* portal = this->getPortal(); 04015 if (!portal) 04016 return false; 04017 04018 sql = "SELECT * FROM \"" + tableNameDB + "\" WHERE 1=2"; 04019 if (!portal->query(sql)) 04020 { 04021 delete portal; 04022 return false; 04023 } 04024 else 04025 { 04026 attList = portal->getAttributeList(); 04027 } 04028 04029 portal->freeResult(); 04030 04031 //por fim preenchemos as informacoes com relacao as chaves 04032 sql =