[pywin32-checkins] pywin32/win32/src odbc.cpp,1.10,1.11
OLD project page for the Python extensions for Windows
                
                Brought to you by:
                
                    mhammond
                    
                
            
            
        
        
        
    | 
      
      
      From: Mark H. <mha...@us...> - 2004-07-13 04:56:32
      
     | 
| Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25381 Modified Files: odbc.cpp Log Message: [ 956094 ] convert C++ comments to C in odbc.cpp Index: odbc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/odbc.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** odbc.cpp 25 Apr 2004 04:31:41 -0000 1.10 --- odbc.cpp 13 Jul 2004 04:56:22 -0000 1.11 *************** *** 6,10 **** */ ! // @doc - this file contains autoduck documentation in the comments. #include <math.h> #include <limits.h> --- 6,10 ---- */ ! /* @doc - this file contains autoduck documentation in the comments. */ #include <math.h> #include <limits.h> *************** *** 20,26 **** #include <time.h> ! // Python 1.5.2 doesn't have PyObject_New ! // PyObject_NEW is not *quite* as safe, but seem to work fine ! // (as all win32all for 1.5.2 used it! #ifndef PyObject_New #define PyObject_New PyObject_NEW --- 20,26 ---- #include <time.h> ! /* Python 1.5.2 doesn't have PyObject_New ! PyObject_NEW is not *quite* as safe, but seem to work fine ! (as all win32all for 1.5.2 used it! */ #ifndef PyObject_New #define PyObject_New PyObject_NEW *************** *** 30,34 **** #endif ! #include "dbi.h" //$ This is a hack static PyObject *odbcError; --- 30,34 ---- #endif ! #include "dbi.h" /*$ This is a hack */ static PyObject *odbcError; *************** *** 145,149 **** static odbcErrorDesc *lookupError(const char *sqlState); ! static PyObject *dbiErrors[6]; // 'cause I know about six DBI errors static void odbcPrintError --- 145,149 ---- static odbcErrorDesc *lookupError(const char *sqlState); ! static PyObject *dbiErrors[6]; /* 'cause I know about six DBI errors */ static void odbcPrintError *************** *** 187,191 **** } ! // internal is the default int errn = errorType ? errorType->index : 5 ; error = dbiErrors[errn]; --- 187,191 ---- } ! /* internal is the default */ int errn = errorType ? errorType->index : 5 ; error = dbiErrors[errn]; *************** *** 226,230 **** } conn->connected = 1; ! conn->connect_id++; // perturb it so cursors know to reconnect return 0; --- 226,230 ---- } conn->connected = 1; ! conn->connect_id++; /* perturb it so cursors know to reconnect */ return 0; *************** *** 236,240 **** (cur->my_conx->connected == 0)) { ! // ie the cursor was made on an old connection printf("Attempting reconnect\n"); --- 236,240 ---- (cur->my_conx->connected == 0)) { ! /* ie the cursor was made on an old connection */ printf("Attempting reconnect\n"); *************** *** 243,247 **** if (cur->my_conx->connected == 0) { ! // ie the db has not been reconnected if (doConnect(cur->my_conx)) { --- 243,247 ---- if (cur->my_conx->connected == 0) { ! /* ie the db has not been reconnected */ if (doConnect(cur->my_conx)) { *************** *** 261,270 **** } ! // @pymethod |connection|setautocommit|Sets the autocommit mode. static PyObject *odbcSetAutoCommit(PyObject *self, PyObject *args) { int c; connectionObject *conn; ! // @pyparm int|c||The boolean autocommit mode. if (!PyArg_ParseTuple(args, "i",&c)) return NULL; --- 261,270 ---- } ! /* @pymethod |connection|setautocommit|Sets the autocommit mode. */ static PyObject *odbcSetAutoCommit(PyObject *self, PyObject *args) { int c; connectionObject *conn; ! /* @pyparm int|c||The boolean autocommit mode. */ if (!PyArg_ParseTuple(args, "i",&c)) return NULL; *************** *** 298,302 **** ! // @pymethod |connection|commit|Commits a transaction. static PyObject *odbcCommit(PyObject *self, PyObject *args) { --- 298,302 ---- ! /* @pymethod |connection|commit|Commits a transaction. */ static PyObject *odbcCommit(PyObject *self, PyObject *args) { *************** *** 320,324 **** } ! // @pymethod |connection|rollback|Rollsback a transaction. static PyObject *odbcRollback(PyObject *self, PyObject *args) { --- 320,324 ---- } ! /* @pymethod |connection|rollback|Rollsback a transaction. */ static PyObject *odbcRollback(PyObject *self, PyObject *args) { *************** *** 341,345 **** } ! // @pymethod |connection|cursor|Creates a <o cursor> object static PyObject *odbcCursor(PyObject *self, PyObject *args) { --- 341,345 ---- } ! /* @pymethod |connection|cursor|Creates a <o cursor> object */ static PyObject *odbcCursor(PyObject *self, PyObject *args) { *************** *** 375,379 **** } ! // @pymethod |connection|close|Closes the connection. static PyObject *odbcClose(PyObject *self, PyObject *args) { --- 375,379 ---- } ! /* @pymethod |connection|close|Closes the connection. */ static PyObject *odbcClose(PyObject *self, PyObject *args) { *************** *** 382,392 **** } ! // @object connection|An object representing an ODBC connection static PyMethodDef connectionMethods[] = { ! { "setautocommit", odbcSetAutoCommit, 1 }, // @pymeth setautocommit|Sets the autocommit mode. ! { "commit", odbcCommit, 1 } , // @pymeth commit|Commits a transaction. ! { "rollback", odbcRollback, 1 } , // @pymeth rollback|Rollsback a transaction. ! { "cursor", odbcCursor, 1 } , // @pymeth cursor|Creates a <o cursor> object ! { "close", odbcClose, 1 } , // @pymeth close|Closes the connection. {0, 0} }; --- 382,392 ---- } ! /* @object connection|An object representing an ODBC connection */ static PyMethodDef connectionMethods[] = { ! { "setautocommit", odbcSetAutoCommit, 1 }, /* @pymeth setautocommit|Sets the autocommit mode. */ ! { "commit", odbcCommit, 1 } , /* @pymeth commit|Commits a transaction. */ ! { "rollback", odbcRollback, 1 } , /* @pymeth rollback|Rollsback a transaction. */ ! { "cursor", odbcCursor, 1 } , /* @pymeth cursor|Creates a <o cursor> object */ ! { "close", odbcClose, 1 } , /* @pymeth close|Closes the connection. */ {0, 0} }; *************** *** 434,438 **** { InputBinding *next = ib->next; ! //$ free(ib->bind_area); free(ib); ib = next; --- 434,438 ---- { InputBinding *next = ib->next; ! /*$ free(ib->bind_area); */ free(ib); ib = next; *************** *** 467,474 **** ! // @pymethod |cursor|close|Closes the cursor static PyObject *odbcCurClose(PyObject *self, PyObject *args) { ! // @comm This method does nothing!! I presume it should!?!?! Py_INCREF(Py_None); return Py_None; --- 467,474 ---- ! /* @pymethod |cursor|close|Closes the cursor */ static PyObject *odbcCurClose(PyObject *self, PyObject *args) { ! /* @comm This method does nothing!! I presume it should!?!?! */ Py_INCREF(Py_None); return Py_None; *************** *** 493,500 **** ob->vsize = vsize; ! // Stick the new column on the end of the linked list. ! // We do this because we call SQLGetData() while walking the linked list. ! // Some ODBC drivers require all BLOB columns to be at the end of the column list. ! // So preserve the order our consumer called us with. ob->next = NULL; if (cur->outputVars == NULL) --- 493,500 ---- ob->vsize = vsize; ! /* Stick the new column on the end of the linked list. ! We do this because we call SQLGetData() while walking the linked list. ! Some ODBC drivers require all BLOB columns to be at the end of the column list. ! So preserve the order our consumer called us with. */ ob->next = NULL; if (cur->outputVars == NULL) *************** *** 1124,1130 **** ! // This lame function is here for backward compatibility with some ! // very old ODBC drivers that got naively ported from Windows 3.1. ! // So says: Chris Ingram [chr...@sy...] static RETCODE sendSQLInputData ( --- 1124,1130 ---- ! /* This lame function is here for backward compatibility with some ! very old ODBC drivers that got naively ported from Windows 3.1. ! So says: Chris Ingram [chr...@sy...] */ static RETCODE sendSQLInputData ( *************** *** 1141,1145 **** InputBinding* pInputBinding = cur->inputVars; ! // find the input to put while (pInputBinding) { --- 1141,1145 ---- InputBinding* pInputBinding = cur->inputVars; ! /* find the input to put */ while (pInputBinding) { *************** *** 1175,1179 **** } ! // see if additional data is needed. rc = SQLParamData(cur->hstmt, (void **)&pIndx); } --- 1175,1179 ---- } ! /* see if additional data is needed. */ rc = SQLParamData(cur->hstmt, (void **)&pIndx); } *************** *** 1183,1187 **** } ! // @pymethod int|cursor|execute|Execute some SQL static PyObject *odbcCurExec(PyObject *self, PyObject *args) { --- 1183,1187 ---- } ! /* @pymethod int|cursor|execute|Execute some SQL */ static PyObject *odbcCurExec(PyObject *self, PyObject *args) { *************** *** 1202,1207 **** } ! // @pyparm string|sql||The SQL to execute ! // @pyparm sequence|[var, ...]|[]|Input variables. if (!PyArg_ParseTuple(args, "s|O", &sql, &inputvars)) { --- 1202,1207 ---- } ! /* @pyparm string|sql||The SQL to execute */ ! /* @pyparm sequence|[var, ...]|[]|Input variables. */ if (!PyArg_ParseTuple(args, "s|O", &sql, &inputvars)) { *************** *** 1217,1221 **** { temp = PySequence_GetItem(inputvars, 0); ! // Strings don't count as a list in this case. if (PySequence_Check(temp) && !PyString_Check(temp)) { --- 1217,1221 ---- { temp = PySequence_GetItem(inputvars, 0); ! /* Strings don't count as a list in this case. */ if (PySequence_Check(temp) && !PyString_Check(temp)) { *************** *** 1263,1267 **** if (rows) { ! // handle insert cases... for(int i = 0; i < PySequence_Length(rows); i++) { --- 1263,1267 ---- if (rows) { ! /* handle insert cases... */ for(int i = 0; i < PySequence_Length(rows); i++) { *************** *** 1285,1289 **** SQL_NTS); Py_END_ALLOW_THREADS ! // move data here. if (rc == SQL_NEED_DATA) { --- 1285,1289 ---- SQL_NTS); Py_END_ALLOW_THREADS ! /* move data here. */ if (rc == SQL_NEED_DATA) { *************** *** 1366,1393 **** RETCODE rc; long cbRead = 0; ! // Use SQLGetData to retrieve data for blob (or long varchar) type columns. if (ob->bGetData) { ! // Initialize memory (offsets, etc.) ! // (use bind_area for buffer, and dynamically allocate in the loop below) cbRequired = ob->vsize; ob->rcode = 0; ! cbRead = 0; // Count of bytes read (running total and offset into buffer). ! // Loop until SQLGetData tells us that there are no more chunks ! // of the blob to retrieve. do { ! // Check to see if bind_area is big enough ! // if cbRequired > vsize ! // re-allocate bind_area to cbRequired ! // set ob->vsize = cbRequired if (cbRequired > ob->vsize) { void *pTemp; ! // ! // Some BLOBs can be huge, be paranoid about allowing ! // other threads to run. ! // Py_BEGIN_ALLOW_THREADS pTemp = malloc (cbRequired); --- 1366,1391 ---- RETCODE rc; long cbRead = 0; ! /* Use SQLGetData to retrieve data for blob (or long varchar) type columns. */ if (ob->bGetData) { ! /* Initialize memory (offsets, etc.) ! (use bind_area for buffer, and dynamically allocate in the loop below) */ cbRequired = ob->vsize; ob->rcode = 0; ! cbRead = 0; /* Count of bytes read (running total and offset into buffer). */ ! /* Loop until SQLGetData tells us that there are no more chunks ! of the blob to retrieve. */ do { ! /* Check to see if bind_area is big enough ! if cbRequired > vsize ! re-allocate bind_area to cbRequired ! set ob->vsize = cbRequired */ if (cbRequired > ob->vsize) { void *pTemp; ! /* Some BLOBs can be huge, be paranoid about allowing ! other threads to run. */ Py_BEGIN_ALLOW_THREADS pTemp = malloc (cbRequired); *************** *** 1399,1403 **** } ! // rc = GetData( ... , bind_area + offset, vsize - offset, &rcode ) Py_BEGIN_ALLOW_THREADS rc = SQLGetData(cur->hstmt, --- 1397,1401 ---- } ! /* rc = GetData( ... , bind_area + offset, vsize - offset, &rcode ) */ Py_BEGIN_ALLOW_THREADS rc = SQLGetData(cur->hstmt, *************** *** 1417,1438 **** if ((ob->rcode != SQL_NO_TOTAL) && (ob->rcode <= ob->vsize - cbRead)) { ! // If we get here, then this should be the last iteration ! // through the loop. cbRead += ob->rcode; } else { ! // Grow buffer by (32k minus 1 byte) each for each chunk. ! // If not for the SQL Anywhere 5.0 problem (driver version ! // 5.05.041867), we could probably grow by 50% each time ! // or the remaining size (as determined by ob->rcode). ! //cbRequired += ob->rcode - ob->vsize; ! cbRequired += 32767; // Fix that works for SQL Anywhere 5.0 driver. if (ob->vtype == SQL_C_CHAR) { ! // We want to ignore the intermediate ! // NULL characters SQLGetData() gives us. ! // (silly, silly) cbRead = ob->vsize - 1; } --- 1415,1436 ---- if ((ob->rcode != SQL_NO_TOTAL) && (ob->rcode <= ob->vsize - cbRead)) { ! /* If we get here, then this should be the last iteration ! through the loop. */ cbRead += ob->rcode; } else { ! /* Grow buffer by (32k minus 1 byte) each for each chunk. ! If not for the SQL Anywhere 5.0 problem (driver version ! 5.05.041867), we could probably grow by 50% each time ! or the remaining size (as determined by ob->rcode). */ ! /*cbRequired += ob->rcode - ob->vsize; */ ! cbRequired += 32767; /* Fix that works for SQL Anywhere 5.0 driver. */ if (ob->vtype == SQL_C_CHAR) { ! /* We want to ignore the intermediate ! NULL characters SQLGetData() gives us. ! (silly, silly) */ cbRead = ob->vsize - 1; } *************** *** 1524,1528 **** else { ! Py_DECREF(list); // thwow it away return NULL; } --- 1522,1526 ---- else { ! Py_DECREF(list); /* throw it away */ return NULL; } *************** *** 1532,1536 **** ! // @pymethod data|cursor|fetchone|Fetch one row of data static PyObject *odbcCurFetchOne(PyObject *self, PyObject *args) { --- 1530,1534 ---- ! /* @pymethod data|cursor|fetchone|Fetch one row of data */ static PyObject *odbcCurFetchOne(PyObject *self, PyObject *args) { *************** *** 1539,1543 **** ! // @pymethod [data, ...]|cursor|fetchmany|Fetch many rows of data static PyObject *odbcCurFetchMany(PyObject *self, PyObject *args) { --- 1537,1541 ---- ! /* @pymethod [data, ...]|cursor|fetchmany|Fetch many rows of data */ static PyObject *odbcCurFetchMany(PyObject *self, PyObject *args) { *************** *** 1552,1556 **** } ! // @pymethod [data, ...]|cursor|fetchall|Fetch all rows of data static PyObject *odbcCurFetchAll(PyObject *self, PyObject *args) { --- 1550,1554 ---- } ! /* @pymethod [data, ...]|cursor|fetchall|Fetch all rows of data */ static PyObject *odbcCurFetchAll(PyObject *self, PyObject *args) { *************** *** 1558,1562 **** } ! // @pymethod |cursor|setinputsizes| static PyObject *odbcCurSetInputSizes(PyObject *self, PyObject *args) { --- 1556,1560 ---- } ! /* @pymethod |cursor|setinputsizes| */ static PyObject *odbcCurSetInputSizes(PyObject *self, PyObject *args) { *************** *** 1564,1568 **** return Py_None; } ! // @pymethod |cursor|setoutputsize| static PyObject *odbcCurSetOutputSize(PyObject *self, PyObject *args) { --- 1562,1566 ---- return Py_None; } ! /* @pymethod |cursor|setoutputsize| */ static PyObject *odbcCurSetOutputSize(PyObject *self, PyObject *args) { *************** *** 1576,1588 **** } ! // @object cursor|An object representing an ODBC cursor. static PyMethodDef cursorMethods[] = { ! { "close", odbcCurClose, 1} , // @pymeth close|Closes the cursor ! { "execute", odbcCurExec, 1} , // @pymeth execute|Execute some SQL ! { "fetchone", odbcCurFetchOne, 1} , // @pymeth fetchone|Fetch one row of data ! { "fetchmany", odbcCurFetchMany, 1} , // @pymeth fetchmany|Fetch many rows of data ! { "fetchall", odbcCurFetchAll, 1} , // @pymeth fetchall|Fetch all the rows of data ! { "setinputsizes", odbcCurSetInputSizes, 1} , // @pymeth setinputsizes| ! { "setoutputsize", odbcCurSetOutputSize, 1} ,// @pymeth setoutputsize| {0, 0} /* Sentinel */ }; --- 1574,1586 ---- } ! /* @object cursor|An object representing an ODBC cursor. */ static PyMethodDef cursorMethods[] = { ! { "close", odbcCurClose, 1} , /* @pymeth close|Closes the cursor */ ! { "execute", odbcCurExec, 1} , /* @pymeth execute|Execute some SQL */ ! { "fetchone", odbcCurFetchOne, 1} , /* @pymeth fetchone|Fetch one row of data */ ! { "fetchmany", odbcCurFetchMany, 1} , /* @pymeth fetchmany|Fetch many rows of data */ ! { "fetchall", odbcCurFetchAll, 1} , /* @pymeth fetchall|Fetch all the rows of data */ ! { "setinputsizes", odbcCurSetInputSizes, 1} , /* @pymeth setinputsizes| */ ! { "setoutputsize", odbcCurSetOutputSize, 1} ,/* @pymeth setoutputsize| */ {0, 0} /* Sentinel */ }; *************** *** 1656,1660 **** } ! connectionStringLength = strlen(dsn) + strlen(uid) + strlen(pwd) + 15; // add room for DSN=;UID=;PWD=\0 conn->connectionString = (char *) malloc(connectionStringLength); strcpy(conn->connectionString, "DSN="); --- 1654,1658 ---- } ! connectionStringLength = strlen(dsn) + strlen(uid) + strlen(pwd) + 15; /* add room for DSN=;UID=;PWD=\0 */ conn->connectionString = (char *) malloc(connectionStringLength); strcpy(conn->connectionString, "DSN="); *************** *** 1678,1682 **** } ! // @pymethod <o connection>|odbc|odbc|Creates an ODBC connection static PyObject *odbcLogon(PyObject *self, PyObject *args) { --- 1676,1680 ---- } ! /* @pymethod <o connection>|odbc|odbc|Creates an ODBC connection */ static PyObject *odbcLogon(PyObject *self, PyObject *args) { *************** *** 1684,1692 **** connectionObject *conn; ! // @pyparm string|connectionString||An ODBC connection string. ! // For backwards-compatibility, this parameter can be of the form ! // DSN[/username[/password]] (e.g. "myDSN/myUserName/myPassword"). ! // Alternatively, a full ODBC connection string can be used (e.g., ! // "Driver={SQL Server};Server=(local);Database=myDatabase"). if (!PyArg_ParseTuple(args, "s", &connectionString)) { --- 1682,1690 ---- connectionObject *conn; ! /* @pyparm string|connectionString||An ODBC connection string. ! For backwards-compatibility, this parameter can be of the form ! DSN[/username[/password]] (e.g. "myDSN/myUserName/myPassword"). ! Alternatively, a full ODBC connection string can be used (e.g., ! "Driver={SQL Server};Server=(local);Database=myDatabase"). */ if (!PyArg_ParseTuple(args, "s", &connectionString)) { *************** *** 1700,1704 **** } ! conn->connect_id = 0; // initialize it to anything conn->hdbc = SQL_NULL_HDBC; conn->connectionString = NULL; --- 1698,1702 ---- } ! conn->connect_id = 0; /* initialize it to anything */ conn->hdbc = SQL_NULL_HDBC; conn->connectionString = NULL; *************** *** 1721,1727 **** } ! // @module odbc|A Python wrapper around the ODBC API. static PyMethodDef globalMethods[] = { ! { "odbc", odbcLogon, 1} , // @pymeth odbc|Creates an <o connection> object. {0, 0} /* Sentinel */ }; --- 1719,1725 ---- } ! /* @module odbc|A Python wrapper around the ODBC API. */ static PyMethodDef globalMethods[] = { ! { "odbc", odbcLogon, 1} , /* @pymeth odbc|Creates an <o connection> object. */ {0, 0} /* Sentinel */ }; *************** *** 1761,1855 **** static odbcErrorDesc errorTable[] = { ! { "01000", 5, 0 } , // General warning ! { "01002", 1, 1 } , // Disconnect error ! { "01004", 0, 1 } , // Data truncated ! { "01006", 5, 1 } , // Privilege not revoked ! { "01S00", 2, 1 } , // Invalid connection string attribute ! { "01S01", 5, 1 } , // Error in row ! { "01S02", 5, 1 } , // Option value changed ! { "01S03", 0, 1 } , // No rows updated or deleted ! { "01S04", 0, 1 } , // More than one row updated or deleted ! { "01S05", 0, 1 } , // Cancel treated as SQLFreeStmt with the SQL_CLOSE ! { "01S06", 2, 1 } , // Attempt to fetch before the result set returned ! { "07001", 2, 1 } , // Wrong number of parameters ! { "07006", 2, 1 } , // Restricted data type attribute violation ! { "07S01", 2, 1 } , // Invalid use of default parameter ! { "08001", 1, 1 } , // Unable to connect to data source ! { "08002", 1, 1 } , // Connection in use ! { "08003", 1, 1 } , // Connection not open ! { "08004", 1, 1 } , // Data source rejected establishment of connection ! { "08007", 1, 1 } , // Connection failure during transaction ! { "08S01", 1, 0 } , // Communication link failure ! { "21S01", 2, 1 } , // Insert value list does not match column list ! { "21S02", 2, 1 } , // Degree of derived table does not match column list ! { "22001", 0, 1 } , // String data right truncation ! { "22002", 5, 1 } , // Indicator variable required but not supplied ! { "22003", 4, 1 } , // Numeric value out of range ! { "22005", 4, 1 } , // Error in assignment ! { "22008", 4, 1 } , // Datetime field overflow ! { "22012", 4, 1 } , // Division by zero ! { "22026", 4, 1 } , // String data, length mismatch ! { "23000", 3, 1 } , // Integrity constraint violation ! { "24000", 5, 1 } , // Invalid cursor state ! { "25000", 5, 1 } , // Invalid transaction state ! { "28000", 1, 1 } , // Invalid authorization specification ! { "34000", 5, 1 } , // Invalid cursor name ! { "37000", 2, 1 } , // Syntax error or access violation ! { "3C000", 5, 1 } , // Duplicate cursor name ! { "40001", 5, 1 } , // Serialization failure ! { "42000", 2, 1 } , // Syntax error or access violation ! { "70100", 1, 1 } , // Operation aborted ! { "IM001", 1, 1 } , // Driver does not support this function ! { "IM002", 1, 1 } , // Data source name not found and no default driver ! { "IM003", 1, 1 } , // Specified driver could not be loaded ! { "IM004", 1, 1 } , // Driver's SQLAllocEnv failed ! { "IM005", 1, 1 } , // Driver's SQLAllocConnect failed ! { "IM006", 1, 1 } , // Driver's SQLSetConnect-Option failed ! { "IM007", 1, 1 } , // No data source or driver specified; dialog prohibited ! { "IM008", 1, 1 } , // Dialog failed ! { "IM009", 1, 1 } , // Unable to load translation DLL ! { "IM010", 1, 1 } , // Data source name too long ! { "IM011", 1, 1 } , // Driver name too long ! { "IM012", 1, 1 } , // DRIVER keyword syntax error ! { "IM013", 1, 1 } , // Trace file error ! { "S0001", 2, 1 } , // Base table or view already exists ! { "S0002", 2, 1 } , // Base table not found ! { "S0011", 2, 1 } , // Index already exists ! { "S0012", 2, 1 } , // Index not found ! { "S0021", 2, 1 } , // Column already exists ! { "S0022", 2, 1 } , // Column not found ! { "S0023", 2, 1 } , // No default for column ! { "S1000", 1, 1 } , // General error ! { "S1001", 1, 1 } , // Memory allocation failure ! { "S1002", 5, 1 } , // Invalid column number ! { "S1003", 5, 1 } , // Program type out of range ! { "S1004", 5, 1 } , // SQL data type out of range ! { "S1008", 1, 1 } , // Operation canceled ! { "S1009", 5, 1 } , // Invalid argument value ! { "S1010", 5, 1 } , // Function sequence error ! { "S1011", 5, 1 } , // Operation invalid at this time ! { "S1012", 5, 1 } , // Invalid transaction operation code specified ! { "S1015", 5, 1 } , // No cursor name available ! { "S1090", 5, 1 } , // Invalid string or buffer length ! { "S1091", 5, 1 } , // Descriptor type out of range ! { "S1092", 5, 1 } , // Option type out of range ! { "S1093", 5, 1 } , // Invalid parameter number ! { "S1095", 5, 1 } , // Function type out of range ! { "S1096", 5, 1 } , // Information type out of range ! { "S1097", 5, 1 } , // Column type out of range ! { "S1098", 5, 1 } , // Scope type out of range ! { "S1099", 5, 1 } , // Nullable type out of range ! { "S1100", 5, 1 } , // Uniqueness option type out of range ! { "S1101", 5, 1 } , // Accuracy option type out of range ! { "S1103", 5, 1 } , // Direction option out of range ! { "S1105", 5, 1 } , // Invalid parameter type ! { "S1106", 5, 1 } , // Fetch type out of range ! { "S1107", 5, 1 } , // Row value out of range ! { "S1108", 5, 1 } , // Concurrency option out of range ! { "S1109", 5, 1 } , // Invalid cursor position ! { "S1110", 5, 1 } , // Invalid driver completion ! { "S1111", 5, 1 } , // Invalid bookmark value ! { "S1C00", 1, 1 } , // Driver not capable ! { "S1T00", 1, 1 } // Timeout expired }; --- 1759,1853 ---- static odbcErrorDesc errorTable[] = { ! { "01000", 5, 0 }, /* General warning */ ! { "01002", 1, 1 }, /* Disconnect error */ ! { "01004", 0, 1 }, /* Data truncated */ ! { "01006", 5, 1 }, /* Privilege not revoked */ ! { "01S00", 2, 1 }, /* Invalid connection string attribute */ ! { "01S01", 5, 1 }, /* Error in row */ ! { "01S02", 5, 1 }, /* Option value changed */ ! { "01S03", 0, 1 }, /* No rows updated or deleted */ ! { "01S04", 0, 1 }, /* More than one row updated or deleted */ ! { "01S05", 0, 1 }, /* Cancel treated as SQLFreeStmt with the SQL_CLOSE */ ! { "01S06", 2, 1 }, /* Attempt to fetch before the result set returned */ ! { "07001", 2, 1 }, /* Wrong number of parameters */ ! { "07006", 2, 1 }, /* Restricted data type attribute violation */ ! { "07S01", 2, 1 }, /* Invalid use of default parameter */ ! { "08001", 1, 1 }, /* Unable to connect to data source */ ! { "08002", 1, 1 }, /* Connection in use */ ! { "08003", 1, 1 }, /* Connection not open */ ! { "08004", 1, 1 }, /* Data source rejected establishment of connection */ ! { "08007", 1, 1 }, /* Connection failure during transaction */ ! { "08S01", 1, 0 }, /* Communication link failure */ ! { "21S01", 2, 1 }, /* Insert value list does not match column list */ ! { "21S02", 2, 1 }, /* Degree of derived table does not match column list */ ! { "22001", 0, 1 }, /* String data right truncation */ ! { "22002", 5, 1 }, /* Indicator variable required but not supplied */ ! { "22003", 4, 1 }, /* Numeric value out of range */ ! { "22005", 4, 1 }, /* Error in assignment */ ! { "22008", 4, 1 }, /* Datetime field overflow */ ! { "22012", 4, 1 }, /* Division by zero */ ! { "22026", 4, 1 }, /* String data, length mismatch */ ! { "23000", 3, 1 }, /* Integrity constraint violation */ ! { "24000", 5, 1 }, /* Invalid cursor state */ ! { "25000", 5, 1 }, /* Invalid transaction state */ ! { "28000", 1, 1 }, /* Invalid authorization specification */ ! { "34000", 5, 1 }, /* Invalid cursor name */ ! { "37000", 2, 1 }, /* Syntax error or access violation */ ! { "3C000", 5, 1 }, /* Duplicate cursor name */ ! { "40001", 5, 1 }, /* Serialization failure */ ! { "42000", 2, 1 }, /* Syntax error or access violation */ ! { "70100", 1, 1 }, /* Operation aborted */ ! { "IM001", 1, 1 }, /* Driver does not support this function */ ! { "IM002", 1, 1 }, /* Data source name not found and no default driver */ ! { "IM003", 1, 1 }, /* Specified driver could not be loaded */ ! { "IM004", 1, 1 }, /* Driver's SQLAllocEnv failed */ ! { "IM005", 1, 1 }, /* Driver's SQLAllocConnect failed */ ! { "IM006", 1, 1 }, /* Driver's SQLSetConnect-Option failed */ ! { "IM007", 1, 1 }, /* No data source or driver specified; dialog prohibited */ ! { "IM008", 1, 1 }, /* Dialog failed */ ! { "IM009", 1, 1 }, /* Unable to load translation DLL */ ! { "IM010", 1, 1 }, /* Data source name too long */ ! { "IM011", 1, 1 }, /* Driver name too long */ ! { "IM012", 1, 1 }, /* DRIVER keyword syntax error */ ! { "IM013", 1, 1 }, /* Trace file error */ ! { "S0001", 2, 1 }, /* Base table or view already exists */ ! { "S0002", 2, 1 }, /* Base table not found */ ! { "S0011", 2, 1 }, /* Index already exists */ ! { "S0012", 2, 1 }, /* Index not found */ ! { "S0021", 2, 1 }, /* Column already exists */ ! { "S0022", 2, 1 }, /* Column not found */ ! { "S0023", 2, 1 }, /* No default for column */ ! { "S1000", 1, 1 }, /* General error */ ! { "S1001", 1, 1 }, /* Memory allocation failure */ ! { "S1002", 5, 1 }, /* Invalid column number */ ! { "S1003", 5, 1 }, /* Program type out of range */ ! { "S1004", 5, 1 }, /* SQL data type out of range */ ! { "S1008", 1, 1 }, /* Operation canceled */ ! { "S1009", 5, 1 }, /* Invalid argument value */ ! { "S1010", 5, 1 }, /* Function sequence error */ ! { "S1011", 5, 1 }, /* Operation invalid at this time */ ! { "S1012", 5, 1 }, /* Invalid transaction operation code specified */ ! { "S1015", 5, 1 }, /* No cursor name available */ ! { "S1090", 5, 1 }, /* Invalid string or buffer length */ ! { "S1091", 5, 1 }, /* Descriptor type out of range */ ! { "S1092", 5, 1 }, /* Option type out of range */ ! { "S1093", 5, 1 }, /* Invalid parameter number */ ! { "S1095", 5, 1 }, /* Function type out of range */ ! { "S1096", 5, 1 }, /* Information type out of range */ ! { "S1097", 5, 1 }, /* Column type out of range */ ! { "S1098", 5, 1 }, /* Scope type out of range */ ! { "S1099", 5, 1 }, /* Nullable type out of range */ ! { "S1100", 5, 1 }, /* Uniqueness option type out of range */ ! { "S1101", 5, 1 }, /* Accuracy option type out of range */ ! { "S1103", 5, 1 }, /* Direction option out of range */ ! { "S1105", 5, 1 }, /* Invalid parameter type */ ! { "S1106", 5, 1 }, /* Fetch type out of range */ ! { "S1107", 5, 1 }, /* Row value out of range */ ! { "S1108", 5, 1 }, /* Concurrency option out of range */ ! { "S1109", 5, 1 }, /* Invalid cursor position */ ! { "S1110", 5, 1 }, /* Invalid driver completion */ ! { "S1111", 5, 1 }, /* Invalid bookmark value */ ! { "S1C00", 1, 1 }, /* Driver not capable */ ! { "S1T00", 1, 1 } /* Timeout expired */ }; *************** *** 1871,1875 **** &key, errorTable, ! sizeof(errorTable)/ sizeof(odbcErrorDesc), // number of elems sizeof(odbcErrorDesc), odbcCompare); --- 1869,1873 ---- &key, errorTable, ! sizeof(errorTable)/ sizeof(odbcErrorDesc), /* number of elems */ sizeof(odbcErrorDesc), odbcCompare); |