src/odbc/odbcDbc.h

Go to the documentation of this file.
00001 // Class CSqlOdbcDbc
00002 // Description: Database Connection Handle manager. 
00003 
00004 #ifndef _ODBC_DBC_H_
00005 #define _ODBC_DBC_H_
00006 #include<SqlFactory.h>
00007 // State's of Connection Handle.
00008 typedef enum 
00009 {
00010     C0,  // henv not allocated,hdbc not allocated
00011     C1,  // henv allocated,hdbc not allocated
00012     C2,  // henv allocated,hdbc allocated
00013     C3,  // Connection function needs data
00014     C4,  // Connected hdbc
00015     C5,  // Connected hdbc, allocated statement
00016     C6   // Connected hdbc, Transaction in progress
00017 } DbcState_t ;
00018 
00019 class CSqlOdbcDbc
00020 {
00021         CSqlOdbcDbc(void); // Should not create obj without using SQLAllocHandle
00022 
00023     public:
00024         // Top 2 variable declaration should not be moved down.
00025         int         handleType_;    // Handle type.
00026         CSqlOdbcError      err_;           // Last error info.
00027 
00028         DbcState_t  state_;         // Environment State.
00029         CSqlOdbcEnv        *parentEnv_;    // Parent Environment Handle.
00030         std::vector<CSqlOdbcStmt*>   stmtList_;      // Statement handle list.
00031         std::vector<CSqlOdbcDesc*>   descList_;      // Descriptor handle list.
00032         AbsSqlConnection  *fsqlConn_;      // CSQL connection object 
00033         int mode_; //1->csql , 2->gateway
00034         SQLUINTEGER curAccessMode_;
00035         IsolationLevel curIsolationLevel_;
00036 
00037         // Connection Attributes
00038         SQLUINTEGER accessMode_;    // Transaction access mode
00039                                     // SQL_MODE_READ_ONLY OR
00040                                     // SQL_MODE_READ_WRITE
00041 
00042         IsolationLevel  isolationLevel_;// Transaction Isolation Level.
00043                                     // SQL_TXN_READ_UNCOMMITTED
00044                                     // SQL_TXN_READ_COMMITTED
00045                                     // SQL_TXN_REPEATABLE_READ
00046                                     // SQL_TXN_SERIALIZABLE
00047 
00048         SQLUINTEGER autoCommit_;    // Automatically Commit after execution.
00049                                     // SQL_AUTOCOMMIT_ON
00050                                     // SQL_AUTOCOMMIT_OFF
00051 
00052     // METHODS
00053         // State Transition
00054         SQLRETURN chkStateForSQLFreeHandle( void );
00055         SQLRETURN chkStateForSQLConnect( void );
00056         SQLRETURN chkStateForSQLDisconnect( void );
00057         SQLRETURN chkStateForSQLEndTran( void );
00058         SQLRETURN chkStateForSQLSetConnectAttr( void );
00059 
00060         // ODBC API's
00061         static SQLRETURN SQLAllocHandle(
00062             SQLHANDLE   inputHandle,    // IN
00063             SQLHANDLE   *outputHandle );// OUT
00064 
00065         static SQLRETURN SQLFreeHandle(
00066             SQLHANDLE inputHandle);     // IN
00067  
00068         SQLRETURN SQLConnect(           // All param's are IN
00069             SQLCHAR *serverName,
00070             SQLSMALLINT len1,
00071             SQLCHAR *user,
00072             SQLSMALLINT len2,
00073             SQLCHAR *pass, 
00074             SQLSMALLINT len3);
00075 
00076         SQLRETURN SQLDisconnect(); 
00077 
00078         SQLRETURN SQLEndTran(
00079             SQLSMALLINT completionType);// IN
00080 
00081         SQLRETURN SQLSetConnectAttr(
00082             SQLINTEGER attribute,       // IN
00083             SQLPOINTER value,           // IN
00084             SQLINTEGER stringLength);   // IN
00085 
00086         SQLRETURN SQLGetConnectAttr(
00087             SQLINTEGER attribute,       // IN
00088             SQLPOINTER value,           // OUT
00089             SQLINTEGER bufferLength,    // IN
00090             SQLINTEGER *stringLength);  // OUT
00091             
00092         // Others
00093 };
00094 
00095 #endif // _ODBC_DBC_H_

Generated on Mon Jun 9 22:37:14 2008 for csql by  doxygen 1.4.7