#include <odbcEnv.h>
Collaboration diagram for CSqlOdbcEnv:
Public Member Functions | |
SQLRETURN | chkStateForSQLFreeHandle (void) |
SQLRETURN | chkStateForSQLSetEnvAttr (void) |
SQLRETURN | SQLEndTran (SQLSMALLINT completionType) |
SQLRETURN | SQLSetEnvAttr (SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength) |
SQLRETURN | SQLGetEnvAttr (SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER *stringLength) |
Static Public Member Functions | |
static SQLRETURN | SQLAllocHandle (SQLHANDLE inputHandle, SQLHANDLE *outputHandle) |
static SQLRETURN | SQLFreeHandle (SQLHANDLE inputHandle) |
Data Fields | |
int | handleType_ |
CSqlOdbcError | err_ |
EnvState_t | state_ |
std::vector< CSqlOdbcDbc * > | dbcList_ |
SQLUINTEGER | odbcVersion_ |
Definition at line 15 of file odbcEnv.h.
SQLRETURN CSqlOdbcEnv::chkStateForSQLFreeHandle | ( | void | ) |
Definition at line 12 of file odbcState.cxx.
References E0, E1, E2, err_, ERROR_FUNCSEQ, CSqlOdbcError::set(), SQL_ERROR, SQL_SUCCESS, and state_.
00013 { 00014 switch( state_ ) 00015 { 00016 case E0: 00017 case E1: break; 00018 case E2: err_.set( ERROR_FUNCSEQ ); 00019 return( SQL_ERROR ); 00020 } 00021 return( SQL_SUCCESS ); 00022 }
Here is the call graph for this function:
SQLRETURN CSqlOdbcEnv::chkStateForSQLSetEnvAttr | ( | void | ) |
Definition at line 23 of file odbcState.cxx.
References E0, E1, E2, err_, ERROR_ATTR_CANNOT_SET, CSqlOdbcError::set(), SQL_ERROR, SQL_SUCCESS, and state_.
Referenced by SQLSetEnvAttr().
00024 { 00025 switch( state_ ) 00026 { 00027 case E0: 00028 case E1: break; 00029 case E2: err_.set( ERROR_ATTR_CANNOT_SET ); 00030 return( SQL_ERROR ); 00031 } 00032 return( SQL_SUCCESS ); 00033 }
Here is the call graph for this function:
Here is the caller graph for this function:
Definition at line 30 of file odbcEnv.cxx.
References ERROR_MEMALLOC, globalError, CSqlOdbcError::printStr(), CSqlOdbcError::set(), SQL_ERROR, SQL_NULL_HANDLE, SQL_NULL_HENV, SQL_OV_ODBC3, and SQL_SUCCESS.
Referenced by SQLAllocEnv(), and SQLAllocHandle().
00033 { 00034 // Error in parameters 00035 if( inputHandle != SQL_NULL_HANDLE ) 00036 { 00037 *outputHandle = SQL_NULL_HENV; 00038 return( SQL_ERROR ); 00039 } 00040 00041 // Allocate Environment. 00042 *outputHandle = (SQLHANDLE*) new CSqlOdbcEnv; 00043 if( *outputHandle == NULL ) 00044 { 00045 globalError.set((int) ERROR_MEMALLOC ); 00046 globalError.printStr( SQL_OV_ODBC3 ); 00047 return( SQL_ERROR ); 00048 } 00049 00050 return( SQL_SUCCESS ); 00051 }
Here is the call graph for this function:
Here is the caller graph for this function:
SQLRETURN CSqlOdbcEnv::SQLEndTran | ( | SQLSMALLINT | completionType | ) |
Definition at line 94 of file odbcEnv.cxx.
References dbcList_, err_, ERROR_FUNCSEQ, NO_ERR, odbcVersion_, CSqlOdbcError::set(), SQL_ERROR, and SQL_SUCCESS.
00096 { 00097 // Start with NO_ERR 00098 err_.set( NO_ERR ); 00099 00100 // Stop if odbcVersion not set. 00101 if( odbcVersion_ == 0 ) 00102 { 00103 err_.set( ERROR_FUNCSEQ ); 00104 return( SQL_ERROR ); 00105 } 00106 00107 // If no connection objects ? 00108 if( dbcList_.size() == 0 ) 00109 return( SQL_SUCCESS ); 00110 00111 // For each connect obj, call SQLEndTran 00112 std::vector<CSqlOdbcDbc*>::iterator iter; 00113 iter = dbcList_.begin(); 00114 while( iter != dbcList_.end() ) 00115 { 00116 if( (*iter)->chkStateForSQLEndTran() == SQL_SUCCESS ) { 00117 if( (*iter)->SQLEndTran( completionType ) == SQL_ERROR ) 00118 return( SQL_ERROR ); 00119 } 00120 else return ( SQL_ERROR ); 00121 iter++; 00122 } 00123 00124 return( SQL_SUCCESS ); 00125 }
Here is the call graph for this function:
Definition at line 60 of file odbcEnv.cxx.
References isValidHandle(), SQL_ERROR, SQL_HANDLE_ENV, SQL_INVALID_HANDLE, and SQL_SUCCESS.
Referenced by SQLFreeEnv(), and SQLFreeHandle().
00062 { 00063 CSqlOdbcEnv *inputEnv = (CSqlOdbcEnv*) inputHandle; 00064 00065 // Validate handle 00066 if( isValidHandle( inputEnv, SQL_HANDLE_ENV ) != SQL_SUCCESS ) 00067 return( SQL_INVALID_HANDLE ); 00068 00069 // Check whether we can proceed. 00070 if( inputEnv->chkStateForSQLFreeHandle() != SQL_SUCCESS ) 00071 return( SQL_ERROR ); 00072 00073 inputEnv->handleType_ = -1; // Make object invalid. 00074 delete inputEnv; // Delete Environment. 00075 00076 return( SQL_SUCCESS ); 00077 }
Here is the call graph for this function:
Here is the caller graph for this function:
SQLRETURN CSqlOdbcEnv::SQLGetEnvAttr | ( | SQLINTEGER | attribute, | |
SQLPOINTER | value, | |||
SQLINTEGER | bufferLength, | |||
SQLINTEGER * | stringLength | |||
) |
Definition at line 197 of file odbcEnv.cxx.
References err_, ERROR_OPTRANGE, NO_ERR, odbcVersion_, CSqlOdbcError::set(), SQL_ATTR_ODBC_VERSION, SQL_ATTR_OUTPUT_NTS, SQL_ERROR, SQL_SUCCESS, and SQL_TRUE.
00202 { 00203 // Start with NO_ERR 00204 err_.set( NO_ERR ); 00205 00206 // Can we proceed.? Always ( in all states) 00207 00208 switch( attribute ) 00209 { 00210 case SQL_ATTR_ODBC_VERSION: 00211 *((SQLUINTEGER*) value) = odbcVersion_; 00212 break; 00213 00214 case SQL_ATTR_OUTPUT_NTS: 00215 *((SQLUINTEGER*) value) = SQL_TRUE; 00216 break; 00217 00218 default: err_.set( ERROR_OPTRANGE ); 00219 return( SQL_ERROR ); 00220 } 00221 00222 return( SQL_SUCCESS ); 00223 }
Here is the call graph for this function:
SQLRETURN CSqlOdbcEnv::SQLSetEnvAttr | ( | SQLINTEGER | attribute, | |
SQLPOINTER | value, | |||
SQLINTEGER | stringLength | |||
) |
Definition at line 140 of file odbcEnv.cxx.
References chkStateForSQLSetEnvAttr(), err_, ERROR_OPTCHANGE, ERROR_OPTFEATURE_NOTIMP, ERROR_OPTRANGE, NO_ERR, odbcVersion_, CSqlOdbcError::set(), SQL_ATTR_ODBC_VERSION, SQL_ATTR_OUTPUT_NTS, SQL_ERROR, SQL_OV_ODBC2, SQL_OV_ODBC3, SQL_SUCCESS, and SQL_TRUE.
00144 { 00145 // Start with NO_ERR 00146 err_.set( NO_ERR ); 00147 00148 // Check whether we can proceed. 00149 if( chkStateForSQLSetEnvAttr() != SQL_SUCCESS ) 00150 return( SQL_ERROR ); 00151 00152 switch( attribute ) 00153 { 00154 case SQL_ATTR_ODBC_VERSION: 00155 switch( (SQLINTEGER) value ) 00156 { 00157 case SQL_OV_ODBC2: 00158 case SQL_OV_ODBC3: break; 00159 default: 00160 err_.set( ERROR_OPTCHANGE ); 00161 return( SQL_ERROR ); 00162 } 00163 odbcVersion_ = (SQLUINTEGER) value; 00164 break; 00165 00166 case SQL_ATTR_OUTPUT_NTS: 00167 if( (SQLINTEGER) value == SQL_TRUE ) 00168 return( SQL_SUCCESS ); 00169 else 00170 { 00171 err_.set( ERROR_OPTFEATURE_NOTIMP ); 00172 return( SQL_ERROR ); 00173 } 00174 break; 00175 00176 default: err_.set( ERROR_OPTRANGE ); 00177 return( SQL_ERROR ); 00178 } 00179 00180 return( SQL_SUCCESS ); 00181 }
Here is the call graph for this function:
std::vector<CSqlOdbcDbc*> CSqlOdbcEnv::dbcList_ |
Definition at line 22 of file odbcEnv.h.
Referenced by chkStateForSQLFreeHandle(), chkStateForSQLSetEnvAttr(), SQLEndTran(), SQLGetEnvAttr(), and SQLSetEnvAttr().
Definition at line 28 of file odbcEnv.h.
Referenced by SQLEndTran(), SQLGetEnvAttr(), and SQLSetEnvAttr().
Definition at line 24 of file odbcEnv.h.
Referenced by chkStateForSQLFreeHandle(), and chkStateForSQLSetEnvAttr().