| TerraLib 4.1

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

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

Public Member Functions | Protected Member Functions | Protected Attributes | Friends
TeOCIOracle Class Reference

A concrete implementation of a interface driver to the ORACLE DBMS. More...

`#include <TeOCIOracle.h>`

Inheritance diagram for TeOCIOracle:

List of all members.

## Public Member Functions

| TeOCIOracle ()
| Constructor.
| ~TeOCIOracle ()
| Destructor.
string | escapeSequence (const string &from)
| Escapes special characters in a string to be used in a SQL statement.
bool | beginTransaction ()
| Begins a transaction.
bool | commitTransaction ()
| Commits a transaction.
bool | rollbackTransaction ()
| Rollbacks a transaction.
virtual bool | newDatabase (const string &database, const string &user, const string &password, const string &host, const int &port=0, bool terralibModel=true, const std::string &characterSet="")
| Connects to a Oracle DBMS and creates the TerraLib conceptual data model.
virtual bool | connect (const string &host, const string &user, const string &password, const string &database, int port=0)
| Connects to a Oracle DBMS.
bool | listTables (vector< string > &tableList)
| Lists all tables in the database.
void | close ()
| Closes the connection to a Oracle DBMS.
bool | tableExist (const string &table)
| Verify if there is a specific table in the database.
bool | viewExist (const string &view)
| Verify if there is a specific view in the database.
bool | columnExist (const string &table, const string &column, TeAttribute &attr)
| Verify if there is a specific column in a table.
virtual bool | createTable (const string &table, TeAttributeList &attr)
| Creates a new table.
bool | addColumn (const string &table, TeAttributeRep &rep)
| Adds a new column in a table.
bool | deleteTable (const string &table)
| Deletes a specific table.
bool | execute (const string &sql)
| Executes a SQL statement that does not return rows (INSERT, UPDATE, CREATE, etc.)
virtual TeDatabasePortal * | getPortal ()
| Gets a cursor or record set using the opened connection.
TeDBRelationType | existRelation (const string &tableName, const string &relName)
| Verify if there is a relation associated to a specific table.
bool | createRelation (const string &name, const string &table, const string &fieldName, const string &relatedTable, const string &relatedField, bool cascadeDeletion)
| Creates a new relation between two tables.
virtual bool | getIndexesFromTable (const string &tableName, std::vector< TeDatabaseIndex > &vecIndexes)
| Return a TeDatabaseIndex vector from a table.
virtual bool | generateLabelPositions (TeTheme *theme, const std::string &objectId="")
| Generates label positions to each object of a theme.
string | concatValues (vector< string > &values, const string &unionString)
| Concats values in a vector using unionString as the join between each value.
virtual bool | getAttributeList (const string &tableName, TeAttributeList &attList)
| Gets the list of attributes of a table.
Inserts, updates and deletes geometries from the tables
bool | insertTableInfo (int layerId, TeTable &table, const string &user="")
| Inserts information about an attribute table.
bool | insertRelationInfo (const int tableId, const string &tField, const string &rName, const string &rField, int &relId)
| Inserts information about a link to an external table.
bool | alterTable (const string &table, TeAttributeRep &rep, const string &oldColName)
| Alter a property of a table.
bool | alterTable (const string &oldTableName, const string &newTablename)
| Alter the table name.
bool | insertTable (TeTable &table)
| Saves a table and its contents in the database.
bool | updateTable (TeTable &table)
| Updates a table and its contents in the database.
bool | insertProjection (TeProjection *proj)
| Insert information about a geographical projection.
bool | insertRepresentation (int layerId, TeRepresentation &rep)
| Inserts information about a geometrical representation.
bool | insertLegend (TeLegendEntry *legend)
| Inserts legend in the database.
bool | insertView (TeView *view)
| Inserts a view.
bool | insertViewTree (TeViewTree *tree)
| Recursive inserting of a view tree.
bool | insertTheme (TeAbstractTheme *theme)
| Inserts an abstract theme in the database.
bool | insertThemeTable (int themeId, int tableId, int relationId, int tableOrder)
| Inserts information about a table used by a theme.
bool | insertThemeGroup (TeViewTree *tree)
| Inserts a group of themes in the database.
bool | insertLayer (TeLayer *layer)
| Insert information about a layer.
bool | insertProject (TeProject *project)
| Insert information about a project.
bool | deleteLayer (int layerId)
| Delete a particular layer passing its id.
Inserts, updates and deletes geometry tables
bool | getValueSequence (const string &table)
virtual bool | insertPolygonSet (const string &table, TePolygonSet &ps)
| Inserts a polygon set in a geometry table.
virtual bool | insertPolygon (const string &table, TePolygon &p)
| Inserts a polygon in a geometry table.
virtual bool | updatePolygon (const string &table, TePolygon &p)
| Updates a polygon in a geometry table.
virtual bool | insertLineSet (const string &table, TeLineSet &ls)
virtual bool | insertLine (const string &table, TeLine2D &l)
virtual bool | updateLine (const string &table, TeLine2D &l)
virtual bool | insertPoint (const string &table, TePoint &p)
virtual bool | insertText (const string &table, TeText &t)
virtual bool | insertArc (const string &table, TeArc &arc)
| Inserts an arc geometry in the database.
virtual bool | insertNode (const string &table, TeNode &node)
virtual bool | insertCell (const string &table, TeCell &c)
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.
Methods to deal with large binary objects (BLOB)
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.
Methods that return specific SQL statement according to each DBMS
string | getSQLStatistics (TeGroupingAttr &attrs)
| Return a string SQL to calculate the statistics of some attributes.
string | getSQLAutoNumber (const string &table)
| Return the database function in SQL to generate autonumber values.
string | getSQLTime (const TeTime &time) const
| Returns a valid SQL time string.
string | toUpper (const string &value)
| Returns the SQL function for upper case.

