| TerraLib 4.1

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

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/ado/TeAdoOracle.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00026 #ifndef  __TERRALIB_INTERNAL_ADOORACLE_H
    00027 #define  __TERRALIB_INTERNAL_ADOORACLE_H
    00028
    00029 #include <TeDatabaseFactory.h>
    00030
    00031 #ifdef WIN32
    00032 #pragma warning ( disable: 4192 )
    00033 #pragma warning ( disable: 4146 )
    00034 #include <atldbcli.h>
    00035 #include <iostream>
    00036 #include <comdef.h>
    00037
    00038 /*
    00039  *   Lets use the import directive to create some smart pointers for us
    00040  */
    00041 #import "msado26.tlb"  rename("EOF", "IsEOF") rename("BOF", "IsBOF")
    00042 #import <msadox.dll>
    00043 #import <oledb32.dll> rename_namespace("OLEDB")
    00044 #else
    00045 #error ONLY FOR WINDOWS OPERATIONAL SYSTEM
    00046 #endif
    00047
    00048 #include <TeDatabase.h>
    00049 #include <TeAdoDB.h>
    00050
    00051
    00052 #ifdef AFX_DLL
    00053 #define EXPORT_WIN __declspec( dllexport )
    00054 #else
    00055 #define EXPORT_WIN
    00056 #endif
    00057
    00059 class  TLADO_DLL  TeOracle : public TeAdo
    00060 {
    00061 friend class TeOraclePortal;
    00062
    00063 public:
    00064
    00065            TeOracle();
    00066            ~TeOracle();
    00067
    00068            // Methods to create and connect to a ADO database
    00069                       bool newDatabase(const string& database, const string& user, const string& password, const string& host, const int &port=-1, bool terralibModel=true);
    00070                       bool connect (const string& host, const string& user, const string& password, const string& database, int port = -1);
    00071
    00072            // Methods to manipulate a table
    00073                       bool tableExist(const string& table);
    00074                       bool listTables(vector<string>& tableList);
    00075            bool columnExist(const string& table, const string& column, TeAttribute& attr);
    00076                       bool createTable(const string& table, TeAttributeList &attr);
    00077
    00078            bool addColumn(const string& table,TeAttributeRep &rep);
    00079                       bool alterTable (const string& table, TeAttributeRep &rep, const string& oldColName="");
    00080                       bool alterTable (const string& oldTableName, const string& newTableName);
    00081                       bool deleteTable (const string& table);
    00082            bool createRelation (const string& name, const string& table, const string& fieldName, const string& relatedTable, const string& relatedField, bool cascadeDeletion);
    00083
    00084                       bool deleteLayer(int layerId);
    00085
    00086                       TeDBRelationType existRelation(const string& tableName, const string& relName);
    00087
    00088 // Insert/Update methods
    00089
    00090            // Insert an attribute table
    00091         bool insertTableInfo (int layerId, TeTable &table, const string& user="");
    00092                       bool insertRelationInfo(const int tableId, const string& tField, const string& rName, const string& rField, int& relId);
    00093
    00094            bool insertLayer(TeLayer *layer);
    00095                       virtual bool updateBBox          (const string& tableName, const string& idName, int idValue, const TeBox& box); /*****/
    00096                       virtual bool updateLayerBox      (TeLayer* layer);
    00097                       virtual bool updateLayer         (TeLayer* layer);
    00098
    00099            bool insertRepresentation (int layerId, TeRepresentation& rep);
    00100            bool insertView (TeView *view);
    00101                       bool insertViewTree (TeViewTree *tree);
    00102            bool insertTheme (TeAbstractTheme *theme);
    00103                       bool insertThemeTable (int themeId, int tableId, int relationId, int tableOrder);
    00104                       bool insertThemeGroup(TeViewTree* tree);
    00105                       bool generateLabelPositions (TeTheme *theme, const std::string& objectId = "");
    00106            bool insertLegend (TeLegendEntry *legend);
    00107            bool insertProjection (TeProjection *proj);
    00108
    00109                       bool insertPolygonSet (const string& table, TePolygonSet &ps);
    00110            bool insertPolygon (const string& table, TePolygon &p);
    00111
    00112            bool insertLineSet (const string& table, TeLineSet &ls);
    00113            bool insertLine (const string& table, TeLine2D &l);
    00114
    00115            bool insertPointSet (const string& table, TePointSet &ps);
    00116            bool insertPoint (const string& table, TePoint &p);
    00117
    00118            bool insertTextSet (const string& table, TeTextSet &ts);
    00119            bool insertText (const string& table, TeText &t);
    00120
    00121            bool insertArcSet (const string& table, TeArcSet &as);
    00122            bool insertArc (const string& table,TeArc &arc);
    00123
    00124            bool insertNodeSet (const string& table, TeNodeSet &ns);
    00125            bool insertNode       (const string& table, TeNode &node);
    00126
    00127            bool insertCellSet (const string& table, TeCellSet &cs);
    00128                       bool insertCell       (const string& table, TeCell &c);
    00129
    00130            TeDatabasePortal* getPortal ();
    00131
    00132            bool createAutoIncrementTrigger(const string &tableName, const string &fieldName);
    00133                       string     getNameTrigger(const string &tableName);
    00134
    00135                       bool       createSequence(const string &seqName);
    00136                       string     getNameSequence(const string &tableName);
    00137
    00138                       string  getSQLAutoNumber(const string& table);
    00139
    00140                       bool getAttributeList(const string& tableName,TeAttributeList& attList);
    00141
    00142                       string getSQLTime(const TeTime& time) const;
    00143
    00144                       bool insertProject(TeProject* project);
    00145 };
    00146
    00148 class  TLADO_DLL  TeOraclePortal : public TeAdoPortal
    00149 {
    00150
    00151 public :
    00152
    00153            // Constructor / Destructor
    00154            TeOraclePortal ();
    00155            TeOraclePortal (TeDatabase* pDatabase);
    00156            ~TeOraclePortal ();
    00157
    00158            bool query ( const string &qry, TeCursorLocation l = TeSERVERSIDE, TeCursorType t = TeBIDIRECTIONAL, TeCursorEditType e = TeREADWRITE, TeCursorDataType dt = TeTEXTCURSOR );
    00159
    00160            TeTime getDate (int i);
    00161            TeTime getDate (const string& s);
    00162
    00163            string getDateAsString(int i);
    00164            string getDateAsString(const string& s);
    00165 };
    00166
    00167
    00173 class TLADO_DLL TeOracleFactory : public TeDatabaseFactory
    00174 {
    00175   public :
    00176
    00180     TeOracleFactory() : TeDatabaseFactory( std::string( "OracleAdo" ) ) {};
    00181
    00185     ~TeOracleFactory() {};
    00186
    00187   protected :
    00188
    00196     TeDatabase* build( const TeDatabaseFactoryParams& arg )
    00197     {
    00198       TeOracle* instance_ptr = new TeOracle();
    00199
    00200       if( arg.host_ != "" ) {
    00201         instance_ptr->connect( arg.host_, arg.user_, arg.password_,
    00202           arg.database_, arg.port_ );
    00203       }
    00204
    00205       return (TeDatabase*)instance_ptr;
    00206     }
    00207 };
    00208
    00209 namespace {
    00210   static TeOracleFactory TeOracleFactory_instance;
    00211 };
    00212
    00213
    00214 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines