src/odbc/odbcCommon.cxx File Reference

#include "odbcCommon.h"

Include dependency graph for odbcCommon.cxx:

Go to the source code of this file.

Functions

SQLRETURN SQLAllocHandle (SQLSMALLINT hdlType, SQLHANDLE inHdl, SQLHANDLE *outHdl)
SQLRETURN SQLFreeHandle (SQLSMALLINT hdlType, SQLHANDLE inHdl)
SQLRETURN SQLEndTran (SQLSMALLINT hdlType, SQLHANDLE hdl, SQLSMALLINT compType)
SQLRETURN isValidHandle (SQLHANDLE hdl, SQLSMALLINT hdlType)
SQLRETURN isValidCType (SQLSMALLINT type)
SQLRETURN isValidSQLType (SQLSMALLINT type)
DataType getCSqlType (SQLSMALLINT type)
SQLSMALLINT getSQLType (DataType type)
SQLCHARgetSQLTypeName (SQLSMALLINT type)
void getInputBuffer (void **buffer, SQLSMALLINT type, SQLUINTEGER length)
void copyFromOdbc (AbsSqlStatement *stmt, int paramNo, SQLUINTEGER destLen, void *odbcData, SQLUINTEGER odbcLen, SQLSMALLINT type)
SQLINTEGER copyToOdbc (void *odbcData, SQLUINTEGER odbcLen, void *sourceData, SQLUINTEGER sourceLen, SQLSMALLINT type)


Function Documentation

void copyFromOdbc ( AbsSqlStatement stmt,
int  paramNo,
SQLUINTEGER  destLen,
void *  odbcData,
SQLUINTEGER  odbcLen,
SQLSMALLINT  type 
)

Definition at line 330 of file odbcCommon.cxx.

References Date::set(), Time::set(), AbsSqlStatement::setByteIntParam(), TimeStamp::setDate(), AbsSqlStatement::setDateParam(), AbsSqlStatement::setDoubleParam(), AbsSqlStatement::setFloatParam(), AbsSqlStatement::setIntParam(), AbsSqlStatement::setLongLongParam(), AbsSqlStatement::setLongParam(), AbsSqlStatement::setShortParam(), AbsSqlStatement::setStringParam(), TimeStamp::setTime(), AbsSqlStatement::setTimeParam(), AbsSqlStatement::setTimeStampParam(), stmt, typeByteInt, typeDate, typeDecimal, typeDouble, typeFloat, typeInt, typeLong, typeLongLong, typeShort, typeString, typeTime, and typeTimeStamp.

Referenced by CSqlOdbcStmt::SQLExecute().

00331 {
00332     //No point in continuing further
00333     if(odbcData == NULL)
00334         return;
00335     switch( type )
00336     {
00337         case typeShort:
00338             //*(short*)destData = *(short*)odbcData;
00339             stmt->setShortParam(paramNo, *(short*)odbcData);
00340             break;
00341         case typeInt:
00342             //*(int*)destData = *(int*)odbcData;
00343             stmt->setIntParam(paramNo, *(int*)odbcData);
00344             break;
00345         case typeLong:
00346             //*(long*)destData = *(long*)odbcData;
00347             stmt->setLongParam(paramNo, *(long*)odbcData);
00348             break;
00349         case typeLongLong:
00350             //*(long long*)destData = *(long long*)odbcData;
00351             stmt->setLongLongParam(paramNo, *(long long *)odbcData);
00352             break;
00353         case typeByteInt: {
00354             //*(char*)destData = *(char*)odbcData;
00355             ByteInt bt(*(char*)odbcData);
00356              stmt->setByteIntParam(paramNo, bt);
00357             break;
00358         }
00359 /*        case csqlSqlTbit:
00360             *(unsigned char*)destData = *(unsigned char*)odbcData;
00361             break;*/
00362 
00363         case typeFloat:
00364             //*(float*)destData = *(float*)odbcData;
00365             stmt->setFloatParam(paramNo, *(float*)odbcData);
00366             break;
00367 
00368         case typeDouble:
00369             //*(double*)destData = *(double*)odbcData;
00370             stmt->setDoubleParam(paramNo, *(double*)odbcData);
00371             break;
00372 
00373 //        case csqlSqlTlongDouble:
00374 //        case csqlSqlTnumeric:
00375         case typeDecimal:
00376             //*(long double*)destData = *(long double*)odbcData;
00377             // TODO
00378             break;
00379 
00380         case typeString:
00381             stmt->setStringParam(paramNo, (char*) odbcData);
00382             /*if(odbcLen < destLen)
00383             {
00384                 strcpy( (char*)destData, (char*)odbcData);
00385                 *((char*)destData+odbcLen)='\0';
00386             }
00387             else
00388             {
00389                 strncpy((char*)destData,(char*)odbcData,(destLen-1));
00390                 *((char*)destData+destLen)='\0';
00391             }*/
00392             
00393             break;
00394         case typeDate: {
00395             Date dt;
00396             dt.set((*(SQL_DATE_STRUCT *)odbcData).year,
00397                    (*(SQL_DATE_STRUCT *)odbcData).month,
00398                    (*(SQL_DATE_STRUCT *)odbcData).day);
00399             stmt->setDateParam(paramNo, dt);
00400             break;
00401         }
00402         case typeTime: {
00403             Time tm;
00404             tm.set((*(SQL_TIME_STRUCT *)odbcData).hour,
00405                    (*(SQL_TIME_STRUCT *)odbcData).minute,
00406                    (*(SQL_TIME_STRUCT *)odbcData).second);
00407             stmt->setTimeParam(paramNo, tm);
00408             break;
00409         }
00410         case typeTimeStamp: {
00411             TimeStamp ts;
00412             ts.setDate((*(SQL_TIMESTAMP_STRUCT *)odbcData).year,
00413                        (*(SQL_TIMESTAMP_STRUCT *)odbcData).month,
00414                        (*(SQL_TIMESTAMP_STRUCT *)odbcData).day);
00415             ts.setTime((*(SQL_TIMESTAMP_STRUCT*)odbcData).hour,
00416                        (*(SQL_TIMESTAMP_STRUCT *)odbcData).minute,
00417                        (*(SQL_TIMESTAMP_STRUCT *)odbcData).second);
00418             stmt->setTimeStampParam(paramNo, ts);
00419             break;
00420         }
00421    }
00422     
00423 }

Here is the call graph for this function:

Here is the caller graph for this function:

SQLINTEGER copyToOdbc ( void *  odbcData,
SQLUINTEGER  odbcLen,
void *  sourceData,
SQLUINTEGER  sourceLen,
SQLSMALLINT  type 
)

Definition at line 429 of file odbcCommon.cxx.

References typeBinary, typeByteInt, typeDate, typeDecimal, typeDouble, typeFloat, typeInt, typeLong, typeLongLong, typeShort, typeString, typeTime, and typeTimeStamp.

Referenced by CSqlOdbcStmt::SQLFetch().

00430 {
00431     SQLINTEGER ind;
00432     if(odbcData == NULL || sourceData == NULL)
00433         return -1;
00434     switch( type )
00435     {
00436         case typeShort:
00437             *(short*)odbcData = *(short*)sourceData;
00438             break;
00439 
00440         case typeInt:
00441             *(int*)odbcData = *(int*)sourceData;
00442             break;
00443 
00444         case typeLong:
00445             *(long*)odbcData = *(long*)sourceData;
00446             break;
00447 
00448         case typeLongLong:
00449             *(long long*)odbcData = *(long long*)sourceData;
00450             break;
00451 
00452         case typeByteInt:
00453             *(char*)odbcData = *(char*)sourceData;
00454             break;
00455 
00456 //        case csqlSqlTbit:
00457 //            CSqlOdbcError::printDbg("copyToOdbc");
00458 //            *(unsigned char*)odbcData = *(unsigned char*)sourceData;
00459 //            break;
00460 
00461         case typeFloat:
00462             *(float*)odbcData = *(float*)sourceData;
00463             break;
00464         case typeDouble:
00465             *(double*)odbcData = *(double*)sourceData;
00466             break;
00467         case typeDecimal:
00468 
00469 //        case csqlSqlTlongDouble:
00470 //        case csqlSqlTnumeric:
00471             *(long double*)odbcData = *(long double*)sourceData;
00472             break;
00473         case typeString:
00474 //      case csqlSqlTvarString:
00475             if(sourceLen < odbcLen)
00476             {
00477                 strcpy((char*)odbcData,(char*)sourceData);
00478                 ind=strlen((char*)odbcData)+1;
00479             }
00480             else
00481             {
00482                 strncpy((char*)odbcData,(char*)sourceData ,odbcLen);
00483                 ind=odbcLen;
00484             }
00485             *((char *)odbcData+ind-1)='\0';
00486             break;
00487         case typeDate:
00488             (*(SQL_DATE_STRUCT *)odbcData).year = (*(Date *)sourceData).year();
00489             (*(SQL_DATE_STRUCT *)odbcData).month= (*(Date *)sourceData).month();
00490             (*(SQL_DATE_STRUCT *)odbcData).day = (*(Date *)sourceData).dayOfMonth();
00491             break;
00492         case typeTime:                        
00493             (*(SQL_TIME_STRUCT *)odbcData).hour = (*(Time *)sourceData).hours();
00494             (*(SQL_TIME_STRUCT *)odbcData).minute= (*(Time *)sourceData).minutes();
00495             (*(SQL_TIME_STRUCT *)odbcData).second = (*(Time *)sourceData).seconds();
00496             break;
00497         case typeTimeStamp:                        
00498             (*(SQL_TIMESTAMP_STRUCT *)odbcData).year= (*(TimeStamp *)sourceData).year();
00499             (*(SQL_TIMESTAMP_STRUCT *)odbcData).month= (*(TimeStamp *)sourceData).month();
00500             (*(SQL_TIMESTAMP_STRUCT *)odbcData).day= (*(TimeStamp *)sourceData).dayOfMonth();
00501             (*(SQL_TIMESTAMP_STRUCT *)odbcData).hour = (*(TimeStamp *)sourceData).hours();
00502             (*(SQL_TIMESTAMP_STRUCT *)odbcData).minute= (*(TimeStamp *)sourceData).minutes();
00503             (*(SQL_TIMESTAMP_STRUCT *)odbcData).second = (*(TimeStamp *)sourceData).seconds();
00504             break;
00505         case typeBinary:
00506 //        case csqlSqlTvarBinary:                        
00507 //            CSqlOdbcError::printDbg("copyToOdbc");
00508 //            memset((unsigned char*)odbcData,0,odbcLen);
00509             if(sourceLen < odbcLen)
00510             {
00511                 memcpy( (unsigned char*)odbcData , (unsigned char*)sourceData,sourceLen);
00512                 ind=sourceLen;
00513             }
00514             else
00515             {
00516                 memcpy( (unsigned char*)odbcData , (unsigned char*)sourceData,odbcLen);
00517                 ind=odbcLen;
00518             }
00519             break;
00520     }
00521     return ind;
00522 }

Here is the caller graph for this function:

DataType getCSqlType ( SQLSMALLINT  type  ) 

Definition at line 134 of file odbcCommon.cxx.

