| TerraLib 4.1

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

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

Public Member Functions | Protected Attributes
TeDatabasePortal Class Reference

An abstract access portal to a database. More...

`#include <TeDatabase.h>`

Inheritance diagram for TeDatabasePortal:

List of all members.

## Public Member Functions

| TeDatabasePortal ()
| Constructor.
virtual | ~TeDatabasePortal ()
| Destructor.
TeDatabase * | getDatabase ()
| Returns the database associated to this portal.
virtual bool | query (const string &qry, TeCursorLocation l=TeSERVERSIDE, TeCursorType t=TeUNIDIRECTIONAL, TeCursorEditType e=TeREADONLY, TeCursorDataType dt=TeTEXTCURSOR)=0
| Executes a SQL query that opens a record set.
virtual bool | fetchRow ()=0
| Fetchs the next row in a record set that shouldve been previously opened.
virtual bool | fetchRow (int i)=0
| Fetchs a particular row.
virtual void | freeResult ()=0
| Frees the current record set.
virtual string | errorMessage ()
| Gets the last error message.
virtual int | errorNum ()
| Gets the number of the last error message.
int | numRows ()
| Retrieves the number of rows in a portal. Some drivers (like PostgreSQL and PostGIS) brings to the client only a part of the row, and then this number can be less than the number of rows returned by query.
int | numFields ()
| Retrieves the number of fields in this portal.
TeAttributeList & | getAttributeList ()
| Retrieves attribute list in this portal.
TeAttribute | getAttribute (int i)
| Retrieves the i-th attribute in this portal.
TeAttribute | getAttribute (const string &s)
| Retrieves an attribute by name.
virtual char * | getData (int i)=0
| Gets the value of the i-th attribute as a literal.
virtual char * | getData (const string &s)=0
| Gets the value of a named attribute as a literal.
virtual double | getDouble (int i)
| Gets the value of the i-th attribute as a double.
virtual double | getDouble (const string &s)
| Gets the value of a named attribute as a double.
virtual int | getInt (int i)
| Gets the value of the i-th attribute as an integer.
virtual int | getInt (const string &s)
| Gets the value of a named attribute as an integer.
virtual bool | getBool (const string &s)=0
| Gets the value of a named attribute as a boolean.
virtual bool | getBool (int i)=0
| Gets the value of the i-th attribute as a boolean.
virtual TeTime | getDate (int i)=0
| Gets the value of the i-th attribute as a date.
virtual TeTime | getDate (const string &s)=0
| Gets the value of a named attribute as a date.
virtual string | getDateAsString (int i)=0
| Gets the of a date/time attribute as a string formatted as accepted in further SQL statements.
virtual string | getDateAsString (const string &s)=0
| Gets the of a date/time attribute as a string formatted as accepted in further SQL statements.
virtual bool | getBlob (const string &s, unsigned char *&data, long &size)=0
| Gets the value of a named BLOB attribute.
int | getColumnIndex (const string &s)
| Gets the index of a named attribute.
string | getColumnName (int i)
| Gets the name of the i-th attribute.
Data Model
The following methods decodify structures as stored in the database according to the data model proposed in TerraLib.
virtual TeViewTree * | getViewTree ()
virtual TeLegendEntry | getLegend ()
virtual void | getVisual (TeVisual *)
virtual bool | getVisual (TeVisual *vis, TeGeomRep &rep, const unsigned int &initIndex)
virtual bool | getRasterVisual (TeRasterVisual &vis, const unsigned int &initIndex=0)
virtual TeColor | getColor ()
virtual bool | getRasterBlock (unsigned long &size, unsigned char *ptData)=0
virtual bool | getView (TeView &view, const unsigned int &initIndex=0)
virtual void | getDatum (TeDatum &datum, const unsigned int &initIndex=0)
virtual bool | getProjection (TeProjection **proj, const unsigned int &initIndex=0)
virtual void | getViewNodeParams (TeViewNodeParams &params, const unsigned int &initIndex=0)
virtual bool | getTheme (TeAbstractTheme &theme, const unsigned int &initIndex=0)
virtual bool | getGrouping (TeGrouping &group, const unsigned int &initIndex=0)
virtual bool | getLegend (TeLegendEntry &leg, const unsigned int &initIndex=0)
virtual bool | getAttrTable (TeTable &table, const unsigned int &initIndex=0)
virtual bool | getLayer (TeLayer &layer, const unsigned int &initIndex=0)
virtual bool | getRepresentation (TeRepresentation &rep, const unsigned int &initIndex=0)
Fetch Geometry
The following methods decodify geometries as stored in the database according to the data model proposed in TerraLib.

Parameters:

  geom | the geometry that will be filled from portal
  initIndex | the position index in the portal where begins the geometry information

Returns:
  The fetchGeometry methods advance the portal to the next record and they return TRUE if there are more records to be read and FALSE otherwise.

virtual bool | fetchGeometry (TePolygon &geom)=0
virtual bool | fetchGeometry (TePolygon &geom, const unsigned int &initIndex)
virtual bool | fetchGeometry (TeLine2D &geom)=0
virtual bool | fetchGeometry (TeLine2D &geom, const unsigned int &initIndex)
virtual bool | fetchGeometry (TeNode &geom)=0
virtual bool | fetchGeometry (TeNode &geom, const unsigned int &initIndex)
virtual bool | fetchGeometry (TePoint &geom)=0
virtual bool | fetchGeometry (TePoint &geom, const unsigned int &initIndex)
virtual bool | fetchGeometry (TeCell &geom)
virtual bool | fetchGeometry (TeCell &geom, const unsigned int &initIndex)
virtual bool | fetchGeometry (TeArc &geom)
virtual bool | fetchGeometry (TeArc &geom, const unsigned int &initIndex)
virtual bool | fetchGeometry (TeText &geom)
virtual bool | fetchGeometry (TeText &geom, const unsigned int &initIndex)

## Protected Attributes

TeDatabase * | db_
| the database associated to this portal
TeAttributeList | attList_
| the list of attributes associated to this portal
int | numRows_
| the number of rows in this portal
int | numFields_
| the number of fields in this portal
string | errorMessage_
| error message
int | errorNumber_
| error number

## Detailed Description

An abstract access portal to a database.

A portal has a concept of a record set, that is generated by a selection (query) on the data accessible through a connection to a database server.

See also:
  TeDatabase, TeGeometry, TeTable, TeTheme, TeView, TeLayer

Examples:

  createTable.cpp, and databaseSQLQuery.cpp.

## Constructor & Destructor Documentation

TeDatabasePortal::TeDatabasePortal | ( |  | ) |

Constructor.

TeDatabasePortal::~TeDatabasePortal | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual string TeDatabasePortal::errorMessage | ( |  | ) | `[inline, virtual]`

Gets the last error message.

Reimplemented in TeMySQLPortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual int TeDatabasePortal::errorNum | ( |  | ) | `[inline, virtual]`

Gets the number of the last error message.

Reimplemented in TeMySQLPortal.

virtual bool TeDatabasePortal::fetchGeometry | ( | TePolygon & | geom | ) | `[pure virtual]`

Implemented in TeAdoPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

Examples:
  databaseSQLQuery.cpp.

bool TeDatabasePortal::fetchGeometry | ( | TePolygon & | geom,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

Reimplemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

bool TeDatabasePortal::fetchGeometry | ( | TeArc & | geom | ) | `[virtual]`

virtual bool TeDatabasePortal::fetchGeometry | ( | TeLine2D & | geom | ) | `[pure virtual]`

Implemented in TeAdoPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

bool TeDatabasePortal::fetchGeometry | ( | TeLine2D & | geom,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

Reimplemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual bool TeDatabasePortal::fetchGeometry | ( | TeNode & | geom | ) | `[pure virtual]`

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

bool TeDatabasePortal::fetchGeometry | ( | TeNode & | geom,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

Reimplemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual bool TeDatabasePortal::fetchGeometry | ( | TePoint & | geom | ) | `[pure virtual]`

Implemented in TeAdoPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

bool TeDatabasePortal::fetchGeometry | ( | TePoint & | geom,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

Reimplemented in TeAdoPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TeOracleSpatialPortal, TePostGISPortal, TePostgreSQLPortal, and TeSQLitePortal.

bool TeDatabasePortal::fetchGeometry | ( | TeCell & | geom | ) | `[virtual]`

Reimplemented in TeOracleSpatialPortal, TePostGISPortal, and TePostgreSQLPortal.

bool TeDatabasePortal::fetchGeometry | ( | TeCell & | geom,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

Reimplemented in TeOracleSpatialPortal, TePostGISPortal, and TePostgreSQLPortal.

bool TeDatabasePortal::fetchGeometry | ( | TeArc & | geom,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

bool TeDatabasePortal::fetchGeometry | ( | TeText & | geom | ) | `[virtual]`

bool TeDatabasePortal::fetchGeometry | ( | TeText & | geom,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

virtual bool TeDatabasePortal::fetchRow | ( | int | i | ) | `[pure virtual]`

Fetchs a particular row.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual bool TeDatabasePortal::fetchRow | ( |  | ) | `[pure virtual]`

Fetchs the next row in a record set that shouldve been previously opened.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

Examples:
  createTable.cpp, and databaseSQLQuery.cpp.

virtual void TeDatabasePortal::freeResult | ( |  | ) | `[pure virtual]`

Frees the current record set.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

TeAttribute TeDatabasePortal::getAttribute | ( | int | i | ) |

Retrieves the i-th attribute in this portal.

TeAttribute TeDatabasePortal::getAttribute | ( | const string & | s | ) |

Retrieves an attribute by name.

TeAttributeList& TeDatabasePortal::getAttributeList | ( |  | ) | `[inline]`

Retrieves attribute list in this portal.

bool TeDatabasePortal::getAttrTable | ( | TeTable & | table,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

virtual bool TeDatabasePortal::getBlob | ( | const string & | s,
|  | unsigned char *& | data,
|  | long & | size
| ) |  | `[pure virtual]`

Gets the value of a named BLOB attribute.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual bool TeDatabasePortal::getBool | ( | const string & | s | ) | `[pure virtual]`

Gets the value of a named attribute as a boolean.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual bool TeDatabasePortal::getBool | ( | int | i | ) | `[pure virtual]`

Gets the value of the i-th attribute as a boolean.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

TeColor TeDatabasePortal::getColor | ( |  | ) | `[virtual]`

int TeDatabasePortal::getColumnIndex | ( | const string & | s | ) |

Gets the index of a named attribute.

Reimplemented in TeSQLitePortal.

string TeDatabasePortal::getColumnName | ( | int | i | ) |

Gets the name of the i-th attribute.

virtual char* TeDatabasePortal::getData | ( | const string & | s | ) | `[pure virtual]`

Gets the value of a named attribute as a literal.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual char* TeDatabasePortal::getData | ( | int | i | ) | `[pure virtual]`

Gets the value of the i-th attribute as a literal.

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

Examples:
  createTable.cpp.

TeDatabase* TeDatabasePortal::getDatabase | ( |  | ) | `[inline]`

Returns the database associated to this portal.

virtual TeTime TeDatabasePortal::getDate | ( | int | i | ) | `[pure virtual]`

Gets the value of the i-th attribute as a date.

Implemented in TeAdoPortal, TeOraclePortal, TeSqlServerPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

Examples:
  createTable.cpp.

virtual TeTime TeDatabasePortal::getDate | ( | const string & | s | ) | `[pure virtual]`

Gets the value of a named attribute as a date.

Implemented in TeAdoPortal, TeOraclePortal, TeSqlServerPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual string TeDatabasePortal::getDateAsString | ( | const string & | s | ) | `[pure virtual]`

Gets the of a date/time attribute as a string formatted as accepted in further SQL statements.

Implemented in TeAdoPortal, TeOraclePortal, TeSqlServerPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

virtual string TeDatabasePortal::getDateAsString | ( | int | i | ) | `[pure virtual]`

Gets the of a date/time attribute as a string formatted as accepted in further SQL statements.

Implemented in TeAdoPortal, TeOraclePortal, TeSqlServerPortal, TeSqlServerSpatialPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

void TeDatabasePortal::getDatum | ( | TeDatum & | datum,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

double TeDatabasePortal::getDouble | ( | const string & | s | ) | `[virtual]`

Gets the value of a named attribute as a double.

Reimplemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, and TePostgreSQLPortal.

double TeDatabasePortal::getDouble | ( | int | i | ) | `[virtual]`

Gets the value of the i-th attribute as a double.

Reimplemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, and TePostgreSQLPortal.

Examples:
  createTable.cpp.

bool TeDatabasePortal::getGrouping | ( | TeGrouping & | group,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

int TeDatabasePortal::getInt | ( | int | i | ) | `[virtual]`

Gets the value of the i-th attribute as an integer.

Reimplemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

int TeDatabasePortal::getInt | ( | const string & | s | ) | `[virtual]`

Gets the value of a named attribute as an integer.

Reimplemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

bool TeDatabasePortal::getLayer | ( | TeLayer & | layer,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

bool TeDatabasePortal::getLegend | ( | TeLegendEntry & | leg,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

TeLegendEntry TeDatabasePortal::getLegend | ( |  | ) | `[virtual]`

bool TeDatabasePortal::getProjection | ( | TeProjection ** | proj,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

virtual bool TeDatabasePortal::getRasterBlock | ( | unsigned long & | size,
|  | unsigned char * | ptData
| ) |  | `[pure virtual]`

Implemented in TeAdoPortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

bool TeDatabasePortal::getRasterVisual | ( | TeRasterVisual & | vis,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

bool TeDatabasePortal::getRepresentation | ( | TeRepresentation & | rep,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

bool TeDatabasePortal::getTheme | ( | TeAbstractTheme & | theme,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

bool TeDatabasePortal::getView | ( | TeView & | view,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

void TeDatabasePortal::getViewNodeParams | ( | TeViewNodeParams & | params,
|  | const unsigned int & | initIndex = `0`
| ) |  | `[virtual]`

TeViewTree * TeDatabasePortal::getViewTree | ( |  | ) | `[virtual]`

bool TeDatabasePortal::getVisual | ( | TeVisual * | vis,
|  | TeGeomRep & | rep,
|  | const unsigned int & | initIndex
| ) |  | `[virtual]`

void TeDatabasePortal::getVisual | ( | TeVisual * | vis | ) | `[virtual]`

int TeDatabasePortal::numFields | ( |  | ) | `[inline]`

Retrieves the number of fields in this portal.

int TeDatabasePortal::numRows | ( | void |  | ) | `[inline]`

Retrieves the number of rows in a portal. Some drivers (like PostgreSQL and PostGIS) brings to the client only a part of the row, and then this number can be less than the number of rows returned by query.

virtual bool TeDatabasePortal::query | ( | const string & | qry,
|  | TeCursorLocation | l = `TeSERVERSIDE`,
|  | TeCursorType | t = `TeUNIDIRECTIONAL`,
|  | TeCursorEditType | e = `TeREADONLY`,
|  | TeCursorDataType | dt = `TeTEXTCURSOR`
| ) |  | `[pure virtual]`

Executes a SQL query that opens a record set.

Implemented in TeAdoPortal, TeOraclePortal, TeFirebirdPortal, TeMySQLPortal, TeOCIOraclePortal, TePostgreSQLPortal, and TeSQLitePortal.

Examples:
  createTable.cpp, and databaseSQLQuery.cpp.

## Member Data Documentation

TeAttributeList TeDatabasePortal::attList_`[protected]`

the list of attributes associated to this portal

TeDatabase* TeDatabasePortal::db_`[protected]`

the database associated to this portal

string TeDatabasePortal::errorMessage_`[protected]`

error message

int TeDatabasePortal::errorNumber_`[protected]`

error number

int TeDatabasePortal::numFields_`[protected]`

the number of fields in this portal

int TeDatabasePortal::numRows_`[protected]`

the number of rows in this portal

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeDatabase.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeDatabase.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines