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:
Robert Roebling
1998-12-30 23:30:49 +00:00
parent 8c14576d36
commit 7e616b1050
44 changed files with 8431 additions and 8529 deletions

600
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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,"");

View File

@@ -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 = '");

View File

@@ -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 \

View File

@@ -1,32 +1,58 @@
include Version.mk include ../Version.mk
include Config.mk include ../Config.mk
INCDIR = . INCDIR = .
OUTDIR = $(HOME) OUTFILE = iodbc
CFLAGS = -O $(PIC) $(ANSI) -I$(INCDIR) -D$(DLDAPI) $(CFLAGSX)\ CFLAGS = -O $(PIC) $(ANSI) -I$(INCDIR) -D$(DLDAPI) $(CFLAGSX)\
-DVERSION=\"$(VERSION)$(EXTVER)\" -DVERSION=\"$(VERSION)$(EXTVER)\"
ODBCDM = $(OUTDIR)/$(OUTFILE)-$(VERSION).$(DLSUFFIX) # 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 \ OBJS = dlf.o dlproc.o herr.o henv.o hdbc.o hstmt.o connect.o prepare.o\
connect.o prepare.o execute.o result.o \ execute.o result.o fetch.o info.o catalog.o misc.o itrace.o $(OBJX)
fetch.o info.o catalog.o misc.o itrace.o $(OBJX)
all: $(OBJS) all: $(OBJS) $(ODBCDM) $(ODBC_LIBPATH)/lib$(OUTFILE).a
@echo "Generating iODBC driver manager -->" $(ODBCDM) @rm -f $(ODBC_INCLUDE)/isql.h
@\rm -f $(ODBCDM) @rm -f $(ODBC_INCLUDE)/isqlext.h
@$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(ODBCDM) @rm -f $(ODBC_INCLUDE)/odbc_types.h
@rm -f $(ODBC_INCLUDE)/odbc_funcs.h
cp isql.h $(ODBC_INCLUDE)/
cp isqlext.h $(ODBC_INCLUDE)/
cp odbc_types.h $(ODBC_INCLUDE)/
cp odbc_funcs.h $(ODBC_INCLUDE)/
@echo
@echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@echo
@echo Don\'t forget tu update $(ODBC_LIBPATH)/iodbc.ini with your conf
@echo
@echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@echo
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

View File

