Guess what: ODBC updates and build fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -39,56 +39,75 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <../iodbc/isql.h>
|
||||||
|
#include <../iodbc/isqlext.h>
|
||||||
|
#include <../iodbc/odbc_funcs.h>
|
||||||
|
#include <../iodbc/odbc_types.h>
|
||||||
|
|
||||||
|
typedef float SFLOAT;
|
||||||
|
typedef double SDOUBLE;
|
||||||
|
#define ULONG UDWORD
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define ODBCVER 0x0250
|
#define ODBCVER 0x0250
|
||||||
#include <sql.h>
|
#include <sql.h>
|
||||||
#include <sqlext.h>
|
#include <sqlext.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
enum enumDummy {enumDum1};
|
enum enumDummy {enumDum1};
|
||||||
|
|
||||||
#define SQL_C_BOOLEAN (sizeof(int) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
#define SQL_C_BOOLEAN (sizeof(int) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
||||||
#define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG) //glt 2-21-97
|
#define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG) //glt 2-21-97
|
||||||
|
|
||||||
// Database Globals
|
// Database Globals
|
||||||
const DB_TYPE_NAME_LEN = 40;
|
const int DB_TYPE_NAME_LEN = 40;
|
||||||
const DB_MAX_STATEMENT_LEN = 2048;
|
const int DB_MAX_STATEMENT_LEN = 2048;
|
||||||
const DB_MAX_WHERE_CLAUSE_LEN = 1024;
|
const int DB_MAX_WHERE_CLAUSE_LEN = 1024;
|
||||||
const DB_MAX_ERROR_MSG_LEN = 512;
|
const int DB_MAX_ERROR_MSG_LEN = 512;
|
||||||
const DB_MAX_ERROR_HISTORY = 5;
|
const int DB_MAX_ERROR_HISTORY = 5;
|
||||||
const DB_MAX_TABLE_NAME_LEN = 128;
|
const int DB_MAX_TABLE_NAME_LEN = 128;
|
||||||
const DB_MAX_COLUMN_NAME_LEN = 128;
|
const int DB_MAX_COLUMN_NAME_LEN = 128;
|
||||||
|
|
||||||
const DB_DATA_TYPE_VARCHAR = 1;
|
const int DB_DATA_TYPE_VARCHAR = 1;
|
||||||
const DB_DATA_TYPE_INTEGER = 2;
|
const int DB_DATA_TYPE_INTEGER = 2;
|
||||||
const DB_DATA_TYPE_FLOAT = 3;
|
const int DB_DATA_TYPE_FLOAT = 3;
|
||||||
const DB_DATA_TYPE_DATE = 4;
|
const int DB_DATA_TYPE_DATE = 4;
|
||||||
|
|
||||||
const DB_SELECT_KEYFIELDS = 1;
|
const int DB_SELECT_KEYFIELDS = 1;
|
||||||
const DB_SELECT_WHERE = 2;
|
const int DB_SELECT_WHERE = 2;
|
||||||
const DB_SELECT_MATCHING = 3;
|
const int DB_SELECT_MATCHING = 3;
|
||||||
const DB_SELECT_STATEMENT = 4;
|
const int DB_SELECT_STATEMENT = 4;
|
||||||
|
|
||||||
const DB_UPD_KEYFIELDS = 1;
|
const int DB_UPD_KEYFIELDS = 1;
|
||||||
const DB_UPD_WHERE = 2;
|
const int DB_UPD_WHERE = 2;
|
||||||
|
|
||||||
const DB_DEL_KEYFIELDS = 1;
|
const int DB_DEL_KEYFIELDS = 1;
|
||||||
const DB_DEL_WHERE = 2;
|
const int DB_DEL_WHERE = 2;
|
||||||
const DB_DEL_MATCHING = 3;
|
const int DB_DEL_MATCHING = 3;
|
||||||
|
|
||||||
const DB_WHERE_KEYFIELDS = 1;
|
const int DB_WHERE_KEYFIELDS = 1;
|
||||||
const DB_WHERE_MATCHING = 2;
|
const int DB_WHERE_MATCHING = 2;
|
||||||
|
|
||||||
const DB_CURSOR0 = 0;
|
const int DB_CURSOR0 = 0;
|
||||||
const DB_CURSOR1 = 1;
|
const int DB_CURSOR1 = 1;
|
||||||
const DB_CURSOR2 = 2;
|
const int DB_CURSOR2 = 2;
|
||||||
//const DB_CURSOR3 = 3;
|
//const int DB_CURSOR3 = 3;
|
||||||
//const DB_CURSOR4 = 4;
|
//const int DB_CURSOR4 = 4;
|
||||||
//const DB_CURSOR5 = 5;
|
//const int DB_CURSOR5 = 5;
|
||||||
|
|
||||||
const DB_GRANT_SELECT = 1;
|
const int DB_GRANT_SELECT = 1;
|
||||||
const DB_GRANT_INSERT = 2;
|
const int DB_GRANT_INSERT = 2;
|
||||||
const DB_GRANT_UPDATE = 4;
|
const int DB_GRANT_UPDATE = 4;
|
||||||
const DB_GRANT_DELETE = 8;
|
const int DB_GRANT_DELETE = 8;
|
||||||
const DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE;
|
const int DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE;
|
||||||
|
|
||||||
// ODBC Error codes (derived from ODBC SqlState codes)
|
// ODBC Error codes (derived from ODBC SqlState codes)
|
||||||
enum ODBC_ERRORS
|
enum ODBC_ERRORS
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "wx/db.h"
|
#include "wx/db.h"
|
||||||
|
|
||||||
const ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger
|
const int ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger
|
||||||
|
|
||||||
// The following class is used to define a column of a table.
|
// The following class is used to define a column of a table.
|
||||||
// The wxTable constructor will dynamically allocate as many of
|
// The wxTable constructor will dynamically allocate as many of
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
wxTable(wxDB *pwxDB, const char *tblName, const int nCols, const char *qryTblName = 0);
|
wxTable(wxDB *pwxDB, const char *tblName, const int nCols, const char *qryTblName = 0);
|
||||||
~wxTable();
|
virtual ~wxTable();
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool CreateTable(void);
|
bool CreateTable(void);
|
||||||
bool CreateIndex(char * idxName, bool unique, int noIdxCols, CidxDef *pIdxDefs);
|
bool CreateIndex(char * idxName, bool unique, int noIdxCols, CidxDef *pIdxDefs);
|
||||||
|
@@ -37,6 +37,10 @@
|
|||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#endif //WX_PRECOMP
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
#include "db.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h> // Included strictly for reading the text file with the database parameters
|
#include <stdio.h> // Included strictly for reading the text file with the database parameters
|
||||||
|
|
||||||
#include <wx/db.h> // Required in the file which will get the data source connection
|
#include <wx/db.h> // Required in the file which will get the data source connection
|
||||||
|
@@ -14,12 +14,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/*
|
|
||||||
// SYNOPSIS START
|
|
||||||
|
|
||||||
Contains dialog class for creating a data table lookup listbox
|
Contains dialog class for creating a data table lookup listbox
|
||||||
|
|
||||||
// SYNOPSIS STOP
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LISTDB_DOT_H
|
#ifndef LISTDB_DOT_H
|
||||||
|
@@ -52,6 +52,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include "wx/db.h"
|
#include "wx/db.h"
|
||||||
|
|
||||||
DbList *PtrBegDbList = 0;
|
DbList *PtrBegDbList = 0;
|
||||||
@@ -308,94 +310,94 @@ bool wxDB::getDbInfo(void)
|
|||||||
{
|
{
|
||||||
SWORD cb;
|
SWORD cb;
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_SERVER_NAME, dbInf.serverName, 40, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_SERVER_NAME, (UCHAR*) dbInf.serverName, 40, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_DATABASE_NAME, dbInf.databaseName, 128, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_DATABASE_NAME, (UCHAR*) dbInf.databaseName, 128, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_DBMS_NAME, dbInf.dbmsName, 40, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_DBMS_NAME, (UCHAR*) dbInf.dbmsName, 40, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_DBMS_VER, dbInf.dbmsVer, 20, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_DBMS_VER, (UCHAR*) dbInf.dbmsVer, 20, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ACTIVE_CONNECTIONS, &dbInf.maxConnections, sizeof(dbInf.maxConnections), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_ACTIVE_CONNECTIONS, (UCHAR*) &dbInf.maxConnections, sizeof(dbInf.maxConnections), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ACTIVE_STATEMENTS, &dbInf.maxStmts, sizeof(dbInf.maxStmts), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_ACTIVE_STATEMENTS, (UCHAR*) &dbInf.maxStmts, sizeof(dbInf.maxStmts), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_DRIVER_NAME, dbInf.driverName, 40, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_DRIVER_NAME, (UCHAR*) dbInf.driverName, 40, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_DRIVER_ODBC_VER, dbInf.odbcVer, 20, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_DRIVER_ODBC_VER, (UCHAR*) dbInf.odbcVer, 20, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ODBC_VER, dbInf.drvMgrOdbcVer, 20, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_ODBC_VER, (UCHAR*) dbInf.drvMgrOdbcVer, 20, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_DRIVER_VER, dbInf.driverVer, 40, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_DRIVER_VER, (UCHAR*) dbInf.driverVer, 40, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ODBC_API_CONFORMANCE, &dbInf.apiConfLvl, sizeof(dbInf.apiConfLvl), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_ODBC_API_CONFORMANCE, (UCHAR*) &dbInf.apiConfLvl, sizeof(dbInf.apiConfLvl), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ODBC_SAG_CLI_CONFORMANCE, &dbInf.cliConfLvl, sizeof(dbInf.cliConfLvl), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_ODBC_SAG_CLI_CONFORMANCE, (UCHAR*) &dbInf.cliConfLvl, sizeof(dbInf.cliConfLvl), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ODBC_SQL_CONFORMANCE, &dbInf.sqlConfLvl, sizeof(dbInf.sqlConfLvl), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_ODBC_SQL_CONFORMANCE, (UCHAR*) &dbInf.sqlConfLvl, sizeof(dbInf.sqlConfLvl), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_OUTER_JOINS, dbInf.outerJoins, 2, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_OUTER_JOINS, (UCHAR*) dbInf.outerJoins, 2, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_PROCEDURES, dbInf.procedureSupport, 2, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_PROCEDURES, (UCHAR*) dbInf.procedureSupport, 2, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_CURSOR_COMMIT_BEHAVIOR, &dbInf.cursorCommitBehavior, sizeof(dbInf.cursorCommitBehavior), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_CURSOR_COMMIT_BEHAVIOR, (UCHAR*) &dbInf.cursorCommitBehavior, sizeof(dbInf.cursorCommitBehavior), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_CURSOR_ROLLBACK_BEHAVIOR, &dbInf.cursorRollbackBehavior, sizeof(dbInf.cursorRollbackBehavior), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_CURSOR_ROLLBACK_BEHAVIOR, (UCHAR*) &dbInf.cursorRollbackBehavior, sizeof(dbInf.cursorRollbackBehavior), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_NON_NULLABLE_COLUMNS, &dbInf.supportNotNullClause, sizeof(dbInf.supportNotNullClause), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_NON_NULLABLE_COLUMNS, (UCHAR*) &dbInf.supportNotNullClause, sizeof(dbInf.supportNotNullClause), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ODBC_SQL_OPT_IEF, dbInf.supportIEF, 2, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_ODBC_SQL_OPT_IEF, (UCHAR*) dbInf.supportIEF, 2, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION, &dbInf.txnIsolation, sizeof(dbInf.txnIsolation), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION, (UCHAR*) &dbInf.txnIsolation, sizeof(dbInf.txnIsolation), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_TXN_ISOLATION_OPTION, &dbInf.txnIsolationOptions, sizeof(dbInf.txnIsolationOptions), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_TXN_ISOLATION_OPTION, (UCHAR*) &dbInf.txnIsolationOptions, sizeof(dbInf.txnIsolationOptions), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_FETCH_DIRECTION, &dbInf.fetchDirections, sizeof(dbInf.fetchDirections), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_FETCH_DIRECTION, (UCHAR*) &dbInf.fetchDirections, sizeof(dbInf.fetchDirections), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_LOCK_TYPES, &dbInf.lockTypes, sizeof(dbInf.lockTypes), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_LOCK_TYPES, (UCHAR*) &dbInf.lockTypes, sizeof(dbInf.lockTypes), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_POS_OPERATIONS, &dbInf.posOperations, sizeof(dbInf.posOperations), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_POS_OPERATIONS, (UCHAR*) &dbInf.posOperations, sizeof(dbInf.posOperations), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_POSITIONED_STATEMENTS, &dbInf.posStmts, sizeof(dbInf.posStmts), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_POSITIONED_STATEMENTS, (UCHAR*) &dbInf.posStmts, sizeof(dbInf.posStmts), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_SCROLL_CONCURRENCY, &dbInf.scrollConcurrency, sizeof(dbInf.scrollConcurrency), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_SCROLL_CONCURRENCY, (UCHAR*) &dbInf.scrollConcurrency, sizeof(dbInf.scrollConcurrency), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_SCROLL_OPTIONS, &dbInf.scrollOptions, sizeof(dbInf.scrollOptions), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_SCROLL_OPTIONS, (UCHAR*) &dbInf.scrollOptions, sizeof(dbInf.scrollOptions), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_STATIC_SENSITIVITY, &dbInf.staticSensitivity, sizeof(dbInf.staticSensitivity), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_STATIC_SENSITIVITY, (UCHAR*) &dbInf.staticSensitivity, sizeof(dbInf.staticSensitivity), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_TXN_CAPABLE, &dbInf.txnCapable, sizeof(dbInf.txnCapable), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_TXN_CAPABLE, (UCHAR*) &dbInf.txnCapable, sizeof(dbInf.txnCapable), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_LOGIN_TIMEOUT, &dbInf.loginTimeout, sizeof(dbInf.loginTimeout), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_LOGIN_TIMEOUT, (UCHAR*) &dbInf.loginTimeout, sizeof(dbInf.loginTimeout), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
#ifdef DBDEBUG_CONSOLE
|
#ifdef DBDEBUG_CONSOLE
|
||||||
@@ -625,15 +627,15 @@ bool wxDB::getDataTypeInfo(SWORD fSqlType, SqlTypeInfo &structSQLTypeInfo)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
// Obtain columns from the record
|
// Obtain columns from the record
|
||||||
if (SQLGetData(hstmt, 1, SQL_C_CHAR, structSQLTypeInfo.TypeName, DB_TYPE_NAME_LEN, &cbRet) != SQL_SUCCESS)
|
if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) structSQLTypeInfo.TypeName, DB_TYPE_NAME_LEN, &cbRet) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
if (SQLGetData(hstmt, 3, SQL_C_LONG, &structSQLTypeInfo.Precision, 0, &cbRet) != SQL_SUCCESS)
|
if (SQLGetData(hstmt, 3, SQL_C_LONG, (UCHAR*) &structSQLTypeInfo.Precision, 0, &cbRet) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
if (SQLGetData(hstmt, 8, SQL_C_SHORT, &structSQLTypeInfo.CaseSensitive, 0, &cbRet) != SQL_SUCCESS)
|
if (SQLGetData(hstmt, 8, SQL_C_SHORT, (UCHAR*) &structSQLTypeInfo.CaseSensitive, 0, &cbRet) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
// if (SQLGetData(hstmt, 14, SQL_C_SHORT, &structSQLTypeInfo.MinimumScale, 0, &cbRet) != SQL_SUCCESS)
|
// if (SQLGetData(hstmt, 14, SQL_C_SHORT, (UCHAR*) &structSQLTypeInfo.MinimumScale, 0, &cbRet) != SQL_SUCCESS)
|
||||||
// return(DispAllErrors(henv, hdbc, hstmt));
|
// return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
if (SQLGetData(hstmt, 15, SQL_C_SHORT, &structSQLTypeInfo.MaximumScale, 0, &cbRet) != SQL_SUCCESS)
|
if (SQLGetData(hstmt, 15, SQL_C_SHORT, (UCHAR*) &structSQLTypeInfo.MaximumScale, 0, &cbRet) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
|
|
||||||
if (structSQLTypeInfo.MaximumScale < 0)
|
if (structSQLTypeInfo.MaximumScale < 0)
|
||||||
@@ -1144,9 +1146,9 @@ CcolInf *wxDB::GetColumns(char *tableName[])
|
|||||||
delete [] colInf;
|
delete [] colInf;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
SQLBindCol(hstmt, 3, SQL_C_CHAR, tblName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
SQLBindCol(hstmt, 3, SQL_C_CHAR, (UCHAR*) tblName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
SQLBindCol(hstmt, 4, SQL_C_CHAR, colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
SQLBindCol(hstmt, 4, SQL_C_CHAR, (UCHAR*) colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
SQLBindCol(hstmt, 5, SQL_C_SSHORT, &sqlDataType, 0, &cb);
|
SQLBindCol(hstmt, 5, SQL_C_SSHORT, (UCHAR*) &sqlDataType, 0, &cb);
|
||||||
while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS)
|
while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
if (pass == 1) // First pass, just add up the number of columns
|
if (pass == 1) // First pass, just add up the number of columns
|
||||||
@@ -1217,12 +1219,12 @@ bool wxDB::Catalog(char *userID, char *fileName)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLBindCol(hstmt, 3, SQL_C_CHAR, tblName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
SQLBindCol(hstmt, 3, SQL_C_CHAR, (UCHAR*) tblName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
SQLBindCol(hstmt, 4, SQL_C_CHAR, colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
SQLBindCol(hstmt, 4, SQL_C_CHAR, (UCHAR*) colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
SQLBindCol(hstmt, 5, SQL_C_SSHORT, &sqlDataType, 0, &cb);
|
SQLBindCol(hstmt, 5, SQL_C_SSHORT, (UCHAR*) &sqlDataType, 0, &cb);
|
||||||
SQLBindCol(hstmt, 6, SQL_C_CHAR, typeName, 16, &cb);
|
SQLBindCol(hstmt, 6, SQL_C_CHAR, (UCHAR*) typeName, 16, &cb);
|
||||||
SQLBindCol(hstmt, 7, SQL_C_SSHORT, &precision, 0, &cb);
|
SQLBindCol(hstmt, 7, SQL_C_SSHORT, (UCHAR*) &precision, 0, &cb);
|
||||||
SQLBindCol(hstmt, 8, SQL_C_SSHORT, &length, 0, &cb);
|
SQLBindCol(hstmt, 8, SQL_C_SSHORT, (UCHAR*) &length, 0, &cb);
|
||||||
|
|
||||||
char outStr[256];
|
char outStr[256];
|
||||||
strcpy(tblNameSave,"");
|
strcpy(tblNameSave,"");
|
||||||
|
@@ -132,7 +132,7 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, const char *
|
|||||||
// Datasource does not support static cursors. Driver
|
// Datasource does not support static cursors. Driver
|
||||||
// will substitute a cursor type. Call SQLGetStmtOption()
|
// will substitute a cursor type. Call SQLGetStmtOption()
|
||||||
// to determine which cursor type was selected.
|
// to determine which cursor type was selected.
|
||||||
if (SQLGetStmtOption(c1, SQL_CURSOR_TYPE, &cursorType) != SQL_SUCCESS)
|
if (SQLGetStmtOption(c1, SQL_CURSOR_TYPE, (UCHAR*) &cursorType) != SQL_SUCCESS)
|
||||||
pDb->DispAllErrors(henv, hdbc, c1);
|
pDb->DispAllErrors(henv, hdbc, c1);
|
||||||
#ifdef _CONSOLE
|
#ifdef _CONSOLE
|
||||||
cout << "Static cursor changed to: ";
|
cout << "Static cursor changed to: ";
|
||||||
@@ -494,7 +494,7 @@ UWORD wxTable::GetRowNum(void)
|
|||||||
{
|
{
|
||||||
UDWORD rowNum;
|
UDWORD rowNum;
|
||||||
|
|
||||||
if (SQLGetStmtOption(hstmt, SQL_ROW_NUMBER, &rowNum) != SQL_SUCCESS)
|
if (SQLGetStmtOption(hstmt, SQL_ROW_NUMBER, (UCHAR*) &rowNum) != SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
pDb->DispAllErrors(henv, hdbc, hstmt);
|
pDb->DispAllErrors(henv, hdbc, hstmt);
|
||||||
return(0);
|
return(0);
|
||||||
@@ -550,7 +550,7 @@ bool wxTable::bindInsertParams(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SQLBindParameter(hstmtInsert, i+1, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
|
if (SQLBindParameter(hstmtInsert, i+1, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
|
||||||
fSqlType, precision, scale, colDefs[i].PtrDataObj,
|
fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj,
|
||||||
precision+1,&colDefs[i].CbValue) != SQL_SUCCESS)
|
precision+1,&colDefs[i].CbValue) != SQL_SUCCESS)
|
||||||
return(pDb->DispAllErrors(henv, hdbc, hstmtInsert));
|
return(pDb->DispAllErrors(henv, hdbc, hstmtInsert));
|
||||||
}
|
}
|
||||||
@@ -605,7 +605,7 @@ bool wxTable::bindUpdateParams(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SQLBindParameter(hstmtUpdate, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
|
if (SQLBindParameter(hstmtUpdate, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
|
||||||
fSqlType, precision, scale, colDefs[i].PtrDataObj,
|
fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj,
|
||||||
precision+1, &colDefs[i].CbValue) != SQL_SUCCESS)
|
precision+1, &colDefs[i].CbValue) != SQL_SUCCESS)
|
||||||
return(pDb->DispAllErrors(henv, hdbc, hstmtUpdate));
|
return(pDb->DispAllErrors(henv, hdbc, hstmtUpdate));
|
||||||
}
|
}
|
||||||
@@ -623,7 +623,7 @@ bool wxTable::bindCols(HSTMT cursor)
|
|||||||
// Bind each column of the table to a memory address for fetching data
|
// Bind each column of the table to a memory address for fetching data
|
||||||
for (int i = 0; i < noCols; i++)
|
for (int i = 0; i < noCols; i++)
|
||||||
{
|
{
|
||||||
if (SQLBindCol(cursor, i+1, colDefs[i].SqlCtype, colDefs[i].PtrDataObj,
|
if (SQLBindCol(cursor, i+1, colDefs[i].SqlCtype, (UCHAR*) colDefs[i].PtrDataObj,
|
||||||
colDefs[i].SzDataObj, &cb) != SQL_SUCCESS)
|
colDefs[i].SzDataObj, &cb) != SQL_SUCCESS)
|
||||||
return(pDb->DispAllErrors(henv, hdbc, cursor));
|
return(pDb->DispAllErrors(henv, hdbc, cursor));
|
||||||
}
|
}
|
||||||
@@ -1040,7 +1040,7 @@ void wxTable::GetUpdateStmt(char *pSqlStmt, int typeOfUpd, char *pWhereClause)
|
|||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
// simply fall down through the code and build the WHERE clause
|
// simply fall down through the code and build the WHERE clause
|
||||||
// based on the key fields.
|
// based on the key fields.
|
||||||
if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
|
if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
strcat(pSqlStmt, "ROWID = '");
|
strcat(pSqlStmt, "ROWID = '");
|
||||||
strcat(pSqlStmt, rowid);
|
strcat(pSqlStmt, rowid);
|
||||||
@@ -1092,7 +1092,7 @@ void wxTable::GetDeleteStmt(char *pSqlStmt, int typeOfDel, char *pWhereClause)
|
|||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
// simply fall down through the code and build the WHERE clause
|
// simply fall down through the code and build the WHERE clause
|
||||||
// based on the key fields.
|
// based on the key fields.
|
||||||
if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
|
if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
strcat(pSqlStmt, "ROWID = '");
|
strcat(pSqlStmt, "ROWID = '");
|
||||||
strcat(pSqlStmt, rowid);
|
strcat(pSqlStmt, rowid);
|
||||||
@@ -1216,9 +1216,11 @@ bool wxTable::IsColNull(int colNo)
|
|||||||
|
|
||||||
bool wxTable::CanSelectForUpdate(void)
|
bool wxTable::CanSelectForUpdate(void)
|
||||||
{
|
{
|
||||||
|
#ifndef __WXGTK__
|
||||||
if (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE)
|
if (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE)
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
} // wxTable::CanSelectForUpdate()
|
} // wxTable::CanSelectForUpdate()
|
||||||
@@ -1327,7 +1329,7 @@ void wxTable::SetColDefs (int index, char *fieldName, int dataType, void *pData,
|
|||||||
int cType, int size, bool keyField, bool upd,
|
int cType, int size, bool keyField, bool upd,
|
||||||
bool insAllow, bool derivedCol)
|
bool insAllow, bool derivedCol)
|
||||||
{
|
{
|
||||||
if (strlen(fieldName) > DB_MAX_COLUMN_NAME_LEN) // glt 4/21/97
|
if (strlen(fieldName) > (uint)DB_MAX_COLUMN_NAME_LEN) // glt 4/21/97
|
||||||
{
|
{
|
||||||
strncpy (colDefs[index].ColName, fieldName, DB_MAX_COLUMN_NAME_LEN);
|
strncpy (colDefs[index].ColName, fieldName, DB_MAX_COLUMN_NAME_LEN);
|
||||||
colDefs[index].ColName[DB_MAX_COLUMN_NAME_LEN] = 0; // glt 10/23/97
|
colDefs[index].ColName[DB_MAX_COLUMN_NAME_LEN] = 0; // glt 10/23/97
|
||||||
@@ -1439,7 +1441,7 @@ ULONG wxTable::Count(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the result
|
// Obtain the result
|
||||||
if (SQLGetData(hstmtCount, 1, SQL_C_ULONG, &l, sizeof(l), &cb) != SQL_SUCCESS)
|
if (SQLGetData(hstmtCount, 1, SQL_C_ULONG, (UCHAR*) &l, sizeof(l), &cb) != SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
pDb->DispAllErrors(henv, hdbc, hstmtCount);
|
pDb->DispAllErrors(henv, hdbc, hstmtCount);
|
||||||
return(0);
|
return(0);
|
||||||
@@ -1480,7 +1482,7 @@ bool wxTable::Refresh(void)
|
|||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
// simply fall down through the code and build the WHERE clause
|
// simply fall down through the code and build the WHERE clause
|
||||||
// based on the key fields.
|
// based on the key fields.
|
||||||
if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
|
if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
strcat(whereClause, queryTableName);
|
strcat(whereClause, queryTableName);
|
||||||
strcat(whereClause, ".ROWID = '");
|
strcat(whereClause, ".ROWID = '");
|
||||||
|
@@ -34,7 +34,8 @@ LIB_CPP_SRC=\
|
|||||||
common/memory.cpp \
|
common/memory.cpp \
|
||||||
common/module.cpp \
|
common/module.cpp \
|
||||||
common/object.cpp \
|
common/object.cpp \
|
||||||
common/odbc.cpp \
|
common/db.cpp \
|
||||||
|
common/dbtable.cpp \
|
||||||
common/postscrp.cpp \
|
common/postscrp.cpp \
|
||||||
common/prntbase.cpp \
|
common/prntbase.cpp \
|
||||||
common/resource.cpp \
|
common/resource.cpp \
|
||||||
|
@@ -1,58 +1,58 @@
|
|||||||
July 30, 1995, v2.00.beta:
|
July 30, 1995, v2.00.beta:
|
||||||
0. the first release and beta version.
|
0. the first release and beta version.
|
||||||
|
|
||||||
Sep. 11, 1995, v2.10:
|
Sep. 11, 1995, v2.10:
|
||||||
1. Porting to AIX 3.x and 4.x, by writing dlopen(),
|
1. Porting to AIX 3.x and 4.x, by writing dlopen(),
|
||||||
dlsym(), dlclose() interface.
|
dlsym(), dlclose() interface.
|
||||||
2. Tested on SCO OpenServer 5.x
|
2. Tested on SCO OpenServer 5.x
|
||||||
3. Awared of that, unlike s700/s800, exported function
|
3. Awared of that, unlike s700/s800, exported function
|
||||||
symbols on HP9000 s300/s400 will be prepended with
|
symbols on HP9000 s300/s400 will be prepended with
|
||||||
a '_' prefix by compiler(and this '_' prefix is not
|
a '_' prefix by compiler(and this '_' prefix is not
|
||||||
automatically handled by shl_findsym()). Now, it works
|
automatically handled by shl_findsym()). Now, it works
|
||||||
fine on s300/s400.
|
fine on s300/s400.
|
||||||
4. Support driver ODBC call tracing.
|
4. Support driver ODBC call tracing.
|
||||||
|
|
||||||
Oct. 12, 1995, v2.11:
|
Oct. 12, 1995, v2.11:
|
||||||
5. Driver's SQLNumResultCols() will automatically be
|
5. Driver's SQLNumResultCols() will automatically be
|
||||||
invoked in driver manager's SQLExecute(),
|
invoked in driver manager's SQLExecute(),
|
||||||
SQLExecDirect() and SQLParamData() after successfully
|
SQLExecDirect() and SQLParamData() after successfully
|
||||||
(i.e. return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO )
|
(i.e. return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO )
|
||||||
calling of their correspondent driver functions. This
|
calling of their correspondent driver functions. This
|
||||||
simplifies the state tracing/checking of the driver
|
simplifies the state tracing/checking of the driver
|
||||||
manager a lot and allows store procedures to return
|
manager a lot and allows store procedures to return
|
||||||
result set and also make iODBC driver manager work
|
result set and also make iODBC driver manager work
|
||||||
properly with SELECT INTO statements which actually
|
properly with SELECT INTO statements which actually
|
||||||
don't return result sets.
|
don't return result sets.
|
||||||
6. Memory leaks are cleared.
|
6. Memory leaks are cleared.
|
||||||
7. Two bugs in dld.c for AIX are fixed
|
7. Two bugs in dld.c for AIX are fixed
|
||||||
8. A bug of setting tracing option is fixed.
|
8. A bug of setting tracing option is fixed.
|
||||||
9. The driver will not be unloaded by SQLDisconnect()
|
9. The driver will not be unloaded by SQLDisconnect()
|
||||||
but by SQLFreeConnect() or next SQLConnect()/
|
but by SQLFreeConnect() or next SQLConnect()/
|
||||||
SQLDriverConnect()/SQLBrowsConnect() on a different
|
SQLDriverConnect()/SQLBrowsConnect() on a different
|
||||||
driver. This will save driver's loading time if it
|
driver. This will save driver's loading time if it
|
||||||
has been used by a previous connection(even there
|
has been used by a previous connection(even there
|
||||||
is no active connection on this driver).
|
is no active connection on this driver).
|
||||||
10.Another three platforms are supported:
|
10.Another three platforms are supported:
|
||||||
FreeBSD 2.x
|
FreeBSD 2.x
|
||||||
Concurrent Max/OS SVR4 1.x
|
Concurrent Max/OS SVR4 1.x
|
||||||
DG/UX 5.x
|
DG/UX 5.x
|
||||||
11.autoconfig and build -- shell scripts to help modifying
|
11.autoconfig and build -- shell scripts to help modifying
|
||||||
Config.mk and building iodbc driver manager
|
Config.mk and building iodbc driver manager
|
||||||
|
|
||||||
Nov. 12, 1995, v2.12
|
Nov. 12, 1995, v2.12
|
||||||
12.I realized that a driver manager doesn't aware of
|
12.I realized that a driver manager doesn't aware of
|
||||||
difference between a C5 (i.e. hstmt) and a C6
|
difference between a C5 (i.e. hstmt) and a C6
|
||||||
(i.e. transaction) states.
|
(i.e. transaction) states.
|
||||||
13.The link flags "-lc" has been droped from Linux ELF
|
13.The link flags "-lc" has been droped from Linux ELF
|
||||||
section of Config.mk to fix a segment fault problem.
|
section of Config.mk to fix a segment fault problem.
|
||||||
Now, it works fine on Slackware 2.3 and Red Hat 2.0
|
Now, it works fine on Slackware 2.3 and Red Hat 2.0
|
||||||
(kernel version are 1.2.xx and 1.3.xx respectively).
|
(kernel version are 1.2.xx and 1.3.xx respectively).
|
||||||
14.On FreeBSD 2.x, dlsym() doesn't handle the '_' prefix
|
14.On FreeBSD 2.x, dlsym() doesn't handle the '_' prefix
|
||||||
prepended to an exportting function symbol by compiler.
|
prepended to an exportting function symbol by compiler.
|
||||||
So, CLI_NAME_PREFIX needs to be defined as "_SQL" for
|
So, CLI_NAME_PREFIX needs to be defined as "_SQL" for
|
||||||
FreeBSD 2.x.
|
FreeBSD 2.x.
|
||||||
15.Some files are renamed
|
15.Some files are renamed
|
||||||
dld.c -> dlf.c
|
dld.c -> dlf.c
|
||||||
dld.h -> dlf.h
|
dld.h -> dlf.h
|
||||||
confg.h -> config.h
|
confg.h -> config.h
|
||||||
16. Fix a bug on setting tracing options.
|
16. Fix a bug on setting tracing options.
|
||||||
|
@@ -1,32 +1,58 @@
|
|||||||
include Version.mk
|
include ../Version.mk
|
||||||
include Config.mk
|
include ../Config.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INCDIR = .
|
||||||
|
OUTFILE = iodbc
|
||||||
|
|
||||||
|
CFLAGS = -O $(PIC) $(ANSI) -I$(INCDIR) -D$(DLDAPI) $(CFLAGSX)\
|
||||||
|
-DVERSION=\"$(VERSION)$(EXTVER)\"
|
||||||
|
|
||||||
|
# ODBC adminiatator is statically linked on BSDI 3.1
|
||||||
|
# On this one can comment the following line:
|
||||||
|
#
|
||||||
|
ODBCDM = $(ODBC_LIBPATH)/$(OUTFILE).$(DLSUFFIX)
|
||||||
|
|
||||||
|
OBJS = dlf.o dlproc.o herr.o henv.o hdbc.o hstmt.o connect.o prepare.o\
|
||||||
|
execute.o result.o fetch.o info.o catalog.o misc.o itrace.o $(OBJX)
|
||||||
|
|
||||||
|
all: $(OBJS) $(ODBCDM) $(ODBC_LIBPATH)/lib$(OUTFILE).a
|
||||||
|
@rm -f $(ODBC_INCLUDE)/isql.h
|
||||||
INCDIR = .
|
@rm -f $(ODBC_INCLUDE)/isqlext.h
|
||||||
OUTDIR = $(HOME)
|
@rm -f $(ODBC_INCLUDE)/odbc_types.h
|
||||||
|
@rm -f $(ODBC_INCLUDE)/odbc_funcs.h
|
||||||
CFLAGS = -O $(PIC) $(ANSI) -I$(INCDIR) -D$(DLDAPI) $(CFLAGSX)\
|
cp isql.h $(ODBC_INCLUDE)/
|
||||||
-DVERSION=\"$(VERSION)$(EXTVER)\"
|
cp isqlext.h $(ODBC_INCLUDE)/
|
||||||
|
cp odbc_types.h $(ODBC_INCLUDE)/
|
||||||
ODBCDM = $(OUTDIR)/$(OUTFILE)-$(VERSION).$(DLSUFFIX)
|
cp odbc_funcs.h $(ODBC_INCLUDE)/
|
||||||
|
@echo
|
||||||
OBJS = dlf.o dlproc.o herr.o henv.o hdbc.o hstmt.o \
|
@echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
connect.o prepare.o execute.o result.o \
|
@echo
|
||||||
fetch.o info.o catalog.o misc.o itrace.o $(OBJX)
|
@echo Don\'t forget tu update $(ODBC_LIBPATH)/iodbc.ini with your conf
|
||||||
|
@echo
|
||||||
all: $(OBJS)
|
@echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@echo "Generating iODBC driver manager -->" $(ODBCDM)
|
@echo
|
||||||
@\rm -f $(ODBCDM)
|
|
||||||
@$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(ODBCDM)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
\rm -f $(OBJS)
|
\rm -f $(OBJS)
|
||||||
|
|
||||||
|
delete: clean
|
||||||
|
|
||||||
|
delete_all: delete
|
||||||
|
|
||||||
|
misc.o: misc.c
|
||||||
|
$(CC) $(CFLAGS) -DFIX_INI_FILE -DDIR_INI_FILE=\"$(ODBC_LIBPATH)\" -c $<
|
||||||
|
|
||||||
|
$(ODBC_LIBPATH)/lib$(OUTFILE).a: $(OBJS)
|
||||||
|
$(AR) $(ODBC_LIBPATH)/lib$(OUTFILE).a $(OBJS)
|
||||||
|
$(RANLIB) $(ODBC_LIBPATH)/lib$(OUTFILE).a
|
||||||
|
|
||||||
|
$(ODBCDM): $(OBJS)
|
||||||
|
@echo "Generating iODBC driver manager -->" $(ODBCDM)
|
||||||
|
@rm -f $(ODBCDM)
|
||||||
|
$(LD) $(LDFLAGS) -L$(ODBC_LIBPATH) $(OBJS) -o $(ODBCDM) $(LIBS)
|
||||||
|
if [ ! -f $(ODBC_LIBPATH)/iodbc.ini ]; then cp iodbc.$(OS) $(ODBC_LIBPATH)/iodbc.ini; fi
|
||||||
|
|
||||||
|
270
src/iodbc/README
270
src/iodbc/README
@@ -1,187 +1,187 @@
|
|||||||
0. Changes
|
0. Changes
|
||||||
a. I realized that a driver manager doesn't aware of
|
a. I realized that a driver manager doesn't aware of
|
||||||
difference between a C5 (i.e. hstmt) and a C6
|
difference between a C5 (i.e. hstmt) and a C6
|
||||||
(i.e. transaction) states.
|
(i.e. transaction) states.
|
||||||
|
|
||||||
b. The link flags "-lc" has been removed from Linux ELF
|
b. The link flags "-lc" has been removed from Linux ELF
|
||||||
section of Config.mk to fix a segment fault problem.
|
section of Config.mk to fix a segment fault problem.
|
||||||
Now, it works fine on Slackware 2.3 and Red Hat 2.0
|
Now, it works fine on Slackware 2.3 and Red Hat 2.0
|
||||||
(kernel version are 1.2.xx and 1.3.xx respectively).
|
(kernel version are 1.2.xx and 1.3.xx respectively).
|
||||||
|
|
||||||
c. On FreeBSD 2.x, dlsym() doesn't handle the '_'
|
|
||||||
prepended before a exporting function symbol. So,
|
|
||||||
CLI_NAME_PREFIX needs to be defined as "_SQL" for
|
|
||||||
FreeBSD.
|
|
||||||
|
|
||||||
d. Some files are renamed
|
c. On FreeBSD 2.x, dlsym() doesn't handle the '_'
|
||||||
dld.c -> dlf.c
|
prepended before a exporting function symbol. So,
|
||||||
dld.h -> dlf.h
|
CLI_NAME_PREFIX needs to be defined as "_SQL" for
|
||||||
confg.h -> config.h
|
FreeBSD.
|
||||||
|
|
||||||
|
d. Some files are renamed
|
||||||
|
dld.c -> dlf.c
|
||||||
|
dld.h -> dlf.h
|
||||||
|
confg.h -> config.h
|
||||||
|
|
||||||
1. iODBC driver manager platform availability
|
1. iODBC driver manager platform availability
|
||||||
|
|
||||||
iODBC driver manager has been ported to following Unix platforms:
|
iODBC driver manager has been ported to following Unix platforms:
|
||||||
|
|
||||||
SunOS 4.1.x Sun Sparc
|
SunOS 4.1.x Sun Sparc
|
||||||
HP/UX 9.x, 10.x HP9000 s700/s800
|
HP/UX 9.x, 10.x HP9000 s700/s800
|
||||||
HP/UX 9.x HP9000 s300/s400
|
HP/UX 9.x HP9000 s300/s400
|
||||||
IBM AIX 3.x, 4.x IBM RS6000, PowerPC
|
IBM AIX 3.x, 4.x IBM RS6000, PowerPC
|
||||||
Sun Solaris 2.x Sun Sparc, PCx86
|
Sun Solaris 2.x Sun Sparc, PCx86
|
||||||
SGI Irix SVR4 5.x, 6.x IP12 MIPS, IP22 MIPS
|
SGI Irix SVR4 5.x, 6.x IP12 MIPS, IP22 MIPS
|
||||||
NCR SVR4 3.x NCR 3435
|
NCR SVR4 3.x NCR 3435
|
||||||
UnixWare SVR4.2 1.x, 2.x x86
|
UnixWare SVR4.2 1.x, 2.x x86
|
||||||
DEC Unix(OSF/1) 3.x, 4.x DEC Alpha
|
DEC Unix(OSF/1) 3.x, 4.x DEC Alpha
|
||||||
FreeBSD 2.x x86
|
FreeBSD 2.x x86
|
||||||
BSDI BSD/OS 2.x ?
|
BSDI BSD/OS 2.x ?
|
||||||
Linux ELF 1.2.x, 1.3.x x86
|
Linux ELF 1.2.x, 1.3.x x86
|
||||||
SCO OpenServer 5.x x86
|
SCO OpenServer 5.x x86
|
||||||
Max/OS SVR4 1.x Concurrent Maxion 9200 MP
|
Max/OS SVR4 1.x Concurrent Maxion 9200 MP
|
||||||
DG/UX 5.x Aviion
|
DG/UX 5.x Aviion
|
||||||
|
|
||||||
Porting of iODBC driver manager to some non-unix operating systems
|
Porting of iODBC driver manager to some non-unix operating systems
|
||||||
such as Windows family(3.x, 95, NT), OS/2 and Mac is supported but
|
such as Windows family(3.x, 95, NT), OS/2 and Mac is supported but
|
||||||
has never compiled and tested yet :). Of cause, you need to supply
|
has never compiled and tested yet :). Of cause, you need to supply
|
||||||
a make/build file and a short LibMain for creating the iodbc.dll.
|
a make/build file and a short LibMain for creating the iodbc.dll.
|
||||||
|
|
||||||
2. How to build iODBC driver manager:
|
2. How to build iODBC driver manager:
|
||||||
|
|
||||||
step 1. Identify your system
|
step 1. Identify your system
|
||||||
step 2. Run build with a suitable option
|
step 2. Run build with a suitable option
|
||||||
|
|
||||||
Here is an example:
|
Here is an example:
|
||||||
|
|
||||||
%[1]: sh iodbc-2.12.shar
|
%[1]: sh iodbc-2.12.shar
|
||||||
....
|
....
|
||||||
%[2]: cd iodbc-2.12
|
%[2]: cd iodbc-2.12
|
||||||
%[3]: uname -s -v -r -m
|
%[3]: uname -s -v -r -m
|
||||||
HP-UX B.10.01 A 9000/710
|
HP-UX B.10.01 A 9000/710
|
||||||
%[4]: ./build hp700
|
%[4]: ./build hp700
|
||||||
autoconfig hp700
|
autoconfig hp700
|
||||||
make
|
make
|
||||||
....
|
....
|
||||||
Generating iODBC driver manager --> /home/kejin/iodbc-2.12.sl
|
Generating iODBC driver manager --> /home/kejin/iodbc-2.12.sl
|
||||||
|
|
||||||
3. odbc.ini( ~/.odbc.ini )
|
3. odbc.ini( ~/.odbc.ini )
|
||||||
|
|
||||||
Driver manager and drivers use odbc.ini(or ~/.odbc.ini on Unix) file
|
Driver manager and drivers use odbc.ini(or ~/.odbc.ini on Unix) file
|
||||||
or connection string when establishing a data source connection. On
|
or connection string when establishing a data source connection. On
|
||||||
Windows, odbc.ini is located in Windows directory. On unix, iODBC driver
|
Windows, odbc.ini is located in Windows directory. On unix, iODBC driver
|
||||||
manager(and all other ODBC drivers and driver managers I awared) looks
|
manager(and all other ODBC drivers and driver managers I awared) looks
|
||||||
.odbc.ini file in real user's home directory (it could be a softlink to
|
.odbc.ini file in real user's home directory (it could be a softlink to
|
||||||
the file located somewhere else). Make sure your driver will look into
|
the file located somewhere else). Make sure your driver will look into
|
||||||
the same file (or a file which is a symbolic link to the same file).
|
the same file (or a file which is a symbolic link to the same file).
|
||||||
The format of odbc.ini( or ~/.odbc.ini ) is defined as:
|
The format of odbc.ini( or ~/.odbc.ini ) is defined as:
|
||||||
|
|
||||||
odbc.ini(or .odbc.ini) ::= data_source_list
|
odbc.ini(or .odbc.ini) ::= data_source_list
|
||||||
|
|
||||||
data_source_list ::= /* empty */
|
data_source_list ::= /* empty */
|
||||||
| data_source '\n' data_source_list
|
| data_source '\n' data_source_list
|
||||||
|
|
||||||
data_source ::= '[' data_source_name ']' '\n' data_source_desc
|
data_source ::= '[' data_source_name ']' '\n' data_source_desc
|
||||||
|
|
||||||
data_source_name ::= 'default' | [A-Za-z]*[A-Za-z0-9_]*
|
data_source_name ::= 'default' | [A-Za-z]*[A-Za-z0-9_]*
|
||||||
|
|
||||||
data_source_desc ::= /* empty */
|
data_source_desc ::= /* empty */
|
||||||
| attrib_desc '\n' data_source_desc
|
| attrib_desc '\n' data_source_desc
|
||||||
|
|
||||||
addrib_desc ::= Attrib '=' attrib_value
|
addrib_desc ::= Attrib '=' attrib_value
|
||||||
|
|
||||||
Attrib ::= 'Driver' | 'PID' | 'UID' | driver_def_attrib
|
Attrib ::= 'Driver' | 'PID' | 'UID' | driver_def_attrib
|
||||||
|
|
||||||
driver_def_attrib ::= [A-Za-z]*[A-Za-z0-9_]*
|
driver_def_attrib ::= [A-Za-z]*[A-Za-z0-9_]*
|
||||||
|
|
||||||
An example of .odbc.ini file:
|
An example of .odbc.ini file:
|
||||||
|
|
||||||
[toronto_yp]
|
[toronto_yp]
|
||||||
# yellow page of metro Toronto
|
# yellow page of metro Toronto
|
||||||
Driver = /usr/lib/odbc/oracle.so
|
Driver = /usr/lib/odbc/oracle.so
|
||||||
<....>
|
<....>
|
||||||
|
|
||||||
[toronto_wp]
|
[toronto_wp]
|
||||||
# white page of metro Toronto
|
# white page of metro Toronto
|
||||||
Driver = /usr/lib/odbc/oracle.so
|
Driver = /usr/lib/odbc/oracle.so
|
||||||
<....>
|
<....>
|
||||||
|
|
||||||
[contract]
|
[contract]
|
||||||
# all contract documents
|
# all contract documents
|
||||||
Driver = /usr/lib/odbc/informix.so
|
Driver = /usr/lib/odbc/informix.so
|
||||||
<....>
|
<....>
|
||||||
|
|
||||||
[netnews]
|
[netnews]
|
||||||
# NNTP netnews group
|
# NNTP netnews group
|
||||||
Driver = /usr/lib/odbc/nnodbc.so
|
Driver = /usr/lib/odbc/nnodbc.so
|
||||||
Server = news.empress.com
|
Server = news.empress.com
|
||||||
|
|
||||||
[rnd_test]
|
[rnd_test]
|
||||||
# data source for R&D test
|
# data source for R&D test
|
||||||
Driver = /home/r_d/odbc/empodbc.so
|
Driver = /home/r_d/odbc/empodbc.so
|
||||||
URL = empodbc://rnd.empress.com:6322/rnd_test/testdb
|
URL = empodbc://rnd.empress.com:6322/rnd_test/testdb
|
||||||
|
|
||||||
[default]
|
[default]
|
||||||
# default to odbc gateway
|
# default to odbc gateway
|
||||||
Driver = /usr/lib/odbc/gateway.so
|
Driver = /usr/lib/odbc/gateway.so
|
||||||
|
|
||||||
4. Tracing
|
4. Tracing
|
||||||
|
|
||||||
iODBC driver manager traces driver's ODBC call invoked by the driver
|
iODBC driver manager traces driver's ODBC call invoked by the driver
|
||||||
manager. Default tracing file is ./odbc.log. Tracing option (i.e.
|
manager. Default tracing file is ./odbc.log. Tracing option (i.e.
|
||||||
on/off or optional tracing file name) can be set in ~/.odbc.ini
|
on/off or optional tracing file name) can be set in ~/.odbc.ini
|
||||||
file (under a data source section) as:
|
file (under a data source section) as:
|
||||||
|
|
||||||
TraceFile = <optional_trace_file>
|
TraceFile = <optional_trace_file>
|
||||||
Trace = ON | On | on | 1 | OFF | Off | off | 0
|
Trace = ON | On | on | 1 | OFF | Off | off | 0
|
||||||
|
|
||||||
If <optional_trace_file> is stderr or stdout, i.e.
|
If <optional_trace_file> is stderr or stdout, i.e.
|
||||||
|
|
||||||
TraceFile = stderr
|
TraceFile = stderr
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
TraceFile = stdout
|
TraceFile = stdout
|
||||||
|
|
||||||
the tracing message will go to the terminal screen(if it is available).
|
the tracing message will go to the terminal screen(if it is available).
|
||||||
|
|
||||||
iODBC driver manager allows one to tune on/off tracing on selected
|
iODBC driver manager allows one to tune on/off tracing on selected
|
||||||
connection(s). Different connections can share one or use different
|
connection(s). Different connections can share one or use different
|
||||||
tracing file(s). ODBC calls on connections without tuning tracing on
|
tracing file(s). ODBC calls on connections without tuning tracing on
|
||||||
will not be traced.
|
will not be traced.
|
||||||
|
|
||||||
5. File list:
|
5. File list:
|
||||||
|
|
||||||
README This file
|
README This file
|
||||||
IAFA-PACKAGE Version and copyright information
|
IAFA-PACKAGE Version and copyright information
|
||||||
Changes.log Source changes log
|
Changes.log Source changes log
|
||||||
Version.mk Version make include file
|
Version.mk Version make include file
|
||||||
Config.mk Config make include file
|
Config.mk Config make include file
|
||||||
Makefile make file
|
Makefile make file
|
||||||
config.h system config include file
|
config.h system config include file
|
||||||
isql.h ODBC 1.0 macro
|
isql.h ODBC 1.0 macro
|
||||||
isqlext.h ODBC 2.0 macro
|
isqlext.h ODBC 2.0 macro
|
||||||
dlf.h general dynamic loader module interface
|
dlf.h general dynamic loader module interface
|
||||||
dlf.c general dynamic loader module (mapping to svr4)
|
dlf.c general dynamic loader module (mapping to svr4)
|
||||||
dlproc.h simple dynamic loader module interface
|
dlproc.h simple dynamic loader module interface
|
||||||
dlproc.c simple dynamic loader on top of dlf module
|
dlproc.c simple dynamic loader on top of dlf module
|
||||||
herr.h error handling module interface
|
herr.h error handling module interface
|
||||||
herr.c error handling module
|
herr.c error handling module
|
||||||
herr.ci error handling source include
|
herr.ci error handling source include
|
||||||
henv.h environment handle interface
|
henv.h environment handle interface
|
||||||
henv.c environment handle module
|
henv.c environment handle module
|
||||||
henv.ci environment handle source include
|
henv.ci environment handle source include
|
||||||
hdbc.h connection handle interface
|
hdbc.h connection handle interface
|
||||||
hdbc.c connection handle module
|
hdbc.c connection handle module
|
||||||
hstmt.h statement handle interface
|
hstmt.h statement handle interface
|
||||||
hstmt.c statement handle module
|
hstmt.c statement handle module
|
||||||
connect.c connect functions
|
connect.c connect functions
|
||||||
prepare.c query prepare functions
|
prepare.c query prepare functions
|
||||||
execute.c query executing functions
|
execute.c query executing functions
|
||||||
result.c query result property functions
|
result.c query result property functions
|
||||||
fetch.c query result fetch functions
|
fetch.c query result fetch functions
|
||||||
info.c driver information functions
|
info.c driver information functions
|
||||||
catalog.c catalog functions
|
catalog.c catalog functions
|
||||||
misc.c miscellaneous functions
|
misc.c miscellaneous functions
|
||||||
itrace.h macro
|
itrace.h macro
|
||||||
itrace.c trace function
|
itrace.c trace function
|
||||||
main.c entry function used to build a share library on AIX
|
main.c entry function used to build a share library on AIX
|
||||||
shrsub.exp export symbol list used on AIX
|
shrsub.exp export symbol list used on AIX
|
||||||
autoconfig shell script for creating Config.mk
|
autoconfig shell script for creating Config.mk
|
||||||
build shell script for building iodbc driver manager
|
build shell script for building iodbc driver manager
|
||||||
|
1694
src/iodbc/catalog.c
1694
src/iodbc/catalog.c
File diff suppressed because it is too large
Load Diff
@@ -1,45 +1,100 @@
|
|||||||
#ifndef _LINUX_CONFIG_H
|
#ifndef _CONFIG_H
|
||||||
#define _LINUX_CONFIG_H
|
#define _CONFIG_H
|
||||||
|
|
||||||
#ifdef __LINUX__
|
# if !defined(WINDOWS) && !defined(WIN32_SYSTEM) && !defined(OS2)
|
||||||
#include <linux/autoconf.h>
|
# define _UNIX_
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
# include <stdlib.h>
|
||||||
* Defines for what uname() should return
|
# include <sys/types.h>
|
||||||
*/
|
# include <string.h>
|
||||||
#ifndef UTS_SYSNAME
|
# include <stdio.h>
|
||||||
#define UTS_SYSNAME "Linux"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef UTS_MACHINE
|
# define MEM_ALLOC(size) (malloc((size_t)(size)))
|
||||||
#define UTS_MACHINE "unknown"
|
# define MEM_FREE(ptr) {if(ptr) free(ptr);}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef UTS_NODENAME
|
# define STRCPY(t, s) (strcpy((char*)(t), (char*)(s)))
|
||||||
#define UTS_NODENAME "(none)" /* set by sethostname() */
|
# define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n)))
|
||||||
#endif
|
# define STRCAT(t, s) (strcat((char*)(t), (char*)(s)))
|
||||||
|
# define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n)))
|
||||||
|
# define STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0)
|
||||||
|
# define STRLEN(str) ((str)? strlen((char*)(str)):0)
|
||||||
|
|
||||||
#ifndef UTS_DOMAINNAME
|
# define EXPORT
|
||||||
#define UTS_DOMAINNAME "(none)" /* set by setdomainname() */
|
# define CALLBACK
|
||||||
#endif
|
# define FAR
|
||||||
|
|
||||||
/*
|
typedef signed short SSHOR;
|
||||||
* The definitions for UTS_RELEASE and UTS_VERSION are now defined
|
typedef short WORD;
|
||||||
* in linux/version.h, and should only be used by linux/version.c
|
typedef long DWORD;
|
||||||
*/
|
|
||||||
|
|
||||||
/* Shouldn't these be defined somewhere in a i386 definition? */
|
typedef WORD WPARAM;
|
||||||
|
typedef DWORD LPARAM;
|
||||||
|
typedef void* HWND;
|
||||||
|
typedef int BOOL;
|
||||||
|
|
||||||
/* Don't touch these, unless you really know what you're doing. */
|
# endif /* _UNIX_ */
|
||||||
#define DEF_INITSEG 0x9000
|
|
||||||
#define DEF_SYSSEG 0x1000
|
|
||||||
#define DEF_SETUPSEG 0x9020
|
|
||||||
#define DEF_SYSSIZE 0x7F00
|
|
||||||
|
|
||||||
/* internal svga startup constants */
|
# if defined(WINDOWS) || defined(WIN32_SYSTEM)
|
||||||
#define NORMAL_VGA 0xffff /* 80x25 mode */
|
|
||||||
#define EXTENDED_VGA 0xfffe /* 80x50 mode */
|
# include <windows.h>
|
||||||
#define ASK_VGA 0xfffd /* ask for it at bootup */
|
# include <windowsx.h>
|
||||||
|
|
||||||
|
# ifdef _MSVC_
|
||||||
|
# define MEM_ALLOC(size) (fmalloc((size_t)(size)))
|
||||||
|
# define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0))
|
||||||
|
# define STRCPY(t, s) (fstrcpy((char FAR*)(t), (char FAR*)(s)))
|
||||||
|
# define STRNCPY(t,s,n) (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
|
||||||
|
# define STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0)
|
||||||
|
# define STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef _BORLAND_
|
||||||
|
# define MEM_ALLOC(size) (farmalloc((unsigned long)(size))
|
||||||
|
# define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0)
|
||||||
|
# define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s)))
|
||||||
|
# define STRNCPY(t,s,n) (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
|
||||||
|
# define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0)
|
||||||
|
# define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif /* WINDOWS */
|
||||||
|
|
||||||
|
# if defined(OS2)
|
||||||
|
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <string.h>
|
||||||
|
# include <memory.h>
|
||||||
|
# define INCL_DOSMODULEMGR /* Module Manager values */
|
||||||
|
# define INCL_DOSERRORS /* Error values */
|
||||||
|
# include <os2.h>
|
||||||
|
|
||||||
|
# ifndef FAR
|
||||||
|
# define FAR
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define MEM_ALLOC(size) (malloc((size_t)(size)))
|
||||||
|
# define MEM_FREE(ptr) (free((ptr)))
|
||||||
|
# define STRCPY(t, s) (strcpy((char*)(t), (char*)(s)))
|
||||||
|
# define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n)))
|
||||||
|
# define STRCAT(t, s) (strcat((char*)(t), (char*)(s)))
|
||||||
|
# define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n)))
|
||||||
|
# define STRLEN(str) ((str)? strlen((char*)(str)):0)
|
||||||
|
# define STREQ(a, b) (0 == strcmp((char *)(a), (char *)(b)))
|
||||||
|
|
||||||
|
typedef signed short SSHOR;
|
||||||
|
typedef short WORD;
|
||||||
|
typedef long DWORD;
|
||||||
|
|
||||||
|
typedef WORD WPARAM;
|
||||||
|
typedef DWORD LPARAM;
|
||||||
|
|
||||||
|
# endif /* OS2 */
|
||||||
|
|
||||||
|
# define SYSERR (-1)
|
||||||
|
|
||||||
|
# ifndef NULL
|
||||||
|
# define NULL ((void FAR*)0UL)
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
2202
src/iodbc/connect.c
2202
src/iodbc/connect.c
File diff suppressed because it is too large
Load Diff
862
src/iodbc/dlf.c
862
src/iodbc/dlf.c
File diff suppressed because it is too large
Load Diff
@@ -1,35 +1,24 @@
|
|||||||
#ifndef _DLF_H
|
#ifndef _DLF_H
|
||||||
# define _DLF_H
|
# define _DLF_H
|
||||||
|
|
||||||
#define DLDAPI_SVR4_DLFCN
|
#define DLDAPI_SVR4_DLFCN
|
||||||
|
|
||||||
#ifdef __HPUX__
|
|
||||||
#define DLDAPI_HP_SHL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __AIX__
|
|
||||||
#define DLDAPI_AIX_LOAD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# include <../iodbc/config.h>
|
|
||||||
# include <../iodbc/windows.h>
|
|
||||||
|
|
||||||
# ifdef DLDAPI_SVR4_DLFCN
|
# ifdef DLDAPI_SVR4_DLFCN
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# else
|
# else
|
||||||
extern void FAR* dlopen(char FAR* path, int mode);
|
extern void FAR* dlopen(char FAR* path, int mode);
|
||||||
extern void FAR* dlsym(void FAR* hdll, char FAR* sym);
|
extern void FAR* dlsym(void FAR* hdll, char FAR* sym);
|
||||||
extern char FAR* dlerror();
|
extern char FAR* dlerror();
|
||||||
extern int dlclose(void FAR* hdll);
|
extern int dlclose(void FAR* hdll);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef RTLD_LAZY
|
# ifndef RTLD_LAZY
|
||||||
# define RTLD_LAZY 1
|
# define RTLD_LAZY 1
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define DLL_OPEN(dll) (void*)dlopen((char*)(path), RTLD_LAZY)
|
# define DLL_OPEN(dll) (void*)dlopen((char*)(path), RTLD_LAZY)
|
||||||
# define DLL_PROC(hdll, sym) (void*)dlsym((void*)(hdll), (char*)sym)
|
# define DLL_PROC(hdll, sym) (void*)dlsym((void*)(hdll), (char*)sym)
|
||||||
# define DLL_ERROR() (char*)dlerror()
|
# define DLL_ERROR() (char*)dlerror()
|
||||||
# define DLL_CLOSE(hdll) dlclose((void*)(hdll))
|
# define DLL_CLOSE(hdll) dlclose((void*)(hdll))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/** Load driver and resolve driver's function entry point
|
/** Load driver and resolve driver's function entry point
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <../iodbc/iodbc.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <../iodbc/isql.h>
|
||||||
@@ -28,72 +29,72 @@
|
|||||||
|
|
||||||
#include "../iodbc/henv.ci"
|
#include "../iodbc/henv.ci"
|
||||||
|
|
||||||
HPROC _iodbcdm_getproc( HDBC hdbc, int idx )
|
HPROC _iodbcdm_getproc( HDBC hdbc, int idx )
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
||||||
ENV_t FAR* penv;
|
ENV_t FAR* penv;
|
||||||
/* HDLL hdll; */
|
HDLL hdll;
|
||||||
HPROC FAR* phproc;
|
static HPROC FAR* phproc;
|
||||||
|
|
||||||
if( idx <= 0 || idx > SQL_EXT_API_LAST )
|
if( idx <= 0 || idx > SQL_EXT_API_LAST )
|
||||||
/* first entry naver used */
|
/* first entry never used */
|
||||||
{
|
{
|
||||||
return SQL_NULL_HPROC;
|
return SQL_NULL_HPROC;
|
||||||
}
|
}
|
||||||
|
|
||||||
penv = (ENV_t FAR*)(pdbc->henv);
|
|
||||||
|
|
||||||
if( penv == NULL )
|
penv = (ENV_t FAR*)(pdbc->henv);
|
||||||
{
|
|
||||||
return SQL_NULL_HPROC;
|
|
||||||
}
|
|
||||||
|
|
||||||
phproc = penv->dllproc_tab + idx;
|
if( penv == NULL )
|
||||||
|
{
|
||||||
|
return SQL_NULL_HPROC;
|
||||||
|
}
|
||||||
|
|
||||||
if( *phproc == SQL_NULL_HPROC )
|
phproc = penv->dllproc_tab + idx;
|
||||||
{
|
|
||||||
int i, en_idx;
|
|
||||||
|
|
||||||
for( i=0 ; ; i++ )
|
if( *phproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
en_idx = odbcapi_symtab[i].en_idx;
|
int i, en_idx;
|
||||||
|
|
||||||
if( en_idx == en_NullProc )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( en_idx == idx )
|
for( i=0 ; ; i++ )
|
||||||
{
|
{
|
||||||
*phproc = _iodbcdm_dllproc( penv->hdll,
|
en_idx = odbcapi_symtab[i].en_idx;
|
||||||
odbcapi_symtab[i].symbol );
|
|
||||||
|
|
||||||
break;
|
if( en_idx == en_NullProc )
|
||||||
}
|
{
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *phproc;
|
if( en_idx == idx )
|
||||||
|
{
|
||||||
|
*phproc = _iodbcdm_dllproc( penv->hdll,
|
||||||
|
odbcapi_symtab[i].symbol );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return *phproc;
|
||||||
}
|
}
|
||||||
|
|
||||||
HDLL _iodbcdm_dllopen( char FAR* path )
|
HDLL _iodbcdm_dllopen( char FAR* path )
|
||||||
{
|
{
|
||||||
return (HDLL)DLL_OPEN( path );
|
return (HDLL)DLL_OPEN( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
HPROC _iodbcdm_dllproc( HDLL hdll, char FAR* sym )
|
HPROC _iodbcdm_dllproc( HDLL hdll, char FAR* sym )
|
||||||
{
|
{
|
||||||
return (HPROC)DLL_PROC( hdll, sym );
|
return (HPROC)DLL_PROC( hdll, sym );
|
||||||
}
|
}
|
||||||
|
|
||||||
int _iodbcdm_dllclose( HDLL hdll )
|
int _iodbcdm_dllclose( HDLL hdll )
|
||||||
{
|
{
|
||||||
DLL_CLOSE( hdll );
|
DLL_CLOSE( hdll );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* _iodbcdm_dllerror( )
|
char* _iodbcdm_dllerror( )
|
||||||
{
|
{
|
||||||
return DLL_ERROR();
|
return DLL_ERROR();
|
||||||
}
|
}
|
||||||
|
@@ -1,31 +1,39 @@
|
|||||||
#ifndef _DLPROC_H
|
#ifndef _DLPROC_H
|
||||||
# define _DLPROC_H
|
# define _DLPROC_H
|
||||||
|
|
||||||
# include <../iodbc/dlf.h>
|
# include <../iodbc/dlf.h>
|
||||||
|
|
||||||
typedef RETCODE (FAR* HPROC)();
|
# ifdef OS2
|
||||||
|
typedef RETCODE (FAR* _System HPROC)();
|
||||||
|
# else
|
||||||
|
typedef RETCODE (FAR* HPROC)();
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef DLDAPI_SVR4_DLFCN
|
# ifdef DLDAPI_SVR4_DLFCN
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
typedef void* HDLL;
|
typedef void* HDLL;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef DLDAPI_HP_SHL
|
# ifdef DLDAPI_HP_SHL
|
||||||
# include <dl.h>
|
# include <dl.h>
|
||||||
typedef shl_t HDLL;
|
typedef shl_t HDLL;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef DLDAPI_AIX_LOAD
|
# ifdef DLDAPI_AIX_LOAD
|
||||||
typedef void* HDLL;
|
typedef void* HDLL;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
extern HPROC _iodbcdm_getproc();
|
# ifdef DLDAPI_OS2
|
||||||
extern HDLL _iodbcdm_dllopen(char FAR* dll);
|
typedef HMODULE HDLL;
|
||||||
extern HPROC _iodbcdm_dllproc(HDLL hdll, char FAR* sym);
|
# endif
|
||||||
extern char FAR* _iodbcdm_dllerror();
|
|
||||||
extern int _iodbcdm_dllclose(HDLL hdll);
|
|
||||||
|
|
||||||
#define SQL_NULL_HDLL ((HDLL)NULL)
|
extern HPROC _iodbcdm_getproc();
|
||||||
#define SQL_NULL_HPROC ((HPROC)NULL)
|
extern HDLL _iodbcdm_dllopen(char FAR* dll);
|
||||||
|
extern HPROC _iodbcdm_dllproc(HDLL hdll, char FAR* sym);
|
||||||
|
extern char FAR* _iodbcdm_dllerror();
|
||||||
|
extern int _iodbcdm_dllclose(HDLL hdll);
|
||||||
|
|
||||||
|
#define SQL_NULL_HDLL ((HDLL)NULL)
|
||||||
|
#define SQL_NULL_HPROC ((HPROC)NULL)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
1380
src/iodbc/execute.c
1380
src/iodbc/execute.c
File diff suppressed because it is too large
Load Diff
1106
src/iodbc/fetch.c
1106
src/iodbc/fetch.c
File diff suppressed because it is too large
Load Diff
1254
src/iodbc/hdbc.c
1254
src/iodbc/hdbc.c
File diff suppressed because it is too large
Load Diff
@@ -1,55 +1,55 @@
|
|||||||
#ifndef _HDBC_H
|
#ifndef _HDBC_H
|
||||||
#define _HDBC_H
|
#define _HDBC_H
|
||||||
|
|
||||||
typedef struct DBC
|
typedef struct DBC
|
||||||
{
|
{
|
||||||
int type; /* must be 1st field */
|
int type; /* must be 1st field */
|
||||||
struct DBC FAR*
|
struct DBC FAR*
|
||||||
next;
|
next;
|
||||||
|
|
||||||
HENV genv; /* back point to global env object */
|
HENV genv; /* back point to global env object */
|
||||||
|
|
||||||
HDBC dhdbc; /* driver's private dbc */
|
HDBC dhdbc; /* driver's private dbc */
|
||||||
HENV henv; /* back point to instant env object */
|
HENV henv; /* back point to instant env object */
|
||||||
HSTMT hstmt; /* list of statement object handle(s) */
|
HSTMT hstmt; /* list of statement object handle(s) */
|
||||||
HERR herr;
|
HERR herr;
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
/* options */
|
/* options */
|
||||||
UDWORD access_mode;
|
UDWORD access_mode;
|
||||||
UDWORD autocommit;
|
UDWORD autocommit;
|
||||||
|
|
||||||
UDWORD login_timeout;
|
UDWORD login_timeout;
|
||||||
UDWORD odbc_cursors;
|
UDWORD odbc_cursors;
|
||||||
UDWORD packet_size;
|
UDWORD packet_size;
|
||||||
UDWORD quiet_mode;
|
UDWORD quiet_mode;
|
||||||
UDWORD txn_isolation;
|
UDWORD txn_isolation;
|
||||||
SWORD cb_commit;
|
SWORD cb_commit;
|
||||||
SWORD cb_rollback;
|
SWORD cb_rollback;
|
||||||
|
|
||||||
char FAR*
|
char FAR*
|
||||||
current_qualifier;
|
current_qualifier;
|
||||||
|
|
||||||
int trace; /* trace flag */
|
int trace; /* trace flag */
|
||||||
char FAR*
|
char FAR*
|
||||||
tfile;
|
tfile;
|
||||||
void FAR*
|
void FAR*
|
||||||
tstm; /* trace stream */
|
tstm; /* trace stream */
|
||||||
} DBC_t;
|
} DBC_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note:
|
* Note:
|
||||||
* - ODBC applications can see address of driver manager's
|
* - ODBC applications can see address of driver manager's
|
||||||
* connection object, i.e connection handle -- a void pointer,
|
* connection object, i.e connection handle -- a void pointer,
|
||||||
* but not detail of it. ODBC applications can neither see
|
* but not detail of it. ODBC applications can neither see
|
||||||
* detail driver's connection object nor its address.
|
* detail driver's connection object nor its address.
|
||||||
*
|
*
|
||||||
* - ODBC driver manager knows its own connection objects and
|
* - ODBC driver manager knows its own connection objects and
|
||||||
* exposes their address to an ODBC application. Driver manager
|
* exposes their address to an ODBC application. Driver manager
|
||||||
* also knows address of driver's connection objects and keeps
|
* also knows address of driver's connection objects and keeps
|
||||||
* it via dhdbc field in driver manager's connection object.
|
* it via dhdbc field in driver manager's connection object.
|
||||||
*
|
*
|
||||||
* - ODBC driver exposes address of its own connection object to
|
* - ODBC driver exposes address of its own connection object to
|
||||||
* driver manager without detail.
|
* driver manager without detail.
|
||||||
*
|
*
|
||||||
@@ -57,11 +57,11 @@ typedef struct DBC
|
|||||||
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HDBC.
|
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HDBC.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
en_dbc_allocated,
|
en_dbc_allocated,
|
||||||
en_dbc_needdata,
|
en_dbc_needdata,
|
||||||
en_dbc_connected,
|
en_dbc_connected,
|
||||||
en_dbc_hstmt
|
en_dbc_hstmt
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/** Environment object managment functions
|
/** Environment object managment functions
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,51 +25,51 @@
|
|||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
#include <../iodbc/itrace.h>
|
||||||
|
|
||||||
RETCODE SQL_API SQLAllocEnv( HENV FAR* phenv )
|
RETCODE SQL_API SQLAllocEnv( HENV FAR* phenv )
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv;
|
GENV_t FAR* genv;
|
||||||
|
|
||||||
genv = (GENV_t*)MEM_ALLOC( sizeof(GENV_t) );
|
genv = (GENV_t*)MEM_ALLOC( sizeof(GENV_t) );
|
||||||
|
|
||||||
if( genv == NULL )
|
if( genv == NULL )
|
||||||
{
|
{
|
||||||
*phenv = SQL_NULL_HENV;
|
*phenv = SQL_NULL_HENV;
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (ODBCVER >= 0x0300 )
|
#if (ODBCVER >= 0x0300 )
|
||||||
genv->type = SQL_HANDLE_ENV;
|
genv->type = SQL_HANDLE_ENV;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
genv->henv = SQL_NULL_HENV; /* driver's env list */
|
genv->henv = SQL_NULL_HENV; /* driver's env list */
|
||||||
genv->hdbc = SQL_NULL_HDBC; /* driver's dbc list */
|
genv->hdbc = SQL_NULL_HDBC; /* driver's dbc list */
|
||||||
genv->herr = SQL_NULL_HERR; /* err list */
|
genv->herr = SQL_NULL_HERR; /* err list */
|
||||||
|
|
||||||
*phenv = (HENV)genv;
|
*phenv = (HENV)genv;
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLFreeEnv ( HENV henv )
|
RETCODE SQL_API SQLFreeEnv ( HENV henv )
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t*)henv;
|
GENV_t FAR* genv = (GENV_t*)henv;
|
||||||
|
|
||||||
if( henv == SQL_NULL_HENV )
|
if( henv == SQL_NULL_HENV )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( genv->hdbc != SQL_NULL_HDBC )
|
if( genv->hdbc != SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1010 );
|
PUSHSQLERR ( genv->herr, en_S1010 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
_iodbcdm_freesqlerrlist( genv->herr );
|
_iodbcdm_freesqlerrlist( genv->herr );
|
||||||
|
|
||||||
MEM_FREE( henv );
|
MEM_FREE( henv );
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -1,95 +1,86 @@
|
|||||||
|
#ifndef CLI_NAME_PREFIX
|
||||||
#ifdef __HPUX__
|
|
||||||
#define CLI_NAME_PREFIX "_SQL"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __AIX__
|
|
||||||
#define CLI_NAME_PREFIX ".SQL"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CLI_NAME_PREFIX
|
|
||||||
|
|
||||||
/* There are some exceptions :
|
/* There are some exceptions :
|
||||||
* on FreeBSD 2.x CLI_NAME_PREFIX is defined in Config.mk as "_SQL"
|
* on FreeBSD 2.x CLI_NAME_PREFIX is defined in Config.mk as "_SQL"
|
||||||
* on HP/UX s300/s400, CLI_NAME_PREFIX is defined in Config.mk as "_SQL"
|
* on HP/UX s300/s400, CLI_NAME_PREFIX is defined in Config.mk as "_SQL"
|
||||||
* on AIX 3.x 4.x, CLI_NAME_PREFIX is defined in Config.mk as ".SQL"
|
* on AIX 3.x 4.x, CLI_NAME_PREFIX is defined in Config.mk as ".SQL"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# define CLI_NAME_PREFIX "SQL" /* using call by value prefix */
|
# define CLI_NAME_PREFIX "SQL" /* using call by value prefix */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
int en_idx;
|
int en_idx;
|
||||||
char* symbol;
|
char* symbol;
|
||||||
} odbcapi_symtab[] = {
|
} odbcapi_symtab[] = {
|
||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
en_AllocHandle CLI_NAME_PREFIX "AllocHandle",
|
en_AllocHandle CLI_NAME_PREFIX "AllocHandle",
|
||||||
en_FreeHandle CLI_NAME_PREFIX "FreeHandle",
|
en_FreeHandle CLI_NAME_PREFIX "FreeHandle",
|
||||||
#endif
|
#endif
|
||||||
en_AllocEnv, CLI_NAME_PREFIX "AllocEnv",
|
en_AllocEnv, CLI_NAME_PREFIX "AllocEnv",
|
||||||
en_AllocConnect, CLI_NAME_PREFIX "AllocConnect",
|
en_AllocConnect, CLI_NAME_PREFIX "AllocConnect",
|
||||||
en_Connect, CLI_NAME_PREFIX "Connect",
|
en_Connect, CLI_NAME_PREFIX "Connect",
|
||||||
en_DriverConnect, CLI_NAME_PREFIX "DriverConnect",
|
en_DriverConnect, CLI_NAME_PREFIX "DriverConnect",
|
||||||
en_BrowseConnect, CLI_NAME_PREFIX "BrowseConnect",
|
en_BrowseConnect, CLI_NAME_PREFIX "BrowseConnect",
|
||||||
|
|
||||||
en_DataSources, CLI_NAME_PREFIX "DataSources",
|
en_DataSources, CLI_NAME_PREFIX "DataSources",
|
||||||
en_Drivers, CLI_NAME_PREFIX "Driver",
|
en_Drivers, CLI_NAME_PREFIX "Driver",
|
||||||
en_GetInfo, CLI_NAME_PREFIX "GetInfo",
|
en_GetInfo, CLI_NAME_PREFIX "GetInfo",
|
||||||
en_GetFunctions, CLI_NAME_PREFIX "GetFunctions",
|
en_GetFunctions, CLI_NAME_PREFIX "GetFunctions",
|
||||||
en_GetTypeInfo, CLI_NAME_PREFIX "GetTypeInfo",
|
en_GetTypeInfo, CLI_NAME_PREFIX "GetTypeInfo",
|
||||||
|
|
||||||
en_SetConnectOption, CLI_NAME_PREFIX "SetConnectOption",
|
en_SetConnectOption, CLI_NAME_PREFIX "SetConnectOption",
|
||||||
en_GetConnectOption, CLI_NAME_PREFIX "GetConnectOption",
|
en_GetConnectOption, CLI_NAME_PREFIX "GetConnectOption",
|
||||||
en_SetStmtOption, CLI_NAME_PREFIX "SetStmtOption",
|
en_SetStmtOption, CLI_NAME_PREFIX "SetStmtOption",
|
||||||
en_GetStmtOption, CLI_NAME_PREFIX "GetStmtOption",
|
en_GetStmtOption, CLI_NAME_PREFIX "GetStmtOption",
|
||||||
|
|
||||||
en_AllocStmt, CLI_NAME_PREFIX "AllocStmt",
|
en_AllocStmt, CLI_NAME_PREFIX "AllocStmt",
|
||||||
en_Prepare, CLI_NAME_PREFIX "Prepare",
|
en_Prepare, CLI_NAME_PREFIX "Prepare",
|
||||||
en_BindParameter, CLI_NAME_PREFIX "BindParameter",
|
en_BindParameter, CLI_NAME_PREFIX "BindParameter",
|
||||||
en_ParamOptions, CLI_NAME_PREFIX "ParamOptions",
|
en_ParamOptions, CLI_NAME_PREFIX "ParamOptions",
|
||||||
en_GetCursorName, CLI_NAME_PREFIX "GetCursorName",
|
en_GetCursorName, CLI_NAME_PREFIX "GetCursorName",
|
||||||
en_SetCursorName, CLI_NAME_PREFIX "SetCursorName",
|
en_SetCursorName, CLI_NAME_PREFIX "SetCursorName",
|
||||||
en_SetScrollOptions, CLI_NAME_PREFIX "SetScrollOptions",
|
en_SetScrollOptions, CLI_NAME_PREFIX "SetScrollOptions",
|
||||||
en_SetParam, CLI_NAME_PREFIX "SetParam",
|
en_SetParam, CLI_NAME_PREFIX "SetParam",
|
||||||
|
|
||||||
en_Execute, CLI_NAME_PREFIX "Execute",
|
en_Execute, CLI_NAME_PREFIX "Execute",
|
||||||
en_ExecDirect, CLI_NAME_PREFIX "ExecDirect",
|
en_ExecDirect, CLI_NAME_PREFIX "ExecDirect",
|
||||||
en_NativeSql, CLI_NAME_PREFIX "NativeSql",
|
en_NativeSql, CLI_NAME_PREFIX "NativeSql",
|
||||||
en_DescribeParam, CLI_NAME_PREFIX "DescribeParam",
|
en_DescribeParam, CLI_NAME_PREFIX "DescribeParam",
|
||||||
en_NumParams, CLI_NAME_PREFIX "NumParams",
|
en_NumParams, CLI_NAME_PREFIX "NumParams",
|
||||||
en_ParamData, CLI_NAME_PREFIX "ParamData",
|
en_ParamData, CLI_NAME_PREFIX "ParamData",
|
||||||
en_PutData, CLI_NAME_PREFIX "PutData",
|
en_PutData, CLI_NAME_PREFIX "PutData",
|
||||||
|
|
||||||
en_RowCount, CLI_NAME_PREFIX "RowCount",
|
en_RowCount, CLI_NAME_PREFIX "RowCount",
|
||||||
en_NumResultCols, CLI_NAME_PREFIX "NumResultCols",
|
en_NumResultCols, CLI_NAME_PREFIX "NumResultCols",
|
||||||
en_DescribeCol, CLI_NAME_PREFIX "DescribeCol",
|
en_DescribeCol, CLI_NAME_PREFIX "DescribeCol",
|
||||||
en_ColAttributes, CLI_NAME_PREFIX "ColAttributes",
|
en_ColAttributes, CLI_NAME_PREFIX "ColAttributes",
|
||||||
en_BindCol, CLI_NAME_PREFIX "BindCol",
|
en_BindCol, CLI_NAME_PREFIX "BindCol",
|
||||||
en_Fetch, CLI_NAME_PREFIX "Fetch",
|
en_Fetch, CLI_NAME_PREFIX "Fetch",
|
||||||
en_ExtendedFetch, CLI_NAME_PREFIX "ExtendedFetch",
|
en_ExtendedFetch, CLI_NAME_PREFIX "ExtendedFetch",
|
||||||
en_GetData, CLI_NAME_PREFIX "GetData",
|
en_GetData, CLI_NAME_PREFIX "GetData",
|
||||||
en_SetPos, CLI_NAME_PREFIX "SetPos",
|
en_SetPos, CLI_NAME_PREFIX "SetPos",
|
||||||
en_MoreResults, CLI_NAME_PREFIX "MoreResults",
|
en_MoreResults, CLI_NAME_PREFIX "MoreResults",
|
||||||
en_Error, CLI_NAME_PREFIX "Error",
|
en_Error, CLI_NAME_PREFIX "Error",
|
||||||
|
|
||||||
en_ColumnPrivileges, CLI_NAME_PREFIX "ColumnPrivileges",
|
en_ColumnPrivileges, CLI_NAME_PREFIX "ColumnPrivileges",
|
||||||
en_Columns, CLI_NAME_PREFIX "Columns",
|
en_Columns, CLI_NAME_PREFIX "Columns",
|
||||||
en_ForeignKeys, CLI_NAME_PREFIX "ForeignKeys",
|
en_ForeignKeys, CLI_NAME_PREFIX "ForeignKeys",
|
||||||
en_PrimaryKeys, CLI_NAME_PREFIX "PrimaryKeys",
|
en_PrimaryKeys, CLI_NAME_PREFIX "PrimaryKeys",
|
||||||
en_ProcedureColumns, CLI_NAME_PREFIX "ProcedureColumns",
|
en_ProcedureColumns, CLI_NAME_PREFIX "ProcedureColumns",
|
||||||
en_Procedures, CLI_NAME_PREFIX "Procedures",
|
en_Procedures, CLI_NAME_PREFIX "Procedures",
|
||||||
en_SpecialColumns, CLI_NAME_PREFIX "SpecialColumns",
|
en_SpecialColumns, CLI_NAME_PREFIX "SpecialColumns",
|
||||||
en_Statistics, CLI_NAME_PREFIX "Statistics",
|
en_Statistics, CLI_NAME_PREFIX "Statistics",
|
||||||
en_TablePrivileges, CLI_NAME_PREFIX "TablePrivileges",
|
en_TablePrivileges, CLI_NAME_PREFIX "TablePrivileges",
|
||||||
en_Tables, CLI_NAME_PREFIX "Tables",
|
en_Tables, CLI_NAME_PREFIX "Tables",
|
||||||
|
|
||||||
en_FreeStmt, CLI_NAME_PREFIX "FreeStmt",
|
en_FreeStmt, CLI_NAME_PREFIX "FreeStmt",
|
||||||
en_Cancel, CLI_NAME_PREFIX "Cancel",
|
en_Cancel, CLI_NAME_PREFIX "Cancel",
|
||||||
en_Transact, CLI_NAME_PREFIX "Transact",
|
en_Transact, CLI_NAME_PREFIX "Transact",
|
||||||
|
|
||||||
en_Disconnect, CLI_NAME_PREFIX "Disconnect",
|
en_Disconnect, CLI_NAME_PREFIX "Disconnect",
|
||||||
en_FreeConnect, CLI_NAME_PREFIX "FreeConnect",
|
en_FreeConnect, CLI_NAME_PREFIX "FreeConnect",
|
||||||
en_FreeEnv, CLI_NAME_PREFIX "FreeEnv",
|
en_FreeEnv, CLI_NAME_PREFIX "FreeEnv",
|
||||||
|
|
||||||
en_NullProc, NULL
|
en_NullProc, NULL
|
||||||
};
|
};
|
||||||
|
160
src/iodbc/henv.h
160
src/iodbc/henv.h
@@ -1,109 +1,109 @@
|
|||||||
#ifndef _HENV_H
|
#ifndef _HENV_H
|
||||||
#define _HENV_H
|
#define _HENV_H
|
||||||
|
|
||||||
# include <../iodbc/config.h>
|
# include <config.h>
|
||||||
# include <../iodbc/dlproc.h>
|
# include <dlproc.h>
|
||||||
|
|
||||||
# include <../iodbc/isql.h>
|
# include <isql.h>
|
||||||
# include <../iodbc/isqlext.h>
|
# include <isqlext.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
en_AllocHandle = SQL_API_SQLALLOCHANDLE,
|
en_AllocHandle = SQL_API_SQLALLOCHANDLE,
|
||||||
en_FreeHandle = SQL_API_SQLFREEHANDLE,
|
en_FreeHandle = SQL_API_SQLFREEHANDLE,
|
||||||
#endif
|
#endif
|
||||||
en_AllocEnv = SQL_API_SQLALLOCENV,
|
en_AllocEnv = SQL_API_SQLALLOCENV,
|
||||||
en_AllocConnect = SQL_API_SQLALLOCCONNECT,
|
en_AllocConnect = SQL_API_SQLALLOCCONNECT,
|
||||||
en_Connect = SQL_API_SQLCONNECT,
|
en_Connect = SQL_API_SQLCONNECT,
|
||||||
en_DriverConnect = SQL_API_SQLDRIVERCONNECT,
|
en_DriverConnect = SQL_API_SQLDRIVERCONNECT,
|
||||||
en_BrowseConnect = SQL_API_SQLBROWSECONNECT,
|
en_BrowseConnect = SQL_API_SQLBROWSECONNECT,
|
||||||
|
|
||||||
en_DataSources = SQL_API_SQLDATASOURCES,
|
en_DataSources = SQL_API_SQLDATASOURCES,
|
||||||
en_Drivers = SQL_API_SQLDRIVERS,
|
en_Drivers = SQL_API_SQLDRIVERS,
|
||||||
en_GetInfo = SQL_API_SQLGETINFO,
|
en_GetInfo = SQL_API_SQLGETINFO,
|
||||||
en_GetFunctions = SQL_API_SQLGETFUNCTIONS,
|
en_GetFunctions = SQL_API_SQLGETFUNCTIONS,
|
||||||
en_GetTypeInfo = SQL_API_SQLGETTYPEINFO,
|
en_GetTypeInfo = SQL_API_SQLGETTYPEINFO,
|
||||||
|
|
||||||
en_SetConnectOption = SQL_API_SQLSETCONNECTOPTION,
|
en_SetConnectOption = SQL_API_SQLSETCONNECTOPTION,
|
||||||
en_GetConnectOption = SQL_API_SQLGETCONNECTOPTION,
|
en_GetConnectOption = SQL_API_SQLGETCONNECTOPTION,
|
||||||
en_SetStmtOption = SQL_API_SQLSETSTMTOPTION,
|
en_SetStmtOption = SQL_API_SQLSETSTMTOPTION,
|
||||||
en_GetStmtOption = SQL_API_SQLGETSTMTOPTION,
|
en_GetStmtOption = SQL_API_SQLGETSTMTOPTION,
|
||||||
|
|
||||||
en_AllocStmt = SQL_API_SQLALLOCSTMT,
|
en_AllocStmt = SQL_API_SQLALLOCSTMT,
|
||||||
en_Prepare = SQL_API_SQLPREPARE,
|
en_Prepare = SQL_API_SQLPREPARE,
|
||||||
en_BindParameter = SQL_API_SQLBINDPARAMETER,
|
en_BindParameter = SQL_API_SQLBINDPARAMETER,
|
||||||
en_ParamOptions = SQL_API_SQLPARAMOPTIONS,
|
en_ParamOptions = SQL_API_SQLPARAMOPTIONS,
|
||||||
en_GetCursorName = SQL_API_SQLGETCURSORNAME,
|
en_GetCursorName = SQL_API_SQLGETCURSORNAME,
|
||||||
en_SetCursorName = SQL_API_SQLSETCURSORNAME,
|
en_SetCursorName = SQL_API_SQLSETCURSORNAME,
|
||||||
en_SetScrollOptions = SQL_API_SQLSETSCROLLOPTIONS,
|
en_SetScrollOptions = SQL_API_SQLSETSCROLLOPTIONS,
|
||||||
en_SetParam = SQL_API_SQLSETPARAM,
|
en_SetParam = SQL_API_SQLSETPARAM,
|
||||||
|
|
||||||
en_Execute = SQL_API_SQLEXECUTE,
|
en_Execute = SQL_API_SQLEXECUTE,
|
||||||
en_ExecDirect = SQL_API_SQLEXECDIRECT,
|
en_ExecDirect = SQL_API_SQLEXECDIRECT,
|
||||||
en_NativeSql = SQL_API_SQLNATIVESQL,
|
en_NativeSql = SQL_API_SQLNATIVESQL,
|
||||||
en_DescribeParam = SQL_API_SQLDESCRIBEPARAM,
|
en_DescribeParam = SQL_API_SQLDESCRIBEPARAM,
|
||||||
en_NumParams = SQL_API_SQLNUMPARAMS,
|
en_NumParams = SQL_API_SQLNUMPARAMS,
|
||||||
en_ParamData = SQL_API_SQLPARAMDATA,
|
en_ParamData = SQL_API_SQLPARAMDATA,
|
||||||
en_PutData = SQL_API_SQLPUTDATA,
|
en_PutData = SQL_API_SQLPUTDATA,
|
||||||
|
|
||||||
en_RowCount = SQL_API_SQLROWCOUNT,
|
en_RowCount = SQL_API_SQLROWCOUNT,
|
||||||
en_NumResultCols = SQL_API_SQLNUMRESULTCOLS,
|
en_NumResultCols = SQL_API_SQLNUMRESULTCOLS,
|
||||||
en_DescribeCol = SQL_API_SQLDESCRIBECOL,
|
en_DescribeCol = SQL_API_SQLDESCRIBECOL,
|
||||||
en_ColAttributes = SQL_API_SQLCOLATTRIBUTES,
|
en_ColAttributes = SQL_API_SQLCOLATTRIBUTES,
|
||||||
en_BindCol = SQL_API_SQLBINDCOL,
|
en_BindCol = SQL_API_SQLBINDCOL,
|
||||||
en_Fetch = SQL_API_SQLFETCH,
|
en_Fetch = SQL_API_SQLFETCH,
|
||||||
en_ExtendedFetch = SQL_API_SQLEXTENDEDFETCH,
|
en_ExtendedFetch = SQL_API_SQLEXTENDEDFETCH,
|
||||||
en_GetData = SQL_API_SQLGETDATA,
|
en_GetData = SQL_API_SQLGETDATA,
|
||||||
en_SetPos = SQL_API_SQLSETPOS,
|
en_SetPos = SQL_API_SQLSETPOS,
|
||||||
en_MoreResults = SQL_API_SQLMORERESULTS,
|
en_MoreResults = SQL_API_SQLMORERESULTS,
|
||||||
en_Error = SQL_API_SQLERROR,
|
en_Error = SQL_API_SQLERROR,
|
||||||
|
|
||||||
en_ColumnPrivileges = SQL_API_SQLCOLUMNPRIVILEGES,
|
en_ColumnPrivileges = SQL_API_SQLCOLUMNPRIVILEGES,
|
||||||
en_Columns = SQL_API_SQLCOLUMNS,
|
en_Columns = SQL_API_SQLCOLUMNS,
|
||||||
en_ForeignKeys = SQL_API_SQLFOREIGNKEYS,
|
en_ForeignKeys = SQL_API_SQLFOREIGNKEYS,
|
||||||
en_PrimaryKeys = SQL_API_SQLPRIMARYKEYS,
|
en_PrimaryKeys = SQL_API_SQLPRIMARYKEYS,
|
||||||
en_ProcedureColumns = SQL_API_SQLPROCEDURECOLUMNS,
|
en_ProcedureColumns = SQL_API_SQLPROCEDURECOLUMNS,
|
||||||
en_Procedures = SQL_API_SQLPROCEDURES,
|
en_Procedures = SQL_API_SQLPROCEDURES,
|
||||||
en_SpecialColumns = SQL_API_SQLSPECIALCOLUMNS,
|
en_SpecialColumns = SQL_API_SQLSPECIALCOLUMNS,
|
||||||
en_Statistics = SQL_API_SQLSTATISTICS,
|
en_Statistics = SQL_API_SQLSTATISTICS,
|
||||||
en_TablePrivileges = SQL_API_SQLTABLEPRIVILEGES,
|
en_TablePrivileges = SQL_API_SQLTABLEPRIVILEGES,
|
||||||
en_Tables = SQL_API_SQLTABLES,
|
en_Tables = SQL_API_SQLTABLES,
|
||||||
|
|
||||||
en_FreeStmt = SQL_API_SQLFREESTMT,
|
en_FreeStmt = SQL_API_SQLFREESTMT,
|
||||||
en_Cancel = SQL_API_SQLCANCEL,
|
en_Cancel = SQL_API_SQLCANCEL,
|
||||||
en_Transact = SQL_API_SQLTRANSACT,
|
en_Transact = SQL_API_SQLTRANSACT,
|
||||||
|
|
||||||
en_Disconnect = SQL_API_SQLDISCONNECT,
|
en_Disconnect = SQL_API_SQLDISCONNECT,
|
||||||
en_FreeConnect = SQL_API_SQLFREECONNECT,
|
en_FreeConnect = SQL_API_SQLFREECONNECT,
|
||||||
en_FreeEnv = SQL_API_SQLFREEENV,
|
en_FreeEnv = SQL_API_SQLFREEENV,
|
||||||
|
|
||||||
en_NullProc = SYSERR
|
en_NullProc = SYSERR
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int type; /* must be 1st field */
|
int type; /* must be 1st field */
|
||||||
|
|
||||||
HENV henv; /* driver's env list */
|
HENV henv; /* driver's env list */
|
||||||
HDBC hdbc; /* driver's dbc list */
|
HDBC hdbc; /* driver's dbc list */
|
||||||
HERR herr; /* err list */
|
HERR herr; /* err list */
|
||||||
int state;
|
int state;
|
||||||
} GENV_t;
|
} GENV_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
HENV next; /* next attached env handle */
|
HENV next; /* next attached env handle */
|
||||||
int refcount; /* Driver's bookkeeping reference count */
|
int refcount; /* Driver's bookkeeping reference count */
|
||||||
HPROC dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls */
|
HPROC dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls */
|
||||||
|
|
||||||
HENV dhenv; /* driver env handle */
|
HENV dhenv; /* driver env handle */
|
||||||
HDLL hdll; /* drvier share library handle */
|
HDLL hdll; /* driver share library handle */
|
||||||
} ENV_t;
|
} ENV_t;
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
*
|
*
|
||||||
* - ODBC applications only know about global environment handle,
|
* - ODBC applications only know about global environment handle,
|
||||||
* a void pointer points to a GENV_t object. There is only one
|
* a void pointer points to a GENV_t object. There is only one
|
||||||
* this object per process(however, to make the library reentrant,
|
* this object per process(however, to make the library reentrant,
|
||||||
* we still keep this object on heap). Applications only know
|
* we still keep this object on heap). Applications only know
|
||||||
* address of this object and needn't care about its detail.
|
* address of this object and needn't care about its detail.
|
||||||
*
|
*
|
||||||
* - ODBC driver manager knows about instance environment handles,
|
* - ODBC driver manager knows about instance environment handles,
|
||||||
@@ -120,6 +120,6 @@ typedef struct {
|
|||||||
*
|
*
|
||||||
* - Applications can get driver's environment object handle by
|
* - Applications can get driver's environment object handle by
|
||||||
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HENV
|
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HENV
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
538
src/iodbc/herr.c
538
src/iodbc/herr.c
@@ -1,6 +1,6 @@
|
|||||||
/** Error stack management functions
|
/** Error stack management functions
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,336 +31,336 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static HERR _iodbcdm_popsqlerr( HERR herr )
|
static HERR _iodbcdm_popsqlerr( HERR herr )
|
||||||
{
|
{
|
||||||
sqlerr_t* list = (sqlerr_t*)herr;
|
sqlerr_t* list = (sqlerr_t*)herr;
|
||||||
sqlerr_t* next;
|
sqlerr_t* next;
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR )
|
if( herr == SQL_NULL_HERR )
|
||||||
{
|
{
|
||||||
return herr;
|
return herr;
|
||||||
}
|
}
|
||||||
|
|
||||||
next = list->next;
|
|
||||||
|
|
||||||
MEM_FREE (list);
|
next = list->next;
|
||||||
|
|
||||||
return next;
|
MEM_FREE (list);
|
||||||
|
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _iodbcdm_freesqlerrlist( HERR herrlist )
|
void _iodbcdm_freesqlerrlist( HERR herrlist )
|
||||||
{
|
{
|
||||||
HERR list;
|
HERR list;
|
||||||
|
|
||||||
for(list = herrlist; list!= 0; )
|
for(list = herrlist; list!= 0; )
|
||||||
{
|
{
|
||||||
list = _iodbcdm_popsqlerr(list);
|
list = _iodbcdm_popsqlerr(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HERR _iodbcdm_pushsqlerr (
|
HERR _iodbcdm_pushsqlerr (
|
||||||
HERR herr,
|
HERR herr,
|
||||||
sqlstcode_t code,
|
sqlstcode_t code,
|
||||||
char* msg )
|
char* msg )
|
||||||
{
|
{
|
||||||
sqlerr_t* ebuf;
|
sqlerr_t* ebuf;
|
||||||
sqlerr_t* perr = (sqlerr_t*)herr;
|
sqlerr_t* perr = (sqlerr_t*)herr;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
if(herr != SQL_NULL_HERR )
|
if(herr != SQL_NULL_HERR )
|
||||||
{
|
{
|
||||||
idx = perr->idx + 1;
|
idx = perr->idx + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( idx == 64 )
|
if( idx == 64 )
|
||||||
/* over wirte the top entry to prevent error stack blow out */
|
/* over wirte the top entry to prevent error stack blow out */
|
||||||
{
|
{
|
||||||
perr->code = code;
|
perr->code = code;
|
||||||
perr->msg = msg;
|
perr->msg = msg;
|
||||||
|
|
||||||
return herr;
|
return herr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ebuf = (sqlerr_t*)MEM_ALLOC (sizeof(sqlerr_t));
|
ebuf = (sqlerr_t*)MEM_ALLOC (sizeof(sqlerr_t));
|
||||||
|
|
||||||
if( ebuf == NULL )
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ebuf->msg = msg;
|
if( ebuf == NULL )
|
||||||
ebuf->code = code;
|
{
|
||||||
ebuf->idx = idx;
|
return NULL;
|
||||||
ebuf->next = (sqlerr_t*)herr;
|
}
|
||||||
|
|
||||||
return (HERR)ebuf;
|
ebuf->msg = msg;
|
||||||
|
ebuf->code = code;
|
||||||
|
ebuf->idx = idx;
|
||||||
|
ebuf->next = (sqlerr_t*)herr;
|
||||||
|
|
||||||
|
return (HERR)ebuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FAR* _iodbcdm_getsqlstate (
|
static char FAR* _iodbcdm_getsqlstate (
|
||||||
HERR herr,
|
HERR herr,
|
||||||
void FAR* tab )
|
void FAR* tab )
|
||||||
{
|
|
||||||
sqlerr_t* perr = (sqlerr_t*)herr;
|
|
||||||
sqlerrmsg_t* ptr;
|
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR || tab == NULL )
|
|
||||||
{
|
|
||||||
return (char FAR*)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( ptr = tab;
|
|
||||||
ptr->code != en_sqlstat_total;
|
|
||||||
ptr++ )
|
|
||||||
{
|
|
||||||
if(ptr->code == perr->code)
|
|
||||||
{
|
|
||||||
return (char FAR*)(ptr->stat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (char FAR*)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char FAR* _iodbcdm_getsqlerrmsg(
|
|
||||||
HERR herr,
|
|
||||||
void FAR* errtab )
|
|
||||||
{
|
{
|
||||||
sqlerr_t* perr = (sqlerr_t*)herr;
|
sqlerr_t* perr = (sqlerr_t*)herr;
|
||||||
sqlerrmsg_t* ptr;
|
sqlerrmsg_t* ptr;
|
||||||
|
|
||||||
|
if( herr == SQL_NULL_HERR || tab == NULL )
|
||||||
|
{
|
||||||
|
return (char FAR*)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( ptr = tab;
|
||||||
|
ptr->code != en_sqlstat_total;
|
||||||
|
ptr++ )
|
||||||
|
{
|
||||||
|
if(ptr->code == perr->code)
|
||||||
|
{
|
||||||
|
return (char FAR*)(ptr->stat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (char FAR*)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char FAR* _iodbcdm_getsqlerrmsg(
|
||||||
|
HERR herr,
|
||||||
|
void FAR* errtab )
|
||||||
|
{
|
||||||
|
sqlerr_t* perr = (sqlerr_t*)herr;
|
||||||
|
sqlerrmsg_t* ptr;
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR )
|
if( herr == SQL_NULL_HERR )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( perr->msg == NULL && errtab == NULL )
|
if( perr->msg == NULL && errtab == NULL )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( perr->msg != NULL )
|
if( perr->msg != NULL )
|
||||||
{
|
{
|
||||||
return perr->msg;
|
return perr->msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ptr = (sqlerrmsg_t*)errtab;
|
for( ptr = (sqlerrmsg_t*)errtab;
|
||||||
ptr->code != en_sqlstat_total;
|
ptr->code != en_sqlstat_total;
|
||||||
ptr++ )
|
ptr++ )
|
||||||
{
|
{
|
||||||
if( ptr->code == perr->code )
|
if( ptr->code == perr->code )
|
||||||
{
|
{
|
||||||
return (char FAR*)ptr->msg;
|
return (char FAR*)ptr->msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char FAR*)NULL;
|
return (char FAR*)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLError (
|
RETCODE SQL_API SQLError (
|
||||||
HENV henv,
|
HENV henv,
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UCHAR FAR* szSqlstate,
|
UCHAR FAR* szSqlstate,
|
||||||
SDWORD FAR* pfNativeError,
|
SDWORD FAR* pfNativeError,
|
||||||
UCHAR FAR* szErrorMsg,
|
UCHAR FAR* szErrorMsg,
|
||||||
SWORD cbErrorMsgMax,
|
SWORD cbErrorMsgMax,
|
||||||
SWORD FAR* pcbErrorMsg )
|
SWORD FAR* pcbErrorMsg )
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*) henv;
|
GENV_t FAR* genv = (GENV_t FAR*) henv;
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*) hdbc;
|
DBC_t FAR* pdbc = (DBC_t FAR*) hdbc;
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HDBC thdbc;
|
HDBC thdbc;
|
||||||
|
|
||||||
HENV dhenv = SQL_NULL_HENV;
|
HENV dhenv = SQL_NULL_HENV;
|
||||||
HDBC dhdbc = SQL_NULL_HDBC;
|
HDBC dhdbc = SQL_NULL_HDBC;
|
||||||
HSTMT dhstmt = SQL_NULL_HSTMT;
|
HSTMT dhstmt = SQL_NULL_HSTMT;
|
||||||
|
|
||||||
HERR herr = SQL_NULL_HERR;
|
HERR herr = SQL_NULL_HERR;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
char FAR* errmsg = NULL;
|
char FAR* errmsg = NULL;
|
||||||
char FAR* ststr = NULL;
|
char FAR* ststr = NULL;
|
||||||
|
|
||||||
int handle = 0;
|
int handle = 0;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
if( hstmt != SQL_NULL_HSTMT ) /* retrive stmt err */
|
|
||||||
{
|
|
||||||
herr = pstmt->herr;
|
|
||||||
thdbc = pstmt->hdbc;
|
|
||||||
|
|
||||||
if( thdbc == SQL_NULL_HDBC )
|
if( hstmt != SQL_NULL_HSTMT ) /* retrive stmt err */
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
herr = pstmt->herr;
|
||||||
}
|
thdbc = pstmt->hdbc;
|
||||||
hproc = _iodbcdm_getproc( thdbc, en_Error );
|
|
||||||
dhstmt = pstmt->dhstmt;
|
|
||||||
handle = 3;
|
|
||||||
}
|
|
||||||
else if( hdbc != SQL_NULL_HDBC ) /* retrive dbc err */
|
|
||||||
{
|
|
||||||
herr = pdbc->herr;
|
|
||||||
thdbc = hdbc;
|
|
||||||
if( thdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
|
||||||
return SQL_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
hproc = _iodbcdm_getproc( thdbc, en_Error );
|
|
||||||
dhdbc = pdbc->dhdbc;
|
|
||||||
handle = 2;
|
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR
|
if( thdbc == SQL_NULL_HDBC )
|
||||||
&& pdbc->henv == SQL_NULL_HENV )
|
{
|
||||||
{
|
return SQL_INVALID_HANDLE;
|
||||||
return SQL_NO_DATA_FOUND;
|
}
|
||||||
}
|
hproc = _iodbcdm_getproc( thdbc, en_Error );
|
||||||
}
|
dhstmt = pstmt->dhstmt;
|
||||||
else if( henv != SQL_NULL_HENV ) /* retrive env err */
|
handle = 3;
|
||||||
{
|
}
|
||||||
herr = genv->herr;
|
else if( hdbc != SQL_NULL_HDBC ) /* retrive dbc err */
|
||||||
|
{
|
||||||
|
herr = pdbc->herr;
|
||||||
|
thdbc = hdbc;
|
||||||
|
if( thdbc == SQL_NULL_HDBC )
|
||||||
|
{
|
||||||
|
return SQL_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
hproc = _iodbcdm_getproc( thdbc, en_Error );
|
||||||
|
dhdbc = pdbc->dhdbc;
|
||||||
|
handle = 2;
|
||||||
|
|
||||||
/* Drivers shouldn't push error message
|
if( herr == SQL_NULL_HERR
|
||||||
* on envoriment handle */
|
&& pdbc->henv == SQL_NULL_HENV )
|
||||||
|
{
|
||||||
|
return SQL_NO_DATA_FOUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( henv != SQL_NULL_HENV ) /* retrive env err */
|
||||||
|
{
|
||||||
|
herr = genv->herr;
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR )
|
/* Drivers shouldn't push error message
|
||||||
{
|
* on envoriment handle */
|
||||||
return SQL_NO_DATA_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
handle = 1;
|
if( herr == SQL_NULL_HERR )
|
||||||
}
|
{
|
||||||
else
|
return SQL_NO_DATA_FOUND;
|
||||||
{
|
}
|
||||||
return SQL_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( szErrorMsg != NULL )
|
handle = 1;
|
||||||
{
|
}
|
||||||
if( cbErrorMsgMax < 0
|
else
|
||||||
|| cbErrorMsgMax > SQL_MAX_MESSAGE_LENGTH - 1 )
|
{
|
||||||
{
|
return SQL_INVALID_HANDLE;
|
||||||
return SQL_ERROR;
|
}
|
||||||
/* SQLError() doesn't post error for itself */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR ) /* no err on drv mng */
|
if( szErrorMsg != NULL )
|
||||||
{
|
{
|
||||||
/* call driver */
|
if( cbErrorMsgMax < 0
|
||||||
if( hproc == SQL_NULL_HPROC )
|
|| cbErrorMsgMax > SQL_MAX_MESSAGE_LENGTH - 1 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( herr, en_IM001 );
|
return SQL_ERROR;
|
||||||
|
/* SQLError() doesn't post error for itself */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SQL_ERROR;
|
if( herr == SQL_NULL_HERR ) /* no err on drv mng */
|
||||||
}
|
{
|
||||||
|
/* call driver */
|
||||||
|
if( hproc == SQL_NULL_HPROC )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( herr, en_IM001 );
|
||||||
|
|
||||||
CALL_DRIVER ( thdbc, retcode, hproc, en_Error, (
|
return SQL_ERROR;
|
||||||
dhenv, dhdbc, dhstmt,
|
}
|
||||||
szSqlstate, pfNativeError,
|
|
||||||
szErrorMsg, cbErrorMsgMax, pcbErrorMsg) )
|
CALL_DRIVER ( thdbc, retcode, hproc, en_Error, (
|
||||||
|
dhenv, dhdbc, dhstmt,
|
||||||
|
szSqlstate, pfNativeError,
|
||||||
|
szErrorMsg, cbErrorMsgMax, pcbErrorMsg) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(dhenv, dhdbc, dhstmt,
|
retcode = hproc(dhenv, dhdbc, dhstmt,
|
||||||
szSqlstate, pfNativeError,
|
szSqlstate, pfNativeError,
|
||||||
szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
|
szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( szSqlstate != NULL )
|
if( szSqlstate != NULL )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* get sql state string */
|
/* get sql state string */
|
||||||
ststr = (char FAR*)_iodbcdm_getsqlstate( herr,
|
ststr = (char FAR*)_iodbcdm_getsqlstate( herr,
|
||||||
(void FAR*)sqlerrmsg_tab );
|
(void FAR*)sqlerrmsg_tab );
|
||||||
|
|
||||||
if( ststr == NULL)
|
|
||||||
{
|
|
||||||
len = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
len = (int)STRLEN(ststr);
|
|
||||||
}
|
|
||||||
|
|
||||||
STRNCPY ( szSqlstate, ststr, len );
|
|
||||||
szSqlstate[len] = 0;
|
|
||||||
/* buffer size of szSqlstate is not checked. Applications
|
|
||||||
* suppose provide enough ( not less than 6 bytes ) buffer
|
|
||||||
* or NULL for it.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pfNativeError != NULL )
|
if( ststr == NULL)
|
||||||
{
|
{
|
||||||
/* native error code is specific to data source */
|
len = 0;
|
||||||
*pfNativeError = (SDWORD)0L;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
len = (int)STRLEN(ststr);
|
||||||
|
}
|
||||||
|
|
||||||
if( szErrorMsg == NULL || cbErrorMsgMax == 0 )
|
STRNCPY ( szSqlstate, ststr, len );
|
||||||
{
|
szSqlstate[len] = 0;
|
||||||
if( pcbErrorMsg != NULL )
|
/* buffer size of szSqlstate is not checked. Applications
|
||||||
{
|
* suppose provide enough ( not less than 6 bytes ) buffer
|
||||||
*pcbErrorMsg = (SWORD)0;
|
* or NULL for it.
|
||||||
}
|
*/
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char msgbuf[256] = { '\0' };
|
|
||||||
|
|
||||||
/* get sql state message */
|
if( pfNativeError != NULL )
|
||||||
errmsg = _iodbcdm_getsqlerrmsg(herr,
|
{
|
||||||
(void FAR*)sqlerrmsg_tab);
|
/* native error code is specific to data source */
|
||||||
|
*pfNativeError = (SDWORD)0L;
|
||||||
|
}
|
||||||
|
|
||||||
if(errmsg == NULL)
|
if( szErrorMsg == NULL || cbErrorMsgMax == 0 )
|
||||||
{
|
{
|
||||||
errmsg = (char FAR*)"";
|
if( pcbErrorMsg != NULL )
|
||||||
}
|
{
|
||||||
|
*pcbErrorMsg = (SWORD)0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char msgbuf[256] = { '\0' };
|
||||||
|
|
||||||
sprintf(msgbuf, "%s%s", sqlerrhd, errmsg);
|
/* get sql state message */
|
||||||
|
errmsg = _iodbcdm_getsqlerrmsg(herr,
|
||||||
len = STRLEN( msgbuf );
|
(void FAR*)sqlerrmsg_tab);
|
||||||
|
|
||||||
if( len < cbErrorMsgMax - 1 )
|
if(errmsg == NULL)
|
||||||
{
|
{
|
||||||
retcode = SQL_SUCCESS;
|
errmsg = (char FAR*)"";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
len = cbErrorMsgMax - 1;
|
|
||||||
retcode = SQL_SUCCESS_WITH_INFO;
|
|
||||||
/* and not posts error for itself */
|
|
||||||
}
|
|
||||||
|
|
||||||
STRNCPY((char*)szErrorMsg, msgbuf, len);
|
sprintf(msgbuf, "%s%s", sqlerrhd, errmsg);
|
||||||
szErrorMsg[len] = 0;
|
|
||||||
|
|
||||||
if( pcbErrorMsg != NULL)
|
len = STRLEN( msgbuf );
|
||||||
{
|
|
||||||
*pcbErrorMsg = (SWORD)len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(handle) /* free this err */
|
if( len < cbErrorMsgMax - 1 )
|
||||||
{
|
{
|
||||||
case 1:
|
retcode = SQL_SUCCESS;
|
||||||
genv->herr = _iodbcdm_popsqlerr(genv->herr);
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
len = cbErrorMsgMax - 1;
|
||||||
|
retcode = SQL_SUCCESS_WITH_INFO;
|
||||||
|
/* and not posts error for itself */
|
||||||
|
}
|
||||||
|
|
||||||
case 2:
|
STRNCPY((char*)szErrorMsg, msgbuf, len);
|
||||||
pdbc->herr = _iodbcdm_popsqlerr(pdbc->herr);
|
szErrorMsg[len] = 0;
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
if( pcbErrorMsg != NULL)
|
||||||
pstmt->herr= _iodbcdm_popsqlerr(pstmt->herr);
|
{
|
||||||
break;
|
*pcbErrorMsg = (SWORD)len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
switch(handle) /* free this err */
|
||||||
break;
|
{
|
||||||
}
|
case 1:
|
||||||
|
genv->herr = _iodbcdm_popsqlerr(genv->herr);
|
||||||
|
break;
|
||||||
|
|
||||||
return retcode;
|
case 2:
|
||||||
|
pdbc->herr = _iodbcdm_popsqlerr(pdbc->herr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
pstmt->herr= _iodbcdm_popsqlerr(pstmt->herr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retcode;
|
||||||
}
|
}
|
||||||
|
@@ -1,98 +1,98 @@
|
|||||||
static const sqlerrmsg_t sqlerrmsg_tab[] =
|
static const sqlerrmsg_t sqlerrmsg_tab[] =
|
||||||
{
|
{
|
||||||
en_00000, "00000", "",
|
en_00000, "00000", "",
|
||||||
en_01000, "01000", "General warning",
|
en_01000, "01000", "General warning",
|
||||||
en_01002, "01002", "Disconnect error",
|
en_01002, "01002", "Disconnect error",
|
||||||
en_01004, "01004", "Data truncated",
|
en_01004, "01004", "Data truncated",
|
||||||
en_01006, "01006", "Privilege not revoked",
|
en_01006, "01006", "Privilege not revoked",
|
||||||
en_01S00, "01S00", "Invalid connection string attribute",
|
en_01S00, "01S00", "Invalid connection string attribute",
|
||||||
en_01S01, "01S01", "Error in row",
|
en_01S01, "01S01", "Error in row",
|
||||||
en_01S02, "01S02", "Optional value changed",
|
en_01S02, "01S02", "Optional value changed",
|
||||||
en_01S03, "01S03", "No rows updated or deleted",
|
en_01S03, "01S03", "No rows updated or deleted",
|
||||||
en_01S04, "01S04", "More than one row updated or deleted",
|
en_01S04, "01S04", "More than one row updated or deleted",
|
||||||
en_07001, "07001", "Wrong number of parameters",
|
en_07001, "07001", "Wrong number of parameters",
|
||||||
en_07006, "07006", "Restricted data type attribute violation",
|
en_07006, "07006", "Restricted data type attribute violation",
|
||||||
en_08001, "08001", "Unable to connect to data source",
|
en_08001, "08001", "Unable to connect to data source",
|
||||||
en_08002, "08002", "Connection in use",
|
en_08002, "08002", "Connection in use",
|
||||||
en_08003, "08003", "Connect not open",
|
en_08003, "08003", "Connect not open",
|
||||||
en_08004, "08004", "Data source rejected establishment of connection",
|
en_08004, "08004", "Data source rejected establishment of connection",
|
||||||
en_08007, "08007", "Connection failure during transaction",
|
en_08007, "08007", "Connection failure during transaction",
|
||||||
en_08S01, "08S01", "Communication link failure",
|
en_08S01, "08S01", "Communication link failure",
|
||||||
en_21S01, "21S01", "Insert value list does not match",
|
en_21S01, "21S01", "Insert value list does not match",
|
||||||
en_21S02, "21S02", "Degree of derived table does not match column list",
|
en_21S02, "21S02", "Degree of derived table does not match column list",
|
||||||
en_22001, "22001", "String data right truncation",
|
en_22001, "22001", "String data right truncation",
|
||||||
en_22003, "22003", "Numeric value out of range",
|
en_22003, "22003", "Numeric value out of range",
|
||||||
en_22005, "22005", "Error in assignment",
|
en_22005, "22005", "Error in assignment",
|
||||||
en_22008, "22008", "Datetime field overflow",
|
en_22008, "22008", "Datetime field overflow",
|
||||||
en_22012, "22012", "Division by zero",
|
en_22012, "22012", "Division by zero",
|
||||||
en_22026, "22026", "String data, length mismatch",
|
en_22026, "22026", "String data, length mismatch",
|
||||||
en_23000, "23000", "Integrity constraint violation",
|
en_23000, "23000", "Integrity constraint violation",
|
||||||
en_24000, "24000", "Invalid cursor state",
|
en_24000, "24000", "Invalid cursor state",
|
||||||
en_25000, "25000", "Invalid transaction state",
|
en_25000, "25000", "Invalid transaction state",
|
||||||
en_28000, "28000", "Invalid authorization specification",
|
en_28000, "28000", "Invalid authorization specification",
|
||||||
en_34000, "34000", "Invalid cursor name",
|
en_34000, "34000", "Invalid cursor name",
|
||||||
en_37000, "37000", "Syntex error or access violation",
|
en_37000, "37000", "Syntex error or access violation",
|
||||||
en_3C000, "3C000", "Duplicate cursor name",
|
en_3C000, "3C000", "Duplicate cursor name",
|
||||||
en_40001, "40001", "Serialization failure",
|
en_40001, "40001", "Serialization failure",
|
||||||
en_42000, "42000", "Syntax error or access violation",
|
en_42000, "42000", "Syntax error or access violation",
|
||||||
en_70100, "70100", "Operation aborted",
|
en_70100, "70100", "Operation aborted",
|
||||||
en_IM001, "IM001", "Driver does not support this function",
|
en_IM001, "IM001", "Driver does not support this function",
|
||||||
en_IM002, "IM002", "Data source name not found and no default "
|
en_IM002, "IM002", "Data source name not found and no default "
|
||||||
"driver specified. Driver could not be loaded",
|
"driver specified. Driver could not be loaded",
|
||||||
en_IM003, "IM003", "Specified driver could not be loaded",
|
en_IM003, "IM003", "Specified driver could not be loaded",
|
||||||
en_IM004, "IM004", "Driver's SQLAllocEnv() failed",
|
en_IM004, "IM004", "Driver's SQLAllocEnv() failed",
|
||||||
en_IM005, "IM005", "Driver's SQLAllocConnect() failed",
|
en_IM005, "IM005", "Driver's SQLAllocConnect() failed",
|
||||||
en_IM006, "IM006", "Driver's SQLSetConnectOption failed",
|
en_IM006, "IM006", "Driver's SQLSetConnectOption failed",
|
||||||
en_IM007, "IM007", "No data source or driver specified, dialog prohibited",
|
en_IM007, "IM007", "No data source or driver specified, dialog prohibited",
|
||||||
en_IM008, "IM008", "Dialog failed",
|
en_IM008, "IM008", "Dialog failed",
|
||||||
en_IM009, "IM009", "Unable to load translation DLL",
|
en_IM009, "IM009", "Unable to load translation DLL",
|
||||||
en_IM010, "IM010", "Data source name too long",
|
en_IM010, "IM010", "Data source name too long",
|
||||||
en_IM011, "IM011", "Driver name too long",
|
en_IM011, "IM011", "Driver name too long",
|
||||||
en_IM012, "IM012", "DRIVER keyword syntax error",
|
en_IM012, "IM012", "DRIVER keyword syntax error",
|
||||||
en_IM013, "IM013", "Trace file error",
|
en_IM013, "IM013", "Trace file error",
|
||||||
en_IM014, "IM014", "Try to change tracing file while tracing is on",
|
en_IM014, "IM014", "Try to change tracing file while tracing is on",
|
||||||
en_S0001, "S0001", "Base table or view already exists",
|
en_S0001, "S0001", "Base table or view already exists",
|
||||||
en_S0002, "S0002", "Base table not found",
|
en_S0002, "S0002", "Base table not found",
|
||||||
en_S0011, "S0011", "Index already exists",
|
en_S0011, "S0011", "Index already exists",
|
||||||
en_S0012, "S0012", "Index not found",
|
en_S0012, "S0012", "Index not found",
|
||||||
en_S0021, "S0021", "Column already exists",
|
en_S0021, "S0021", "Column already exists",
|
||||||
en_S0022, "S0022", "Column not found",
|
en_S0022, "S0022", "Column not found",
|
||||||
en_S0023, "S0023", "No default for column",
|
en_S0023, "S0023", "No default for column",
|
||||||
en_S1000, "S1000", "General error",
|
en_S1000, "S1000", "General error",
|
||||||
en_S1001, "S1001", "Memory allocation failure",
|
en_S1001, "S1001", "Memory allocation failure",
|
||||||
en_S1002, "S1002", "Invalid column number",
|
en_S1002, "S1002", "Invalid column number",
|
||||||
en_S1003, "S1003", "Program type out of range",
|
en_S1003, "S1003", "Program type out of range",
|
||||||
en_S1004, "S1004", "SQL data type out of range",
|
en_S1004, "S1004", "SQL data type out of range",
|
||||||
en_S1008, "S1008", "Operation canceled",
|
en_S1008, "S1008", "Operation canceled",
|
||||||
en_S1009, "S1009", "Invalid argument value",
|
en_S1009, "S1009", "Invalid argument value",
|
||||||
en_S1010, "S1010", "Function sequence error",
|
en_S1010, "S1010", "Function sequence error",
|
||||||
en_S1011, "S1011", "Operation invalid at this time",
|
en_S1011, "S1011", "Operation invalid at this time",
|
||||||
en_S1012, "S1012", "Invalid transaction operation code specified",
|
en_S1012, "S1012", "Invalid transaction operation code specified",
|
||||||
en_S1015, "S1015", "No cursor name available",
|
en_S1015, "S1015", "No cursor name available",
|
||||||
en_S1090, "S1090", "Invalid string or buffer length",
|
en_S1090, "S1090", "Invalid string or buffer length",
|
||||||
en_S1091, "S1091", "Descriptor type out of range",
|
en_S1091, "S1091", "Descriptor type out of range",
|
||||||
en_S1092, "S1092", "Option type out of range",
|
en_S1092, "S1092", "Option type out of range",
|
||||||
en_S1093, "S1093", "Invalid parameter",
|
en_S1093, "S1093", "Invalid parameter",
|
||||||
en_S1094, "S1094", "Invalid scale value",
|
en_S1094, "S1094", "Invalid scale value",
|
||||||
en_S1095, "S1095", "Function type out of range",
|
en_S1095, "S1095", "Function type out of range",
|
||||||
en_S1096, "S1096", "Information type out of range",
|
en_S1096, "S1096", "Information type out of range",
|
||||||
en_S1097, "S1097", "Column type out of range",
|
en_S1097, "S1097", "Column type out of range",
|
||||||
en_S1098, "S1098", "Scope type out of range",
|
en_S1098, "S1098", "Scope type out of range",
|
||||||
en_S1099, "S1099", "Nullable type out of range",
|
en_S1099, "S1099", "Nullable type out of range",
|
||||||
en_S1100, "S1100", "Uniquenss option type out of range",
|
en_S1100, "S1100", "Uniquenss option type out of range",
|
||||||
en_S1101, "S1101", "Accuracy option type out of range",
|
en_S1101, "S1101", "Accuracy option type out of range",
|
||||||
en_S1103, "S1103", "Direction option out of range",
|
en_S1103, "S1103", "Direction option out of range",
|
||||||
en_S1104, "S1104", "Invalid precision value",
|
en_S1104, "S1104", "Invalid precision value",
|
||||||
en_S1105, "S1105", "Invalid parameter type",
|
en_S1105, "S1105", "Invalid parameter type",
|
||||||
en_S1106, "S1106", "Fetch type out of range",
|
en_S1106, "S1106", "Fetch type out of range",
|
||||||
en_S1107, "S1107", "Row value out of range",
|
en_S1107, "S1107", "Row value out of range",
|
||||||
en_S1108, "S1108", "Concurrency option out of range",
|
en_S1108, "S1108", "Concurrency option out of range",
|
||||||
en_S1109, "S1109", "Invalid cursor position",
|
en_S1109, "S1109", "Invalid cursor position",
|
||||||
en_S1110, "S1110", "Invalid driver completion",
|
en_S1110, "S1110", "Invalid driver completion",
|
||||||
en_S1111, "S1111", "Invalid bookmark value",
|
en_S1111, "S1111", "Invalid bookmark value",
|
||||||
en_S1C00, "S1C00", "Driver not capable",
|
en_S1C00, "S1C00", "Driver not capable",
|
||||||
en_S1T00, "S1T00", "Timeout expired",
|
en_S1T00, "S1T00", "Timeout expired",
|
||||||
en_sqlstat_total, NULL, NULL
|
en_sqlstat_total, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static char FAR* sqlerrhd = "[iODBC][Driver Manager]";
|
static char FAR* sqlerrhd = "[iODBC][Driver Manager]";
|
||||||
|
224
src/iodbc/herr.h
224
src/iodbc/herr.h
@@ -1,125 +1,125 @@
|
|||||||
#ifndef _HERR_H
|
#ifndef _HERR_H
|
||||||
#define _HERR_H
|
#define _HERR_H
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
en_00000 = 0,
|
en_00000 = 0,
|
||||||
en_01000,
|
en_01000,
|
||||||
en_01002,
|
en_01002,
|
||||||
en_01004,
|
en_01004,
|
||||||
en_01006,
|
en_01006,
|
||||||
en_01S00,
|
en_01S00,
|
||||||
en_01S01,
|
en_01S01,
|
||||||
en_01S02,
|
en_01S02,
|
||||||
en_01S03,
|
en_01S03,
|
||||||
en_01S04,
|
en_01S04,
|
||||||
en_07001,
|
en_07001,
|
||||||
en_07006,
|
en_07006,
|
||||||
en_08001,
|
en_08001,
|
||||||
en_08002,
|
en_08002,
|
||||||
en_08003,
|
en_08003,
|
||||||
en_08004,
|
en_08004,
|
||||||
en_08007,
|
en_08007,
|
||||||
en_08S01,
|
en_08S01,
|
||||||
en_21S01,
|
en_21S01,
|
||||||
en_21S02,
|
en_21S02,
|
||||||
en_22001,
|
en_22001,
|
||||||
en_22003,
|
en_22003,
|
||||||
en_22005,
|
en_22005,
|
||||||
en_22008,
|
en_22008,
|
||||||
en_22012,
|
en_22012,
|
||||||
en_22026,
|
en_22026,
|
||||||
en_23000,
|
en_23000,
|
||||||
en_24000,
|
en_24000,
|
||||||
en_25000,
|
en_25000,
|
||||||
en_28000,
|
en_28000,
|
||||||
en_34000,
|
en_34000,
|
||||||
en_37000,
|
en_37000,
|
||||||
en_3C000,
|
en_3C000,
|
||||||
en_40001,
|
en_40001,
|
||||||
en_42000,
|
en_42000,
|
||||||
en_70100,
|
en_70100,
|
||||||
en_IM001,
|
en_IM001,
|
||||||
en_IM002,
|
en_IM002,
|
||||||
en_IM003,
|
en_IM003,
|
||||||
en_IM004,
|
en_IM004,
|
||||||
en_IM005,
|
en_IM005,
|
||||||
en_IM006,
|
en_IM006,
|
||||||
en_IM007,
|
en_IM007,
|
||||||
en_IM008,
|
en_IM008,
|
||||||
en_IM009,
|
en_IM009,
|
||||||
en_IM010,
|
en_IM010,
|
||||||
en_IM011,
|
en_IM011,
|
||||||
en_IM012,
|
en_IM012,
|
||||||
en_IM013,
|
en_IM013,
|
||||||
en_IM014,
|
en_IM014,
|
||||||
en_S0001,
|
en_S0001,
|
||||||
en_S0002,
|
en_S0002,
|
||||||
en_S0011,
|
en_S0011,
|
||||||
en_S0012,
|
en_S0012,
|
||||||
en_S0021,
|
en_S0021,
|
||||||
en_S0022,
|
en_S0022,
|
||||||
en_S0023,
|
en_S0023,
|
||||||
en_S1000,
|
en_S1000,
|
||||||
en_S1001,
|
en_S1001,
|
||||||
en_S1002,
|
en_S1002,
|
||||||
en_S1003,
|
en_S1003,
|
||||||
en_S1004,
|
en_S1004,
|
||||||
en_S1008,
|
en_S1008,
|
||||||
en_S1009,
|
en_S1009,
|
||||||
en_S1010,
|
en_S1010,
|
||||||
en_S1011,
|
en_S1011,
|
||||||
en_S1012,
|
en_S1012,
|
||||||
en_S1015,
|
en_S1015,
|
||||||
en_S1090,
|
en_S1090,
|
||||||
en_S1091,
|
en_S1091,
|
||||||
en_S1092,
|
en_S1092,
|
||||||
en_S1093,
|
en_S1093,
|
||||||
en_S1094,
|
en_S1094,
|
||||||
en_S1095,
|
en_S1095,
|
||||||
en_S1096,
|
en_S1096,
|
||||||
en_S1097,
|
en_S1097,
|
||||||
en_S1098,
|
en_S1098,
|
||||||
en_S1099,
|
en_S1099,
|
||||||
en_S1100,
|
en_S1100,
|
||||||
en_S1101,
|
en_S1101,
|
||||||
en_S1103,
|
en_S1103,
|
||||||
en_S1104,
|
en_S1104,
|
||||||
en_S1105,
|
en_S1105,
|
||||||
en_S1106,
|
en_S1106,
|
||||||
en_S1107,
|
en_S1107,
|
||||||
en_S1108,
|
en_S1108,
|
||||||
en_S1109,
|
en_S1109,
|
||||||
en_S1110,
|
en_S1110,
|
||||||
en_S1111,
|
en_S1111,
|
||||||
en_S1C00,
|
en_S1C00,
|
||||||
en_S1T00,
|
en_S1T00,
|
||||||
en_sqlstat_total
|
en_sqlstat_total
|
||||||
} sqlstcode_t;
|
} sqlstcode_t;
|
||||||
|
|
||||||
typedef void FAR* HERR;
|
typedef void FAR* HERR;
|
||||||
# define SQL_NULL_HERR ((HERR)NULL)
|
# define SQL_NULL_HERR ((HERR)NULL)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
sqlstcode_t code;
|
sqlstcode_t code;
|
||||||
char FAR* stat;
|
char FAR* stat;
|
||||||
char FAR* msg;
|
char FAR* msg;
|
||||||
} sqlerrmsg_t;
|
} sqlerrmsg_t;
|
||||||
|
|
||||||
typedef struct sqlerr {
|
typedef struct sqlerr {
|
||||||
sqlstcode_t code;
|
sqlstcode_t code;
|
||||||
int idx;
|
int idx;
|
||||||
char FAR* msg;
|
char FAR* msg;
|
||||||
struct sqlerr* next;
|
struct sqlerr* next;
|
||||||
} sqlerr_t;
|
} sqlerr_t;
|
||||||
|
|
||||||
extern void _iodbcdm_freesqlerrlist( HERR herr );
|
extern void _iodbcdm_freesqlerrlist( HERR herr );
|
||||||
extern HERR _iodbcdm_pushsqlerr ( HERR list, sqlstcode_t code, char* sysmsg );
|
extern HERR _iodbcdm_pushsqlerr ( HERR list, sqlstcode_t code, char* sysmsg );
|
||||||
|
|
||||||
# define PUSHSYSERR(list, msg) \
|
# define PUSHSYSERR(list, msg) \
|
||||||
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), 0, (char*)msg )
|
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), 0, (char*)msg )
|
||||||
# define PUSHSQLERR(list, code) \
|
# define PUSHSQLERR(list, code) \
|
||||||
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), (int)(code), NULL )
|
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), (int)(code), NULL )
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SQLERR_H */
|
|
||||||
|
#endif /* _SQLERR_H */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,48 +1,48 @@
|
|||||||
#ifndef _HSTMT_H
|
#ifndef _HSTMT_H
|
||||||
#define _HSTMT_H
|
#define _HSTMT_H
|
||||||
|
|
||||||
#include <../iodbc/config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <isql.h>
|
||||||
#include <../iodbc/isqlext.h>
|
#include <isqlext.h>
|
||||||
|
|
||||||
typedef struct STMT
|
typedef struct STMT
|
||||||
{
|
{
|
||||||
int type; /* must be 1st field */
|
int type; /* must be 1st field */
|
||||||
|
|
||||||
struct STMT* next;
|
struct STMT* next;
|
||||||
|
|
||||||
HERR herr;
|
HERR herr;
|
||||||
HDBC hdbc; /* back point to connection object */
|
HDBC hdbc; /* back point to connection object */
|
||||||
HSTMT dhstmt; /* driver's stmt handle */
|
HSTMT dhstmt; /* driver's stmt handle */
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
int cursor_state;
|
int cursor_state;
|
||||||
int prep_state;
|
int prep_state;
|
||||||
int asyn_on; /* async executing which odbc call */
|
int asyn_on; /* async executing which odbc call */
|
||||||
int need_on; /* which call return SQL_NEED_DATA */
|
int need_on; /* which call return SQL_NEED_DATA */
|
||||||
} STMT_t;
|
} STMT_t;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
en_stmt_allocated = 0,
|
en_stmt_allocated = 0,
|
||||||
en_stmt_prepared,
|
en_stmt_prepared,
|
||||||
en_stmt_executed,
|
en_stmt_executed,
|
||||||
en_stmt_cursoropen,
|
en_stmt_cursoropen,
|
||||||
en_stmt_fetched,
|
en_stmt_fetched,
|
||||||
en_stmt_xfetched,
|
en_stmt_xfetched,
|
||||||
en_stmt_needdata, /* not call SQLParamData() yet */
|
en_stmt_needdata, /* not call SQLParamData() yet */
|
||||||
en_stmt_mustput, /* not call SQLPutData() yet */
|
en_stmt_mustput, /* not call SQLPutData() yet */
|
||||||
en_stmt_canput /* SQLPutData() called */
|
en_stmt_canput /* SQLPutData() called */
|
||||||
}; /* for statement handle state */
|
}; /* for statement handle state */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
en_stmt_cursor_no = 0,
|
en_stmt_cursor_no = 0,
|
||||||
en_stmt_cursor_named,
|
en_stmt_cursor_named,
|
||||||
en_stmt_cursor_opened,
|
en_stmt_cursor_opened,
|
||||||
en_stmt_cursor_fetched,
|
en_stmt_cursor_fetched,
|
||||||
en_stmt_cursor_xfetched
|
en_stmt_cursor_xfetched
|
||||||
}; /* for statement cursor state */
|
}; /* for statement cursor state */
|
||||||
|
|
||||||
extern RETCODE _iodbcdm_dropstmt();
|
extern RETCODE _iodbcdm_dropstmt();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
566
src/iodbc/info.c
566
src/iodbc/info.c
@@ -1,6 +1,6 @@
|
|||||||
/** Information functions
|
/** Information functions
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,363 +30,363 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
RETCODE SQL_API SQLDataSources(
|
RETCODE SQL_API SQLDataSources(
|
||||||
HENV henv,
|
HENV henv,
|
||||||
UWORD fDir,
|
UWORD fDir,
|
||||||
UCHAR FAR* szDSN,
|
UCHAR FAR* szDSN,
|
||||||
SWORD cbDSNMax,
|
SWORD cbDSNMax,
|
||||||
SWORD FAR* pcbDSN,
|
SWORD FAR* pcbDSN,
|
||||||
UCHAR FAR* szDesc,
|
UCHAR FAR* szDesc,
|
||||||
SWORD cbDescMax,
|
SWORD cbDescMax,
|
||||||
SWORD FAR* pcbDesc )
|
SWORD FAR* pcbDesc )
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
||||||
|
|
||||||
if( henv == SQL_NULL_HENV )
|
|
||||||
{
|
|
||||||
return SQL_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check argument */
|
if( henv == SQL_NULL_HENV )
|
||||||
if( cbDSNMax < 0 || cbDescMax < 0 )
|
{
|
||||||
{
|
return SQL_INVALID_HANDLE;
|
||||||
PUSHSQLERR ( genv->herr, en_S1090 );
|
}
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( fDir != SQL_FETCH_FIRST
|
/* check argument */
|
||||||
&& fDir != SQL_FETCH_NEXT )
|
if( cbDSNMax < 0 || cbDescMax < 0 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1103 );
|
PUSHSQLERR ( genv->herr, en_S1090 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************/
|
if( fDir != SQL_FETCH_FIRST
|
||||||
|
&& fDir != SQL_FETCH_NEXT )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( genv->herr, en_S1103 );
|
||||||
|
|
||||||
return SQL_NO_DATA_FOUND;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLDrivers(
|
/*************************/
|
||||||
HENV henv,
|
|
||||||
UWORD fDir,
|
return SQL_SUCCESS;
|
||||||
UCHAR FAR* szDrvDesc,
|
}
|
||||||
SWORD cbDrvDescMax,
|
|
||||||
SWORD FAR* pcbDrvDesc,
|
RETCODE SQL_API SQLDrivers(
|
||||||
UCHAR FAR* szDrvAttr,
|
HENV henv,
|
||||||
SWORD cbDrvAttrMax,
|
UWORD fDir,
|
||||||
SWORD FAR* pcbDrvAttr )
|
UCHAR FAR* szDrvDesc,
|
||||||
|
SWORD cbDrvDescMax,
|
||||||
|
SWORD FAR* pcbDrvDesc,
|
||||||
|
UCHAR FAR* szDrvAttr,
|
||||||
|
SWORD cbDrvAttrMax,
|
||||||
|
SWORD FAR* pcbDrvAttr )
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
||||||
|
|
||||||
if( henv == SQL_NULL_HENV )
|
if( henv == SQL_NULL_HENV )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbDrvDescMax < 0
|
if( cbDrvDescMax < 0
|
||||||
|| cbDrvAttrMax < 0
|
|| cbDrvAttrMax < 0
|
||||||
|| cbDrvAttrMax == 1 )
|
|| cbDrvAttrMax == 1 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1090 );
|
PUSHSQLERR ( genv->herr, en_S1090 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fDir != SQL_FETCH_FIRST
|
if( fDir != SQL_FETCH_FIRST
|
||||||
|| fDir != SQL_FETCH_NEXT )
|
|| fDir != SQL_FETCH_NEXT )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1103 );
|
PUSHSQLERR ( genv->herr, en_S1103 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetInfo(
|
RETCODE SQL_API SQLGetInfo(
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fInfoType,
|
UWORD fInfoType,
|
||||||
PTR rgbInfoValue,
|
PTR rgbInfoValue,
|
||||||
SWORD cbInfoValueMax,
|
SWORD cbInfoValueMax,
|
||||||
SWORD FAR* pcbInfoValue )
|
SWORD FAR* pcbInfoValue )
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
||||||
ENV_t FAR* penv;
|
ENV_t FAR* penv;
|
||||||
STMT_t FAR* pstmt = NULL;
|
STMT_t FAR* pstmt = NULL;
|
||||||
STMT_t FAR* tpstmt;
|
STMT_t FAR* tpstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
DWORD dword = 0;
|
DWORD dword;
|
||||||
int size = 0, len = 0;
|
int size = 0, len = 0;
|
||||||
char buf[16] = { '\0' };
|
char buf[16] = { '\0' };
|
||||||
|
|
||||||
if( hdbc == SQL_NULL_HDBC
|
if( hdbc == SQL_NULL_HDBC
|
||||||
|| pdbc->henv == SQL_NULL_HENV )
|
|| pdbc->henv == SQL_NULL_HENV )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbInfoValueMax < 0 )
|
if( cbInfoValueMax < 0 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1090 );
|
PUSHSQLERR ( pdbc->herr, en_S1090 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( /* fInfoType < SQL_INFO_FIRST || */
|
if( /* fInfoType < SQL_INFO_FIRST || */
|
||||||
( fInfoType > SQL_INFO_LAST
|
( fInfoType > SQL_INFO_LAST
|
||||||
&& fInfoType < SQL_INFO_DRIVER_START ) )
|
&& fInfoType < SQL_INFO_DRIVER_START ) )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1096 );
|
PUSHSQLERR ( pdbc->herr, en_S1096 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fInfoType == SQL_ODBC_VER )
|
if( fInfoType == SQL_ODBC_VER )
|
||||||
{
|
{
|
||||||
sprintf( buf, "%02d.%02d",
|
sprintf( buf, "%02d.%02d",
|
||||||
(ODBCVER)>>8, 0x00FF&(ODBCVER) );
|
(ODBCVER)>>8, 0x00FF&(ODBCVER) );
|
||||||
|
|
||||||
|
|
||||||
if( rgbInfoValue != NULL
|
|
||||||
&& cbInfoValueMax > 0 )
|
|
||||||
{
|
|
||||||
len = STRLEN( buf );
|
|
||||||
|
|
||||||
if( len < cbInfoValueMax - 1 )
|
if( rgbInfoValue != NULL
|
||||||
{
|
&& cbInfoValueMax > 0 )
|
||||||
len = cbInfoValueMax - 1;
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_01004 );
|
len = STRLEN( buf );
|
||||||
|
|
||||||
retcode = SQL_SUCCESS_WITH_INFO;
|
if( len < cbInfoValueMax - 1 )
|
||||||
}
|
{
|
||||||
|
len = cbInfoValueMax - 1;
|
||||||
|
PUSHSQLERR ( pdbc->herr, en_01004 );
|
||||||
|
|
||||||
STRNCPY( rgbInfoValue, buf, len );
|
retcode = SQL_SUCCESS_WITH_INFO;
|
||||||
((char FAR*)rgbInfoValue)[len] = '\0';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( pcbInfoValue != NULL )
|
STRNCPY( rgbInfoValue, buf, len );
|
||||||
{
|
((char FAR*)rgbInfoValue)[len] = '\0';
|
||||||
*pcbInfoValue = (SWORD)len;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retcode;
|
if( pcbInfoValue != NULL )
|
||||||
}
|
{
|
||||||
|
*pcbInfoValue = (SWORD)len;
|
||||||
|
}
|
||||||
|
|
||||||
if( pdbc->state == en_dbc_allocated
|
return retcode;
|
||||||
|| pdbc->state == en_dbc_needdata )
|
}
|
||||||
{
|
|
||||||
PUSHSQLERR ( pdbc->herr, en_08003 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
if( pdbc->state == en_dbc_allocated
|
||||||
}
|
|| pdbc->state == en_dbc_needdata )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pdbc->herr, en_08003 );
|
||||||
|
|
||||||
switch( fInfoType )
|
return SQL_ERROR;
|
||||||
{
|
}
|
||||||
case SQL_DRIVER_HDBC:
|
|
||||||
dword = (DWORD)(pdbc->dhdbc);
|
|
||||||
size = sizeof(dword);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SQL_DRIVER_HENV:
|
switch( fInfoType )
|
||||||
penv = (ENV_t FAR*)(pdbc->henv);
|
{
|
||||||
dword = (DWORD)(penv->dhenv);
|
case SQL_DRIVER_HDBC:
|
||||||
size = sizeof(dword);
|
dword = (DWORD)(pdbc->dhdbc);
|
||||||
break;
|
size = sizeof(dword);
|
||||||
|
break;
|
||||||
|
|
||||||
case SQL_DRIVER_HLIB:
|
case SQL_DRIVER_HENV:
|
||||||
penv = (ENV_t FAR*)(pdbc->henv);
|
penv = (ENV_t FAR*)(pdbc->henv);
|
||||||
dword = (DWORD)(penv->hdll);
|
dword = (DWORD)(penv->dhenv);
|
||||||
size = sizeof(dword);
|
size = sizeof(dword);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_DRIVER_HSTMT:
|
case SQL_DRIVER_HLIB:
|
||||||
if( rgbInfoValue != NULL )
|
penv = (ENV_t FAR*)(pdbc->henv);
|
||||||
{
|
dword = (DWORD)(penv->hdll);
|
||||||
pstmt = *((STMT_t FAR**)rgbInfoValue);
|
size = sizeof(dword);
|
||||||
}
|
break;
|
||||||
|
|
||||||
for( tpstmt = (STMT_t FAR*)(pdbc->hstmt);
|
case SQL_DRIVER_HSTMT:
|
||||||
tpstmt != NULL;
|
if( rgbInfoValue != NULL )
|
||||||
tpstmt = tpstmt->next )
|
{
|
||||||
{
|
pstmt = *((STMT_t FAR**)rgbInfoValue);
|
||||||
if( tpstmt == pstmt )
|
}
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( tpstmt == NULL )
|
for( tpstmt = (STMT_t FAR*)(pdbc->hstmt);
|
||||||
{
|
tpstmt != NULL;
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1009 );
|
tpstmt = tpstmt->next )
|
||||||
|
{
|
||||||
return SQL_ERROR;
|
if( tpstmt == pstmt )
|
||||||
}
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dword = (DWORD)(pstmt->dhstmt);
|
if( tpstmt == NULL )
|
||||||
size = sizeof(dword);
|
{
|
||||||
break;
|
PUSHSQLERR ( pdbc->herr, en_S1009 );
|
||||||
|
|
||||||
default:
|
return SQL_ERROR;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( size )
|
dword = (DWORD)(pstmt->dhstmt);
|
||||||
{
|
size = sizeof(dword);
|
||||||
if( rgbInfoValue != NULL )
|
break;
|
||||||
{
|
|
||||||
*((DWORD*)rgbInfoValue) = dword;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pcbInfoValue != NULL )
|
default:
|
||||||
{
|
break;
|
||||||
*(pcbInfoValue) = (SWORD)size;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
if( size )
|
||||||
}
|
{
|
||||||
|
if( rgbInfoValue != NULL )
|
||||||
|
{
|
||||||
|
*((DWORD*)rgbInfoValue) = dword;
|
||||||
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_GetInfo );
|
if( pcbInfoValue != NULL )
|
||||||
|
{
|
||||||
|
*(pcbInfoValue) = (SWORD)size;
|
||||||
|
}
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
return SQL_SUCCESS;
|
||||||
{
|
}
|
||||||
PUSHSQLERR ( pdbc->herr, en_IM001 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
hproc = _iodbcdm_getproc( hdbc, en_GetInfo );
|
||||||
}
|
|
||||||
|
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_GetInfo, (
|
if( hproc == SQL_NULL_HPROC )
|
||||||
pdbc->dhdbc,
|
{
|
||||||
fInfoType,
|
PUSHSQLERR ( pdbc->herr, en_IM001 );
|
||||||
rgbInfoValue,
|
|
||||||
cbInfoValueMax,
|
return SQL_ERROR;
|
||||||
pcbInfoValue ) )
|
}
|
||||||
|
|
||||||
|
CALL_DRIVER ( hdbc, retcode, hproc, en_GetInfo, (
|
||||||
|
pdbc->dhdbc,
|
||||||
|
fInfoType,
|
||||||
|
rgbInfoValue,
|
||||||
|
cbInfoValueMax,
|
||||||
|
pcbInfoValue ) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(pdbc->dhdbc,
|
retcode = hproc(pdbc->dhdbc,
|
||||||
fInfoType,
|
fInfoType,
|
||||||
rgbInfoValue,
|
rgbInfoValue,
|
||||||
cbInfoValueMax,
|
cbInfoValueMax,
|
||||||
pcbInfoValue );
|
pcbInfoValue );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( retcode == SQL_ERROR
|
if( retcode == SQL_ERROR
|
||||||
&& fInfoType == SQL_DRIVER_ODBC_VER )
|
&& fInfoType == SQL_DRIVER_ODBC_VER )
|
||||||
{
|
{
|
||||||
STRCPY( buf, "01.00" );
|
STRCPY( buf, "01.00" );
|
||||||
|
|
||||||
if( rgbInfoValue != NULL
|
if( rgbInfoValue != NULL
|
||||||
&& cbInfoValueMax > 0 )
|
&& cbInfoValueMax > 0 )
|
||||||
{
|
{
|
||||||
len = STRLEN( buf );
|
len = STRLEN( buf );
|
||||||
|
|
||||||
if( len < cbInfoValueMax - 1 )
|
if( len < cbInfoValueMax - 1 )
|
||||||
{
|
{
|
||||||
len = cbInfoValueMax - 1;
|
len = cbInfoValueMax - 1;
|
||||||
PUSHSQLERR ( pdbc->herr, en_01004 );
|
PUSHSQLERR ( pdbc->herr, en_01004 );
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY( rgbInfoValue, buf, len );
|
STRNCPY( rgbInfoValue, buf, len );
|
||||||
((char FAR*)rgbInfoValue)[len] = '\0';
|
((char FAR*)rgbInfoValue)[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pcbInfoValue != NULL )
|
if( pcbInfoValue != NULL )
|
||||||
{
|
{
|
||||||
*pcbInfoValue = (SWORD)len;
|
*pcbInfoValue = (SWORD)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* what should we return in this case ???? */
|
/* what should we return in this case ???? */
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetFunctions(
|
RETCODE SQL_API SQLGetFunctions(
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fFunc,
|
UWORD fFunc,
|
||||||
UWORD FAR* pfExists )
|
UWORD FAR* pfExists )
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hdbc == SQL_NULL_HDBC )
|
if( hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fFunc > SQL_EXT_API_LAST )
|
if( fFunc > SQL_EXT_API_LAST )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1095 );
|
PUSHSQLERR ( pdbc->herr, en_S1095 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->state == en_dbc_allocated
|
if( pdbc->state == en_dbc_allocated
|
||||||
|| pdbc->state == en_dbc_needdata )
|
|| pdbc->state == en_dbc_needdata )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1010 );
|
PUSHSQLERR ( pdbc->herr, en_S1010 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pfExists == NULL )
|
if( pfExists == NULL )
|
||||||
{
|
{
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_GetFunctions );
|
hproc = _iodbcdm_getproc( hdbc, en_GetFunctions );
|
||||||
|
|
||||||
if( hproc != SQL_NULL_HPROC )
|
if( hproc != SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_GetFunctions, (
|
CALL_DRIVER ( hdbc, retcode, hproc, en_GetFunctions, (
|
||||||
pdbc->dhdbc, fFunc, pfExists ) )
|
pdbc->dhdbc, fFunc, pfExists ) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc( pdbc->dhdbc, fFunc, pfExists );
|
retcode = hproc( pdbc->dhdbc, fFunc, pfExists );
|
||||||
#endif
|
#endif
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fFunc == SQL_API_SQLSETPARAM )
|
if( fFunc == SQL_API_SQLSETPARAM )
|
||||||
{
|
{
|
||||||
fFunc = SQL_API_SQLBINDPARAMETER;
|
fFunc = SQL_API_SQLBINDPARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fFunc != SQL_API_ALL_FUNCTIONS )
|
if( fFunc != SQL_API_ALL_FUNCTIONS )
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( hdbc, fFunc );
|
hproc = _iodbcdm_getproc( hdbc, fFunc );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
*pfExists = (UWORD)0;
|
*pfExists = (UWORD)0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pfExists = (UWORD)1;
|
*pfExists = (UWORD)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( fFunc=0 ; fFunc < 100; fFunc ++ )
|
for( fFunc=0 ; fFunc < 100; fFunc ++ )
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( hdbc, fFunc );
|
hproc = _iodbcdm_getproc( hdbc, fFunc );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
pfExists[fFunc] = (UWORD)0;
|
pfExists[fFunc] = (UWORD)0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pfExists[fFunc] = (UWORD)1;
|
pfExists[fFunc] = (UWORD)1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
225
src/iodbc/isql.h
225
src/iodbc/isql.h
@@ -1,91 +1,192 @@
|
|||||||
#ifndef _INTRINSIC_SQL_H
|
#ifndef _INTRINSIC_SQL_H
|
||||||
# define _INTRINSIC_SQL_H
|
# define _INTRINSIC_SQL_H
|
||||||
|
|
||||||
typedef unsigned char UCHAR;
|
#ifndef OS2
|
||||||
typedef long int SDWORD;
|
typedef unsigned char UCHAR;
|
||||||
typedef short int SWORD;
|
#endif
|
||||||
typedef unsigned long int UDWORD;
|
typedef long int SDWORD;
|
||||||
typedef unsigned short int UWORD;
|
typedef short int SWORD;
|
||||||
|
typedef unsigned long int UDWORD;
|
||||||
|
typedef unsigned short int UWORD;
|
||||||
|
typedef unsigned int UINT;
|
||||||
|
|
||||||
typedef void FAR* PTR;
|
#ifndef FAR
|
||||||
|
# define FAR
|
||||||
|
#endif
|
||||||
|
#ifndef NEAR
|
||||||
|
# define NEAR
|
||||||
|
#endif
|
||||||
|
#ifndef HANDLE
|
||||||
|
typedef int HANDLE;
|
||||||
|
#endif
|
||||||
|
#ifndef HGLOBAL
|
||||||
|
typedef HANDLE HGLOBAL;
|
||||||
|
#endif
|
||||||
|
#ifndef SQL_INDEX_OTHER
|
||||||
|
#define SQL_INDEX_OTHER 3
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void FAR* HENV;
|
# ifndef BOOL
|
||||||
typedef void FAR* HDBC;
|
# define BOOL int
|
||||||
typedef void FAR* HSTMT;
|
# endif
|
||||||
|
# ifndef CHAR
|
||||||
|
# define CHAR char
|
||||||
|
# endif
|
||||||
|
# ifndef FALSE
|
||||||
|
# define FALSE (0 != 0)
|
||||||
|
# endif
|
||||||
|
# ifndef HWND
|
||||||
|
# define HWND int
|
||||||
|
# endif
|
||||||
|
# ifndef SQLHWND
|
||||||
|
# define SQLHWND int
|
||||||
|
# endif
|
||||||
|
# ifndef LONG
|
||||||
|
# define LONG long
|
||||||
|
# endif
|
||||||
|
# ifndef PASCAL
|
||||||
|
# define PASCAL
|
||||||
|
# endif
|
||||||
|
# ifndef SHORT
|
||||||
|
# define SHORT short
|
||||||
|
# endif
|
||||||
|
# ifndef SQL_API
|
||||||
|
# define SQL_API
|
||||||
|
# endif
|
||||||
|
# ifndef SQL_LOCAL_API
|
||||||
|
# define SQL_LOCAL_API
|
||||||
|
# endif
|
||||||
|
# ifndef TRUE
|
||||||
|
# define TRUE (0 == 0)
|
||||||
|
# endif
|
||||||
|
|
||||||
typedef signed short RETCODE;
|
typedef struct tagDATE_STRUCT
|
||||||
|
{
|
||||||
|
SWORD year;
|
||||||
|
UWORD month;
|
||||||
|
UWORD day;
|
||||||
|
} DATE_STRUCT;
|
||||||
|
|
||||||
# ifdef WIN32
|
typedef struct tagTIME_STRUCT
|
||||||
# define SQL_API __stdcall
|
{
|
||||||
# else
|
UWORD hour;
|
||||||
# define SQL_API EXPORT CALLBACK
|
UWORD minute;
|
||||||
# endif
|
UWORD second;
|
||||||
|
} TIME_STRUCT;
|
||||||
|
|
||||||
# define ODBCVER 0x0200
|
typedef struct tagTIMESTAMP_STRUCT
|
||||||
|
{
|
||||||
|
SWORD year;
|
||||||
|
UWORD month;
|
||||||
|
UWORD day;
|
||||||
|
UWORD hour;
|
||||||
|
UWORD minute;
|
||||||
|
UWORD second;
|
||||||
|
UDWORD fraction;
|
||||||
|
} TIMESTAMP_STRUCT;
|
||||||
|
|
||||||
# define SQL_MAX_MESSAGE_LENGTH 512
|
|
||||||
# define SQL_MAX_DSN_LENGTH 32
|
|
||||||
|
typedef UCHAR FAR* PTR,
|
||||||
|
FAR* SQLPTR;
|
||||||
|
|
||||||
|
typedef void FAR* HENV,
|
||||||
|
FAR* SQLHENV;
|
||||||
|
typedef void FAR* HDBC,
|
||||||
|
FAR* SQLHDBC;
|
||||||
|
typedef void FAR* HSTMT,
|
||||||
|
FAR* SQLHSTMT;
|
||||||
|
typedef SDWORD SQLINTEGER;
|
||||||
|
typedef signed short RETCODE;
|
||||||
|
typedef UCHAR SQLCHAR;
|
||||||
|
typedef UWORD SQLUSMALLINT;
|
||||||
|
typedef PTR SQLPOINTER;
|
||||||
|
typedef SWORD SQLSMALLINT;
|
||||||
|
typedef UDWORD SQLUINTEGER;
|
||||||
|
|
||||||
|
# ifdef WIN32
|
||||||
|
# define SQL_API __stdcall
|
||||||
|
# else
|
||||||
|
# define SQL_API /* giovanni EXPORT CALLBACK */
|
||||||
|
# endif
|
||||||
|
# ifdef OS2
|
||||||
|
# ifdef BCPP
|
||||||
|
# define _Optlink
|
||||||
|
# define _System _syscall
|
||||||
|
# endif
|
||||||
|
# undef SQL_API
|
||||||
|
# define SQL_API _System
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ODBCVER
|
||||||
|
# define ODBCVER 0x0200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# define SQL_MAX_MESSAGE_LENGTH 512
|
||||||
|
# define SQL_MAX_DSN_LENGTH 32
|
||||||
|
|
||||||
/* return code */
|
/* return code */
|
||||||
# define SQL_INVALID_HANDLE (-2)
|
# define SQL_INVALID_HANDLE (-2)
|
||||||
# define SQL_ERROR (-1)
|
# define SQL_ERROR (-1)
|
||||||
# define SQL_SUCCESS 0
|
# define SQL_SUCCESS 0
|
||||||
# define SQL_SUCCESS_WITH_INFO 1
|
# define SQL_SUCCESS_WITH_INFO 1
|
||||||
# define SQL_NO_DATA_FOUND 100
|
# define SQL_NO_DATA_FOUND 100
|
||||||
|
|
||||||
/* standard SQL datatypes (agree with ANSI type numbering) */
|
/* standard SQL datatypes (agree with ANSI type numbering) */
|
||||||
# define SQL_CHAR 1
|
# define SQL_CHAR 1
|
||||||
# define SQL_NUMERIC 2
|
# define SQL_NUMERIC 2
|
||||||
# define SQL_DECIMAL 3
|
# define SQL_DECIMAL 3
|
||||||
# define SQL_INTEGER 4
|
# define SQL_INTEGER 4
|
||||||
# define SQL_SMALLINT 5
|
# define SQL_SMALLINT 5
|
||||||
# define SQL_FLOAT 6
|
# define SQL_FLOAT 6
|
||||||
# define SQL_REAL 7
|
# define SQL_REAL 7
|
||||||
# define SQL_DOUBLE 8
|
# define SQL_DOUBLE 8
|
||||||
# define SQL_VARCHAR 12
|
# define SQL_VARCHAR 12
|
||||||
|
|
||||||
# define SQL_TYPE_MIN SQL_CHAR
|
# define SQL_TYPE_MIN SQL_CHAR
|
||||||
# define SQL_TYPE_NULL 0
|
# define SQL_TYPE_NULL 0
|
||||||
# define SQL_TYPE_MAX SQL_VARCHAR
|
# define SQL_TYPE_MAX SQL_VARCHAR
|
||||||
|
|
||||||
/* C to SQL datatype mapping */
|
/* C to SQL datatype mapping */
|
||||||
# define SQL_C_CHAR SQL_CHAR
|
# define SQL_C_CHAR SQL_CHAR
|
||||||
# define SQL_C_LONG SQL_INTEGER
|
# define SQL_C_LONG SQL_INTEGER
|
||||||
# define SQL_C_SHORT SQL_SMALLINT
|
# define SQL_C_SHORT SQL_SMALLINT
|
||||||
# define SQL_C_FLOAT SQL_REAL
|
# define SQL_C_FLOAT SQL_REAL
|
||||||
# define SQL_C_DOUBLE SQL_DOUBLE
|
# define SQL_C_DOUBLE SQL_DOUBLE
|
||||||
# define SQL_C_DEFAULT 99
|
# define SQL_C_DEFAULT 99
|
||||||
|
|
||||||
# define SQL_NO_NULLS 0
|
# define SQL_NO_NULLS 0
|
||||||
# define SQL_NULLABLE 1
|
# define SQL_NULLABLE 1
|
||||||
# define SQL_NULLABLE_UNKNOWN 2
|
# define SQL_NULLABLE_UNKNOWN 2
|
||||||
|
|
||||||
/* some special length values */
|
/* some special length values */
|
||||||
# define SQL_NULL_DATA (-1)
|
# define SQL_NULL_DATA (-1)
|
||||||
# define SQL_DATA_AT_EXEC (-2)
|
# define SQL_DATA_AT_EXEC (-2)
|
||||||
# define SQL_NTS (-3)
|
# define SQL_NTS (-3)
|
||||||
|
|
||||||
/* SQLFreeStmt flag values */
|
/* SQLFreeStmt flag values */
|
||||||
# define SQL_CLOSE 0
|
# define SQL_CLOSE 0
|
||||||
# define SQL_DROP 1
|
# define SQL_DROP 1
|
||||||
# define SQL_UNBIND 2
|
# define SQL_UNBIND 2
|
||||||
# define SQL_RESET_PARAMS 3
|
# define SQL_RESET_PARAMS 3
|
||||||
|
|
||||||
/* SQLTransact flag values */
|
/* SQLTransact flag values */
|
||||||
# define SQL_COMMIT 0
|
# define SQL_COMMIT 0
|
||||||
# define SQL_ROLLBACK 1
|
# define SQL_ROLLBACK 1
|
||||||
|
|
||||||
/* SQLColAttributes flag values */
|
/* SQLColAttributes flag values */
|
||||||
# define SQL_COLUMN_COUNT 0
|
# define SQL_COLUMN_COUNT 0
|
||||||
# define SQL_COLUMN_LABEL 18
|
# define SQL_COLUMN_LABEL 18
|
||||||
# define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
|
# define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
|
||||||
# define SQL_COLUMN_DRIVER_START 1000
|
# define SQL_COLUMN_DRIVER_START 1000
|
||||||
|
|
||||||
# define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
|
# define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
|
||||||
|
|
||||||
/* Null handles */
|
/* Null handles */
|
||||||
# define SQL_NULL_HENV 0
|
# define SQL_NULL_HENV 0
|
||||||
# define SQL_NULL_HDBC 0
|
# define SQL_NULL_HDBC 0
|
||||||
# define SQL_NULL_HSTMT 0
|
# define SQL_NULL_HSTMT 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@@ -1,307 +1,314 @@
|
|||||||
#ifndef _INTRINSIC_SQLEXT_H
|
#ifndef _INTRINSIC_SQLEXT_H
|
||||||
# define _INTRINSIC_SQLEXT_H
|
# define _INTRINSIC_SQLEXT_H
|
||||||
|
|
||||||
# include <../iodbc/isql.h>
|
# include <isql.h>
|
||||||
|
|
||||||
# define SQL_STILL_EXECUTING 2
|
# define SQL_STILL_EXECUTING 2
|
||||||
# define SQL_NEED_DATA 99
|
# define SQL_NEED_DATA 99
|
||||||
|
|
||||||
/* extend SQL datatypes */
|
/* extend SQL datatypes */
|
||||||
# define SQL_DATE 9
|
# define SQL_DATE 9
|
||||||
# define SQL_TIME 10
|
# define SQL_TIME 10
|
||||||
# define SQL_TIMESTAMP 11
|
# define SQL_TIMESTAMP 11
|
||||||
# define SQL_LONGVARCHAR (-1)
|
# define SQL_LONGVARCHAR (-1)
|
||||||
# define SQL_BINARY (-2)
|
# define SQL_BINARY (-2)
|
||||||
# define SQL_VARBINARY (-3)
|
# define SQL_VARBINARY (-3)
|
||||||
# define SQL_LONGVARBINARY (-4)
|
# define SQL_LONGVARBINARY (-4)
|
||||||
# define SQL_BIGINT (-5)
|
# define SQL_BIGINT (-5)
|
||||||
# define SQL_TINYINT (-6)
|
# define SQL_TINYINT (-6)
|
||||||
# define SQL_BIT (-7) /* conflict with SQL3 ??? */
|
# define SQL_BIT (-7) /* conflict with SQL3 ??? */
|
||||||
# define SQL_TYPE_DRIVER_START (-80)
|
# define SQL_TYPE_DRIVER_START (-80)
|
||||||
|
|
||||||
/* C to SQL datatype mapping */
|
/* C to SQL datatype mapping */
|
||||||
# define SQL_C_DATE SQL_DATE
|
# define SQL_C_DATE SQL_DATE
|
||||||
# define SQL_C_TIME SQL_TIME
|
# define SQL_C_TIME SQL_TIME
|
||||||
# define SQL_C_TIMESTAMP SQL_TIMESTAMP
|
# define SQL_C_TIMESTAMP SQL_TIMESTAMP
|
||||||
# define SQL_C_BINARY SQL_BINARY
|
# define SQL_C_BINARY SQL_BINARY
|
||||||
# define SQL_C_BIT SQL_BIT
|
# define SQL_C_BIT SQL_BIT
|
||||||
# define SQL_C_TINYINT SQL_TINYINT
|
# define SQL_C_TINYINT SQL_TINYINT
|
||||||
|
|
||||||
# define SQL_SIGNED_OFFSET (-20)
|
# define SQL_SIGNED_OFFSET (-20)
|
||||||
# define SQL_UNSIGNED_OFFSET (-22)
|
# define SQL_UNSIGNED_OFFSET (-22)
|
||||||
|
|
||||||
# define SQL_C_SLONG (SQL_C_LONG + SQL_SIGNED_OFFSET)
|
# define SQL_C_SLONG (SQL_C_LONG + SQL_SIGNED_OFFSET)
|
||||||
# define SQL_C_SSHORT (SQL_C_SHORT + SQL_SIGNED_OFFSET)
|
# define SQL_C_SSHORT (SQL_C_SHORT + SQL_SIGNED_OFFSET)
|
||||||
# define SQL_C_STINYINT (SQL_TINYINT + SQL_SIGNED_OFFSET)
|
# define SQL_C_STINYINT (SQL_TINYINT + SQL_SIGNED_OFFSET)
|
||||||
# define SQL_C_ULONG (SQL_C_LONG + SQL_UNSIGNED_OFFSET)
|
# define SQL_C_ULONG (SQL_C_LONG + SQL_UNSIGNED_OFFSET)
|
||||||
# define SQL_C_USHORT (SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
|
# define SQL_C_USHORT (SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
|
||||||
# define SQL_C_UTINYINT (SQL_TINYINT + SQL_UNSIGNED_OFFSET)
|
# define SQL_C_UTINYINT (SQL_TINYINT + SQL_UNSIGNED_OFFSET)
|
||||||
# define SQL_C_BOOKMARK SQL_C_ULONG
|
# define SQL_C_BOOKMARK SQL_C_ULONG
|
||||||
|
|
||||||
# if defined(SQL_TYPE_MIN)
|
# if defined(SQL_TYPE_MIN)
|
||||||
# undef SQL_TYPE_MIN
|
# undef SQL_TYPE_MIN
|
||||||
# define SQL_TYPE_MIN SQL_BIT
|
# define SQL_TYPE_MIN SQL_BIT
|
||||||
/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then,
|
/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then,
|
||||||
* SQL_TYPE_MIN need to be defined as SQL_TINYINT
|
* SQL_TYPE_MIN need to be defined as SQL_TINYINT
|
||||||
* (i.e. -6).
|
* (i.e. -6).
|
||||||
*/
|
*/
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define SQL_ALL_TYPES 0
|
# define SQL_ALL_TYPES 0
|
||||||
|
|
||||||
/* SQLDriverConnect flag values */
|
/* SQLDriverConnect flag values */
|
||||||
# define SQL_DRIVER_NOPROMPT 0
|
# define SQL_DRIVER_NOPROMPT 0
|
||||||
# define SQL_DRIVER_COMPLETE 1
|
# define SQL_DRIVER_COMPLETE 1
|
||||||
# define SQL_DRIVER_PROMPT 2
|
# define SQL_DRIVER_PROMPT 2
|
||||||
# define SQL_DRIVER_COMPLETE_REQUIRED 3
|
# define SQL_DRIVER_COMPLETE_REQUIRED 3
|
||||||
|
|
||||||
/* SQLSetParam extensions */
|
/* SQLSetParam extensions */
|
||||||
# define SQL_DEFAULT_PARAM (-5)
|
# define SQL_DEFAULT_PARAM (-5)
|
||||||
# define SQL_IGNORE (-6)
|
# define SQL_IGNORE (-6)
|
||||||
|
|
||||||
/* function number for SQLGetFunctions and _iodbcdm_getproc */
|
/* function number for SQLGetFunctions and _iodbcdm_getproc */
|
||||||
# define SQL_API_SQLALLOCCONNECT 1
|
# define SQL_API_SQLALLOCCONNECT 1
|
||||||
# define SQL_API_SQLALLOCENV 2
|
# define SQL_API_SQLALLOCENV 2
|
||||||
# define SQL_API_SQLALLOCSTMT 3
|
# define SQL_API_SQLALLOCSTMT 3
|
||||||
# define SQL_API_SQLBINDCOL 4
|
# define SQL_API_SQLBINDCOL 4
|
||||||
# define SQL_API_SQLCANCEL 5
|
# define SQL_API_SQLCANCEL 5
|
||||||
# define SQL_API_SQLCOLATTRIBUTES 6
|
# define SQL_API_SQLCOLATTRIBUTES 6
|
||||||
# define SQL_API_SQLCONNECT 7
|
# define SQL_API_SQLCONNECT 7
|
||||||
# define SQL_API_SQLDESCRIBECOL 8
|
# define SQL_API_SQLDESCRIBECOL 8
|
||||||
# define SQL_API_SQLDISCONNECT 9
|
# define SQL_API_SQLDISCONNECT 9
|
||||||
# define SQL_API_SQLERROR 10
|
# define SQL_API_SQLERROR 10
|
||||||
# define SQL_API_SQLEXECDIRECT 11
|
# define SQL_API_SQLEXECDIRECT 11
|
||||||
# define SQL_API_SQLEXECUTE 12
|
# define SQL_API_SQLEXECUTE 12
|
||||||
# define SQL_API_SQLFETCH 13
|
# define SQL_API_SQLFETCH 13
|
||||||
# define SQL_API_SQLFREECONNECT 14
|
# define SQL_API_SQLFREECONNECT 14
|
||||||
# define SQL_API_SQLFREEENV 15
|
# define SQL_API_SQLFREEENV 15
|
||||||
# define SQL_API_SQLFREESTMT 16
|
# define SQL_API_SQLFREESTMT 16
|
||||||
# define SQL_API_SQLGETCURSORNAME 17
|
# define SQL_API_SQLGETCURSORNAME 17
|
||||||
# define SQL_API_SQLNUMRESULTCOLS 18
|
# define SQL_API_SQLNUMRESULTCOLS 18
|
||||||
# define SQL_API_SQLPREPARE 19
|
# define SQL_API_SQLPREPARE 19
|
||||||
# define SQL_API_SQLROWCOUNT 20
|
# define SQL_API_SQLROWCOUNT 20
|
||||||
# define SQL_API_SQLSETCURSORNAME 21
|
# define SQL_API_SQLSETCURSORNAME 21
|
||||||
# define SQL_API_SQLSETPARAM 22
|
# define SQL_API_SQLSETPARAM 22
|
||||||
# define SQL_API_SQLTRANSACT 23
|
# define SQL_API_SQLTRANSACT 23
|
||||||
|
|
||||||
# define SQL_NUM_FUNCTIONS 23
|
# define SQL_NUM_FUNCTIONS 23
|
||||||
|
|
||||||
# define SQL_EXT_API_START 40
|
# define SQL_EXT_API_START 40
|
||||||
|
|
||||||
# define SQL_API_SQLCOLUMNS 40
|
# define SQL_API_SQLCOLUMNS 40
|
||||||
|
|
||||||
# define SQL_API_SQLDRIVERCONNECT 41
|
# define SQL_API_SQLDRIVERCONNECT 41
|
||||||
# define SQL_API_SQLGETCONNECTOPTION 42
|
# define SQL_API_SQLGETCONNECTOPTION 42
|
||||||
# define SQL_API_SQLGETDATA 43
|
# define SQL_API_SQLGETDATA 43
|
||||||
# define SQL_API_SQLGETFUNCTIONS 44
|
# define SQL_API_SQLGETFUNCTIONS 44
|
||||||
# define SQL_API_SQLGETINFO 45
|
# define SQL_API_SQLGETINFO 45
|
||||||
# define SQL_API_SQLGETSTMTOPTION 46
|
# define SQL_API_SQLGETSTMTOPTION 46
|
||||||
# define SQL_API_SQLGETTYPEINFO 47
|
# define SQL_API_SQLGETTYPEINFO 47
|
||||||
# define SQL_API_SQLPARAMDATA 48
|
# define SQL_API_SQLPARAMDATA 48
|
||||||
# define SQL_API_SQLPUTDATA 49
|
# define SQL_API_SQLPUTDATA 49
|
||||||
# define SQL_API_SQLSETCONNECTOPTION 50
|
# define SQL_API_SQLSETCONNECTOPTION 50
|
||||||
# define SQL_API_SQLSETSTMTOPTION 51
|
# define SQL_API_SQLSETSTMTOPTION 51
|
||||||
# define SQL_API_SQLSPECIALCOLUMNS 52
|
# define SQL_API_SQLSPECIALCOLUMNS 52
|
||||||
# define SQL_API_SQLSTATISTICS 53
|
# define SQL_API_SQLSTATISTICS 53
|
||||||
# define SQL_API_SQLTABLES 54
|
# define SQL_API_SQLTABLES 54
|
||||||
|
|
||||||
# define SQL_API_SQLBROWSECONNECT 55
|
# define SQL_API_SQLBROWSECONNECT 55
|
||||||
# define SQL_API_SQLCOLUMNPRIVILEGES 56
|
# define SQL_API_SQLCOLUMNPRIVILEGES 56
|
||||||
# define SQL_API_SQLDATASOURCES 57
|
# define SQL_API_SQLDATASOURCES 57
|
||||||
# define SQL_API_SQLDESCRIBEPARAM 58
|
# define SQL_API_SQLDESCRIBEPARAM 58
|
||||||
# define SQL_API_SQLEXTENDEDFETCH 59
|
# define SQL_API_SQLEXTENDEDFETCH 59
|
||||||
# define SQL_API_SQLFOREIGNKEYS 60
|
# define SQL_API_SQLFOREIGNKEYS 60
|
||||||
# define SQL_API_SQLMORERESULTS 61
|
# define SQL_API_SQLMORERESULTS 61
|
||||||
# define SQL_API_SQLNATIVESQL 62
|
# define SQL_API_SQLNATIVESQL 62
|
||||||
# define SQL_API_SQLNUMPARAMS 63
|
# define SQL_API_SQLNUMPARAMS 63
|
||||||
# define SQL_API_SQLPARAMOPTIONS 64
|
# define SQL_API_SQLPARAMOPTIONS 64
|
||||||
# define SQL_API_SQLPRIMARYKEYS 65
|
# define SQL_API_SQLPRIMARYKEYS 65
|
||||||
# define SQL_API_SQLPROCEDURECOLUMNS 66
|
# define SQL_API_SQLPROCEDURECOLUMNS 66
|
||||||
# define SQL_API_SQLPROCEDURES 67
|
# define SQL_API_SQLPROCEDURES 67
|
||||||
# define SQL_API_SQLSETPOS 68
|
# define SQL_API_SQLSETPOS 68
|
||||||
# define SQL_API_SQLSETSCROLLOPTIONS 69
|
# define SQL_API_SQLSETSCROLLOPTIONS 69
|
||||||
# define SQL_API_SQLTABLEPRIVILEGES 70
|
# define SQL_API_SQLTABLEPRIVILEGES 70
|
||||||
|
|
||||||
# define SQL_API_SQLDRIVERS 71
|
# define SQL_API_SQLDRIVERS 71
|
||||||
# define SQL_API_SQLBINDPARAMETER 72
|
# define SQL_API_SQLBINDPARAMETER 72
|
||||||
# define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER
|
# define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER
|
||||||
|
|
||||||
# define SQL_API_ALL_FUNCTIONS 0
|
# define SQL_API_ALL_FUNCTIONS 0
|
||||||
|
|
||||||
/* SQLGetInfo infor number */
|
/* SQLGetInfo infor number */
|
||||||
# define SQL_INFO_FIRST 0
|
# define SQL_INFO_FIRST 0
|
||||||
# define SQL_DRIVER_HDBC 3
|
# define SQL_DRIVER_HDBC 3
|
||||||
# define SQL_DRIVER_HENV 4
|
# define SQL_DRIVER_HENV 4
|
||||||
# define SQL_DRIVER_HSTMT 5
|
# define SQL_DRIVER_HSTMT 5
|
||||||
# define SQL_DRIVER_NAME 6
|
# define SQL_DRIVER_NAME 6
|
||||||
# define SQL_ODBC_VER 10
|
# define SQL_ODBC_VER 10
|
||||||
# define SQL_CURSOR_COMMIT_BEHAVIOR 23
|
# define SQL_CURSOR_COMMIT_BEHAVIOR 23
|
||||||
# define SQL_CURSOR_ROLLBACK_BEHAVIOR 24
|
# define SQL_CURSOR_ROLLBACK_BEHAVIOR 24
|
||||||
# define SQL_DEFAULT_TXN_ISOLATION 26
|
# define SQL_DEFAULT_TXN_ISOLATION 26
|
||||||
|
|
||||||
# define SQL_TXN_ISOLATION_OPTION 72
|
# define SQL_TXN_ISOLATION_OPTION 72
|
||||||
# define SQL_NON_NULLABLE_COLUMNS 75
|
# define SQL_NON_NULLABLE_COLUMNS 75
|
||||||
|
|
||||||
# define SQL_DRIVER_HLIB 76
|
# define SQL_DRIVER_HLIB 76
|
||||||
# define SQL_DRIVER_ODBC_VER 77
|
# define SQL_DRIVER_ODBC_VER 77
|
||||||
|
|
||||||
# define SQL_QUALIFIER_LOCATION 114
|
# define SQL_QUALIFIER_LOCATION 114
|
||||||
|
|
||||||
# define SQL_INFO_LAST SQL_QUALIFIER_LOCATION
|
# define SQL_INFO_LAST SQL_QUALIFIER_LOCATION
|
||||||
|
|
||||||
# define SQL_INFO_DRIVER_START 1000
|
# define SQL_INFO_DRIVER_START 1000
|
||||||
|
|
||||||
|
|
||||||
/* SQL_TXN_ISOLATION_OPTION masks */
|
/* SQL_TXN_ISOLATION_OPTION masks */
|
||||||
# define SQL_TXN_READ_UNCOMMITTED 0x00000001L
|
# define SQL_TXN_READ_UNCOMMITTED 0x00000001L
|
||||||
# define SQL_TXN_READ_COMMITTED 0x00000002L
|
# define SQL_TXN_READ_COMMITTED 0x00000002L
|
||||||
# define SQL_TXN_REPEATABLE_READ 0x00000004L
|
# define SQL_TXN_REPEATABLE_READ 0x00000004L
|
||||||
# define SQL_TXN_SERIALIZABLE 0x00000008L
|
# define SQL_TXN_SERIALIZABLE 0x00000008L
|
||||||
# define SQL_TXN_VERSIONING 0x00000010L
|
# define SQL_TXN_VERSIONING 0x00000010L
|
||||||
|
|
||||||
/* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */
|
/* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */
|
||||||
|
|
||||||
# define SQL_CB_DELETE 0x0000
|
# define SQL_CB_DELETE 0x0000
|
||||||
# define SQL_CB_CLOSE 0x0001
|
# define SQL_CB_CLOSE 0x0001
|
||||||
# define SQL_CB_PRESERVE 0x0002
|
# define SQL_CB_PRESERVE 0x0002
|
||||||
|
|
||||||
/* options for SQLGetStmtOption/SQLSetStmtOption */
|
/* options for SQLGetStmtOption/SQLSetStmtOption */
|
||||||
# define SQL_QUERY_TIMEOUT 0
|
# define SQL_QUERY_TIMEOUT 0
|
||||||
# define SQL_MAX_ROWS 1
|
# define SQL_MAX_ROWS 1
|
||||||
# define SQL_NOSCAN 2
|
# define SQL_NOSCAN 2
|
||||||
# define SQL_MAX_LENGTH 3
|
# define SQL_MAX_LENGTH 3
|
||||||
# define SQL_ASYNC_ENABLE 4
|
# define SQL_ASYNC_ENABLE 4
|
||||||
# define SQL_BIND_TYPE 5
|
# define SQL_BIND_TYPE 5
|
||||||
# define SQL_CURSOR_TYPE 6
|
# define SQL_CURSOR_TYPE 6
|
||||||
# define SQL_CONCURRENCY 7
|
# define SQL_CONCURRENCY 7
|
||||||
# define SQL_KEYSET_SIZE 8
|
# define SQL_KEYSET_SIZE 8
|
||||||
# define SQL_ROWSET_SIZE 9
|
# define SQL_ROWSET_SIZE 9
|
||||||
# define SQL_SIMULATE_CURSOR 10
|
# define SQL_SIMULATE_CURSOR 10
|
||||||
# define SQL_RETRIEVE_DATA 11
|
# define SQL_RETRIEVE_DATA 11
|
||||||
# define SQL_USE_BOOKMARKS 12
|
# define SQL_USE_BOOKMARKS 12
|
||||||
# define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */
|
# define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */
|
||||||
# define SQL_ROW_NUMBER 14 /* GetStmtOption Only */
|
# define SQL_ROW_NUMBER 14 /* GetStmtOption Only */
|
||||||
# define SQL_STMT_OPT_MAX SQL_ROW_NUMBER
|
# define SQL_STMT_OPT_MAX SQL_ROW_NUMBER
|
||||||
|
|
||||||
# define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT
|
# define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT
|
||||||
|
|
||||||
|
|
||||||
/* SQL_QUERY_TIMEOUT options */
|
/* SQL_QUERY_TIMEOUT options */
|
||||||
# define SQL_QUERY_TIMEOUT_DEFAULT 0UL
|
# define SQL_QUERY_TIMEOUT_DEFAULT 0UL
|
||||||
|
|
||||||
/* SQL_MAX_ROWS options */
|
/* SQL_MAX_ROWS options */
|
||||||
# define SQL_MAX_ROWS_DEFAULT 0UL
|
# define SQL_MAX_ROWS_DEFAULT 0UL
|
||||||
|
|
||||||
/* SQL_MAX_LENGTH options */
|
/* SQL_MAX_LENGTH options */
|
||||||
# define SQL_MAX_LENGTH_DEFAULT 0UL
|
# define SQL_MAX_LENGTH_DEFAULT 0UL
|
||||||
|
|
||||||
/* SQL_CONCURRENCY options */
|
/* SQL_CONCURRENCY options */
|
||||||
# define SQL_CONCUR_READ_ONLY 1
|
# define SQL_CONCUR_READ_ONLY 1
|
||||||
# define SQL_CONCUR_LOCK 2
|
# define SQL_CONCUR_LOCK 2
|
||||||
# define SQL_CONCUR_ROWVER 3
|
# define SQL_CONCUR_ROWVER 3
|
||||||
# define SQL_CONCUR_VALUES 4
|
# define SQL_CONCUR_VALUES 4
|
||||||
|
|
||||||
|
/* SQL_CURSOR_TYPE options */
|
||||||
|
#define SQL_CURSOR_FORWARD_ONLY 0UL
|
||||||
|
#define SQL_CURSOR_KEYSET_DRIVEN 1UL
|
||||||
|
#define SQL_CURSOR_DYNAMIC 2UL
|
||||||
|
#define SQL_CURSOR_STATIC 3UL
|
||||||
|
#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY
|
||||||
|
|
||||||
/* options for SQLSetConnectOption/SQLGetConnectOption */
|
/* options for SQLSetConnectOption/SQLGetConnectOption */
|
||||||
# define SQL_ACCESS_MODE 101
|
# define SQL_ACCESS_MODE 101
|
||||||
# define SQL_AUTOCOMMIT 102
|
# define SQL_AUTOCOMMIT 102
|
||||||
# define SQL_LOGIN_TIMEOUT 103
|
# define SQL_LOGIN_TIMEOUT 103
|
||||||
# define SQL_OPT_TRACE 104
|
# define SQL_OPT_TRACE 104
|
||||||
# define SQL_OPT_TRACEFILE 105
|
# define SQL_OPT_TRACEFILE 105
|
||||||
# define SQL_TRANSLATE_DLL 106
|
# define SQL_TRANSLATE_DLL 106
|
||||||
# define SQL_TRANSLATE_OPTION 107
|
# define SQL_TRANSLATE_OPTION 107
|
||||||
# define SQL_TXN_ISOLATION 108
|
# define SQL_TXN_ISOLATION 108
|
||||||
# define SQL_CURRENT_QUALIFIER 109
|
# define SQL_CURRENT_QUALIFIER 109
|
||||||
# define SQL_ODBC_CURSORS 110
|
# define SQL_ODBC_CURSORS 110
|
||||||
# define SQL_QUIET_MODE 111
|
# define SQL_QUIET_MODE 111
|
||||||
# define SQL_PACKET_SIZE 112
|
# define SQL_PACKET_SIZE 112
|
||||||
# define SQL_CONN_OPT_MAX SQL_PACKET_SIZE
|
# define SQL_CONN_OPT_MAX SQL_PACKET_SIZE
|
||||||
# define SQL_CONNECT_OPT_DRVR_START 1000
|
# define SQL_CONNECT_OPT_DRVR_START 1000
|
||||||
|
|
||||||
# define SQL_CONN_OPT_MIN SQL_ACCESS_MODE
|
# define SQL_CONN_OPT_MIN SQL_ACCESS_MODE
|
||||||
|
|
||||||
/* SQL_ACCESS_MODE options */
|
/* SQL_ACCESS_MODE options */
|
||||||
# define SQL_MODE_READ_WRITE 0UL
|
# define SQL_MODE_READ_WRITE 0UL
|
||||||
# define SQL_MODE_READ_ONLY 1UL
|
# define SQL_MODE_READ_ONLY 1UL
|
||||||
# define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE
|
# define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE
|
||||||
|
|
||||||
/* SQL_AUTOCOMMIT options */
|
/* SQL_AUTOCOMMIT options */
|
||||||
# define SQL_AUTOCOMMIT_OFF 0UL
|
# define SQL_AUTOCOMMIT_OFF 0UL
|
||||||
# define SQL_AUTOCOMMIT_ON 1UL
|
# define SQL_AUTOCOMMIT_ON 1UL
|
||||||
# define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON
|
# define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON
|
||||||
|
|
||||||
/* SQL_LOGIN_TIMEOUT options */
|
/* SQL_LOGIN_TIMEOUT options */
|
||||||
# define SQL_LOGIN_TIMEOUT_DEFAULT 15UL
|
# define SQL_LOGIN_TIMEOUT_DEFAULT 15UL
|
||||||
|
|
||||||
/* SQL_OPT_TRACE options */
|
/* SQL_OPT_TRACE options */
|
||||||
# define SQL_OPT_TRACE_OFF 0UL
|
# define SQL_OPT_TRACE_OFF 0UL
|
||||||
# define SQL_OPT_TRACE_ON 1UL
|
# define SQL_OPT_TRACE_ON 1UL
|
||||||
# define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF
|
# define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF
|
||||||
# define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log"
|
# define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log"
|
||||||
|
|
||||||
/* SQL_ODBC_CURSORS options */
|
/* SQL_ODBC_CURSORS options */
|
||||||
# define SQL_CUR_USE_IF_NEEDED 0UL
|
# define SQL_CUR_USE_IF_NEEDED 0UL
|
||||||
# define SQL_CUR_USE_ODBC 1UL
|
# define SQL_CUR_USE_ODBC 1UL
|
||||||
# define SQL_CUR_USE_DRIVER 2UL
|
# define SQL_CUR_USE_DRIVER 2UL
|
||||||
# define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER
|
# define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER
|
||||||
|
|
||||||
/* Column types and scopes in SQLSpecialColumns. */
|
/* Column types and scopes in SQLSpecialColumns. */
|
||||||
# define SQL_BEST_ROWID 1
|
# define SQL_BEST_ROWID 1
|
||||||
# define SQL_ROWVER 2
|
# define SQL_ROWVER 2
|
||||||
|
|
||||||
# define SQL_SCOPE_CURROW 0
|
# define SQL_SCOPE_CURROW 0
|
||||||
# define SQL_SCOPE_TRANSACTION 1
|
# define SQL_SCOPE_TRANSACTION 1
|
||||||
# define SQL_SCOPE_SESSION 2
|
# define SQL_SCOPE_SESSION 2
|
||||||
|
|
||||||
/* Operations in SQLSetPos */
|
/* Operations in SQLSetPos */
|
||||||
# define SQL_ADD 4
|
# define SQL_ADD 4
|
||||||
|
|
||||||
/* Lock options in SQLSetPos */
|
/* Lock options in SQLSetPos */
|
||||||
# define SQL_LOCK_NO_CHANGE 0
|
# define SQL_LOCK_NO_CHANGE 0
|
||||||
# define SQL_LOCK_EXCLUSIVE 1
|
# define SQL_LOCK_EXCLUSIVE 1
|
||||||
# define SQL_LOCK_UNLOCK 2
|
# define SQL_LOCK_UNLOCK 2
|
||||||
|
|
||||||
/* SQLExtendedFetch flag values */
|
/* SQLExtendedFetch flag values */
|
||||||
# define SQL_FETCH_NEXT 1
|
# define SQL_FETCH_NEXT 1
|
||||||
# define SQL_FETCH_FIRST 2
|
# define SQL_FETCH_FIRST 2
|
||||||
# define SQL_FETCH_LAST 3
|
# define SQL_FETCH_LAST 3
|
||||||
# define SQL_FETCH_PRIOR 4
|
# define SQL_FETCH_PRIOR 4
|
||||||
# define SQL_FETCH_ABSOLUTE 5
|
# define SQL_FETCH_ABSOLUTE 5
|
||||||
# define SQL_FETCH_RELATIVE 6
|
# define SQL_FETCH_RELATIVE 6
|
||||||
# define SQL_FETCH_BOOKMARK 8
|
# define SQL_FETCH_BOOKMARK 8
|
||||||
|
|
||||||
/* Defines for SQLBindParameter/SQLProcedureColumns */
|
/* Defines for SQLBindParameter/SQLProcedureColumns */
|
||||||
# define SQL_PARAM_TYPE_UNKNOWN 0
|
# define SQL_PARAM_TYPE_UNKNOWN 0
|
||||||
# define SQL_PARAM_INPUT 1
|
# define SQL_PARAM_INPUT 1
|
||||||
# define SQL_PARAM_INPUT_OUTPUT 2
|
# define SQL_PARAM_INPUT_OUTPUT 2
|
||||||
# define SQL_RESULT_COL 3
|
# define SQL_RESULT_COL 3
|
||||||
# define SQL_PARAM_OUTPUT 4
|
# define SQL_PARAM_OUTPUT 4
|
||||||
|
|
||||||
/* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */
|
/* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */
|
||||||
# define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT
|
# define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT
|
||||||
# define SQL_SETPARAM_VALUE_MAX (-1L)
|
# define SQL_SETPARAM_VALUE_MAX (-1L)
|
||||||
|
|
||||||
/* SQLStatistics flag values */
|
/* SQLStatistics flag values */
|
||||||
# define SQL_INDEX_UNIQUE 0
|
# define SQL_INDEX_UNIQUE 0
|
||||||
# define SQL_INDEX_ALL 1
|
# define SQL_INDEX_ALL 1
|
||||||
|
|
||||||
# define SQL_QUICK 0
|
# define SQL_QUICK 0
|
||||||
# define SQL_ENSURE 1
|
# define SQL_ENSURE 1
|
||||||
|
|
||||||
/* SQLSetScrollOption flag values */
|
/* SQLSetScrollOption flag values */
|
||||||
# define SQL_SCROLL_FORWARD_ONLY 0L
|
# define SQL_SCROLL_FORWARD_ONLY 0L
|
||||||
# define SQL_SCROLL_KEYSET_DRIVEN (-1L)
|
# define SQL_SCROLL_KEYSET_DRIVEN (-1L)
|
||||||
# define SQL_SCROLL_DYNAMIC (-2L)
|
# define SQL_SCROLL_DYNAMIC (-2L)
|
||||||
# define SQL_SCROLL_STATIC (-3L)
|
# define SQL_SCROLL_STATIC (-3L)
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# if defined(__cplusplus) || defined(__IBMCPP__)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD);
|
RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD);
|
||||||
RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* );
|
RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* );
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# if defined(__cplusplus) || defined(__IBMCPP__)
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/** trace functions
|
/** trace functions
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,75 +30,75 @@
|
|||||||
|
|
||||||
static int printreturn(void FAR* istm, int ret )
|
static int printreturn(void FAR* istm, int ret )
|
||||||
{
|
{
|
||||||
FILE FAR* stm = (FILE FAR*)istm;
|
FILE FAR* stm = (FILE FAR*)istm;
|
||||||
char FAR* ptr = "Invalid return value";
|
char FAR* ptr = "Invalid return value";
|
||||||
|
|
||||||
switch( ret )
|
switch( ret )
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
ptr = "SQL_SUCCESS";
|
ptr = "SQL_SUCCESS";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
|
||||||
ptr = "SQL_SUCCESS_WITH_INFO";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SQL_NO_DATA_FOUND:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
ptr = "SQL_NO_DATA_FOUND";
|
ptr = "SQL_SUCCESS_WITH_INFO";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_NEED_DATA:
|
case SQL_NO_DATA_FOUND:
|
||||||
ptr = "SQL_NEED_DATA";
|
ptr = "SQL_NO_DATA_FOUND";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_INVALID_HANDLE:
|
case SQL_NEED_DATA:
|
||||||
ptr = "SQL_INVALID_HANDLE";
|
ptr = "SQL_NEED_DATA";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_ERROR:
|
case SQL_INVALID_HANDLE:
|
||||||
ptr = "SQL_ERROR";
|
ptr = "SQL_INVALID_HANDLE";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_STILL_EXECUTING:
|
case SQL_ERROR:
|
||||||
ptr = "SQL_STILL_EXECUTING";
|
ptr = "SQL_ERROR";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case SQL_STILL_EXECUTING:
|
||||||
break;
|
ptr = "SQL_STILL_EXECUTING";
|
||||||
}
|
break;
|
||||||
|
|
||||||
fprintf( stm, "%s\n", ptr);
|
default:
|
||||||
fflush( stm );
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
fprintf( stm, "%s\n", ptr);
|
||||||
|
fflush( stm );
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HPROC _iodbcdm_gettrproc(void FAR* istm, int procid, int type)
|
HPROC _iodbcdm_gettrproc(void FAR* istm, int procid, int type)
|
||||||
{
|
{
|
||||||
FILE FAR* stm = (FILE FAR*)istm;
|
FILE FAR* stm = (FILE FAR*)istm;
|
||||||
|
|
||||||
if( type == TRACE_TYPE_DM2DRV )
|
if( type == TRACE_TYPE_DM2DRV )
|
||||||
{
|
{
|
||||||
int i,j = 0;
|
int i,j = 0;
|
||||||
|
|
||||||
for(i=0;j != en_NullProc ;i++)
|
for(i=0;j != en_NullProc ;i++)
|
||||||
{
|
{
|
||||||
j = odbcapi_symtab[i].en_idx;
|
j = odbcapi_symtab[i].en_idx;
|
||||||
|
|
||||||
if( j == procid )
|
if( j == procid )
|
||||||
{
|
{
|
||||||
fprintf( stm, "\n%s ( ... )\n",
|
fprintf( stm, "\n%s ( ... )\n",
|
||||||
odbcapi_symtab[i].symbol);
|
odbcapi_symtab[i].symbol);
|
||||||
|
|
||||||
fflush( stm );
|
fflush( stm );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( type == TRACE_TYPE_RETURN )
|
if( type == TRACE_TYPE_RETURN )
|
||||||
{
|
{
|
||||||
return (HPROC)printreturn;
|
return (HPROC)printreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SQL_NULL_HPROC;
|
return SQL_NULL_HPROC;
|
||||||
}
|
}
|
||||||
|
@@ -1,97 +1,97 @@
|
|||||||
#ifndef _ITRACE_H
|
#ifndef _ITRACE_H
|
||||||
# define _ITRACE_H
|
# define _ITRACE_H
|
||||||
|
|
||||||
# ifdef DEBUG
|
# ifdef DEBUG
|
||||||
# ifndef NO_TRACE
|
# ifndef NO_TRACE
|
||||||
# define NO_TRACE
|
# define NO_TRACE
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define TRACE_TYPE_APP2DM 1
|
# define TRACE_TYPE_APP2DM 1
|
||||||
# define TRACE_TYPE_DM2DRV 2
|
# define TRACE_TYPE_DM2DRV 2
|
||||||
# define TRACE_TYPE_DRV2DM 3
|
# define TRACE_TYPE_DRV2DM 3
|
||||||
|
|
||||||
# define TRACE_TYPE_RETURN 4
|
# define TRACE_TYPE_RETURN 4
|
||||||
|
|
||||||
extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
# ifdef NO_TRACE
|
||||||
# define TRACE_CALL( stm, trace_on, procid, plist )
|
# define TRACE_CALL( stm, trace_on, procid, plist )
|
||||||
# else
|
# else
|
||||||
# define TRACE_CALL( stm, trace_on, plist )\
|
# define TRACE_CALL( stm, trace_on, plist )\
|
||||||
{\
|
{\
|
||||||
if( trace_on)\
|
if( trace_on)\
|
||||||
{\
|
{\
|
||||||
HPROC hproc;\
|
HPROC hproc;\
|
||||||
\
|
\
|
||||||
hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\
|
hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\
|
||||||
\
|
\
|
||||||
if( hproc )\
|
if( hproc )\
|
||||||
hproc plist;\
|
hproc plist;\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
# ifdef NO_TRACE
|
||||||
# define TRACE_DM2DRV( stm, procid, plist )
|
# define TRACE_DM2DRV( stm, procid, plist )
|
||||||
# else
|
# else
|
||||||
# define TRACE_DM2DRV( stm, procid, plist )\
|
# define TRACE_DM2DRV( stm, procid, plist )\
|
||||||
{\
|
{\
|
||||||
HPROC hproc;\
|
HPROC hproc;\
|
||||||
\
|
\
|
||||||
hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\
|
hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\
|
||||||
\
|
\
|
||||||
if( hproc )\
|
if( hproc )\
|
||||||
hproc plist;\
|
hproc plist;\
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
# ifdef NO_TRACE
|
||||||
# define TRACE_DRV2DM( stm, procid, plist )
|
# define TRACE_DRV2DM( stm, procid, plist )
|
||||||
# else
|
# else
|
||||||
# define TRACE_DRV2DM( stm, procid, plist ) \
|
# define TRACE_DRV2DM( stm, procid, plist ) \
|
||||||
{\
|
{\
|
||||||
HPROC hproc;\
|
HPROC hproc;\
|
||||||
\
|
\
|
||||||
hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\
|
hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\
|
||||||
\
|
\
|
||||||
if( hproc )\
|
if( hproc )\
|
||||||
hproc plist;\
|
hproc plist;\
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
# ifdef NO_TRACE
|
||||||
# define TRACE_RETURN( stm, trace_on, ret )
|
# define TRACE_RETURN( stm, trace_on, ret )
|
||||||
# else
|
# else
|
||||||
# define TRACE_RETURN( stm, trace_on, ret )\
|
# define TRACE_RETURN( stm, trace_on, ret )\
|
||||||
{\
|
{\
|
||||||
if( trace_on ) {\
|
if( trace_on ) {\
|
||||||
HPROC hproc;\
|
HPROC hproc;\
|
||||||
\
|
\
|
||||||
hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\
|
hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\
|
||||||
\
|
\
|
||||||
if( hproc )\
|
if( hproc )\
|
||||||
hproc( stm, ret );\
|
hproc( stm, ret );\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
# ifdef NO_TRACE
|
||||||
# define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; }
|
# define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; }
|
||||||
# else
|
# else
|
||||||
# define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
|
# define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
|
||||||
{\
|
{\
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)(hdbc);\
|
DBC_t FAR* pdbc = (DBC_t FAR*)(hdbc);\
|
||||||
\
|
\
|
||||||
if( pdbc->trace ) {\
|
if( pdbc->trace ) {\
|
||||||
TRACE_DM2DRV( pdbc->tstm, procid, plist )\
|
TRACE_DM2DRV( pdbc->tstm, procid, plist )\
|
||||||
ret = proc plist;\
|
ret = proc plist;\
|
||||||
TRACE_DRV2DM( pdbc->tstm, procid, plist )\
|
TRACE_DRV2DM( pdbc->tstm, procid, plist )\
|
||||||
TRACE_RETURN( pdbc->tstm, 1, ret )\
|
TRACE_RETURN( pdbc->tstm, 1, ret )\
|
||||||
}\
|
}\
|
||||||
else\
|
else\
|
||||||
ret = proc plist;\
|
ret = proc plist;\
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include <iodbc.h>
|
#include <config.h>
|
||||||
|
|
||||||
/* entry function used to build a share library on AIX */
|
/* entry function used to build a share library on AIX */
|
||||||
int __start()
|
int __start()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
592
src/iodbc/misc.c
592
src/iodbc/misc.c
@@ -1,6 +1,6 @@
|
|||||||
/** miscellaneous functions
|
/** miscellaneous functions
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,6 +13,13 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#ifdef DLDAPI_OS2
|
||||||
|
# define INCL_DOSMODULEMGR /* Module Manager values */
|
||||||
|
# define INCL_DOSERRORS /* Error values */
|
||||||
|
# include <os2.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <../iodbc/iodbc.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <../iodbc/isql.h>
|
||||||
@@ -21,360 +28,395 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
static int
|
#include <unistd.h>
|
||||||
upper_strneq(
|
|
||||||
char* s1,
|
|
||||||
char* s2,
|
static int
|
||||||
int n )
|
upper_strneq(
|
||||||
|
char* s1,
|
||||||
|
char* s2,
|
||||||
|
int n )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char c1 = 0, c2 = 0;
|
char c1, c2;
|
||||||
|
|
||||||
for(i=1;i<n;i++)
|
for(i=1;i<n;i++)
|
||||||
{
|
{
|
||||||
c1 = s1[i];
|
c1 = s1[i];
|
||||||
c2 = s2[i];
|
c2 = s2[i];
|
||||||
|
|
||||||
if( c1 >= 'a' && c1 <= 'z' )
|
if( c1 >= 'a' && c1 <= 'z' )
|
||||||
{
|
{
|
||||||
c1 += ('A' - 'a');
|
c1 += ('A' - 'a');
|
||||||
}
|
}
|
||||||
else if( c1 == '\n' )
|
else if( c1 == '\n' )
|
||||||
{
|
{
|
||||||
c1 = '\0';
|
c1 = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( c2 >= 'a' && c2 <= 'z' )
|
if( c2 >= 'a' && c2 <= 'z' )
|
||||||
{
|
{
|
||||||
c2 += ('A' - 'a');
|
c2 += ('A' - 'a');
|
||||||
}
|
}
|
||||||
else if( c2 == '\n' )
|
else if( c2 == '\n' )
|
||||||
{
|
{
|
||||||
c2 = '\0';
|
c2 = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (c1 - c2) || !c1 || !c2 )
|
if( (c1 - c2) || !c1 || !c2 )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)!(c1 - c2);
|
return (int)!(c1 - c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* /* return new position in input str */
|
static char* /* return new position in input str */
|
||||||
readtoken(
|
readtoken(
|
||||||
char* istr, /* old position in input buf */
|
char* istr, /* old position in input buf */
|
||||||
char* obuf ) /* token string ( if "\0", then finished ) */
|
char* obuf ) /* token string ( if "\0", then finished ) */
|
||||||
{
|
{
|
||||||
for(; *istr && *istr != '\n' ; istr ++ )
|
for(; *istr && *istr != '\n' ; istr ++ )
|
||||||
{
|
{
|
||||||
char c, nx;
|
char c, nx;
|
||||||
|
|
||||||
c = *(istr);
|
c = *(istr);
|
||||||
|
|
||||||
if( c == ' ' || c == '\t' )
|
if( c == ' ' || c == '\t' )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
nx = *(istr + 1);
|
nx = *(istr + 1);
|
||||||
|
|
||||||
*obuf = c;
|
*obuf = c;
|
||||||
obuf ++;
|
obuf ++;
|
||||||
|
|
||||||
if( c == ';' || c == '=' )
|
if( c == ';' || c == '=' )
|
||||||
{
|
{
|
||||||
istr ++;
|
istr ++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( nx == ' ' || nx == '\t' || nx == ';' || nx == '=' )
|
if( nx == ' ' || nx == '\t' || nx == ';' || nx == '=' )
|
||||||
{
|
{
|
||||||
istr ++;
|
istr ++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*obuf = '\0';
|
*obuf = '\0';
|
||||||
|
|
||||||
return istr;
|
return istr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(WINDOWS) && !defined(WIN32) && !defined(OS2)
|
#if !defined(WINDOWS) && !defined(WIN32) && !defined(OS2)
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
# define UNIX_PWD
|
# define UNIX_PWD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
getinitfile(char* buf, int size)
|
getinitfile(char* buf, int size)
|
||||||
{
|
{
|
||||||
int /* i, */ j;
|
int i, j;
|
||||||
char* ptr;
|
char* ptr;
|
||||||
|
|
||||||
j = STRLEN("/odbc.ini") + 1;
|
j = STRLEN("/iodbc.ini") + 1;
|
||||||
|
|
||||||
if( size < j )
|
if( size < j )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(UNIX_PWD)
|
#ifdef FIX_INI_FILE
|
||||||
|
sprintf( buf, "%s/iodbc.ini", DIR_INI_FILE );
|
||||||
i = GetWindowsDirectory((LPSTR)buf, size );
|
|
||||||
|
|
||||||
if( i == 0 || i > size - j )
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf( buf + i, "/odbc.ini");
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
#else
|
#else
|
||||||
ptr = (char*)getpwuid(getuid());
|
# ifdef OS2
|
||||||
|
*buf = '\0';
|
||||||
|
if( NULL != getenv("IODBC_INI") )
|
||||||
|
{
|
||||||
|
strcpy( buf, getenv("IODBC_INI") );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HMODULE hModule;
|
||||||
|
|
||||||
if( ptr == NULL )
|
if( NO_ERROR == DosQueryModuleHandle(DLL_NAME, &hModule) &&
|
||||||
{
|
NO_ERROR == DosQueryModuleName(hModule, 256L, buf) )
|
||||||
return NULL;
|
{
|
||||||
}
|
if( NULL != strrchr(buf, '.') )
|
||||||
|
*(strchr(buf, '.')) = '\0';
|
||||||
|
strcat( buf, ".ini" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy( buf, "iodbc.ini" );
|
||||||
|
}
|
||||||
|
|
||||||
ptr = ((struct passwd*)ptr)->pw_dir;
|
}
|
||||||
|
return buf;
|
||||||
|
# else
|
||||||
|
# if !defined(UNIX_PWD)
|
||||||
|
|
||||||
if( ptr == NULL || *ptr == '\0' )
|
i = GetWindowsDirectory((LPSTR)buf, size );
|
||||||
{
|
|
||||||
ptr = "/home";
|
|
||||||
}
|
|
||||||
|
|
||||||
if( size < STRLEN(ptr) + j )
|
if( i == 0 || i > size - j )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( buf, "%s%s", ptr, "/.odbc.ini");
|
sprintf( buf + i, "/iodbc.ini");
|
||||||
/* i.e. searching ~/.odbc.ini */
|
|
||||||
|
return buf;
|
||||||
|
# else
|
||||||
|
ptr = (char*)getpwuid(getuid());
|
||||||
|
|
||||||
|
if( ptr == NULL )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = ((struct passwd*)ptr)->pw_dir;
|
||||||
|
|
||||||
|
if( ptr == NULL || *ptr == '\0' )
|
||||||
|
{
|
||||||
|
ptr = "/home";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( size < STRLEN(ptr) + j )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf( buf, "%s%s", ptr, "/.iodbc.ini");
|
||||||
|
/* i.e. searching ~/.iodbc.ini */
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* _iodbcdm_getkeyvalbydsn(
|
char* _iodbcdm_getkeyvalbydsn(
|
||||||
char* dsn,
|
char* dsn,
|
||||||
int dsnlen,
|
int dsnlen,
|
||||||
char* keywd,
|
char* keywd,
|
||||||
char* value,
|
char* value,
|
||||||
int size )
|
int size )
|
||||||
/* read odbc init file to resolve the value of specified
|
/* read odbc init file to resolve the value of specified
|
||||||
* key from named or defaulted dsn section
|
* key from named or defaulted dsn section
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char dsntk[SQL_MAX_DSN_LENGTH + 3] = { '[', '\0' };
|
char dsntk[SQL_MAX_DSN_LENGTH + 3] = { '[', '\0' };
|
||||||
char token[1024]; /* large enough */
|
char token[1024]; /* large enough */
|
||||||
FILE* file;
|
FILE* file;
|
||||||
char pathbuf[1024];
|
char pathbuf[1024];
|
||||||
char* path;
|
char* path;
|
||||||
|
|
||||||
#define DSN_NOMATCH 0
|
#define DSN_NOMATCH 0
|
||||||
#define DSN_NAMED 1
|
#define DSN_NAMED 1
|
||||||
#define DSN_DEFAULT 2
|
#define DSN_DEFAULT 2
|
||||||
|
|
||||||
int dsnid = DSN_NOMATCH;
|
int dsnid = DSN_NOMATCH;
|
||||||
int defaultdsn = DSN_NOMATCH;
|
int defaultdsn = DSN_NOMATCH;
|
||||||
|
|
||||||
if( dsn == NULL || *dsn == 0 )
|
if( dsn == NULL || *dsn == 0 )
|
||||||
{
|
{
|
||||||
dsn = "default";
|
dsn = "default";
|
||||||
dsnlen = STRLEN(dsn);
|
dsnlen = STRLEN(dsn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dsnlen == SQL_NTS )
|
if( dsnlen == SQL_NTS )
|
||||||
{
|
{
|
||||||
dsnlen = STRLEN(dsn);
|
dsnlen = STRLEN(dsn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dsnlen <= 0 || keywd == NULL || buf == 0 || size <= 0 )
|
if( dsnlen <= 0 || keywd == NULL || buf == 0 || size <= 0 )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dsnlen > sizeof(dsntk) - 2 )
|
if( dsnlen > sizeof(dsntk) - 2 )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
value[0] = '\0';
|
value[0] = '\0';
|
||||||
|
|
||||||
STRNCAT( dsntk, dsn, dsnlen );
|
STRNCAT( dsntk, dsn, dsnlen );
|
||||||
STRCAT( dsntk, "]" );
|
STRCAT( dsntk, "]" );
|
||||||
|
|
||||||
dsnlen = dsnlen + 2;
|
dsnlen = dsnlen + 2;
|
||||||
|
|
||||||
path = getinitfile(pathbuf, sizeof(pathbuf));
|
path = getinitfile(pathbuf, sizeof(pathbuf));
|
||||||
|
|
||||||
if( path == NULL )
|
if( path == NULL )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = (FILE*)fopen(path, "r");
|
file = (FILE*)fopen(path, "r");
|
||||||
|
|
||||||
if( file == NULL )
|
if( file == NULL )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
char* str;
|
char* str;
|
||||||
|
|
||||||
str = fgets(buf, sizeof(buf), file);
|
str = fgets(buf, sizeof(buf), file);
|
||||||
|
|
||||||
if( str == NULL )
|
if( str == NULL )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *str == '[' )
|
strtok( str, "\n\r" );
|
||||||
{
|
|
||||||
if( upper_strneq(str, "[default]", STRLEN("[default]")) )
|
|
||||||
{
|
|
||||||
/* we only read first dsn default dsn
|
|
||||||
* section (as well as named dsn).
|
|
||||||
*/
|
|
||||||
if( defaultdsn == DSN_NOMATCH )
|
|
||||||
{
|
|
||||||
dsnid = DSN_DEFAULT;
|
|
||||||
defaultdsn = DSN_DEFAULT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dsnid = DSN_NOMATCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
if( *str == '[' )
|
||||||
}
|
{
|
||||||
else if( upper_strneq( str, dsntk, dsnlen ) )
|
if( upper_strneq(str, "[default]", STRLEN("[default]")) )
|
||||||
{
|
{
|
||||||
dsnid = DSN_NAMED;
|
/* we only read first dsn default dsn
|
||||||
}
|
* section (as well as named dsn).
|
||||||
else
|
*/
|
||||||
{
|
if( defaultdsn == DSN_NOMATCH )
|
||||||
dsnid = DSN_NOMATCH;
|
{
|
||||||
}
|
dsnid = DSN_DEFAULT;
|
||||||
|
defaultdsn = DSN_DEFAULT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dsnid = DSN_NOMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( dsnid == DSN_NOMATCH )
|
else if( upper_strneq( str, dsntk, dsnlen ) )
|
||||||
{
|
{
|
||||||
continue;
|
dsnid = DSN_NAMED;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dsnid = DSN_NOMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
str = readtoken(str, token);
|
continue;
|
||||||
|
}
|
||||||
|
else if( dsnid == DSN_NOMATCH )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( upper_strneq( keywd, token, STRLEN(keywd)) )
|
str = readtoken(str, token);
|
||||||
{
|
|
||||||
str = readtoken(str, token);
|
|
||||||
|
|
||||||
if( ! STREQ( token, "=") )
|
if( upper_strneq( keywd, token, STRLEN(keywd)) )
|
||||||
/* something other than = */
|
{
|
||||||
{
|
str = readtoken(str, token);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
str = readtoken(str, token);
|
if( ! STREQ( token, "=") )
|
||||||
|
/* something other than = */
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( STRLEN(token) > size - 1)
|
str = readtoken(str, token);
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
STRNCPY(value, token, size);
|
if( STRLEN(token) > size - 1)
|
||||||
/* copy the value(i.e. next token) to buf */
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if( dsnid != DSN_DEFAULT )
|
STRNCPY(value, token, size);
|
||||||
{
|
/* copy the value(i.e. next token) to buf */
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
if( dsnid != DSN_DEFAULT )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (*value)? value:NULL;
|
fclose(file);
|
||||||
|
|
||||||
|
return (*value)? value:NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* _iodbcdm_getkeyvalinstr(
|
char* _iodbcdm_getkeyvalinstr(
|
||||||
char* cnstr,
|
char* cnstr,
|
||||||
int cnlen,
|
int cnlen,
|
||||||
char* keywd,
|
char* keywd,
|
||||||
char* value,
|
char* value,
|
||||||
int size )
|
int size )
|
||||||
{
|
{
|
||||||
char token[1024] = { '\0' };
|
char token[1024] = { '\0' };
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
|
|
||||||
if( cnstr == NULL || value == NULL
|
if( cnstr == NULL || value == NULL
|
||||||
|| keywd == NULL || size < 1 )
|
|| keywd == NULL || size < 1 )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cnlen == SQL_NTS )
|
if( cnlen == SQL_NTS )
|
||||||
{
|
{
|
||||||
cnlen = STRLEN (cnstr);
|
cnlen = STRLEN (cnstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cnlen <= 0 )
|
if( cnlen <= 0 )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
cnstr = readtoken(cnstr, token);
|
cnstr = readtoken(cnstr, token);
|
||||||
|
|
||||||
if( *token == '\0' )
|
if( *token == '\0' )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( STREQ( token, ";" ) )
|
if( STREQ( token, ";" ) )
|
||||||
{
|
{
|
||||||
flag = 0;
|
flag = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(flag)
|
switch(flag)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if( upper_strneq(token, keywd, strlen(keywd)) )
|
if( upper_strneq(token, keywd, strlen(keywd)) )
|
||||||
{
|
{
|
||||||
flag = 1;
|
flag = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if( STREQ( token, "=" ) )
|
if( STREQ( token, "=" ) )
|
||||||
{
|
{
|
||||||
flag = 2;
|
flag = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if( size < strlen(token) + 1 )
|
if( size < strlen(token) + 1 )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY( value, token, size );
|
STRNCPY( value, token, size );
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#define SQL_SPEC_STRING "02.00" /* String constant for version */
|
#define SQL_MAX_USER_NAME_LEN 107
|
||||||
|
#define SQL_SPEC_STRING "02.50" /* String constant for version */
|
||||||
#define SQL_ACTIVE_CONNECTIONS 0
|
#define SQL_ACTIVE_CONNECTIONS 0
|
||||||
#define SQL_ACTIVE_STATEMENTS 1
|
#define SQL_ACTIVE_STATEMENTS 1
|
||||||
#define SQL_DATA_SOURCE_NAME 2
|
#define SQL_DATA_SOURCE_NAME 2
|
||||||
@@ -45,23 +46,9 @@
|
|||||||
#define SQL_CONVERT_FUNCTIONS 48
|
#define SQL_CONVERT_FUNCTIONS 48
|
||||||
#define SQL_SYSTEM_FUNCTIONS 51
|
#define SQL_SYSTEM_FUNCTIONS 51
|
||||||
#define SQL_NUMERIC_FUNCTIONS 49
|
#define SQL_NUMERIC_FUNCTIONS 49
|
||||||
#define SQL_FN_NUM_ABS 0x00000001L
|
|
||||||
#define SQL_FN_NUM_FLOOR 0x00000200L
|
|
||||||
#define SQL_FN_NUM_MOD 0x00000800L
|
|
||||||
#define SQL_FN_NUM_SIGN 0x00001000L
|
|
||||||
#define SQL_STRING_FUNCTIONS 50
|
#define SQL_STRING_FUNCTIONS 50
|
||||||
#define SQL_FN_STR_CONCAT 0x00000001L
|
|
||||||
#define SQL_FN_STR_LEFT 0x00000004L
|
|
||||||
#define SQL_FN_STR_LENGTH 0x00000010L
|
|
||||||
#define SQL_FN_STR_LOCATE 0x00000020L
|
|
||||||
#define SQL_FN_STR_LOCATE_2 0x00010000L
|
|
||||||
#define SQL_FN_STR_RIGHT 0x00000200L
|
|
||||||
#define SQL_FN_STR_SUBSTRING 0x00000800L
|
|
||||||
#define SQL_FN_STR_REPLACE 0x00000100L
|
|
||||||
#define SQL_FN_STR_LCASE 0x00000040L
|
|
||||||
#define SQL_FN_STR_UCASE 0x00001000L
|
|
||||||
#define SQL_TIMEDATE_FUNCTIONS 52
|
#define SQL_TIMEDATE_FUNCTIONS 52
|
||||||
#define SQL_FN_TD_CURDATE 0x00000002L
|
|
||||||
#define SQL_CONVERT_BIGINT 53
|
#define SQL_CONVERT_BIGINT 53
|
||||||
#define SQL_CONVERT_BIT 55
|
#define SQL_CONVERT_BIT 55
|
||||||
#define SQL_CONVERT_CHAR 56
|
#define SQL_CONVERT_CHAR 56
|
||||||
@@ -116,6 +103,8 @@
|
|||||||
#define SQL_MAX_COLUMNS_IN_INDEX 98
|
#define SQL_MAX_COLUMNS_IN_INDEX 98
|
||||||
#define SQL_MAX_INDEX_SIZE 102
|
#define SQL_MAX_INDEX_SIZE 102
|
||||||
#define SQL_MAX_STATEMENT_LEN 105
|
#define SQL_MAX_STATEMENT_LEN 105
|
||||||
|
#define SQL_MAX_OPTION_STRING_LENGTH 256
|
||||||
|
|
||||||
#define SQL_QL_START 0x0001L
|
#define SQL_QL_START 0x0001L
|
||||||
#define SQL_SEARCHABLE 3
|
#define SQL_SEARCHABLE 3
|
||||||
#define SQL_IDENTIFIER_CASE 28
|
#define SQL_IDENTIFIER_CASE 28
|
||||||
@@ -164,17 +153,10 @@
|
|||||||
#define SQL_KEYWORDS 89
|
#define SQL_KEYWORDS 89
|
||||||
#define SQL_SPECIAL_CHARACTERS 94
|
#define SQL_SPECIAL_CHARACTERS 94
|
||||||
#define SQL_TIMEDATE_ADD_INTERVALS 109
|
#define SQL_TIMEDATE_ADD_INTERVALS 109
|
||||||
|
#define SQL_IC_MIXED 0x0004
|
||||||
#define SQL_FN_SYS_DBNAME 0x00000002L
|
#define SQL_FN_SYS_DBNAME 0x00000002L
|
||||||
#define SQL_FN_SYS_IFNULL 0x00000004L
|
#define SQL_FN_SYS_IFNULL 0x00000004L
|
||||||
#define SQL_FN_SYS_USERNAME 0x00000001L
|
#define SQL_FN_SYS_USERNAME 0x00000001L
|
||||||
#define SQL_FN_NUM_CEILING 0x00000020L
|
|
||||||
#define SQL_FN_NUM_EXP 0x00000100L
|
|
||||||
#define SQL_FN_NUM_LOG 0x00000400L
|
|
||||||
#define SQL_FN_NUM_LOG10 0x00080000L
|
|
||||||
#define SQL_FN_NUM_LOG10 0x00080000L
|
|
||||||
#define SQL_FN_NUM_POWER 0x00100000L
|
|
||||||
#define SQL_FN_NUM_SQRT 0x00004000L
|
|
||||||
#define SQL_FN_NUM_ROUND 0x00400000L
|
|
||||||
#define SQL_FN_STR_INSERT 0x00000002L
|
#define SQL_FN_STR_INSERT 0x00000002L
|
||||||
#define SQL_FN_STR_LTRIM 0x00000008L
|
#define SQL_FN_STR_LTRIM 0x00000008L
|
||||||
#define SQL_FN_STR_RTRIM 0x00000400L
|
#define SQL_FN_STR_RTRIM 0x00000400L
|
||||||
@@ -192,107 +174,110 @@
|
|||||||
#define SQL_COLUMN_TABLE_NAME 15
|
#define SQL_COLUMN_TABLE_NAME 15
|
||||||
#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
|
#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
|
||||||
#define SQL_CB_NULL 0x0000
|
#define SQL_CB_NULL 0x0000
|
||||||
#define SQL_FN_NUM_RAND 0x00020000L
|
#define SQL_TC_NONE 0x0000
|
||||||
#define SQL_NOSCAN_OFF 0UL
|
#define SQL_NOSCAN_OFF 0UL
|
||||||
#define SQL_ASYNC_ENABLE_OFF 0UL
|
#define SQL_ASYNC_ENABLE_OFF 0UL
|
||||||
#define SQL_CURSOR_STATIC 3UL
|
|
||||||
#define SQL_SC_NON_UNIQUE 0UL
|
#define SQL_SC_NON_UNIQUE 0UL
|
||||||
#define SQL_UB_OFF 0UL
|
#define SQL_UB_OFF 0UL
|
||||||
#define SQL_PC_NOT_PSEUDO 1
|
#define SQL_PC_NOT_PSEUDO 1
|
||||||
#define SQL_PC_NON_PSEUDO SQL_PC_NOT_PSEUDO
|
#define SQL_PC_NON_PSEUDO SQL_PC_NOT_PSEUDO
|
||||||
#define SQL_UNSEARCHABLE 0
|
#define SQL_UNSEARCHABLE 0
|
||||||
|
#define SQL_FD_FETCH_NEXT 0x00000001L
|
||||||
|
#define SQL_FD_FETCH_FIRST 0x00000002L
|
||||||
|
#define SQL_FD_FETCH_LAST 0x00000004L
|
||||||
|
#define SQL_FD_FETCH_PRIOR 0x00000008L
|
||||||
|
#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR
|
||||||
|
#define SQL_FD_FETCH_ABSOLUTE 0x00000010L
|
||||||
|
#define SQL_FD_FETCH_RELATIVE 0x00000020L
|
||||||
|
|
||||||
/*
|
#define SQL_FN_NUM_ABS 0x00000001L
|
||||||
* Following constants are missed in original odbc_types.h
|
#define SQL_FN_NUM_ACOS 0x00000002L
|
||||||
* Added by serg@informika.ru
|
#define SQL_FN_NUM_ASIN 0x00000004L
|
||||||
*/
|
#define SQL_FN_NUM_ATAN 0x00000008L
|
||||||
|
#define SQL_FN_NUM_ATAN2 0x00000010L
|
||||||
|
#define SQL_FN_NUM_CEILING 0x00000020L
|
||||||
|
#define SQL_FN_NUM_COS 0x00000040L
|
||||||
|
#define SQL_FN_NUM_COT 0x00000080L
|
||||||
|
#define SQL_FN_NUM_EXP 0x00000100L
|
||||||
|
#define SQL_FN_NUM_FLOOR 0x00000200L
|
||||||
|
#define SQL_FN_NUM_LOG 0x00000400L
|
||||||
|
#define SQL_FN_NUM_MOD 0x00000800L
|
||||||
|
#define SQL_FN_NUM_SIGN 0x00001000L
|
||||||
|
#define SQL_FN_NUM_SIN 0x00002000L
|
||||||
|
#define SQL_FN_NUM_SQRT 0x00004000L
|
||||||
|
#define SQL_FN_NUM_TAN 0x00008000L
|
||||||
|
#define SQL_FN_NUM_PI 0x00010000L
|
||||||
|
#define SQL_FN_NUM_RAND 0x00020000L
|
||||||
|
#define SQL_FN_NUM_DEGREES 0x00040000L
|
||||||
|
#define SQL_FN_NUM_LOG10 0x00080000L
|
||||||
|
#define SQL_FN_NUM_POWER 0x00100000L
|
||||||
|
#define SQL_FN_NUM_RADIANS 0x00200000L
|
||||||
|
#define SQL_FN_NUM_ROUND 0x00400000L
|
||||||
|
#define SQL_FN_NUM_TRUNCATE 0x00800000L
|
||||||
|
|
||||||
#define SQL_UNKNOWN_TYPE 0
|
#define SQL_FN_STR_CONCAT 0x00000001L
|
||||||
|
#define SQL_FN_STR_INSERT 0x00000002L
|
||||||
|
#define SQL_FN_STR_LEFT 0x00000004L
|
||||||
|
#define SQL_FN_STR_LTRIM 0x00000008L
|
||||||
|
#define SQL_FN_STR_LENGTH 0x00000010L
|
||||||
|
#define SQL_FN_STR_LOCATE 0x00000020L
|
||||||
|
#define SQL_FN_STR_LCASE 0x00000040L
|
||||||
|
#define SQL_FN_STR_REPEAT 0x00000080L
|
||||||
|
#define SQL_FN_STR_REPLACE 0x00000100L
|
||||||
|
#define SQL_FN_STR_RIGHT 0x00000200L
|
||||||
|
#define SQL_FN_STR_RTRIM 0x00000400L
|
||||||
|
#define SQL_FN_STR_SUBSTRING 0x00000800L
|
||||||
|
#define SQL_FN_STR_UCASE 0x00001000L
|
||||||
|
#define SQL_FN_STR_ASCII 0x00002000L
|
||||||
|
#define SQL_FN_STR_CHAR 0x00004000L
|
||||||
|
#define SQL_FN_STR_DIFFERENCE 0x00008000L
|
||||||
|
#define SQL_FN_STR_LOCATE_2 0x00010000L
|
||||||
|
#define SQL_FN_STR_SOUNDEX 0x00020000L
|
||||||
|
#define SQL_FN_STR_SPACE 0x00040000L
|
||||||
|
#define SQL_FN_STR_BIT_LENGTH 0x00080000L
|
||||||
|
#define SQL_FN_STR_CHAR_LENGTH 0x00100000L
|
||||||
|
#define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L
|
||||||
|
#define SQL_FN_STR_OCTET_LENGTH 0x00400000L
|
||||||
|
#define SQL_FN_STR_POSITION 0x00800000L
|
||||||
|
|
||||||
/* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */
|
#define SQL_FN_TD_NOW 0x00000001L
|
||||||
/* These are also used by SQLGetInfo */
|
#define SQL_FN_TD_CURDATE 0x00000002L
|
||||||
#define SQL_UNSEARCHABLE 0
|
#define SQL_FN_TD_DAYOFMONTH 0x00000004L
|
||||||
#define SQL_LIKE_ONLY 1
|
#define SQL_FN_TD_DAYOFWEEK 0x00000008L
|
||||||
#define SQL_ALL_EXCEPT_LIKE 2
|
#define SQL_FN_TD_DAYOFYEAR 0x00000010L
|
||||||
#define SQL_SEARCHABLE 3
|
#define SQL_FN_TD_MONTH 0x00000020L
|
||||||
#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE
|
#define SQL_FN_TD_QUARTER 0x00000040L
|
||||||
|
#define SQL_FN_TD_WEEK 0x00000080L
|
||||||
|
#define SQL_FN_TD_YEAR 0x00000100L
|
||||||
|
#define SQL_FN_TD_CURTIME 0x00000200L
|
||||||
|
#define SQL_FN_TD_HOUR 0x00000400L
|
||||||
|
#define SQL_FN_TD_MINUTE 0x00000800L
|
||||||
|
#define SQL_FN_TD_SECOND 0x00001000L
|
||||||
|
#define SQL_FN_TD_TIMESTAMPADD 0x00002000L
|
||||||
|
#define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L
|
||||||
|
#define SQL_FN_TD_DAYNAME 0x00008000L
|
||||||
|
#define SQL_FN_TD_MONTHNAME 0x00010000L
|
||||||
|
#define SQL_FN_TD_CURRENT_DATE 0x00020000L
|
||||||
|
#define SQL_FN_TD_CURRENT_TIME 0x00040000L
|
||||||
|
#define SQL_FN_TD_CURRENT_TIMESTAMP 0x00080000L
|
||||||
|
#define SQL_FN_TD_EXTRACT 0x00100000L
|
||||||
|
|
||||||
/* Special return values for SQLGetData */
|
#define SQL_POS_POSITION 0x00000001L
|
||||||
#define SQL_NO_TOTAL (-4)
|
#define SQL_AT_ADD_COLUMN 0x00000001L
|
||||||
|
#define SQL_AT_DROP_COLUMN 0x00000002L
|
||||||
/* SQL_CORRELATION_NAME values */
|
|
||||||
|
|
||||||
#define SQL_CN_NONE 0x0000
|
|
||||||
#define SQL_CN_DIFFERENT 0x0001
|
|
||||||
#define SQL_CN_ANY 0x0002
|
|
||||||
|
|
||||||
/* SQL_NULL_COLLATION values */
|
|
||||||
|
|
||||||
#define SQL_NC_HIGH 0
|
|
||||||
#define SQL_NC_LOW 1
|
|
||||||
#define SQL_NC_START 0x0002
|
|
||||||
#define SQL_NC_END 0x0004
|
|
||||||
|
|
||||||
/* SQL_GROUP_BY values */
|
|
||||||
|
|
||||||
#define SQL_GB_NOT_SUPPORTED 0x0000
|
|
||||||
#define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001
|
|
||||||
#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002
|
|
||||||
#define SQL_GB_NO_RELATION 0x0003
|
#define SQL_GB_NO_RELATION 0x0003
|
||||||
|
#define SQL_BIND_BY_COLUMN 0UL
|
||||||
/* SQL_IDENTIFIER_CASE values */
|
#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN /* Default value */
|
||||||
#define SQL_IC_UPPER 1
|
|
||||||
#define SQL_IC_LOWER 2
|
|
||||||
#define SQL_IC_SENSITIVE 3
|
|
||||||
#define SQL_IC_MIXED 4
|
|
||||||
|
|
||||||
/* SQL_ODBC_SQL_CONFORMANCE values */
|
|
||||||
|
|
||||||
#define SQL_OSC_MINIMUM 0x0000
|
|
||||||
#define SQL_OSC_CORE 0x0001
|
|
||||||
#define SQL_OSC_EXTENDED 0x0002
|
|
||||||
|
|
||||||
/* SQL_SCROLL_OPTIONS masks */
|
|
||||||
|
|
||||||
#define SQL_SO_FORWARD_ONLY 0x00000001L
|
|
||||||
#define SQL_SO_KEYSET_DRIVEN 0x00000002L
|
|
||||||
#define SQL_SO_DYNAMIC 0x00000004L
|
|
||||||
#define SQL_SO_MIXED 0x00000008L
|
|
||||||
#define SQL_SO_STATIC 0x00000010L
|
|
||||||
|
|
||||||
/* SQL_TXN_CAPABLE values */
|
|
||||||
|
|
||||||
#define SQL_TC_NONE 0
|
|
||||||
#define SQL_TC_DML 1
|
|
||||||
#define SQL_TC_ALL 2
|
|
||||||
#define SQL_TC_DDL_COMMIT 3
|
|
||||||
#define SQL_TC_DDL_IGNORE 4
|
|
||||||
|
|
||||||
/* SQL_ALTER_TABLE bitmasks */
|
|
||||||
|
|
||||||
#if (ODBCVER >= 0x0200)
|
|
||||||
#define SQL_AT_ADD_COLUMN 0x00000001L
|
|
||||||
#define SQL_AT_DROP_COLUMN 0x00000002L
|
|
||||||
#endif /* ODBCVER >= 0x0200 */
|
|
||||||
|
|
||||||
#define SQL_MAX_USER_NAME_LEN 107
|
|
||||||
|
|
||||||
/* SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE */
|
|
||||||
|
|
||||||
#define SQL_ATTR_READONLY 0
|
#define SQL_ATTR_READONLY 0
|
||||||
#define SQL_ATTR_WRITE 1
|
#define SQL_FETCH_PREV SQL_FETCH_PRIOR
|
||||||
#define SQL_ATTR_READWRITE_UNKNOWN 2
|
#define SQL_ROW_SUCCESS 0
|
||||||
|
#define SQL_ROW_NOROW 3
|
||||||
|
#define SQL_NOSCAN 2
|
||||||
|
|
||||||
/* SQLExtendedFetch "rgfRowStatus" element values */
|
#define SQL_RD_OFF 0UL
|
||||||
|
#define SQL_RD_ON 1UL
|
||||||
|
#define SQL_RD_DEFAULT SQL_RD_ON
|
||||||
|
|
||||||
#define SQL_ROW_SUCCESS 0
|
#define SQL_NOSCAN_OFF 0UL
|
||||||
#define SQL_ROW_DELETED 1
|
#define SQL_NOSCAN_ON 1UL
|
||||||
#define SQL_ROW_UPDATED 2
|
#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF
|
||||||
#define SQL_ROW_NOROW 3
|
|
||||||
#define SQL_ROW_ADDED 4
|
|
||||||
#define SQL_ROW_ERROR 5
|
|
||||||
|
|
||||||
/* SQL_TIMEDATE_FUNCTIONS */
|
|
||||||
|
|
||||||
#define SQL_FN_TD_NOW 0x00000001L
|
|
||||||
#define SQL_FN_TD_CURTIME 0x00000200L
|
|
@@ -1,188 +0,0 @@
|
|||||||
#ifndef _INTRINSIC_SQL_H
|
|
||||||
# define _INTRINSIC_SQL_H
|
|
||||||
|
|
||||||
#ifndef OS2
|
|
||||||
typedef unsigned char UCHAR;
|
|
||||||
#endif
|
|
||||||
typedef long int SDWORD;
|
|
||||||
typedef short int SWORD;
|
|
||||||
typedef unsigned long int UDWORD;
|
|
||||||
typedef unsigned short int UWORD;
|
|
||||||
|
|
||||||
#ifndef FAR
|
|
||||||
# define FAR
|
|
||||||
#endif
|
|
||||||
#ifndef NEAR
|
|
||||||
# define NEAR
|
|
||||||
#endif
|
|
||||||
#ifndef HANDLE
|
|
||||||
typedef int HANDLE;
|
|
||||||
#endif
|
|
||||||
#ifndef HGLOBAL
|
|
||||||
typedef HANDLE HGLOBAL;
|
|
||||||
#endif
|
|
||||||
#ifndef SQL_INDEX_OTHER
|
|
||||||
#define SQL_INDEX_OTHER 3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef BOOL
|
|
||||||
# define BOOL int
|
|
||||||
# endif
|
|
||||||
# ifndef CHAR
|
|
||||||
# define CHAR char
|
|
||||||
# endif
|
|
||||||
# ifndef FALSE
|
|
||||||
# define FALSE (0 != 0)
|
|
||||||
# endif
|
|
||||||
# ifndef HWND
|
|
||||||
# define HWND int
|
|
||||||
# endif
|
|
||||||
# ifndef SQLHWND
|
|
||||||
# define SQLHWND int
|
|
||||||
# endif
|
|
||||||
# ifndef LONG
|
|
||||||
# define LONG long
|
|
||||||
# endif
|
|
||||||
# ifndef PASCAL
|
|
||||||
# define PASCAL
|
|
||||||
# endif
|
|
||||||
# ifndef SHORT
|
|
||||||
# define SHORT short
|
|
||||||
# endif
|
|
||||||
# ifndef SQL_API
|
|
||||||
# define SQL_API
|
|
||||||
# endif
|
|
||||||
# ifndef SQL_LOCAL_API
|
|
||||||
# define SQL_LOCAL_API
|
|
||||||
# endif
|
|
||||||
# ifndef TRUE
|
|
||||||
# define TRUE (0 == 0)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
typedef struct tagDATE_STRUCT
|
|
||||||
{
|
|
||||||
SWORD year;
|
|
||||||
UWORD month;
|
|
||||||
UWORD day;
|
|
||||||
} DATE_STRUCT;
|
|
||||||
|
|
||||||
typedef struct tagTIME_STRUCT
|
|
||||||
{
|
|
||||||
UWORD hour;
|
|
||||||
UWORD minute;
|
|
||||||
UWORD second;
|
|
||||||
} TIME_STRUCT;
|
|
||||||
|
|
||||||
typedef struct tagTIMESTAMP_STRUCT
|
|
||||||
{
|
|
||||||
SWORD year;
|
|
||||||
UWORD month;
|
|
||||||
UWORD day;
|
|
||||||
UWORD hour;
|
|
||||||
UWORD minute;
|
|
||||||
UWORD second;
|
|
||||||
UDWORD fraction;
|
|
||||||
} TIMESTAMP_STRUCT;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef UCHAR FAR* PTR,
|
|
||||||
FAR* SQLPTR;
|
|
||||||
|
|
||||||
typedef void FAR* HENV,
|
|
||||||
FAR* SQLHENV;
|
|
||||||
typedef void FAR* HDBC,
|
|
||||||
FAR* SQLHDBC;
|
|
||||||
typedef void FAR* HSTMT,
|
|
||||||
FAR* SQLHSTMT;
|
|
||||||
typedef SDWORD SQLINTEGER;
|
|
||||||
typedef signed short RETCODE;
|
|
||||||
typedef UCHAR SQLCHAR;
|
|
||||||
typedef UWORD SQLUSMALLINT;
|
|
||||||
typedef PTR SQLPOINTER;
|
|
||||||
typedef SWORD SQLSMALLINT;
|
|
||||||
typedef UDWORD SQLUINTEGER;
|
|
||||||
|
|
||||||
# ifdef WIN32
|
|
||||||
# define SQL_API __stdcall
|
|
||||||
# else
|
|
||||||
# define SQL_API /* giovanni EXPORT CALLBACK */
|
|
||||||
# endif
|
|
||||||
# ifdef OS2
|
|
||||||
# ifdef BCPP
|
|
||||||
# define _Optlink
|
|
||||||
# define _System _syscall
|
|
||||||
# endif
|
|
||||||
# undef SQL_API
|
|
||||||
# define SQL_API _System
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define ODBCVER 0x0200
|
|
||||||
|
|
||||||
# define SQL_MAX_MESSAGE_LENGTH 512
|
|
||||||
# define SQL_MAX_DSN_LENGTH 32
|
|
||||||
|
|
||||||
/* return code */
|
|
||||||
# define SQL_INVALID_HANDLE (-2)
|
|
||||||
# define SQL_ERROR (-1)
|
|
||||||
# define SQL_SUCCESS 0
|
|
||||||
# define SQL_SUCCESS_WITH_INFO 1
|
|
||||||
# define SQL_NO_DATA_FOUND 100
|
|
||||||
|
|
||||||
/* standard SQL datatypes (agree with ANSI type numbering) */
|
|
||||||
# define SQL_CHAR 1
|
|
||||||
# define SQL_NUMERIC 2
|
|
||||||
# define SQL_DECIMAL 3
|
|
||||||
# define SQL_INTEGER 4
|
|
||||||
# define SQL_SMALLINT 5
|
|
||||||
# define SQL_FLOAT 6
|
|
||||||
# define SQL_REAL 7
|
|
||||||
# define SQL_DOUBLE 8
|
|
||||||
# define SQL_VARCHAR 12
|
|
||||||
|
|
||||||
# define SQL_TYPE_MIN SQL_CHAR
|
|
||||||
# define SQL_TYPE_NULL 0
|
|
||||||
# define SQL_TYPE_MAX SQL_VARCHAR
|
|
||||||
|
|
||||||
/* C to SQL datatype mapping */
|
|
||||||
# define SQL_C_CHAR SQL_CHAR
|
|
||||||
# define SQL_C_LONG SQL_INTEGER
|
|
||||||
# define SQL_C_SHORT SQL_SMALLINT
|
|
||||||
# define SQL_C_FLOAT SQL_REAL
|
|
||||||
# define SQL_C_DOUBLE SQL_DOUBLE
|
|
||||||
# define SQL_C_DEFAULT 99
|
|
||||||
|
|
||||||
# define SQL_NO_NULLS 0
|
|
||||||
# define SQL_NULLABLE 1
|
|
||||||
# define SQL_NULLABLE_UNKNOWN 2
|
|
||||||
|
|
||||||
/* some special length values */
|
|
||||||
# define SQL_NULL_DATA (-1)
|
|
||||||
# define SQL_DATA_AT_EXEC (-2)
|
|
||||||
# define SQL_NTS (-3)
|
|
||||||
|
|
||||||
/* SQLFreeStmt flag values */
|
|
||||||
# define SQL_CLOSE 0
|
|
||||||
# define SQL_DROP 1
|
|
||||||
# define SQL_UNBIND 2
|
|
||||||
# define SQL_RESET_PARAMS 3
|
|
||||||
|
|
||||||
/* SQLTransact flag values */
|
|
||||||
# define SQL_COMMIT 0
|
|
||||||
# define SQL_ROLLBACK 1
|
|
||||||
|
|
||||||
/* SQLColAttributes flag values */
|
|
||||||
# define SQL_COLUMN_COUNT 0
|
|
||||||
# define SQL_COLUMN_LABEL 18
|
|
||||||
# define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
|
|
||||||
# define SQL_COLUMN_DRIVER_START 1000
|
|
||||||
|
|
||||||
# define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
|
|
||||||
|
|
||||||
/* Null handles */
|
|
||||||
# define SQL_NULL_HENV 0
|
|
||||||
# define SQL_NULL_HDBC 0
|
|
||||||
# define SQL_NULL_HSTMT 0
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@@ -1,321 +0,0 @@
|
|||||||
#ifndef _INTRINSIC_SQLEXT_H
|
|
||||||
# define _INTRINSIC_SQLEXT_H
|
|
||||||
|
|
||||||
# include <../iodbc/postgres/isql.h>
|
|
||||||
|
|
||||||
# define SQL_STILL_EXECUTING 2
|
|
||||||
# define SQL_NEED_DATA 99
|
|
||||||
|
|
||||||
/* extend SQL datatypes */
|
|
||||||
# define SQL_DATE 9
|
|
||||||
# define SQL_TIME 10
|
|
||||||
# define SQL_TIMESTAMP 11
|
|
||||||
# define SQL_LONGVARCHAR (-1)
|
|
||||||
# define SQL_BINARY (-2)
|
|
||||||
# define SQL_VARBINARY (-3)
|
|
||||||
# define SQL_LONGVARBINARY (-4)
|
|
||||||
# define SQL_BIGINT (-5)
|
|
||||||
# define SQL_TINYINT (-6)
|
|
||||||
# define SQL_BIT (-7) /* conflict with SQL3 ??? */
|
|
||||||
# define SQL_TYPE_DRIVER_START (-80)
|
|
||||||
|
|
||||||
/* C to SQL datatype mapping */
|
|
||||||
# define SQL_C_DATE SQL_DATE
|
|
||||||
# define SQL_C_TIME SQL_TIME
|
|
||||||
# define SQL_C_TIMESTAMP SQL_TIMESTAMP
|
|
||||||
# define SQL_C_BINARY SQL_BINARY
|
|
||||||
# define SQL_C_BIT SQL_BIT
|
|
||||||
# define SQL_C_TINYINT SQL_TINYINT
|
|
||||||
|
|
||||||
# define SQL_SIGNED_OFFSET (-20)
|
|
||||||
# define SQL_UNSIGNED_OFFSET (-22)
|
|
||||||
|
|
||||||
# define SQL_C_SLONG (SQL_C_LONG + SQL_SIGNED_OFFSET)
|
|
||||||
# define SQL_C_SSHORT (SQL_C_SHORT + SQL_SIGNED_OFFSET)
|
|
||||||
# define SQL_C_STINYINT (SQL_TINYINT + SQL_SIGNED_OFFSET)
|
|
||||||
# define SQL_C_ULONG (SQL_C_LONG + SQL_UNSIGNED_OFFSET)
|
|
||||||
# define SQL_C_USHORT (SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
|
|
||||||
# define SQL_C_UTINYINT (SQL_TINYINT + SQL_UNSIGNED_OFFSET)
|
|
||||||
# define SQL_C_BOOKMARK SQL_C_ULONG
|
|
||||||
|
|
||||||
# if defined(SQL_TYPE_MIN)
|
|
||||||
# undef SQL_TYPE_MIN
|
|
||||||
# define SQL_TYPE_MIN SQL_BIT
|
|
||||||
/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then,
|
|
||||||
* SQL_TYPE_MIN need to be defined as SQL_TINYINT
|
|
||||||
* (i.e. -6).
|
|
||||||
*/
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define SQL_ALL_TYPES 0
|
|
||||||
|
|
||||||
/* SQLDriverConnect flag values */
|
|
||||||
# define SQL_DRIVER_NOPROMPT 0
|
|
||||||
# define SQL_DRIVER_COMPLETE 1
|
|
||||||
# define SQL_DRIVER_PROMPT 2
|
|
||||||
# define SQL_DRIVER_COMPLETE_REQUIRED 3
|
|
||||||
|
|
||||||
/* SQLSetParam extensions */
|
|
||||||
# define SQL_DEFAULT_PARAM (-5)
|
|
||||||
# define SQL_IGNORE (-6)
|
|
||||||
|
|
||||||
/* function number for SQLGetFunctions and _iodbcdm_getproc */
|
|
||||||
# define SQL_API_SQLALLOCCONNECT 1
|
|
||||||
# define SQL_API_SQLALLOCENV 2
|
|
||||||
# define SQL_API_SQLALLOCSTMT 3
|
|
||||||
# define SQL_API_SQLBINDCOL 4
|
|
||||||
# define SQL_API_SQLCANCEL 5
|
|
||||||
# define SQL_API_SQLCOLATTRIBUTES 6
|
|
||||||
# define SQL_API_SQLCONNECT 7
|
|
||||||
# define SQL_API_SQLDESCRIBECOL 8
|
|
||||||
# define SQL_API_SQLDISCONNECT 9
|
|
||||||
# define SQL_API_SQLERROR 10
|
|
||||||
# define SQL_API_SQLEXECDIRECT 11
|
|
||||||
# define SQL_API_SQLEXECUTE 12
|
|
||||||
# define SQL_API_SQLFETCH 13
|
|
||||||
# define SQL_API_SQLFREECONNECT 14
|
|
||||||
# define SQL_API_SQLFREEENV 15
|
|
||||||
# define SQL_API_SQLFREESTMT 16
|
|
||||||
# define SQL_API_SQLGETCURSORNAME 17
|
|
||||||
# define SQL_API_SQLNUMRESULTCOLS 18
|
|
||||||
# define SQL_API_SQLPREPARE 19
|
|
||||||
# define SQL_API_SQLROWCOUNT 20
|
|
||||||
# define SQL_API_SQLSETCURSORNAME 21
|
|
||||||
# define SQL_API_SQLSETPARAM 22
|
|
||||||
# define SQL_API_SQLTRANSACT 23
|
|
||||||
|
|
||||||
# define SQL_NUM_FUNCTIONS 23
|
|
||||||
|
|
||||||
# define SQL_EXT_API_START 40
|
|
||||||
|
|
||||||
# define SQL_API_SQLCOLUMNS 40
|
|
||||||
|
|
||||||
# define SQL_API_SQLDRIVERCONNECT 41
|
|
||||||
# define SQL_API_SQLGETCONNECTOPTION 42
|
|
||||||
# define SQL_API_SQLGETDATA 43
|
|
||||||
# define SQL_API_SQLGETFUNCTIONS 44
|
|
||||||
# define SQL_API_SQLGETINFO 45
|
|
||||||
# define SQL_API_SQLGETSTMTOPTION 46
|
|
||||||
# define SQL_API_SQLGETTYPEINFO 47
|
|
||||||
# define SQL_API_SQLPARAMDATA 48
|
|
||||||
# define SQL_API_SQLPUTDATA 49
|
|
||||||
# define SQL_API_SQLSETCONNECTOPTION 50
|
|
||||||
# define SQL_API_SQLSETSTMTOPTION 51
|
|
||||||
# define SQL_API_SQLSPECIALCOLUMNS 52
|
|
||||||
# define SQL_API_SQLSTATISTICS 53
|
|
||||||
# define SQL_API_SQLTABLES 54
|
|
||||||
|
|
||||||
# define SQL_API_SQLBROWSECONNECT 55
|
|
||||||
# define SQL_API_SQLCOLUMNPRIVILEGES 56
|
|
||||||
# define SQL_API_SQLDATASOURCES 57
|
|
||||||
# define SQL_API_SQLDESCRIBEPARAM 58
|
|
||||||
# define SQL_API_SQLEXTENDEDFETCH 59
|
|
||||||
# define SQL_API_SQLFOREIGNKEYS 60
|
|
||||||
# define SQL_API_SQLMORERESULTS 61
|
|
||||||
# define SQL_API_SQLNATIVESQL 62
|
|
||||||
# define SQL_API_SQLNUMPARAMS 63
|
|
||||||
# define SQL_API_SQLPARAMOPTIONS 64
|
|
||||||
# define SQL_API_SQLPRIMARYKEYS 65
|
|
||||||
# define SQL_API_SQLPROCEDURECOLUMNS 66
|
|
||||||
# define SQL_API_SQLPROCEDURES 67
|
|
||||||
# define SQL_API_SQLSETPOS 68
|
|
||||||
# define SQL_API_SQLSETSCROLLOPTIONS 69
|
|
||||||
# define SQL_API_SQLTABLEPRIVILEGES 70
|
|
||||||
|
|
||||||
# define SQL_API_SQLDRIVERS 71
|
|
||||||
# define SQL_API_SQLBINDPARAMETER 72
|
|
||||||
# define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER
|
|
||||||
|
|
||||||
# define SQL_API_ALL_FUNCTIONS 0
|
|
||||||
|
|
||||||
/* SQLGetInfo infor number */
|
|
||||||
# define SQL_INFO_FIRST 0
|
|
||||||
# define SQL_DRIVER_HDBC 3
|
|
||||||
# define SQL_DRIVER_HENV 4
|
|
||||||
# define SQL_DRIVER_HSTMT 5
|
|
||||||
# define SQL_DRIVER_NAME 6
|
|
||||||
# define SQL_ODBC_VER 10
|
|
||||||
# define SQL_CURSOR_COMMIT_BEHAVIOR 23
|
|
||||||
# define SQL_CURSOR_ROLLBACK_BEHAVIOR 24
|
|
||||||
# define SQL_DEFAULT_TXN_ISOLATION 26
|
|
||||||
|
|
||||||
# define SQL_TXN_ISOLATION_OPTION 72
|
|
||||||
# define SQL_NON_NULLABLE_COLUMNS 75
|
|
||||||
|
|
||||||
# define SQL_DRIVER_HLIB 76
|
|
||||||
# define SQL_DRIVER_ODBC_VER 77
|
|
||||||
|
|
||||||
# define SQL_QUALIFIER_LOCATION 114
|
|
||||||
|
|
||||||
# define SQL_INFO_LAST SQL_QUALIFIER_LOCATION
|
|
||||||
|
|
||||||
# define SQL_INFO_DRIVER_START 1000
|
|
||||||
|
|
||||||
|
|
||||||
/* SQL_TXN_ISOLATION_OPTION masks */
|
|
||||||
# define SQL_TXN_READ_UNCOMMITTED 0x00000001L
|
|
||||||
# define SQL_TXN_READ_COMMITTED 0x00000002L
|
|
||||||
# define SQL_TXN_REPEATABLE_READ 0x00000004L
|
|
||||||
# define SQL_TXN_SERIALIZABLE 0x00000008L
|
|
||||||
# define SQL_TXN_VERSIONING 0x00000010L
|
|
||||||
|
|
||||||
/* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */
|
|
||||||
|
|
||||||
# define SQL_CB_DELETE 0x0000
|
|
||||||
# define SQL_CB_CLOSE 0x0001
|
|
||||||
# define SQL_CB_PRESERVE 0x0002
|
|
||||||
|
|
||||||
/* options for SQLGetStmtOption/SQLSetStmtOption */
|
|
||||||
# define SQL_QUERY_TIMEOUT 0
|
|
||||||
# define SQL_MAX_ROWS 1
|
|
||||||
# define SQL_NOSCAN 2
|
|
||||||
# define SQL_MAX_LENGTH 3
|
|
||||||
# define SQL_ASYNC_ENABLE 4
|
|
||||||
# define SQL_BIND_TYPE 5
|
|
||||||
# define SQL_CURSOR_TYPE 6
|
|
||||||
# define SQL_CONCURRENCY 7
|
|
||||||
# define SQL_KEYSET_SIZE 8
|
|
||||||
# define SQL_ROWSET_SIZE 9
|
|
||||||
# define SQL_SIMULATE_CURSOR 10
|
|
||||||
# define SQL_RETRIEVE_DATA 11
|
|
||||||
# define SQL_USE_BOOKMARKS 12
|
|
||||||
# define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */
|
|
||||||
# define SQL_ROW_NUMBER 14 /* GetStmtOption Only */
|
|
||||||
# define SQL_STMT_OPT_MAX SQL_ROW_NUMBER
|
|
||||||
|
|
||||||
# define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT
|
|
||||||
|
|
||||||
|
|
||||||
/* SQL_QUERY_TIMEOUT options */
|
|
||||||
# define SQL_QUERY_TIMEOUT_DEFAULT 0UL
|
|
||||||
|
|
||||||
/* SQL_MAX_ROWS options */
|
|
||||||
# define SQL_MAX_ROWS_DEFAULT 0UL
|
|
||||||
|
|
||||||
/* SQL_MAX_LENGTH options */
|
|
||||||
# define SQL_MAX_LENGTH_DEFAULT 0UL
|
|
||||||
|
|
||||||
/* SQL_CONCURRENCY options */
|
|
||||||
# define SQL_CONCUR_READ_ONLY 1
|
|
||||||
# define SQL_CONCUR_LOCK 2
|
|
||||||
# define SQL_CONCUR_ROWVER 3
|
|
||||||
# define SQL_CONCUR_VALUES 4
|
|
||||||
|
|
||||||
/* options for SQLSetConnectOption/SQLGetConnectOption */
|
|
||||||
# define SQL_ACCESS_MODE 101
|
|
||||||
# define SQL_AUTOCOMMIT 102
|
|
||||||
# define SQL_LOGIN_TIMEOUT 103
|
|
||||||
# define SQL_OPT_TRACE 104
|
|
||||||
# define SQL_OPT_TRACEFILE 105
|
|
||||||
# define SQL_TRANSLATE_DLL 106
|
|
||||||
# define SQL_TRANSLATE_OPTION 107
|
|
||||||
# define SQL_TXN_ISOLATION 108
|
|
||||||
# define SQL_CURRENT_QUALIFIER 109
|
|
||||||
# define SQL_ODBC_CURSORS 110
|
|
||||||
# define SQL_QUIET_MODE 111
|
|
||||||
# define SQL_PACKET_SIZE 112
|
|
||||||
# define SQL_CONN_OPT_MAX SQL_PACKET_SIZE
|
|
||||||
# define SQL_CONNECT_OPT_DRVR_START 1000
|
|
||||||
|
|
||||||
# define SQL_CONN_OPT_MIN SQL_ACCESS_MODE
|
|
||||||
|
|
||||||
/* SQL_ACCESS_MODE options */
|
|
||||||
# define SQL_MODE_READ_WRITE 0UL
|
|
||||||
# define SQL_MODE_READ_ONLY 1UL
|
|
||||||
# define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE
|
|
||||||
|
|
||||||
/* SQL_AUTOCOMMIT options */
|
|
||||||
# define SQL_AUTOCOMMIT_OFF 0UL
|
|
||||||
# define SQL_AUTOCOMMIT_ON 1UL
|
|
||||||
# define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON
|
|
||||||
|
|
||||||
/* SQL_LOGIN_TIMEOUT options */
|
|
||||||
# define SQL_LOGIN_TIMEOUT_DEFAULT 15UL
|
|
||||||
|
|
||||||
/* SQL_OPT_TRACE options */
|
|
||||||
# define SQL_OPT_TRACE_OFF 0UL
|
|
||||||
# define SQL_OPT_TRACE_ON 1UL
|
|
||||||
# define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF
|
|
||||||
# define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log"
|
|
||||||
|
|
||||||
/* SQL_ODBC_CURSORS options */
|
|
||||||
# define SQL_CUR_USE_IF_NEEDED 0UL
|
|
||||||
# define SQL_CUR_USE_ODBC 1UL
|
|
||||||
# define SQL_CUR_USE_DRIVER 2UL
|
|
||||||
# define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER
|
|
||||||
|
|
||||||
/* Column types and scopes in SQLSpecialColumns. */
|
|
||||||
# define SQL_BEST_ROWID 1
|
|
||||||
# define SQL_ROWVER 2
|
|
||||||
|
|
||||||
# define SQL_SCOPE_CURROW 0
|
|
||||||
# define SQL_SCOPE_TRANSACTION 1
|
|
||||||
# define SQL_SCOPE_SESSION 2
|
|
||||||
|
|
||||||
/* Operations in SQLSetPos */
|
|
||||||
# define SQL_ADD 4
|
|
||||||
|
|
||||||
/* Lock options in SQLSetPos */
|
|
||||||
# define SQL_LOCK_NO_CHANGE 0
|
|
||||||
# define SQL_LOCK_EXCLUSIVE 1
|
|
||||||
# define SQL_LOCK_UNLOCK 2
|
|
||||||
|
|
||||||
/* SQLExtendedFetch flag values */
|
|
||||||
# define SQL_FETCH_NEXT 1
|
|
||||||
# define SQL_FETCH_FIRST 2
|
|
||||||
# define SQL_FETCH_LAST 3
|
|
||||||
# define SQL_FETCH_PRIOR 4
|
|
||||||
# define SQL_FETCH_ABSOLUTE 5
|
|
||||||
# define SQL_FETCH_RELATIVE 6
|
|
||||||
# define SQL_FETCH_BOOKMARK 8
|
|
||||||
|
|
||||||
/* Defines for SQLBindParameter/SQLProcedureColumns */
|
|
||||||
# define SQL_PARAM_TYPE_UNKNOWN 0
|
|
||||||
# define SQL_PARAM_INPUT 1
|
|
||||||
# define SQL_PARAM_INPUT_OUTPUT 2
|
|
||||||
# define SQL_RESULT_COL 3
|
|
||||||
# define SQL_PARAM_OUTPUT 4
|
|
||||||
|
|
||||||
/* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */
|
|
||||||
# define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT
|
|
||||||
# define SQL_SETPARAM_VALUE_MAX (-1L)
|
|
||||||
|
|
||||||
/* SQLStatistics flag values */
|
|
||||||
# define SQL_INDEX_UNIQUE 0
|
|
||||||
# define SQL_INDEX_ALL 1
|
|
||||||
|
|
||||||
# define SQL_QUICK 0
|
|
||||||
# define SQL_ENSURE 1
|
|
||||||
|
|
||||||
/* SQLSetScrollOption flag values */
|
|
||||||
# define SQL_SCROLL_FORWARD_ONLY 0L
|
|
||||||
# define SQL_SCROLL_KEYSET_DRIVEN (-1L)
|
|
||||||
# define SQL_SCROLL_DYNAMIC (-2L)
|
|
||||||
# define SQL_SCROLL_STATIC (-3L)
|
|
||||||
|
|
||||||
# if defined(__cplusplus) || defined(__IBMCPP__)
|
|
||||||
extern "C" {
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
/* SQL CONVERT_FUNCTIONS function */
|
|
||||||
#define SQL_FN_CVT_CONVERT 0x00000001L
|
|
||||||
|
|
||||||
/* SQL_SUBQUERIES masks */
|
|
||||||
|
|
||||||
#define SQL_SQ_COMPARISON 0x00000001L
|
|
||||||
#define SQL_SQ_EXISTS 0x00000002L
|
|
||||||
#define SQL_SQ_IN 0x00000004L
|
|
||||||
#define SQL_SQ_QUANTIFIED 0x00000008L
|
|
||||||
#define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD);
|
|
||||||
RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* );
|
|
||||||
|
|
||||||
# if defined(__cplusplus) || defined(__IBMCPP__)
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,6 +1,6 @@
|
|||||||
/** Prepare a query
|
/** Prepare a query
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,511 +27,512 @@
|
|||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
#include <../iodbc/itrace.h>
|
||||||
|
|
||||||
RETCODE SQL_API SQLPrepare (
|
|
||||||
HSTMT hstmt,
|
RETCODE SQL_API SQLPrepare (
|
||||||
UCHAR FAR* szSqlStr,
|
HSTMT hstmt,
|
||||||
SDWORD cbSqlStr )
|
UCHAR FAR* szSqlStr,
|
||||||
|
SDWORD cbSqlStr )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t*)hstmt;
|
||||||
|
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
|
||||||
|
|
||||||
/* check state */
|
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
|
||||||
{
|
|
||||||
/* not on asyn state */
|
|
||||||
switch( pstmt->state )
|
|
||||||
{
|
|
||||||
case en_stmt_fetched:
|
|
||||||
case en_stmt_xfetched:
|
|
||||||
sqlstat = en_24000;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case en_stmt_needdata:
|
|
||||||
case en_stmt_mustput:
|
|
||||||
case en_stmt_canput:
|
|
||||||
sqlstat = en_S1010;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( pstmt->asyn_on != en_Prepare )
|
|
||||||
{
|
|
||||||
/* asyn on other */
|
|
||||||
sqlstat = en_S1010;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( szSqlStr == NULL )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_Prepare );
|
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Prepare, (
|
|
||||||
pstmt->dhstmt, szSqlStr, cbSqlStr) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* stmt state transition */
|
|
||||||
if( pstmt->asyn_on == en_Prepare )
|
|
||||||
{
|
|
||||||
switch( retcode )
|
|
||||||
{
|
|
||||||
case SQL_SUCCESS:
|
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
|
||||||
case SQL_ERROR:
|
|
||||||
pstmt->asyn_on = en_NullProc;
|
|
||||||
return retcode;
|
|
||||||
|
|
||||||
case SQL_STILL_EXECUTING:
|
|
||||||
default:
|
|
||||||
return retcode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( retcode )
|
|
||||||
{
|
|
||||||
case SQL_STILL_EXECUTING:
|
|
||||||
pstmt->asyn_on = en_Prepare;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SQL_SUCCESS:
|
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
|
||||||
pstmt->state = en_stmt_prepared;
|
|
||||||
pstmt->prep_state = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SQL_ERROR:
|
|
||||||
switch( pstmt->state )
|
|
||||||
{
|
|
||||||
case en_stmt_prepared:
|
|
||||||
case en_stmt_executed:
|
|
||||||
pstmt->state = en_stmt_allocated;
|
|
||||||
pstmt->prep_state = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetCursorName (
|
|
||||||
HSTMT hstmt,
|
|
||||||
UCHAR FAR* szCursor,
|
|
||||||
SWORD cbCursor )
|
|
||||||
{
|
|
||||||
STMT_t FAR* pstmt = (STMT_t*)hstmt;
|
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
|
||||||
|
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
|
||||||
int sqlstat = en_00000;
|
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
|
||||||
return SQL_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( szCursor == NULL )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( cbCursor < 0 && cbCursor != SQL_NTS )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check state */
|
|
||||||
if( pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
|
||||||
sqlstat = en_S1010;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch( pstmt->state )
|
|
||||||
{
|
|
||||||
case en_stmt_executed:
|
|
||||||
case en_stmt_cursoropen:
|
|
||||||
case en_stmt_fetched:
|
|
||||||
case en_stmt_xfetched:
|
|
||||||
sqlstat = en_24000;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case en_stmt_needdata:
|
|
||||||
case en_stmt_mustput:
|
|
||||||
case en_stmt_canput:
|
|
||||||
sqlstat = en_S1010;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetCursorName);
|
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetCursorName, (
|
|
||||||
pstmt->dhstmt, szCursor, cbCursor ) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, szCursor, cbCursor );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( retcode == SQL_SUCCESS
|
|
||||||
|| retcode == SQL_SUCCESS_WITH_INFO )
|
|
||||||
{
|
|
||||||
pstmt->cursor_state = en_stmt_cursor_named;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLBindParameter (
|
|
||||||
HSTMT hstmt,
|
|
||||||
UWORD ipar,
|
|
||||||
SWORD fParamType,
|
|
||||||
SWORD fCType,
|
|
||||||
SWORD fSqlType,
|
|
||||||
UDWORD cbColDef,
|
|
||||||
SWORD ibScale,
|
|
||||||
PTR rgbValue,
|
|
||||||
SDWORD cbValueMax,
|
|
||||||
SDWORD FAR* pcbValue )
|
|
||||||
{
|
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
|
||||||
|
|
||||||
int sqlstat = en_00000;
|
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
|
||||||
return SQL_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check param */
|
|
||||||
if( fSqlType > SQL_TYPE_MAX
|
|
||||||
|| ( fSqlType < SQL_TYPE_MIN
|
|
||||||
&& fSqlType > SQL_TYPE_DRIVER_START ) )
|
|
||||||
/* Note: SQL_TYPE_DRIVER_START is a nagtive number
|
|
||||||
* So, we use ">" */
|
|
||||||
{
|
|
||||||
sqlstat = en_S1004;
|
|
||||||
}
|
|
||||||
else if ( ipar < 1 )
|
|
||||||
{
|
|
||||||
sqlstat = en_S1093;
|
|
||||||
}
|
|
||||||
else if( (rgbValue == NULL && pcbValue == NULL)
|
|
||||||
&& fParamType != SQL_PARAM_OUTPUT )
|
|
||||||
{
|
|
||||||
sqlstat = en_S1009;
|
|
||||||
/* This means, I allow output to nowhere
|
|
||||||
* (i.e. * junk output result). But I can't
|
|
||||||
* allow input from nowhere.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
/**********
|
|
||||||
else if( cbValueMax < 0L && cbValueMax != SQL_SETPARAM_VALUE_MAX )
|
|
||||||
{
|
|
||||||
sqlstat = en_S1090;
|
|
||||||
}
|
|
||||||
**********/
|
|
||||||
else if( fParamType != SQL_PARAM_INPUT
|
|
||||||
&& fParamType != SQL_PARAM_OUTPUT
|
|
||||||
&& fParamType != SQL_PARAM_INPUT_OUTPUT )
|
|
||||||
{
|
|
||||||
sqlstat = en_S1105;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
switch( fCType )
|
|
||||||
{
|
|
||||||
case SQL_C_DEFAULT:
|
|
||||||
case SQL_C_CHAR:
|
|
||||||
case SQL_C_BINARY:
|
|
||||||
case SQL_C_BIT:
|
|
||||||
case SQL_C_TINYINT:
|
|
||||||
case SQL_C_STINYINT:
|
|
||||||
case SQL_C_UTINYINT:
|
|
||||||
case SQL_C_SHORT:
|
|
||||||
case SQL_C_SSHORT:
|
|
||||||
case SQL_C_USHORT:
|
|
||||||
case SQL_C_LONG:
|
|
||||||
case SQL_C_SLONG:
|
|
||||||
case SQL_C_ULONG:
|
|
||||||
case SQL_C_FLOAT:
|
|
||||||
case SQL_C_DOUBLE:
|
|
||||||
case SQL_C_DATE:
|
|
||||||
case SQL_C_TIME:
|
|
||||||
case SQL_C_TIMESTAMP:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
/* check state */
|
||||||
sqlstat = en_S1003;
|
if( pstmt->asyn_on == en_NullProc )
|
||||||
break;
|
{
|
||||||
}
|
/* not on asyn state */
|
||||||
}
|
switch( pstmt->state )
|
||||||
|
{
|
||||||
|
case en_stmt_fetched:
|
||||||
|
case en_stmt_xfetched:
|
||||||
|
sqlstat = en_24000;
|
||||||
|
break;
|
||||||
|
|
||||||
if(sqlstat != en_00000 )
|
case en_stmt_needdata:
|
||||||
{
|
case en_stmt_mustput:
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
case en_stmt_canput:
|
||||||
|
sqlstat = en_S1010;
|
||||||
|
break;
|
||||||
|
|
||||||
return SQL_ERROR;
|
default:
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( pstmt->asyn_on != en_Prepare )
|
||||||
|
{
|
||||||
|
/* asyn on other */
|
||||||
|
sqlstat = en_S1010;
|
||||||
|
}
|
||||||
|
|
||||||
/* check state */
|
if( sqlstat != en_00000 )
|
||||||
if( pstmt->state >= en_stmt_needdata
|
{
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
|
||||||
|
|
||||||
retcode = SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindParameter );
|
if( szSqlStr == NULL )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
return SQL_ERROR;
|
||||||
{
|
}
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
|
||||||
}
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindParameter, (
|
return SQL_ERROR;
|
||||||
pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
|
}
|
||||||
cbColDef, ibScale, rgbValue, cbValueMax, pcbValue ) )
|
|
||||||
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_Prepare );
|
||||||
|
|
||||||
|
if( hproc == SQL_NULL_HPROC )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Prepare, (
|
||||||
|
pstmt->dhstmt, szSqlStr, cbSqlStr) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
|
retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
|
||||||
cbColDef, ibScale, rgbValue, cbValueMax, pcbValue );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retcode;
|
/* stmt state transition */
|
||||||
|
if( pstmt->asyn_on == en_Prepare )
|
||||||
|
{
|
||||||
|
switch( retcode )
|
||||||
|
{
|
||||||
|
case SQL_SUCCESS:
|
||||||
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
|
case SQL_ERROR:
|
||||||
|
pstmt->asyn_on = en_NullProc;
|
||||||
|
return retcode;
|
||||||
|
|
||||||
|
case SQL_STILL_EXECUTING:
|
||||||
|
default:
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( retcode )
|
||||||
|
{
|
||||||
|
case SQL_STILL_EXECUTING:
|
||||||
|
pstmt->asyn_on = en_Prepare;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SQL_SUCCESS:
|
||||||
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
|
pstmt->state = en_stmt_prepared;
|
||||||
|
pstmt->prep_state = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SQL_ERROR:
|
||||||
|
switch( pstmt->state )
|
||||||
|
{
|
||||||
|
case en_stmt_prepared:
|
||||||
|
case en_stmt_executed:
|
||||||
|
pstmt->state = en_stmt_allocated;
|
||||||
|
pstmt->prep_state = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
RETCODE SQL_API SQLSetCursorName (
|
||||||
|
HSTMT hstmt,
|
||||||
|
UCHAR FAR* szCursor,
|
||||||
|
SWORD cbCursor )
|
||||||
|
{
|
||||||
|
STMT_t FAR* pstmt = (STMT_t*)hstmt;
|
||||||
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
|
{
|
||||||
|
return SQL_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( szCursor == NULL )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
||||||
|
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cbCursor < 0 && cbCursor != SQL_NTS )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
||||||
|
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check state */
|
||||||
|
if( pstmt->asyn_on != en_NullProc )
|
||||||
|
{
|
||||||
|
sqlstat = en_S1010;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch( pstmt->state )
|
||||||
|
{
|
||||||
|
case en_stmt_executed:
|
||||||
|
case en_stmt_cursoropen:
|
||||||
|
case en_stmt_fetched:
|
||||||
|
case en_stmt_xfetched:
|
||||||
|
sqlstat = en_24000;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case en_stmt_needdata:
|
||||||
|
case en_stmt_mustput:
|
||||||
|
case en_stmt_canput:
|
||||||
|
sqlstat = en_S1010;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( sqlstat != en_00000 )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
|
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetCursorName);
|
||||||
|
|
||||||
|
if( hproc == SQL_NULL_HPROC )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetCursorName, (
|
||||||
|
pstmt->dhstmt, szCursor, cbCursor ) )
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
retcode = hproc ( pstmt->dhstmt, szCursor, cbCursor );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( retcode == SQL_SUCCESS
|
||||||
|
|| retcode == SQL_SUCCESS_WITH_INFO )
|
||||||
|
{
|
||||||
|
pstmt->cursor_state = en_stmt_cursor_named;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
RETCODE SQL_API SQLBindParameter (
|
||||||
|
HSTMT hstmt,
|
||||||
|
UWORD ipar,
|
||||||
|
SWORD fParamType,
|
||||||
|
SWORD fCType,
|
||||||
|
SWORD fSqlType,
|
||||||
|
UDWORD cbColDef,
|
||||||
|
SWORD ibScale,
|
||||||
|
PTR rgbValue,
|
||||||
|
SDWORD cbValueMax,
|
||||||
|
SDWORD FAR* pcbValue )
|
||||||
|
{
|
||||||
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
|
int sqlstat = en_00000;
|
||||||
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
|
{
|
||||||
|
return SQL_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check param */
|
||||||
|
if( fSqlType > SQL_TYPE_MAX
|
||||||
|
|| ( fSqlType < SQL_TYPE_MIN
|
||||||
|
&& fSqlType > SQL_TYPE_DRIVER_START ) )
|
||||||
|
/* Note: SQL_TYPE_DRIVER_START is a nagtive number
|
||||||
|
* So, we use ">" */
|
||||||
|
{
|
||||||
|
sqlstat = en_S1004;
|
||||||
|
}
|
||||||
|
else if ( ipar < 1 )
|
||||||
|
{
|
||||||
|
sqlstat = en_S1093;
|
||||||
|
}
|
||||||
|
else if( (rgbValue == NULL && pcbValue == NULL)
|
||||||
|
&& fParamType != SQL_PARAM_OUTPUT )
|
||||||
|
{
|
||||||
|
sqlstat = en_S1009;
|
||||||
|
/* This means, I allow output to nowhere
|
||||||
|
* (i.e. * junk output result). But I can't
|
||||||
|
* allow input from nowhere.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
/**********
|
||||||
|
else if( cbValueMax < 0L && cbValueMax != SQL_SETPARAM_VALUE_MAX )
|
||||||
|
{
|
||||||
|
sqlstat = en_S1090;
|
||||||
|
}
|
||||||
|
**********/
|
||||||
|
else if( fParamType != SQL_PARAM_INPUT
|
||||||
|
&& fParamType != SQL_PARAM_OUTPUT
|
||||||
|
&& fParamType != SQL_PARAM_INPUT_OUTPUT )
|
||||||
|
{
|
||||||
|
sqlstat = en_S1105;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch( fCType )
|
||||||
|
{
|
||||||
|
case SQL_C_DEFAULT:
|
||||||
|
case SQL_C_CHAR:
|
||||||
|
case SQL_C_BINARY:
|
||||||
|
case SQL_C_BIT:
|
||||||
|
case SQL_C_TINYINT:
|
||||||
|
case SQL_C_STINYINT:
|
||||||
|
case SQL_C_UTINYINT:
|
||||||
|
case SQL_C_SHORT:
|
||||||
|
case SQL_C_SSHORT:
|
||||||
|
case SQL_C_USHORT:
|
||||||
|
case SQL_C_LONG:
|
||||||
|
case SQL_C_SLONG:
|
||||||
|
case SQL_C_ULONG:
|
||||||
|
case SQL_C_FLOAT:
|
||||||
|
case SQL_C_DOUBLE:
|
||||||
|
case SQL_C_DATE:
|
||||||
|
case SQL_C_TIME:
|
||||||
|
case SQL_C_TIMESTAMP:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
sqlstat = en_S1003;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sqlstat != en_00000 )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
|
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check state */
|
||||||
|
if( pstmt->state >= en_stmt_needdata
|
||||||
|
|| pstmt->asyn_on != en_NullProc )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
||||||
|
|
||||||
|
retcode = SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindParameter );
|
||||||
|
|
||||||
|
if( hproc == SQL_NULL_HPROC )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindParameter, (
|
||||||
|
pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
|
||||||
|
cbColDef, ibScale, rgbValue, cbValueMax, pcbValue ) )
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
retcode = hproc(pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
|
||||||
|
cbColDef, ibScale, rgbValue, cbValueMax, pcbValue );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLParamOptions(
|
RETCODE SQL_API SQLParamOptions(
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UDWORD crow,
|
UDWORD crow,
|
||||||
UDWORD FAR* pirow )
|
UDWORD FAR* pirow )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( crow == (UDWORD)0UL )
|
if( crow == (UDWORD)0UL )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1107 );
|
PUSHSQLERR ( pstmt->herr, en_S1107 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if( pstmt->state >= en_stmt_needdata
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|| pstmt->asyn_on != en_NullProc )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc ( pstmt->hdbc, en_ParamOptions );
|
hproc = _iodbcdm_getproc ( pstmt->hdbc, en_ParamOptions );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamOptions, (
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamOptions, (
|
||||||
pstmt->dhstmt, crow, pirow) )
|
pstmt->dhstmt, crow, pirow) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc ( pstmt->dhstmt, crow, pirow );
|
retcode = hproc ( pstmt->dhstmt, crow, pirow );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetScrollOptions(
|
RETCODE SQL_API SQLSetScrollOptions(
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD fConcurrency,
|
UWORD fConcurrency,
|
||||||
SDWORD crowKeyset,
|
SDWORD crowKeyset,
|
||||||
UWORD crowRowset )
|
UWORD crowRowset )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
|
||||||
return SQL_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(;;)
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
{
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
if( crowRowset == (UWORD)0 )
|
{
|
||||||
{
|
return SQL_INVALID_HANDLE;
|
||||||
sqlstat = en_S1107;
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( crowKeyset > (SDWORD)0L && crowKeyset < (SDWORD)crowRowset )
|
for(;;)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1107;
|
if( crowRowset == (UWORD)0 )
|
||||||
break;
|
{
|
||||||
}
|
sqlstat = en_S1107;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if( crowKeyset < 1 )
|
if( crowKeyset > (SDWORD)0L && crowKeyset < (SDWORD)crowRowset )
|
||||||
{
|
{
|
||||||
if( crowKeyset != SQL_SCROLL_FORWARD_ONLY
|
sqlstat = en_S1107;
|
||||||
&& crowKeyset != SQL_SCROLL_STATIC
|
break;
|
||||||
&& crowKeyset != SQL_SCROLL_KEYSET_DRIVEN
|
}
|
||||||
&& crowKeyset != SQL_SCROLL_DYNAMIC )
|
|
||||||
{
|
|
||||||
sqlstat = en_S1107;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( fConcurrency != SQL_CONCUR_READ_ONLY
|
|
||||||
&& fConcurrency != SQL_CONCUR_LOCK
|
|
||||||
&& fConcurrency != SQL_CONCUR_ROWVER
|
|
||||||
&& fConcurrency != SQL_CONCUR_VALUES )
|
|
||||||
{
|
|
||||||
sqlstat = en_S1108;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pstmt->state != en_stmt_allocated )
|
if( crowKeyset < 1 )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
if( crowKeyset != SQL_SCROLL_FORWARD_ONLY
|
||||||
break;
|
&& crowKeyset != SQL_SCROLL_STATIC
|
||||||
}
|
&& crowKeyset != SQL_SCROLL_KEYSET_DRIVEN
|
||||||
|
&& crowKeyset != SQL_SCROLL_DYNAMIC )
|
||||||
|
{
|
||||||
|
sqlstat = en_S1107;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetScrollOptions );
|
if( fConcurrency != SQL_CONCUR_READ_ONLY
|
||||||
|
&& fConcurrency != SQL_CONCUR_LOCK
|
||||||
|
&& fConcurrency != SQL_CONCUR_ROWVER
|
||||||
|
&& fConcurrency != SQL_CONCUR_VALUES )
|
||||||
|
{
|
||||||
|
sqlstat = en_S1108;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( pstmt->state != en_stmt_allocated )
|
||||||
{
|
{
|
||||||
sqlstat = en_IM001;
|
sqlstat = en_S1010;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlstat = en_00000;
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetScrollOptions );
|
||||||
if( 1 ) /* turn off solaris warning message */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
sqlstat = en_IM001;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return SQL_ERROR;
|
sqlstat = en_00000;
|
||||||
}
|
if( 1 ) /* turn off solaris warning message */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetScrollOptions, (
|
if( sqlstat != en_00000 )
|
||||||
pstmt->dhstmt,
|
{
|
||||||
fConcurrency,
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
crowKeyset,
|
|
||||||
crowRowset ) )
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetScrollOptions, (
|
||||||
|
pstmt->dhstmt,
|
||||||
|
fConcurrency,
|
||||||
|
crowKeyset,
|
||||||
|
crowRowset ) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(pstmt->dhstmt,
|
retcode = hproc(pstmt->dhstmt,
|
||||||
fConcurrency,
|
fConcurrency,
|
||||||
crowKeyset,
|
crowKeyset,
|
||||||
crowRowset );
|
crowRowset );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetParam (
|
RETCODE SQL_API SQLSetParam (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD ipar,
|
UWORD ipar,
|
||||||
SWORD fCType,
|
SWORD fCType,
|
||||||
SWORD fSqlType,
|
SWORD fSqlType,
|
||||||
UDWORD cbColDef,
|
UDWORD cbColDef,
|
||||||
SWORD ibScale,
|
SWORD ibScale,
|
||||||
PTR rgbValue,
|
PTR rgbValue,
|
||||||
SDWORD FAR *pcbValue)
|
SDWORD FAR *pcbValue)
|
||||||
{
|
{
|
||||||
return SQLBindParameter(hstmt,
|
return SQLBindParameter(hstmt,
|
||||||
ipar,
|
ipar,
|
||||||
(SWORD)SQL_PARAM_INPUT_OUTPUT,
|
(SWORD)SQL_PARAM_INPUT_OUTPUT,
|
||||||
fCType,
|
fCType,
|
||||||
fSqlType,
|
fSqlType,
|
||||||
cbColDef,
|
cbColDef,
|
||||||
ibScale,
|
ibScale,
|
||||||
rgbValue,
|
rgbValue,
|
||||||
SQL_SETPARAM_VALUE_MAX,
|
SQL_SETPARAM_VALUE_MAX,
|
||||||
pcbValue );
|
pcbValue );
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/** Prepare for getting query result
|
/** Prepare for getting query result
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,549 +27,549 @@
|
|||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
#include <../iodbc/itrace.h>
|
||||||
|
|
||||||
RETCODE SQL_API SQLBindCol (
|
RETCODE SQL_API SQLBindCol (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD icol,
|
UWORD icol,
|
||||||
SWORD fCType,
|
SWORD fCType,
|
||||||
PTR rgbValue,
|
PTR rgbValue,
|
||||||
SDWORD cbValueMax,
|
SDWORD cbValueMax,
|
||||||
SDWORD FAR* pcbValue )
|
SDWORD FAR* pcbValue )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
switch(fCType)
|
switch(fCType)
|
||||||
{
|
{
|
||||||
case SQL_C_DEFAULT:
|
case SQL_C_DEFAULT:
|
||||||
case SQL_C_CHAR:
|
case SQL_C_CHAR:
|
||||||
case SQL_C_BINARY:
|
case SQL_C_BINARY:
|
||||||
case SQL_C_BIT:
|
case SQL_C_BIT:
|
||||||
case SQL_C_TINYINT:
|
case SQL_C_TINYINT:
|
||||||
case SQL_C_STINYINT:
|
case SQL_C_STINYINT:
|
||||||
case SQL_C_UTINYINT:
|
case SQL_C_UTINYINT:
|
||||||
case SQL_C_SHORT:
|
case SQL_C_SHORT:
|
||||||
case SQL_C_SSHORT:
|
case SQL_C_SSHORT:
|
||||||
case SQL_C_USHORT:
|
case SQL_C_USHORT:
|
||||||
case SQL_C_LONG:
|
case SQL_C_LONG:
|
||||||
case SQL_C_SLONG:
|
case SQL_C_SLONG:
|
||||||
case SQL_C_ULONG:
|
case SQL_C_ULONG:
|
||||||
case SQL_C_FLOAT:
|
case SQL_C_FLOAT:
|
||||||
case SQL_C_DOUBLE:
|
case SQL_C_DOUBLE:
|
||||||
case SQL_C_DATE:
|
case SQL_C_DATE:
|
||||||
case SQL_C_TIME:
|
case SQL_C_TIME:
|
||||||
case SQL_C_TIMESTAMP:
|
case SQL_C_TIMESTAMP:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1003);
|
PUSHSQLERR ( pstmt->herr, en_S1003);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbValueMax < 0 )
|
if( cbValueMax < 0 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check state */
|
return SQL_ERROR;
|
||||||
if( pstmt->state > en_stmt_needdata
|
}
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* call driver's function */
|
/* check state */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindCol );
|
if( pstmt->state > en_stmt_needdata
|
||||||
|
|| pstmt->asyn_on != en_NullProc )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
/* call driver's function */
|
||||||
{
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindCol );
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindCol, (
|
if( hproc == SQL_NULL_HPROC )
|
||||||
pstmt->dhstmt,
|
{
|
||||||
icol,
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
fCType,
|
|
||||||
rgbValue,
|
return SQL_ERROR;
|
||||||
cbValueMax,
|
}
|
||||||
pcbValue ) )
|
|
||||||
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindCol, (
|
||||||
|
pstmt->dhstmt,
|
||||||
|
icol,
|
||||||
|
fCType,
|
||||||
|
rgbValue,
|
||||||
|
cbValueMax,
|
||||||
|
pcbValue ) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(pstmt->dhstmt,
|
retcode = hproc(pstmt->dhstmt,
|
||||||
icol,
|
icol,
|
||||||
fCType,
|
fCType,
|
||||||
rgbValue,
|
rgbValue,
|
||||||
cbValueMax,
|
cbValueMax,
|
||||||
pcbValue );
|
pcbValue );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetCursorName(
|
RETCODE SQL_API SQLGetCursorName(
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UCHAR FAR* szCursor,
|
UCHAR FAR* szCursor,
|
||||||
SWORD cbCursorMax,
|
SWORD cbCursorMax,
|
||||||
SWORD FAR* pcbCursor )
|
SWORD FAR* pcbCursor )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
if( cbCursorMax < (SWORD)0 )
|
if( cbCursorMax < (SWORD)0 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check state */
|
return SQL_ERROR;
|
||||||
if( pstmt->state >= en_stmt_needdata
|
}
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
/* check state */
|
||||||
}
|
if( pstmt->state >= en_stmt_needdata
|
||||||
|
|| pstmt->asyn_on != en_NullProc )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
||||||
|
|
||||||
if( pstmt->state < en_stmt_cursoropen
|
return SQL_ERROR;
|
||||||
&& pstmt->cursor_state == en_stmt_cursor_no )
|
}
|
||||||
{
|
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1015 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
if( pstmt->state < en_stmt_cursoropen
|
||||||
}
|
&& pstmt->cursor_state == en_stmt_cursor_no )
|
||||||
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_S1015 );
|
||||||
|
|
||||||
/* call driver's function */
|
return SQL_ERROR;
|
||||||
hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetCursorName );
|
}
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
/* call driver's function */
|
||||||
{
|
hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetCursorName );
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
|
||||||
|
|
||||||
return SQL_ERROR;
|
if( hproc == SQL_NULL_HPROC )
|
||||||
}
|
{
|
||||||
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetCursorName, (
|
return SQL_ERROR;
|
||||||
pstmt->dhstmt,
|
}
|
||||||
szCursor,
|
|
||||||
cbCursorMax,
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetCursorName, (
|
||||||
pcbCursor ) )
|
pstmt->dhstmt,
|
||||||
|
szCursor,
|
||||||
|
cbCursorMax,
|
||||||
|
pcbCursor ) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(pstmt->dhstmt,
|
retcode = hproc(pstmt->dhstmt,
|
||||||
szCursor,
|
szCursor,
|
||||||
cbCursorMax,
|
cbCursorMax,
|
||||||
pcbCursor );
|
pcbCursor );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLRowCount(
|
RETCODE SQL_API SQLRowCount(
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
SDWORD FAR* pcrow )
|
SDWORD FAR* pcrow )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if( pstmt->state >= en_stmt_needdata
|
||||||
|| pstmt->state <= en_stmt_prepared
|
|| pstmt->state <= en_stmt_prepared
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|| pstmt->asyn_on != en_NullProc )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_RowCount );
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_RowCount );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_RowCount, (
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_RowCount, (
|
||||||
pstmt->dhstmt, pcrow) )
|
pstmt->dhstmt, pcrow) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc ( pstmt->dhstmt, pcrow );
|
retcode = hproc ( pstmt->dhstmt, pcrow );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLNumResultCols(
|
RETCODE SQL_API SQLNumResultCols(
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
SWORD FAR* pccol )
|
SWORD FAR* pccol )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SWORD ccol;
|
SWORD ccol;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if( pstmt->asyn_on == en_NullProc )
|
||||||
{
|
{
|
||||||
if( pstmt->state == en_stmt_allocated
|
if( pstmt->state == en_stmt_allocated
|
||||||
|| pstmt->state >= en_stmt_needdata )
|
|| pstmt->state >= en_stmt_needdata )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_NumResultCols )
|
else if( pstmt->asyn_on != en_NumResultCols )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_NumResultCols );
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_NumResultCols );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_NumResultCols, (
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_NumResultCols, (
|
||||||
pstmt->dhstmt, &ccol) )
|
pstmt->dhstmt, &ccol) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc( pstmt->dhstmt, &ccol );
|
retcode = hproc( pstmt->dhstmt, &ccol );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_NumResultCols )
|
if( pstmt->asyn_on == en_NumResultCols )
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch( retcode )
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
case SQL_ERROR:
|
case SQL_ERROR:
|
||||||
pstmt->asyn_on = en_NullProc;
|
pstmt->asyn_on = en_NullProc;
|
||||||
|
|
||||||
case SQL_STILL_EXECUTING:
|
case SQL_STILL_EXECUTING:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( retcode )
|
switch( retcode )
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_STILL_EXECUTING:
|
case SQL_STILL_EXECUTING:
|
||||||
ccol = 0;
|
ccol = 0;
|
||||||
pstmt->asyn_on = en_NumResultCols;
|
pstmt->asyn_on = en_NumResultCols;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ccol = 0;
|
ccol = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pccol )
|
if( pccol )
|
||||||
{
|
{
|
||||||
*pccol = ccol;
|
*pccol = ccol;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLDescribeCol(
|
RETCODE SQL_API SQLDescribeCol(
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD icol,
|
UWORD icol,
|
||||||
UCHAR FAR* szColName,
|
UCHAR FAR* szColName,
|
||||||
SWORD cbColNameMax,
|
SWORD cbColNameMax,
|
||||||
SWORD FAR* pcbColName,
|
SWORD FAR* pcbColName,
|
||||||
SWORD FAR* pfSqlType,
|
SWORD FAR* pfSqlType,
|
||||||
UDWORD FAR* pcbColDef,
|
UDWORD FAR* pcbColDef,
|
||||||
SWORD FAR* pibScale,
|
SWORD FAR* pibScale,
|
||||||
SWORD FAR* pfNullable )
|
SWORD FAR* pfNullable )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check arguments */
|
/* check arguments */
|
||||||
if( icol == 0 )
|
if( icol == 0 )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1002;
|
sqlstat = en_S1002;
|
||||||
}
|
}
|
||||||
else if( cbColNameMax < 0 )
|
else if( cbColNameMax < 0 )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1090;
|
sqlstat = en_S1090;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if( sqlstat != en_00000 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if( pstmt->asyn_on == en_NullProc )
|
||||||
{
|
{
|
||||||
if( pstmt->asyn_on == en_stmt_allocated
|
if( pstmt->asyn_on == en_stmt_allocated
|
||||||
|| pstmt->asyn_on >= en_stmt_needdata )
|
|| pstmt->asyn_on >= en_stmt_needdata )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_DescribeCol )
|
else if( pstmt->asyn_on != en_DescribeCol )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if( sqlstat != en_00000 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_DescribeCol );
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_DescribeCol );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeCol, (
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeCol, (
|
||||||
pstmt->dhstmt,
|
pstmt->dhstmt,
|
||||||
icol,
|
icol,
|
||||||
szColName,
|
szColName,
|
||||||
cbColNameMax,
|
cbColNameMax,
|
||||||
pcbColName,
|
pcbColName,
|
||||||
pfSqlType,
|
pfSqlType,
|
||||||
pcbColDef,
|
pcbColDef,
|
||||||
pibScale,
|
pibScale,
|
||||||
pfNullable) )
|
pfNullable) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(pstmt->dhstmt,
|
retcode = hproc(pstmt->dhstmt,
|
||||||
icol,
|
icol,
|
||||||
szColName,
|
szColName,
|
||||||
cbColNameMax,
|
cbColNameMax,
|
||||||
pcbColName,
|
pcbColName,
|
||||||
pfSqlType,
|
pfSqlType,
|
||||||
pcbColDef,
|
pcbColDef,
|
||||||
pibScale,
|
pibScale,
|
||||||
pfNullable );
|
pfNullable );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_DescribeCol )
|
if( pstmt->asyn_on == en_DescribeCol )
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch( retcode )
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
case SQL_ERROR:
|
case SQL_ERROR:
|
||||||
pstmt->asyn_on = en_NullProc;
|
pstmt->asyn_on = en_NullProc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch( pstmt->state )
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( retcode == SQL_STILL_EXECUTING )
|
if( retcode == SQL_STILL_EXECUTING )
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_DescribeCol;
|
pstmt->asyn_on = en_DescribeCol;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLColAttributes(
|
RETCODE SQL_API SQLColAttributes(
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD icol,
|
UWORD icol,
|
||||||
UWORD fDescType,
|
UWORD fDescType,
|
||||||
PTR rgbDesc,
|
PTR rgbDesc,
|
||||||
SWORD cbDescMax,
|
SWORD cbDescMax,
|
||||||
SWORD FAR* pcbDesc,
|
SWORD FAR* pcbDesc,
|
||||||
SDWORD FAR* pfDesc )
|
SDWORD FAR* pfDesc )
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if( hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC )
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check arguments */
|
/* check arguments */
|
||||||
if( icol == 0 && fDescType != SQL_COLUMN_COUNT )
|
if( icol == 0 && fDescType != SQL_COLUMN_COUNT )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1002;
|
sqlstat = en_S1002;
|
||||||
}
|
}
|
||||||
else if( cbDescMax < 0 )
|
else if( cbDescMax < 0 )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1090;
|
sqlstat = en_S1090;
|
||||||
}
|
}
|
||||||
else if(/* fDescType < SQL_COLATT_OPT_MIN || */ /* turnoff warning */
|
else if(/* fDescType < SQL_COLATT_OPT_MIN || */ /* turnoff warning */
|
||||||
( fDescType > SQL_COLATT_OPT_MAX
|
( fDescType > SQL_COLATT_OPT_MAX
|
||||||
&& fDescType < SQL_COLUMN_DRIVER_START ) )
|
&& fDescType < SQL_COLUMN_DRIVER_START ) )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1091;
|
sqlstat = en_S1091;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if( sqlstat != en_00000 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if( pstmt->asyn_on == en_NullProc )
|
||||||
{
|
{
|
||||||
if( pstmt->asyn_on == en_stmt_allocated
|
if( pstmt->asyn_on == en_stmt_allocated
|
||||||
|| pstmt->asyn_on >= en_stmt_needdata )
|
|| pstmt->asyn_on >= en_stmt_needdata )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_ColAttributes )
|
else if( pstmt->asyn_on != en_ColAttributes )
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if( sqlstat != en_00000 )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR ( pstmt->herr, sqlstat );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColAttributes );
|
hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColAttributes );
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if( hproc == SQL_NULL_HPROC )
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ColAttributes, (
|
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ColAttributes, (
|
||||||
pstmt->dhstmt,
|
pstmt->dhstmt,
|
||||||
icol,
|
icol,
|
||||||
fDescType,
|
fDescType,
|
||||||
rgbDesc,
|
rgbDesc,
|
||||||
cbDescMax,
|
cbDescMax,
|
||||||
pcbDesc,
|
pcbDesc,
|
||||||
pfDesc) )
|
pfDesc) )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
retcode = hproc(pstmt->dhstmt,
|
retcode = hproc(pstmt->dhstmt,
|
||||||
icol,
|
icol,
|
||||||
fDescType,
|
fDescType,
|
||||||
rgbDesc,
|
rgbDesc,
|
||||||
cbDescMax,
|
cbDescMax,
|
||||||
pcbDesc,
|
pcbDesc,
|
||||||
pfDesc );
|
pfDesc );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_ColAttributes )
|
if( pstmt->asyn_on == en_ColAttributes )
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch( retcode )
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
case SQL_ERROR:
|
case SQL_ERROR:
|
||||||
pstmt->asyn_on = en_NullProc;
|
pstmt->asyn_on = en_NullProc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch( pstmt->state )
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( retcode == SQL_STILL_EXECUTING )
|
if( retcode == SQL_STILL_EXECUTING )
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_ColAttributes;
|
pstmt->asyn_on = en_ColAttributes;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@ SQLFetch
|
|||||||
SQLExtendedFetch
|
SQLExtendedFetch
|
||||||
SQLGetData
|
SQLGetData
|
||||||
SQLSetPos
|
SQLSetPos
|
||||||
SQLMoreResults
|
SQLMoreResults
|
||||||
SQLError
|
SQLError
|
||||||
|
|
||||||
SQLColumnPrivileges
|
SQLColumnPrivileges
|
||||||
|
Reference in New Issue
Block a user