References SQL_C_BINARY, SQL_C_BIT, SQL_C_CHAR, SQL_C_DATE, SQL_C_DOUBLE, SQL_C_FLOAT, SQL_C_LONG, SQL_C_NUMERIC, SQL_C_SBIGINT, SQL_C_SHORT, SQL_C_SLONG, SQL_C_SSHORT, SQL_C_STINYINT, SQL_C_TIME, SQL_C_TIMESTAMP, SQL_C_TINYINT, SQL_C_TYPE_DATE, SQL_C_TYPE_TIME, SQL_C_TYPE_TIMESTAMP, SQL_C_UBIGINT, SQL_C_ULONG, SQL_C_USHORT, SQL_C_UTINYINT, typeBinary, typeByteInt, typeDate, typeDecimal, typeDouble, typeFloat, typeLong, typeLongLong, typeShort, typeString, typeTime, typeTimeStamp, and typeUnknown.

Referenced by CSqlOdbcStmt::SQLBindCol(), CSqlOdbcStmt::SQLBindParameter(), CSqlOdbcStmt::SQLExecute(), and CSqlOdbcStmt::SQLFetch().

00135 {
00136     switch( type )
00137     {
00138         case SQL_C_CHAR:
00139             return typeString;
00140         case SQL_C_LONG:
00141         case SQL_C_SLONG:
00142         case SQL_C_ULONG:
00143             return typeLong;
00144         case SQL_C_FLOAT:
00145             return typeFloat;
00146         case SQL_C_DOUBLE:
00147             return typeDouble;
00148         case SQL_C_BIT:
00149             return typeUnknown;
00150         case SQL_C_SHORT:
00151         case SQL_C_SSHORT:
00152         case SQL_C_USHORT:
00153             return typeShort;
00154         case SQL_C_TINYINT:
00155         case SQL_C_STINYINT:
00156         case SQL_C_UTINYINT:
00157             return typeByteInt;
00158         case SQL_C_SBIGINT:
00159         case SQL_C_UBIGINT:
00160             return typeLongLong;
00161         case SQL_C_NUMERIC:
00162             return typeDecimal;
00163         case SQL_C_DATE:
00164         case SQL_C_TYPE_DATE:
00165             return typeDate;
00166         case SQL_C_TIME:
00167         case SQL_C_TYPE_TIME:
00168             return typeTime;
00169         case SQL_C_TIMESTAMP:
00170         case SQL_C_TYPE_TIMESTAMP: 
00171             return typeTimeStamp;
00172             break;
00173         case SQL_C_BINARY:
00174             return typeBinary;
00175         default: return( typeUnknown);
00176     }
00177 }

Here is the caller graph for this function:

void getInputBuffer ( void **  buffer,
SQLSMALLINT  type,
SQLUINTEGER  length 
)

Definition at line 270 of file odbcCommon.cxx.

References typeBinary, typeByteInt, typeDate, typeDecimal, typeDouble, typeFloat, typeInt, typeLong, typeLongLong, typeShort, typeString, typeTime, and typeTimeStamp.

Referenced by CSqlOdbcStmt::SQLBindCol(), and CSqlOdbcStmt::SQLExecute().

00271 {
00272     switch(type)
00273     {
00274         case typeShort:
00275             *buffer = new short();
00276             break;
00277         case typeInt:
00278             *buffer= new int();
00279             break;
00280         case typeLong:
00281             *buffer= new long();
00282             break;
00283         case typeLongLong:
00284             *buffer = new long long();
00285             break;
00286         case typeByteInt:
00287             *buffer = new signed char();
00288             break;
00289 /*        case csqlSqlTbit:
00290             *buffer = new unsigned char ();
00291             break;*/
00292 
00293         case typeFloat:
00294             *buffer = new float();
00295             break;
00296         case typeDouble:
00297             *buffer = new double();
00298             break;
00299         case typeDecimal:
00300 //        case csqlSqlTlongDouble:
00301 //        case csqlSqlTnumeric:
00302             *buffer = new long double ();
00303             break;
00304 
00305         case typeString:
00306 //        case csqlSqlTvarString:
00307             *buffer = new char [length+1];
00308             break;
00309         case typeDate:
00310             *buffer = new Date();
00311             break;
00312         case typeTime:
00313             *buffer = new Time();
00314             break;
00315         case typeTimeStamp:
00316             *buffer = new TimeStamp();
00317             break;
00318         case typeBinary:
00319 //        case csqlSqlTvarBinary:                        
00320             *buffer = new unsigned char [length+1];
00321             break;
00322     }
00323 }