@@ -127,7 +127,7 @@ RETCODE SQL_API SQLGetTypeInfo(
SWORD fSqlType ) SWORD fSqlType )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
int sqlstat = en_00000; int sqlstat = en_00000;
RETCODE retcode; RETCODE retcode;
@@ -204,7 +204,7 @@ RETCODE SQL_API SQLSpecialColumns(
UWORD fNullable ) UWORD fNullable )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -313,7 +313,7 @@ RETCODE SQL_API SQLStatistics(
UWORD fAccuracy ) UWORD fAccuracy )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -413,7 +413,7 @@ RETCODE SQL_API SQLTables(
SWORD cbTableType ) SWORD cbTableType )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -500,7 +500,7 @@ RETCODE SQL_API SQLColumnPrivileges(
SWORD cbColumnName ) SWORD cbColumnName )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -587,7 +587,7 @@ RETCODE SQL_API SQLColumns(
SWORD cbColumnName ) SWORD cbColumnName )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -678,7 +678,7 @@ RETCODE SQL_API SQLForeignKeys(
SWORD cbFkTableName ) SWORD cbFkTableName )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -773,7 +773,7 @@ RETCODE SQL_API SQLPrimaryKeys(
SWORD cbTableName ) SWORD cbTableName )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -855,7 +855,7 @@ RETCODE SQL_API SQLProcedureColumns(
SWORD cbColumnName ) SWORD cbColumnName )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -940,7 +940,7 @@ RETCODE SQL_API SQLProcedures(
SWORD cbProcName ) SWORD cbProcName )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;
@@ -1021,7 +1021,7 @@ RETCODE SQL_API SQLTablePrivileges(
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc;
RETCODE retcode; RETCODE retcode;
int sqlstat = en_00000; int sqlstat = en_00000;

View File

@@ -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_
# include <stdlib.h>
# include <sys/types.h>
# include <string.h>
# include <stdio.h>
# define MEM_ALLOC(size) (malloc((size_t)(size)))
# define MEM_FREE(ptr) {if(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 STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0)
# define STRLEN(str) ((str)? strlen((char*)(str)):0)
# define EXPORT
# define CALLBACK
# define FAR
typedef signed short SSHOR;
typedef short WORD;
typedef long DWORD;
typedef WORD WPARAM;
typedef DWORD LPARAM;
typedef void* HWND;
typedef int BOOL;
# endif /* _UNIX_ */
# if defined(WINDOWS) || defined(WIN32_SYSTEM)
# include <windows.h>
# 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 # endif
/* # ifdef _BORLAND_
* Defines for what uname() should return # define MEM_ALLOC(size) (farmalloc((unsigned long)(size))
*/ # define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0)
#ifndef UTS_SYSNAME # define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s)))
#define UTS_SYSNAME "Linux" # 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
#ifndef UTS_MACHINE # endif /* WINDOWS */
#define UTS_MACHINE "unknown"
# 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 # endif
#ifndef UTS_NODENAME # define MEM_ALLOC(size) (malloc((size_t)(size)))
#define UTS_NODENAME "(none)" /* set by sethostname() */ # 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
#ifndef UTS_DOMAINNAME
#define UTS_DOMAINNAME "(none)" /* set by setdomainname() */
#endif
/*
* The definitions for UTS_RELEASE and UTS_VERSION are now defined
* in linux/version.h, and should only be used by linux/version.c
*/
/* Shouldn't these be defined somewhere in a i386 definition? */
/* Don't touch these, unless you really know what you're doing. */
#define DEF_INITSEG 0x9000
#define DEF_SYSSEG 0x1000
#define DEF_SETUPSEG 0x9020
#define DEF_SYSSIZE 0x7F00
/* internal svga startup constants */
#define NORMAL_VGA 0xffff /* 80x25 mode */
#define EXTENDED_VGA 0xfffe /* 80x50 mode */
#define ASK_VGA 0xfffd /* ask for it at bootup */
#endif #endif

View File

@@ -26,6 +26,7 @@
#include <../iodbc/hstmt.h> #include <../iodbc/hstmt.h>
#include <../iodbc/itrace.h> #include <../iodbc/itrace.h>
#include <strings.h> #include <strings.h>
#include <stdio.h> #include <stdio.h>
@@ -62,6 +63,11 @@ static RETCODE _iodbcdm_driverload(
RETCODE retcode = SQL_SUCCESS; RETCODE retcode = SQL_SUCCESS;
int sqlstat = en_00000; int sqlstat = en_00000;
if(pdbc->trace)
{
fprintf(pdbc->tstm, "_iodbcdm_driverload(%s, 0x%x)\n", path, (int)hdbc);
}
if( path == NULL || path[0] == '\0' ) if( path == NULL || path[0] == '\0' )
{ {
PUSHSQLERR ( pdbc->herr, en_IM002 ); PUSHSQLERR ( pdbc->herr, en_IM002 );
@@ -84,6 +90,11 @@ static RETCODE _iodbcdm_driverload(
if( hdll == SQL_NULL_HDLL ) if( hdll == SQL_NULL_HDLL )
{ {
if(pdbc->trace)
{
fprintf(pdbc->tstm, "ERROR: _iodbcdm_driverload cannot load driver - '%s'\n", _iodbcdm_dllerror());
}
PUSHSYSERR ( pdbc->herr, _iodbcdm_dllerror() ); PUSHSYSERR ( pdbc->herr, _iodbcdm_dllerror() );
PUSHSQLERR ( pdbc->herr, en_IM003 ); PUSHSQLERR ( pdbc->herr, en_IM003 );
return SQL_ERROR; return SQL_ERROR;
@@ -294,7 +305,7 @@ RETCODE _iodbcdm_driverunload( HDBC hdbc )
GENV_t FAR* genv; GENV_t FAR* genv;
HPROC hproc; HPROC hproc;
RETCODE retcode = SQL_SUCCESS; RETCODE retcode = SQL_SUCCESS;
/* int sqlstat = en_00000; */ int sqlstat = en_00000;
if( hdbc == SQL_NULL_HDBC ) if( hdbc == SQL_NULL_HDBC )
{ {
@@ -362,7 +373,7 @@ RETCODE _iodbcdm_driverunload( HDBC hdbc )
_iodbcdm_dllclose ( penv->hdll ); _iodbcdm_dllclose ( penv->hdll );
penv->hdll = SQL_NULL_HDLL; penv->hdll == SQL_NULL_HDLL;
for( tpenv = (ENV_t FAR*)genv->henv; for( tpenv = (ENV_t FAR*)genv->henv;
tpenv != NULL; tpenv != NULL;
@@ -588,8 +599,7 @@ static RETCODE _iodbcdm_settracing( HDBC hdbc, char* dsn, int dsnlen )
SQL_OPT_TRACE, opt); SQL_OPT_TRACE, opt);
} }
} }
return SQL_SUCCESS;
return setopterr;
} }
RETCODE SQL_API SQLConnect ( RETCODE SQL_API SQLConnect (
@@ -608,6 +618,7 @@ RETCODE SQL_API SQLConnect (
* specifies driver * specifies driver
* path can't longer * path can't longer
* than 255. */ * than 255. */
char szNewDSN[256]; /* OS/2 !!! */
char *ptr; char *ptr;
HPROC hproc; HPROC hproc;
@@ -657,6 +668,19 @@ RETCODE SQL_API SQLConnect (
return SQL_ERROR; return SQL_ERROR;
} }
/*
** OS/2 !!!
**
** get new szDSN from INI file, if existing
*/
if( NULL != _iodbcdm_getkeyvalbydsn( szDSN, cbDSN, "DSN",
(char FAR*) &szNewDSN,
sizeof(szNewDSN) ) )
{
szDSN = &szNewDSN[0];
cbDSN = SQL_NTS;
}
retcode = _iodbcdm_driverload( driver, hdbc ); retcode = _iodbcdm_driverload( driver, hdbc );
switch( retcode ) switch( retcode )
@@ -742,6 +766,7 @@ RETCODE SQL_API SQLDriverConnect (
char drvbuf[1024]; char drvbuf[1024];
char FAR* dsn; char FAR* dsn;
char dsnbuf[SQL_MAX_DSN_LENGTH + 1]; char dsnbuf[SQL_MAX_DSN_LENGTH + 1];
char szNewDSN[256]; /* OS/2 !!! */
UCHAR cnstr2drv[1024]; UCHAR cnstr2drv[1024];
HPROC hproc, dialproc; HPROC hproc, dialproc;
@@ -834,7 +859,7 @@ RETCODE SQL_API SQLDriverConnect (
break; break;
} }
sprintf( (char FAR *)cnstr2drv, "DSN=%s;", dsn); sprintf(cnstr2drv, "DSN=%s;", dsn);
cbConnStrIn += STRLEN(cnstr2drv); cbConnStrIn += STRLEN(cnstr2drv);
STRNCAT( cnstr2drv, szConnStrIn, cbConnStrIn ); STRNCAT( cnstr2drv, szConnStrIn, cbConnStrIn );
szConnStrIn = cnstr2drv; szConnStrIn = cnstr2drv;
@@ -904,13 +929,102 @@ RETCODE SQL_API SQLDriverConnect (
return SQL_ERROR; return SQL_ERROR;
} }
/* giovanni */
/*
** OS/2 !!!
**
** get new szDSN from INI file, if existing
*/
strcpy( szNewDSN, "DSN=" );
if( NULL != _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS, "DSN",
(char FAR*) &szNewDSN[4],
sizeof(szNewDSN) - 4 ) )
{
char *psz;
strcat( szNewDSN, ";UID=" );
psz = strtok( szNewDSN, "\0" );
if(NULL == _iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
/*
"UID", psz, sizeof(szNewDSN) ))
*/
"UID", (char FAR*) &szNewDSN[strlen(psz)],
(sizeof(szNewDSN) - strlen(psz)) ) )
{
_iodbcdm_getkeyvalbydsn( dsn, SQL_NTS,
"UID", (char FAR*) &szNewDSN[strlen(psz)],
(sizeof(szNewDSN) - strlen(psz)) );
}
strcat( szNewDSN, ";PWD=" );
psz = strtok( szNewDSN, "\0" );
if(NULL == _iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
/*
"PWD", psz, sizeof(szNewDSN) ))
*/
"PWD", (char FAR*) &szNewDSN[strlen(psz)],
(sizeof(szNewDSN) - strlen(psz)) ) )
{
_iodbcdm_getkeyvalbydsn( dsn, SQL_NTS,
"PWD", (char FAR*) &szNewDSN[strlen(psz)],
(sizeof(szNewDSN) - strlen(psz)) );
}
/*
new from dirk
{
register char *psz;
strcat( szNewDSN, ";UID=" );
psz = strtok( szNewDSN, "\0" );
_iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
"UID", psz, sizeof(szNewDSN) );
strcat( szNewDSN, ";PWD=" );
psz = strtok( szNewDSN, "\0" );
_iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
"PWD", psz, sizeof(szNewDSN) );
szConnStrIn = &szNewDSN[0];
cbConnStrIn = SQL_NTS;
}
*/
/******** giovanni & monty ********/
/* Add a lot of optional keywords */
{
static char *keywords[]= { "SERVER","PORT","SOCKET","OPTION","DB",0 };
char buff[80],**key,*end;
psz= szNewDSN+strlen(szNewDSN);
end= szNewDSN+sizeof(szNewDSN);
for (key=keywords ; *key ; key++)
{
if (_iodbcdm_getkeyvalbydsn(dsn, SQL_NTS,
*key, (char FAR*) buff,
sizeof(buff)) &&
strlen(*key)+strlen(buff)+2 < (int) (end - psz))
{
*psz++=';';
strcpy(psz,*key); psz+=strlen(*key);
*psz++='=';
strcpy(psz,buff); psz+=strlen(buff);
}
}
}
*psz=0;
/******** giovanni */
szConnStrIn = szNewDSN; /*giovanni, era &szNewDSN */
cbConnStrIn = SQL_NTS;
}
/* giovanni */
CALL_DRIVER ( hdbc, retcode, hproc, en_DriverConnect, ( CALL_DRIVER ( hdbc, retcode, hproc, en_DriverConnect, (
pdbc->dhdbc, hwnd, pdbc->dhdbc, hwnd,
szConnStrIn, cbConnStrIn, szConnStrIn, cbConnStrIn,
szConnStrOut, cbConnStrOutMax, szConnStrOut, cbConnStrOutMax,
pcbConnStrOut, fDriverCompletion ) ) pcbConnStrOut, fDriverCompletion ) )
#if 0 #if 0
retcode = hproc(pdbc->dhdbc, hwnd, retcode = hproc(pdbc->dhdbc, hwnd,
szConnStrIn, cbConnStrIn, szConnStrIn, cbConnStrIn,
@@ -954,16 +1068,16 @@ RETCODE SQL_API SQLBrowseConnect (
SWORD FAR* pcbConnStrOut ) SWORD FAR* pcbConnStrOut )
{ {
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc; DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
/* HDLL hdll; */ HDLL hdll;
char FAR* drv; char FAR* drv;
char drvbuf[1024]; char drvbuf[1024];
char FAR* dsn; char FAR* dsn;
char dsnbuf[SQL_MAX_DSN_LENGTH + 1]; char dsnbuf[SQL_MAX_DSN_LENGTH + 1];
/* UCHAR cnstr2drv[1024]; */ UCHAR cnstr2drv[1024];
HPROC hproc /*, dialproc*/ ; HPROC hproc, dialproc;
/* int sqlstat = en_00000; */ int sqlstat = en_00000;
RETCODE retcode = SQL_SUCCESS; RETCODE retcode = SQL_SUCCESS;
RETCODE setopterr = SQL_SUCCESS; RETCODE setopterr = SQL_SUCCESS;

View File

@@ -13,8 +13,14 @@
GNU General Public License for more details. GNU General Public License for more details.
**/ **/
#include "wx/setup.h" #ifdef DLDAPI_OS2
# define INCL_DOSMODULEMGR /* Module Manager values */
# define INCL_DOSERRORS /* Error values */
# include <os2.h>
# include <stdio.h>
#endif
#include "wx/setup.h"
#include <../iodbc/dlf.h> #include <../iodbc/dlf.h>
#include <errno.h> #include <errno.h>
@@ -85,7 +91,6 @@ int dlclose(void* hdll)
*********************************/ *********************************/
#ifdef DLDAPI_AIX_LOAD #ifdef DLDAPI_AIX_LOAD
# define DLDAPI_DEFINED # define DLDAPI_DEFINED
# include <sys/types.h>
# include <sys/ldr.h> # include <sys/ldr.h>
# include <sys/stat.h> # include <sys/stat.h>
# include <nlist.h> # include <nlist.h>
@@ -570,18 +575,79 @@ int dlclose(void FAR* hdll)
#endif /* end of Windows family */ #endif /* end of Windows family */
/*********************************** /*********************************
* *
* other platforms * OS/2 2.x, 3.x
* *
***********************************/ *********************************/
#ifdef DLDAPI_OS2 #ifdef DLDAPI_OS2
# define DLDAPI_DEFINED # define DLDAPI_DEFINED
/* /*
* DosLoadModule(), DosQueryProcAddress(), DosFreeModule(), ... * DosLoadModule(), DosQueryProcAddress(), DosFreeModule(), ...
*/ */
void FAR* dlopen(char FAR* dll, int mode)
{
APIRET rc = NO_ERROR; /* API return code */
UCHAR LoadError[256] = ""; /* Area for Load fail. info */
HMODULE ModuleHandle = NULLHANDLE; /* Module handle */
if( dll == NULL || '\0' == *dll )
{
return NULL;
}
rc = NO_ERROR;
rc = DosLoadModule( LoadError, /* Failure info buffer */
sizeof(LoadError), /* Size of buffer */
dll, /* Module to load */
&ModuleHandle ); /* Module handle returned */
if (rc != NO_ERROR)
{
#ifdef DEBUG
fprintf( stderr,
"[dlf.c] dlopen: DosLoadModule(0x%08lX, %d, \"%s\", 0x%08lX) = %d\n",
&LoadError, sizeof(LoadError), dll, &ModuleHandle, rc
);
fprintf( stderr,
" ---> missing module '%s'\n",
LoadError );
#endif
return NULL;
}
return (void FAR*) ModuleHandle;
}
void FAR* dlsym( void FAR* hdll, char FAR* sym )
{
APIRET rc = NO_ERROR; /* API return code */
PFN ModuleAddress = NULL; /* Module address */
rc = DosQueryProcAddr( (HMODULE) hdll, 0, sym, &ModuleAddress );
return (void FAR*) (NO_ERROR == rc) ? ModuleAddress
: NULL;
}
char FAR* dlerror()
{
return 0L; /* unimplemented yet */
}
int dlclose(void FAR* hdll)
{
return DosFreeModule( (HMODULE) hdll );
}
#endif #endif
/***********************************
*
* other platforms
*
***********************************/
#ifdef DLDAPI_MAC #ifdef DLDAPI_MAC
# define DLDAPI_DEFINED # define DLDAPI_DEFINED
#endif #endif

View File

@@ -3,17 +3,6 @@
#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

View File

@@ -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>
@@ -32,11 +33,11 @@ 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;
} }

View File

@@ -3,7 +3,11 @@
# include <../iodbc/dlf.h> # include <../iodbc/dlf.h>
# ifdef OS2
typedef RETCODE (FAR* _System HPROC)();
# else
typedef RETCODE (FAR* HPROC)(); typedef RETCODE (FAR* HPROC)();
# endif
# ifdef DLDAPI_SVR4_DLFCN # ifdef DLDAPI_SVR4_DLFCN
# include <dlfcn.h> # include <dlfcn.h>
@@ -19,6 +23,10 @@
typedef void* HDLL; typedef void* HDLL;
# endif # endif
# ifdef DLDAPI_OS2
typedef HMODULE HDLL;
# endif
extern HPROC _iodbcdm_getproc(); extern HPROC _iodbcdm_getproc();
extern HDLL _iodbcdm_dllopen(char FAR* dll); extern HDLL _iodbcdm_dllopen(char FAR* dll);
extern HPROC _iodbcdm_dllproc(HDLL hdll, char FAR* sym); extern HPROC _iodbcdm_dllproc(HDLL hdll, char FAR* sym);

View File

@@ -13,19 +13,19 @@
GNU General Public License for more details. GNU General Public License for more details.
**/ **/
#include <../iodbc/iodbc.h> #include <config.h>
#include <../iodbc/isql.h> #include <isql.h>
#include <../iodbc/isqlext.h> #include <isqlext.h>
#include <../iodbc/dlproc.h> #include <dlproc.h>
#include <../iodbc/herr.h> #include <herr.h>
#include <../iodbc/henv.h> #include <henv.h>
#include <../iodbc/hdbc.h> #include <hdbc.h>
#include <../iodbc/hstmt.h> #include <hstmt.h>
#include <../iodbc/itrace.h> #include <itrace.h>
RETCODE SQL_API SQLFetch ( HSTMT hstmt ) RETCODE SQL_API SQLFetch ( HSTMT hstmt )
{ {

View File

@@ -158,7 +158,7 @@ RETCODE SQL_API SQLSetConnectOption(
UWORD fOption, UWORD fOption,
UDWORD vParam ) UDWORD vParam )
{ {
/* GENV_t FAR* genv; */ GENV_t FAR* genv;
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc; DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
STMT_t FAR* pstmt; STMT_t FAR* pstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc = SQL_NULL_HPROC;
@@ -498,7 +498,7 @@ RETCODE SQL_API SQLGetConnectOption(
UWORD fOption, UWORD fOption,
PTR pvParam ) PTR pvParam )
{ {
/* GENV_t FAR* genv; */ GENV_t FAR* genv;
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc; DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
int sqlstat = en_00000; int sqlstat = en_00000;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc = SQL_NULL_HPROC;
@@ -757,7 +757,7 @@ RETCODE SQL_API SQLTransact(
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;
HERR herr; HERR herr;
RETCODE retcode = 0; RETCODE retcode;
if( hdbc != SQL_NULL_HDBC ) if( hdbc != SQL_NULL_HDBC )
{ {

View File

@@ -1,12 +1,3 @@
#ifdef __HPUX__
#define CLI_NAME_PREFIX "_SQL"
#endif
#ifdef __AIX__
#define CLI_NAME_PREFIX ".SQL"
#endif
#ifndef CLI_NAME_PREFIX #ifndef CLI_NAME_PREFIX
/* There are some exceptions : /* There are some exceptions :

View File

@@ -1,11 +1,11 @@
#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)
@@ -95,7 +95,7 @@ typedef struct {
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:

View File

@@ -189,7 +189,7 @@ RETCODE SQL_API SQLFreeStmt (
UWORD fOption ) UWORD fOption )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
/* STMT_t FAR* tpstmt; */ STMT_t FAR* tpstmt;
DBC_t FAR* pdbc; DBC_t FAR* pdbc;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc = SQL_NULL_HPROC;
@@ -226,7 +226,7 @@ RETCODE SQL_API SQLFreeStmt (
return SQL_ERROR; return SQL_ERROR;
} }
hproc = SQL_NULL_HPROC; hproc == SQL_NULL_HPROC;
#if (ODBCVER >= 0x0300) #if (ODBCVER >= 0x0300)
if( fOption == SQL_DROP ) if( fOption == SQL_DROP )

View File

@@ -1,10 +1,10 @@
#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
{ {

View File

@@ -65,7 +65,7 @@ RETCODE SQL_API SQLDataSources(
/*************************/ /*************************/
return SQL_NO_DATA_FOUND; return SQL_SUCCESS;
} }
RETCODE SQL_API SQLDrivers( RETCODE SQL_API SQLDrivers(
@@ -121,7 +121,7 @@ RETCODE SQL_API SQLGetInfo(
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' };

View File

@@ -1,27 +1,127 @@
#ifndef _INTRINSIC_SQL_H #ifndef _INTRINSIC_SQL_H
# define _INTRINSIC_SQL_H # define _INTRINSIC_SQL_H
#ifndef OS2
typedef unsigned char UCHAR; typedef unsigned char UCHAR;
#endif
typedef long int SDWORD; typedef long int SDWORD;
typedef short int SWORD; typedef short int SWORD;
typedef unsigned long int UDWORD; typedef unsigned long int UDWORD;
typedef unsigned short int UWORD; 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 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 signed short RETCODE;
typedef UCHAR SQLCHAR;
typedef UWORD SQLUSMALLINT;
typedef PTR SQLPOINTER;
typedef SWORD SQLSMALLINT;
typedef UDWORD SQLUINTEGER;
# ifdef WIN32 # ifdef WIN32
# define SQL_API __stdcall # define SQL_API __stdcall
# else # else
# define SQL_API EXPORT CALLBACK # 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 # endif
#ifndef ODBCVER
# define ODBCVER 0x0200 # define ODBCVER 0x0200
#endif
# define SQL_MAX_MESSAGE_LENGTH 512 # define SQL_MAX_MESSAGE_LENGTH 512
# define SQL_MAX_DSN_LENGTH 32 # define SQL_MAX_DSN_LENGTH 32
@@ -89,3 +189,4 @@ typedef signed short RETCODE;
# define SQL_NULL_HSTMT 0 # define SQL_NULL_HSTMT 0
#endif #endif

View File

@@ -1,7 +1,7 @@
#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
@@ -201,6 +201,13 @@
# 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
@@ -293,14 +300,14 @@
# 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

View File

@@ -1,4 +1,4 @@
#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()

View File

@@ -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,6 +28,9 @@
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <strings.h>
#include <unistd.h>
static int static int
upper_strneq( upper_strneq(
char* s1, char* s1,
@@ -28,7 +38,7 @@ upper_strneq(
int n ) 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++)
{ {
@@ -109,16 +119,44 @@ readtoken(
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;
} }
#ifdef FIX_INI_FILE
sprintf( buf, "%s/iodbc.ini", DIR_INI_FILE );
#else
# ifdef OS2
*buf = '\0';
if( NULL != getenv("IODBC_INI") )
{
strcpy( buf, getenv("IODBC_INI") );
}
else
{
HMODULE hModule;
if( NO_ERROR == DosQueryModuleHandle(DLL_NAME, &hModule) &&
NO_ERROR == DosQueryModuleName(hModule, 256L, buf) )
{
if( NULL != strrchr(buf, '.') )
*(strchr(buf, '.')) = '\0';
strcat( buf, ".ini" );
}
else
{
strcpy( buf, "iodbc.ini" );
}
}
return buf;
# else
# if !defined(UNIX_PWD) # if !defined(UNIX_PWD)
i = GetWindowsDirectory((LPSTR)buf, size ); i = GetWindowsDirectory((LPSTR)buf, size );
@@ -128,7 +166,7 @@ getinitfile(char* buf, int size)
return NULL; return NULL;
} }
sprintf( buf + i, "/odbc.ini"); sprintf( buf + i, "/iodbc.ini");
return buf; return buf;
# else # else
@@ -151,8 +189,10 @@ getinitfile(char* buf, int size)
return NULL; return NULL;
} }
sprintf( buf, "%s%s", ptr, "/.odbc.ini"); sprintf( buf, "%s%s", ptr, "/.iodbc.ini");
/* i.e. searching ~/.odbc.ini */ /* i.e. searching ~/.iodbc.ini */
# endif
# endif
#endif #endif
return buf; return buf;
@@ -235,6 +275,8 @@ char* _iodbcdm_getkeyvalbydsn(
break; break;
} }
strtok( str, "\n\r" );
if( *str == '[' ) if( *str == '[' )
{ {
if( upper_strneq(str, "[default]", STRLEN("[default]")) ) if( upper_strneq(str, "[default]", STRLEN("[default]")) )

View File

@@ -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
/* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */ #define SQL_FN_STR_LEFT 0x00000004L
/* These are also used by SQLGetInfo */ #define SQL_FN_STR_LTRIM 0x00000008L
#define SQL_UNSEARCHABLE 0 #define SQL_FN_STR_LENGTH 0x00000010L
#define SQL_LIKE_ONLY 1 #define SQL_FN_STR_LOCATE 0x00000020L
#define SQL_ALL_EXCEPT_LIKE 2 #define SQL_FN_STR_LCASE 0x00000040L
#define SQL_SEARCHABLE 3 #define SQL_FN_STR_REPEAT 0x00000080L
#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE #define SQL_FN_STR_REPLACE 0x00000100L
#define SQL_FN_STR_RIGHT 0x00000200L
/* Special return values for SQLGetData */ #define SQL_FN_STR_RTRIM 0x00000400L
#define SQL_NO_TOTAL (-4) #define SQL_FN_STR_SUBSTRING 0x00000800L
#define SQL_FN_STR_UCASE 0x00001000L
/* SQL_CORRELATION_NAME values */ #define SQL_FN_STR_ASCII 0x00002000L
#define SQL_FN_STR_CHAR 0x00004000L
#define SQL_CN_NONE 0x0000 #define SQL_FN_STR_DIFFERENCE 0x00008000L
#define SQL_CN_DIFFERENT 0x0001 #define SQL_FN_STR_LOCATE_2 0x00010000L
#define SQL_CN_ANY 0x0002 #define SQL_FN_STR_SOUNDEX 0x00020000L
#define SQL_FN_STR_SPACE 0x00040000L
/* SQL_NULL_COLLATION values */ #define SQL_FN_STR_BIT_LENGTH 0x00080000L
#define SQL_FN_STR_CHAR_LENGTH 0x00100000L
#define SQL_NC_HIGH 0 #define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L
#define SQL_NC_LOW 1 #define SQL_FN_STR_OCTET_LENGTH 0x00400000L
#define SQL_NC_START 0x0002 #define SQL_FN_STR_POSITION 0x00800000L
#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
/* SQL_IDENTIFIER_CASE values */
#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_WRITE 1
#define SQL_ATTR_READWRITE_UNKNOWN 2
/* SQLExtendedFetch "rgfRowStatus" element values */
#define SQL_ROW_SUCCESS 0
#define SQL_ROW_DELETED 1
#define SQL_ROW_UPDATED 2
#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_NOW 0x00000001L
#define SQL_FN_TD_CURDATE 0x00000002L
#define SQL_FN_TD_DAYOFMONTH 0x00000004L
#define SQL_FN_TD_DAYOFWEEK 0x00000008L
#define SQL_FN_TD_DAYOFYEAR 0x00000010L
#define SQL_FN_TD_MONTH 0x00000020L
#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_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
#define SQL_POS_POSITION 0x00000001L
#define SQL_AT_ADD_COLUMN 0x00000001L
#define SQL_AT_DROP_COLUMN 0x00000002L
#define SQL_GB_NO_RELATION 0x0003
#define SQL_BIND_BY_COLUMN 0UL
#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN /* Default value */
#define SQL_ATTR_READONLY 0
#define SQL_FETCH_PREV SQL_FETCH_PRIOR
#define SQL_ROW_SUCCESS 0
#define SQL_ROW_NOROW 3
#define SQL_NOSCAN 2
#define SQL_RD_OFF 0UL
#define SQL_RD_ON 1UL
#define SQL_RD_DEFAULT SQL_RD_ON
#define SQL_NOSCAN_OFF 0UL
#define SQL_NOSCAN_ON 1UL
#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF

View File

@@ -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

View File

@@ -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

View File

@@ -27,6 +27,7 @@
#include <../iodbc/itrace.h> #include <../iodbc/itrace.h>
RETCODE SQL_API SQLPrepare ( RETCODE SQL_API SQLPrepare (
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR* szSqlStr, UCHAR FAR* szSqlStr,