## Protected Member Functions

bool | createSequence (const string &seqName)
| Creates a internal sequence structure in the Oracle DBMS.
bool | createAutoIncrementTrigger (const string &tableName, const string &fieldName)
| Creates a internal trigger structure in the Oracle DBMS.
string | getNameSequence (const string &tableName)
| Returns the sequence name created to a specific table.
string | getNameTrigger (const string &tableName)
| Returns the trigger name created to a specific table.

## Protected Attributes

TeOCIConnection * | connection_
| pointer to a opened connection to ORACLE database server
long | sequenceCont_
| sequential number used to improve the data insertion
string | sequenceName_
| sequence name used to improve the data insertion

## Friends

class | TeOCIOraclePortal

## Detailed Description

A concrete implementation of a interface driver to the ORACLE DBMS.

This class contains attributes and methods to implement a driver of interface between TerraLib and ORACLE DBMS using OCI (Oracle Call Interface) library. The class TeOCIOracle implements the abstract interface defined by the class TeDatabase.

See also:
  TeDatabase TeOCIConnect

## Constructor & Destructor Documentation

TeOCIOracle::TeOCIOracle | ( |  | ) |

Constructor.

TeOCIOracle::~TeOCIOracle | ( |  | ) |

Destructor.

## Member Function Documentation

bool TeOCIOracle::addColumn | ( | const string & | table,
|  | TeAttributeRep & | rep
| ) |  | `[virtual]`

Adds a new column in a table.

Implements TeDatabase.

bool TeOCIOracle::alterTable | ( | const string & | tableName,
|  | TeAttributeRep & | rep,
|  | const string & | oldColName
| ) |  | `[virtual]`

Alter a property of a table.

Reimplemented from TeDatabase.

bool TeOCIOracle::alterTable | ( | const string & | oldTableName,
|  | const string & | newTablename
| ) |  | `[virtual]`

Alter the table name.

Reimplemented from TeDatabase.

bool TeOCIOracle::beginTransaction | ( |  | ) | `[virtual]`

Begins a transaction.

Reimplemented from TeDatabase.

void TeOCIOracle::close | ( | void |  | ) | `[virtual]`

Closes the connection to a Oracle DBMS.

Implements TeDatabase.

bool TeOCIOracle::columnExist | ( | const string & | table,
|  | const string & | column,
|  | TeAttribute & | attr
| ) |  | `[virtual]`

Verify if there is a specific column in a table.

Implements TeDatabase.

bool TeOCIOracle::commitTransaction | ( |  | ) | `[virtual]`

Commits a transaction.

Reimplemented from TeDatabase.

string TeOCIOracle::concatValues | ( | vector< string > & | values,
|  | const string & | unionString
| ) |  | `[virtual]`

Concats values in a vector using unionString as the join between each value.

Implements TeDatabase.

bool TeOCIOracle::connect | ( | const string & | host,
|  | const string & | user,
|  | const string & | password,
|  | const string & | database,
|  | int | port = `0`
| ) |  | `[virtual]`

Connects to a Oracle DBMS.

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::createAutoIncrementTrigger | ( | const string & | tableName,
|  | const string & | fieldName
| ) |  | `[protected]`

Creates a internal trigger structure in the Oracle DBMS.

bool TeOCIOracle::createRelation | ( | const string & | name,
|  | const string & | table,
|  | const string & | fieldName,
|  | const string & | relatedTable,
|  | const string & | relatedField,
|  | bool | cascadeDeletion
| ) |  | `[virtual]`

Creates a new relation between two tables.

Implements TeDatabase.

bool TeOCIOracle::createSequence | ( | const string & | seqName | ) | `[protected]`

