00001 // Class CSqlOdbcEnv 00002 // Description: Environment Handle manager. 00003 00004 #ifndef _ODBC_ENV_H_ 00005 #define _ODBC_ENV_H_ 00006 00007 // State's of Environment Handle. 00008 typedef enum 00009 { 00010 E0, // Environment in unallocated state. (DriverManager) 00011 E1, // Allocated Environment , hdbc in unallocated state. 00012 E2 // Allocated Environment , allocated hdbc. 00013 } EnvState_t ; 00014 00015 class CSqlOdbcEnv 00016 { 00017 CSqlOdbcEnv(void); // Should not create obj without SQLAllocHandle 00018 00019 public: 00020 // Top 2 variable declaration should not be moved down. 00021 int handleType_; // Handle type. 00022 CSqlOdbcError err_; // Last error info. 00023 00024 EnvState_t state_; // Environment State. 00025 std::vector<CSqlOdbcDbc*> dbcList_; // Connection handle list. 00026 00027 // Environment Attributes 00028 SQLUINTEGER odbcVersion_; 00029 00030 // State Transition 00031 // Check whether we can continue executing SQLxxxx API. 00032 SQLRETURN chkStateForSQLFreeHandle( void ); 00033 SQLRETURN chkStateForSQLSetEnvAttr( void ); 00034 00035 // ODBC API's 00036 static SQLRETURN SQLAllocHandle( 00037 SQLHANDLE inputHandle, // IN 00038 SQLHANDLE *outputHandle ); // OUT 00039 00040 static SQLRETURN SQLFreeHandle( 00041 SQLHANDLE inputHandle); // IN 00042 00043 SQLRETURN SQLEndTran( 00044 SQLSMALLINT completionType);// IN 00045 00046 SQLRETURN SQLSetEnvAttr( 00047 SQLINTEGER attribute, // IN 00048 SQLPOINTER value, // IN 00049 SQLINTEGER stringLength); // IN 00050 00051 SQLRETURN SQLGetEnvAttr( 00052 SQLINTEGER attribute, // IN 00053 SQLPOINTER value, // OUT 00054 SQLINTEGER bufferLength, // IN 00055 SQLINTEGER *stringLength); // OUT 00056 00057 // Other's 00058 }; 00059 00060 #endif // _ODBC_ENV_H_