Here is the caller graph for this function:

SQLSMALLINT getSQLType ( DataType  type  ) 

Definition at line 179 of file odbcCommon.cxx.

References SQL_BIGINT, SQL_BINARY, SQL_CHAR, SQL_DATE, SQL_DOUBLE, SQL_ERROR, SQL_FLOAT, SQL_INTEGER, SQL_NUMERIC, SQL_SMALLINT, SQL_TIME, SQL_TIMESTAMP, SQL_TINYINT, typeBinary, typeByteInt, typeDate, typeDecimal, typeDouble, typeFloat, typeInt, typeLong, typeLongLong, typeShort, typeString, typeTime, and typeTimeStamp.

Referenced by CSqlOdbcStmt::SQLColAttribute(), CSqlOdbcStmt::SQLDescribeCol(), and CSqlOdbcStmt::SQLDescribeParam().

00180 {
00181     switch(type)
00182     {
00183         case typeShort:
00184             return SQL_SMALLINT;
00185         case typeInt:
00186         case typeLong:
00187             return SQL_INTEGER;
00188         case typeLongLong:
00189             return SQL_BIGINT;
00190         case typeByteInt:
00191             return SQL_TINYINT;
00192 
00193         case typeFloat:
00194             return SQL_FLOAT;
00195         case typeDouble:
00196             return SQL_DOUBLE;
00197         case typeDecimal:
00198             return SQL_NUMERIC;
00199 
00200         case typeDate:
00201             return SQL_DATE;
00202         case typeTime:
00203             return SQL_TIME;
00204         case typeTimeStamp:
00205             return SQL_TIMESTAMP;
00206 
00207         case typeString:
00208             return SQL_CHAR;
00209         case typeBinary:
00210             return SQL_BINARY;
00211 
00212         // NOT SUPPORTED
00213         //case csqlSqlTlongDouble: might be equal typeDecimal
00214         //    return SQL_REAL;
00215         //case csqlSqlTvarString:
00216         //    return SQL_VARCHAR;
00217         //case csqlSqlTvarBinary:
00218         //    return SQL_BINARY;
00219         //case typeBit: 
00220         //    return SQL_BIT;
00221         default:
00222             return SQL_ERROR;
00223             break;
00224     }
00225 }

Here is the caller graph for this function:

SQLCHAR* getSQLTypeName ( SQLSMALLINT  type  ) 

Definition at line 227 of file odbcCommon.cxx.

References SQL_BIGINT, SQL_BINARY, SQL_BIT, SQL_CHAR, SQL_DATE, SQL_DECIMAL, SQL_DOUBLE, SQL_FLOAT, SQL_INTEGER, SQL_NUMERIC, SQL_REAL, SQL_SMALLINT, SQL_TIME, SQL_TIMESTAMP, SQL_TINYINT, SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, and SQL_VARCHAR.

Referenced by CSqlOdbcStmt::SQLColAttribute().

00228 {
00229     switch( type )
00230     {
00231         case SQL_CHAR:
00232             return (SQLCHAR *)"CHAR";
00233         case SQL_VARCHAR:
00234             return (SQLCHAR *)"VARCHAR";
00235         case SQL_BIT:
00236             return (SQLCHAR *)"BIT";
00237         case SQL_SMALLINT:
00238             return (SQLCHAR *)"SMALLINT";
00239         case SQL_INTEGER:
00240             return (SQLCHAR *)"INTEGER";
00241         case SQL_REAL:
00242             return (SQLCHAR *)"REAL";
00243         case SQL_DECIMAL:
00244         case SQL_NUMERIC:
00245             return (SQLCHAR *)"NUMERIC";
00246         case SQL_DOUBLE:
00247             return (SQLCHAR *)"DOUBLE";
00248         case SQL_FLOAT:
00249             return (SQLCHAR *)"FLOAT";
00250         case SQL_TINYINT:
00251             return (SQLCHAR *)"TINYINT";
00252         case SQL_BIGINT:
00253             return (SQLCHAR *)"BIGINT";
00254         case SQL_DATE:
00255         case SQL_TYPE_DATE:
00256             return (SQLCHAR *)"DATE";
00257         case SQL_TIME:
00258         case SQL_TYPE_TIME:
00259             return (SQLCHAR *)"TIME";
00260         case SQL_TIMESTAMP:
00261         case SQL_TYPE_TIMESTAMP: 
00262             return (SQLCHAR *)"TIMESTAMP";
00263             case SQL_BINARY:
00264             return (SQLCHAR *)"BINARY";
00265         default:
00266             break;
00267     }
00268 }

Here is the caller graph for this function:

SQLRETURN isValidCType ( SQLSMALLINT  type  ) 

Definition at line 73 of file odbcCommon.cxx.

References SQL_C_BINARY, SQL_C_BIT, SQL_C_CHAR, SQL_C_DATE, SQL_C_DOUBLE, SQL_C_FLOAT, SQL_C_LONG, SQL_C_NUMERIC, SQL_C_SBIGINT, SQL_C_SHORT, SQL_C_SLONG, SQL_C_SSHORT, SQL_C_STINYINT, SQL_C_TIME, SQL_C_TIMESTAMP, SQL_C_TINYINT, SQL_C_TYPE_DATE, SQL_C_TYPE_TIME, SQL_C_TYPE_TIMESTAMP, SQL_C_UBIGINT, SQL_C_ULONG, SQL_C_USHORT, SQL_C_UTINYINT, SQL_ERROR, and SQL_SUCCESS.

Referenced by CSqlOdbcStmt::SQLBindCol(), and CSqlOdbcStmt::SQLBindParameter().

00074 {
00075     switch( type )
00076     {
00077         case SQL_C_CHAR:
00078         case SQL_C_SLONG:
00079         case SQL_C_ULONG:
00080         case SQL_C_LONG:
00081         case SQL_C_FLOAT:
00082         case SQL_C_DOUBLE:
00083         case SQL_C_BIT:
00084         case SQL_C_SSHORT:
00085         case SQL_C_USHORT:
00086         case SQL_C_SHORT:
00087         case SQL_C_STINYINT:
00088         case SQL_C_UTINYINT:
00089         case SQL_C_TINYINT:
00090         case SQL_C_SBIGINT:
00091         case SQL_C_UBIGINT:
00092         case SQL_C_NUMERIC:
00093         case SQL_C_DATE:
00094         case SQL_C_TIME:
00095         case SQL_C_TIMESTAMP:
00096         case SQL_C_TYPE_DATE:
00097         case SQL_C_TYPE_TIME:
00098         case SQL_C_TYPE_TIMESTAMP:
00099         case SQL_C_BINARY: break;
00100         default: return( SQL_ERROR );
00101     }
00102     return( SQL_SUCCESS );
00103 }

Here is the caller graph for this function:

SQLRETURN isValidHandle ( SQLHANDLE  hdl,
SQLSMALLINT  hdlType 
)

Definition at line 59 of file odbcCommon.cxx.

References ERROR_MEM_MGMNT, globalError, CSqlOdbcError::printStr(), CSqlOdbcError::set(), SQL_HANDLE_DBC, SQL_HANDLE_ENV, SQL_HANDLE_STMT, SQL_INVALID_HANDLE, SQL_OV_ODBC3, and SQL_SUCCESS.

Referenced by CSqlOdbcStmt::SQLAllocHandle(), CSqlOdbcDbc::SQLAllocHandle(), SQLBindCol(), SQLBindParameter(), SQLCloseCursor(), SQLColAttribute(), SQLColAttributes(), SQLConnect(), SQLDescribeCol(), SQLDescribeParam(), SQLDisconnect(), SQLDriverConnect(), SQLEndTran(), SQLError(), SQLExecDirect(), SQLExecute(), SQLFetch(), CSqlOdbcStmt::SQLFreeHandle(), CSqlOdbcEnv::SQLFreeHandle(), CSqlOdbcDbc::SQLFreeHandle(), SQLFreeStmt(), SQLGetConnectAttr(), SQLGetCursorName(), SQLGetDiagRec(), SQLGetEnvAttr(), SQLNumParams(), SQLNumResultCols(), SQLPrepare(), SQLRowCount(), SQLSetConnectAttr(), SQLSetCursorName(), SQLSetEnvAttr(), and SQLTransact().

00061 {
00062     if( hdlType == SQL_HANDLE_ENV || hdlType == SQL_HANDLE_DBC || hdlType == SQL_HANDLE_STMT )
00063 
00064         if( hdl != 0 )
00065             if( ((CSqlOdbcEnv*) hdl)->handleType_ == hdlType )
00066                 return( SQL_SUCCESS );
00067 
00068     globalError.set( ERROR_MEM_MGMNT );
00069     globalError.printStr( SQL_OV_ODBC3 );
00070     return( SQL_INVALID_HANDLE );
00071 }

Here is the call graph for this function:

Here is the caller graph for this function:

SQLRETURN isValidSQLType ( SQLSMALLINT  type  ) 

Definition at line 105 of file odbcCommon.cxx.

References SQL_BIGINT, SQL_BINARY, SQL_BIT, SQL_CHAR, SQL_DATE, SQL_DECIMAL, SQL_DOUBLE, SQL_ERROR, SQL_FLOAT, SQL_INTEGER, SQL_NUMERIC, SQL_REAL, SQL_SMALLINT, SQL_SUCCESS, SQL_TIME, SQL_TIMESTAMP, SQL_TINYINT, SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, SQL_VARBINARY, and SQL_VARCHAR.

Referenced by CSqlOdbcStmt::SQLBindParameter().

00106 {
00107     switch( type )
00108     {
00109         case SQL_CHAR:
00110         case SQL_VARCHAR:
00111         case SQL_BIT:
00112         case SQL_SMALLINT:
00113         case SQL_INTEGER:
00114         case SQL_REAL:
00115         case SQL_DOUBLE:
00116         case SQL_FLOAT:
00117         case SQL_TINYINT:
00118         case SQL_BIGINT:
00119         case SQL_DECIMAL:
00120         case SQL_NUMERIC:
00121         case SQL_DATE:
00122         case SQL_TIME:
00123         case SQL_TIMESTAMP:
00124         case SQL_TYPE_DATE:
00125         case SQL_TYPE_TIME:
00126         case SQL_TYPE_TIMESTAMP:
00127         case SQL_BINARY:
00128         case SQL_VARBINARY: break;
00129         default: return( SQL_ERROR );
00130     }
00131     return( SQL_SUCCESS );
00132 }

Here is the caller graph for this function:

SQLRETURN SQLAllocHandle ( SQLSMALLINT  hdlType,
SQLHANDLE  inHdl,
SQLHANDLE outHdl 
)

Definition at line 3 of file odbcCommon.cxx.

References ERROR_OPTRANGE, globalError, CSqlOdbcError::printStr(), CSqlOdbcError::set(), SQL_ERROR, SQL_HANDLE_DBC, SQL_HANDLE_ENV, SQL_HANDLE_STMT, SQL_OV_ODBC3, CSqlOdbcStmt::SQLAllocHandle(), CSqlOdbcDbc::SQLAllocHandle(), and CSqlOdbcEnv::SQLAllocHandle().

Referenced by SqlOdbcConnection::connect(), SqlOdbcStatement::getPrimaryKeyFieldName(), CacheTableLoader::load(), and SqlOdbcStatement::prepare().

00006 {
00007     switch( hdlType )
00008     {
00009         case SQL_HANDLE_ENV: 
00010                 return CSqlOdbcEnv::SQLAllocHandle( inHdl, outHdl );
00011         case SQL_HANDLE_DBC: 
00012                 return CSqlOdbcDbc::SQLAllocHandle( inHdl, outHdl );
00013         case SQL_HANDLE_STMT: 
00014                 return CSqlOdbcStmt::SQLAllocHandle( inHdl, outHdl );
00015     }
00016 
00017     globalError.set( ERROR_OPTRANGE );
00018     globalError.printStr( SQL_OV_ODBC3 );
00019     return( SQL_ERROR );
00020 }

Here is the call graph for this function:

Here is the caller graph for this function:

SQLRETURN SQLEndTran ( SQLSMALLINT  hdlType,
SQLHANDLE  hdl,
SQLSMALLINT  compType 
)

Definition at line 38 of file odbcCommon.cxx.

References ERROR_OPTRANGE, globalError, isValidHandle(), CSqlOdbcError::printStr(), CSqlOdbcError::set(), SQL_ERROR, SQL_HANDLE_DBC, SQL_HANDLE_ENV, SQL_INVALID_HANDLE, SQL_OV_ODBC3, and SQL_SUCCESS.

Referenced by SQLTransact().

00042 {
00043     if( isValidHandle( hdl, hdlType ) != SQL_SUCCESS )
00044         return( SQL_INVALID_HANDLE );
00045 
00046     switch( hdlType )
00047     {
00048         case SQL_HANDLE_ENV:
00049                 return ((CSqlOdbcEnv*) hdl)->SQLEndTran( compType );
00050         case SQL_HANDLE_DBC:
00051                 return ((CSqlOdbcDbc*) hdl)->SQLEndTran( compType );
00052     }
00053 
00054     globalError.set( ERROR_OPTRANGE );
00055     globalError.printStr( SQL_OV_ODBC3 );
00056     return( SQL_ERROR );
00057 }

Here is the call graph for this function:

Here is the caller graph for this function:

SQLRETURN SQLFreeHandle ( SQLSMALLINT  hdlType,
SQLHANDLE  inHdl 
)

Definition at line 22 of file odbcCommon.cxx.

References ERROR_OPTRANGE, globalError, CSqlOdbcError::printStr(), CSqlOdbcError::set(), SQL_ERROR, SQL_HANDLE_DBC, SQL_HANDLE_ENV, SQL_HANDLE_STMT, SQL_OV_ODBC3, CSqlOdbcStmt::SQLFreeHandle(), CSqlOdbcDbc::SQLFreeHandle(), and CSqlOdbcEnv::SQLFreeHandle().

Referenced by SqlOdbcConnection::disconnect(), SqlOdbcStatement::free(), SqlOdbcStatement::getPrimaryKeyFieldName(), and CacheTableLoader::load().

00025 {
00026     switch( hdlType )
00027     {
00028         case SQL_HANDLE_ENV: return CSqlOdbcEnv::SQLFreeHandle( inHdl );
00029         case SQL_HANDLE_DBC: return CSqlOdbcDbc::SQLFreeHandle( inHdl );
00030         case SQL_HANDLE_STMT: return CSqlOdbcStmt::SQLFreeHandle( inHdl );
00031     }
00032 
00033     globalError.set( ERROR_OPTRANGE );
00034     globalError.printStr( SQL_OV_ODBC3 );
00035     return( SQL_ERROR );
00036 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Mon Jun 9 22:40:48 2008 for csql by  doxygen 1.4.7