Creates a internal sequence structure in the Oracle DBMS.

bool TeOCIOracle::createTable | ( | const string & | table,
|  | TeAttributeList & | attr
| ) |  | `[virtual]`

Creates a new table.

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::deleteLayer | ( | int | layerId | ) | `[virtual]`

Delete a particular layer passing its id.

Reimplemented from TeDatabase.

bool TeOCIOracle::deleteTable | ( | const string & | table | ) | `[virtual]`

Deletes a specific table.

Reimplemented from TeDatabase.

string TeOCIOracle::escapeSequence | ( | const string & | from | ) | `[virtual]`

Escapes special characters in a string to be used in a SQL statement.

Implements TeDatabase.

bool TeOCIOracle::execute | ( | const string & | sql | ) | `[virtual]`

Executes a SQL statement that does not return rows (INSERT, UPDATE, CREATE, etc.)

Implements TeDatabase.

TeDBRelationType TeOCIOracle::existRelation | ( | const string & | tableName,
|  | const string & | relName
| ) |  | `[virtual]`

Verify if there is a relation associated to a specific table.

Implements TeDatabase.

bool TeOCIOracle::generateLabelPositions | ( | TeTheme * | theme,
|  | const std::string & | objectId = `""`
| ) |  | `[virtual]`

Generates label positions to each object of a theme.

Reimplemented from TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::getAttributeList | ( | const string & | tableName,
|  | TeAttributeList & | attList
| ) |  | `[virtual]`

Gets the list of attributes of a table.

Reimplemented from TeDatabase.

bool TeOCIOracle::getIndexesFromTable | ( | const string & | tableName,
|  | std::vector< TeDatabaseIndex > & | vecIndexes
| ) |  | `[virtual]`

Return a TeDatabaseIndex vector from a table.

Reimplemented from TeDatabase.

string TeOCIOracle::getNameSequence | ( | const string & | tableName | ) | `[protected]`

Returns the sequence name created to a specific table.

string TeOCIOracle::getNameTrigger | ( | const string & | tableName | ) | `[protected]`

Returns the trigger name created to a specific table.

TeDatabasePortal * TeOCIOracle::getPortal | ( |  | ) | `[virtual]`

Gets a cursor or record set using the opened connection.

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

string TeOCIOracle::getSQLAutoNumber | ( | const string & | table | ) | `[virtual]`

Return the database function in SQL to generate autonumber values.

Reimplemented from TeDatabase.

string TeOCIOracle::getSQLStatistics | ( | TeGroupingAttr & | attrs | ) | `[virtual]`

Return a string SQL to calculate the statistics of some attributes.

Reimplemented from TeDatabase.

string TeOCIOracle::getSQLTime | ( | const TeTime & |  | ) | const`[virtual]`

Returns a valid SQL time string.

Reimplemented from TeDatabase.

bool TeOCIOracle::getValueSequence | ( | const string & | table | ) |

bool TeOCIOracle::insertArc | ( | const string & | table,
|  | TeArc & | arc
| ) |  | `[virtual]`

Inserts an arc geometry in the database.

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertBlob | ( | const string & | tableName,
|  | const string & | columnBlob,
|  | const string & | whereClause,
|  | unsigned char * | data,
|  | int | size
| ) |  | `[virtual]`

Saves a large binary objects (BLOB) in a row table.

Implements TeDatabase.

bool TeOCIOracle::insertCell | ( | const string & | table,
|  | TeCell & | c
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertLayer | ( | TeLayer * | layer | ) | `[virtual]`

Insert information about a layer.

Implements TeDatabase.

bool TeOCIOracle::insertLegend | ( | TeLegendEntry * | legend | ) | `[virtual]`

Inserts legend in the database.

Implements TeDatabase.

bool TeOCIOracle::insertLine | ( | const string & | table,
|  | TeLine2D & | l
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertLineSet | ( | const string & | table,
|  | TeLineSet & | ls
| ) |  | `[virtual]`

Reimplemented from TeDatabase.

bool TeOCIOracle::insertNode | ( | const string & | table,
|  | TeNode & | node
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertPoint | ( | const string & | table,
|  | TePoint & | p
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertPolygon | ( | const string & | table,
|  | TePolygon & | p
| ) |  | `[virtual]`

Inserts a polygon in a geometry table.

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertPolygonSet | ( | const string & | table,
|  | TePolygonSet & | ps
| ) |  | `[virtual]`

Inserts a polygon set in a geometry table.

Reimplemented from TeDatabase.

bool TeOCIOracle::insertProject | ( | TeProject * | project | ) | `[virtual]`

Insert information about a project.

Implements TeDatabase.

bool TeOCIOracle::insertProjection | ( | TeProjection * | proj | ) | `[virtual]`

Insert information about a geographical projection.

Implements TeDatabase.

bool TeOCIOracle::insertRasterBlock | ( | const string & | table,
|  | const string & | blockId,
|  | const TeCoord2D & | ll,
|  | const TeCoord2D & | ur,
|  | unsigned char * | buf,
|  | unsigned long | size,
|  | int | band = `0`,
|  | unsigned int | res = `1`,
|  | unsigned int | subband = `0`
| ) |  | `[virtual]`

Insert a raster block into the database.

Parameters:

  table | table name
  blockId | block unique identifier
  ll | block lower left coordinate
  ur | block upper right coordinate
  buf | block binary data
  size | block size
  band | block band
  res | block resolution factor
  subband | sub band definitiion

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertRelationInfo | ( | const int | tableId,
|  | const string & | tField,
|  | const string & | rTable,
|  | const string & | rField,
|  | int & | relId
| ) |  | `[virtual]`

Inserts information about a link to an external table.

Implements TeDatabase.

bool TeOCIOracle::insertRepresentation | ( | int | layerId,
|  | TeRepresentation & | rep
| ) |  | `[virtual]`

Inserts information about a geometrical representation.

Implements TeDatabase.

bool TeOCIOracle::insertTable | ( | TeTable & | table | ) | `[virtual]`

Saves a table and its contents in the database.

Reimplemented from TeDatabase.

bool TeOCIOracle::insertTableInfo | ( | int | layerId,
|  | TeTable & | table,
|  | const string & | user = `""`
| ) |  | `[virtual]`

Inserts information about an attribute table.

Implements TeDatabase.

bool TeOCIOracle::insertText | ( | const string & | table,
|  | TeText & | t
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::insertTheme | ( | TeAbstractTheme * | theme | ) | `[virtual]`

Inserts an abstract theme in the database.

Implements TeDatabase.

bool TeOCIOracle::insertThemeGroup | ( | TeViewTree * | tree | ) | `[virtual]`

Inserts a group of themes in the database.

Implements TeDatabase.

bool TeOCIOracle::insertThemeTable | ( | int | themeId,
|  | int | tableId,
|  | int | relationId,
|  | int | tableOrder
| ) |  | `[virtual]`

Inserts information about a table used by a theme.

Implements TeDatabase.

bool TeOCIOracle::insertView | ( | TeView * | view | ) | `[virtual]`

Inserts a view.

Implements TeDatabase.

bool TeOCIOracle::insertViewTree | ( | TeViewTree * | tree | ) | `[virtual]`

Recursive inserting of a view tree.

Implements TeDatabase.

bool TeOCIOracle::listTables | ( | vector< string > & | tableList | ) | `[virtual]`

Lists all tables in the database.

Reimplemented from TeDatabase.

bool TeOCIOracle::newDatabase | ( | const string & | database,
|  | const string & | user,
|  | const string & | password,
|  | const string & | host,
|  | const int & | port = `0`,
|  | bool | terralibModel = `true`,
|  | const std::string & | characterSet = `""`
| ) |  | `[virtual]`

Connects to a Oracle DBMS and creates the TerraLib conceptual data model.

Implements TeDatabase.

bool TeOCIOracle::rollbackTransaction | ( |  | ) | `[virtual]`

Rollbacks a transaction.

Reimplemented from TeDatabase.

bool TeOCIOracle::tableExist | ( | const string & | table | ) | `[virtual]`

Verify if there is a specific table in the database.

Implements TeDatabase.

string TeOCIOracle::toUpper | ( | const string & | value | ) | `[virtual]`

Returns the SQL function for upper case.

Implements TeDatabase.

bool TeOCIOracle::updateLine | ( | const string & | table,
|  | TeLine2D & | l
| ) |  | `[virtual]`

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::updatePolygon | ( | const string & | table,
|  | TePolygon & | p
| ) |  | `[virtual]`

Updates a polygon in a geometry table.

Implements TeDatabase.

Reimplemented in TeOracleSpatial.

bool TeOCIOracle::updateTable | ( | TeTable & | table | ) | `[virtual]`

Updates a table and its contents in the database.

Reimplemented from TeDatabase.

bool TeOCIOracle::viewExist | ( | const string & | view | ) |

Verify if there is a specific view in the database.

## Friends And Related Function Documentation

friend class TeOCIOraclePortal`[friend]`

## Member Data Documentation

TeOCIConnection* TeOCIOracle::connection_`[protected]`

pointer to a opened connection to ORACLE database server

long TeOCIOracle::sequenceCont_`[protected]`

sequential number used to improve the data insertion

string TeOCIOracle::sequenceName_`[protected]`

sequence name used to improve the data insertion

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/Oracle/TeOCIOracle.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/Oracle/TeOCIOracle.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines