From 8551f8ca98daf445a36053a783098f3b696c2c9a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 11 Dec 1999 23:56:46 +0000 Subject: [PATCH] Xiang Li Implementation of a proxy ODBC32 dll. --- Makefile.in | 2 + configure | 2 + configure.in | 1 + dlls/Makefile.in | 1 + dlls/odbc32/.cvsignore | 2 + dlls/odbc32/Makefile.in | 18 + dlls/odbc32/odbc32.spec | 179 ++++ dlls/odbc32/proxyodbc.c | 1825 +++++++++++++++++++++++++++++++++++++++ dlls/odbc32/proxyodbc.h | 116 +++ include/debugdefs.h | 135 +-- include/sql.h | 730 ++++++++++++++++ include/sqlext.h | 1656 +++++++++++++++++++++++++++++++++++ include/sqltypes.h | 237 +++++ loader/loadorder.c | 1 + relay32/builtin32.c | 2 + 15 files changed, 4841 insertions(+), 66 deletions(-) create mode 100644 dlls/odbc32/.cvsignore create mode 100644 dlls/odbc32/Makefile.in create mode 100644 dlls/odbc32/odbc32.spec create mode 100644 dlls/odbc32/proxyodbc.c create mode 100644 dlls/odbc32/proxyodbc.h create mode 100644 include/sql.h create mode 100644 include/sqlext.h create mode 100644 include/sqltypes.h diff --git a/Makefile.in b/Makefile.in index 10c48630bc5..a219ffebbb1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -50,6 +50,7 @@ LIBSUBDIRS = \ dlls/msnet32 \ dlls/msvideo \ dlls/ntdll \ + dlls/odbc32 \ dlls/ole32 \ dlls/oleaut32 \ dlls/olecli \ @@ -163,6 +164,7 @@ LIBOBJS = \ dlls/msnet32/msnet32.o \ dlls/msvideo/msvideo.o \ dlls/ntdll/ntdll.o \ + dlls/odbc32/odbc32.o \ dlls/ole32/ole32.o \ dlls/oleaut32/oleaut32.o \ dlls/olecli/olecli.o \ diff --git a/configure b/configure index d6d8f1403a4..884a0acaccf 100755 --- a/configure +++ b/configure @@ -5858,6 +5858,7 @@ dlls/msacm32/Makefile dlls/msnet32/Makefile dlls/msvideo/Makefile dlls/ntdll/Makefile +dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/olecli/Makefile @@ -6064,6 +6065,7 @@ dlls/msacm32/Makefile dlls/msnet32/Makefile dlls/msvideo/Makefile dlls/ntdll/Makefile +dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/olecli/Makefile diff --git a/configure.in b/configure.in index 8ae78ea704c..d6e82f56d1a 100644 --- a/configure.in +++ b/configure.in @@ -883,6 +883,7 @@ dlls/msacm32/Makefile dlls/msnet32/Makefile dlls/msvideo/Makefile dlls/ntdll/Makefile +dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/olecli/Makefile diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 4a865a9757b..991fca13a7d 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -19,6 +19,7 @@ SUBDIRS = \ msnet32 \ msvideo \ ntdll \ + odbc32 \ ole32 \ oleaut32 \ olecli \ diff --git a/dlls/odbc32/.cvsignore b/dlls/odbc32/.cvsignore new file mode 100644 index 00000000000..4d7688f24aa --- /dev/null +++ b/dlls/odbc32/.cvsignore @@ -0,0 +1,2 @@ +Makefile +odbc32.spec.c diff --git a/dlls/odbc32/Makefile.in b/dlls/odbc32/Makefile.in new file mode 100644 index 00000000000..4232defeaba --- /dev/null +++ b/dlls/odbc32/Makefile.in @@ -0,0 +1,18 @@ +DEFS = @DLLFLAGS@ -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = odbc32 + +SPEC_SRCS = odbc32.spec + +C_SRCS = \ + proxyodbc.c + +all: $(MODULE).o + +@MAKE_RULES@ + +### Dependencies: + diff --git a/dlls/odbc32/odbc32.spec b/dlls/odbc32/odbc32.spec new file mode 100644 index 00000000000..846b549ff85 --- /dev/null +++ b/dlls/odbc32/odbc32.spec @@ -0,0 +1,179 @@ +name odbc32 +type win32 +init MAIN_OdbcInit + +001 stdcall SQLAllocConnect(long ptr) SQLAllocConnect +002 stdcall SQLAllocEnv(ptr) SQLAllocEnv +003 stdcall SQLAllocStmt(long ptr) SQLAllocStmt +004 stdcall SQLBindCol(long long long ptr long ptr) SQLBindCol +005 stdcall SQLCancel(long) SQLCancel +006 stdcall SQLColAttributes(long long long ptr long ptr ptr) SQLColAttributes +007 stdcall SQLConnect(long str long str long str long) SQLConnect +008 stdcall SQLDescribeCol(long long str long ptr ptr ptr ptr ptr) SQLDescribeCol +009 stdcall SQLDisconnect(long) SQLDisconnect +010 stdcall SQLError(long long long str ptr str long ptr) SQLError +011 stdcall SQLExecDirect(long str long) SQLExecDirect +012 stdcall SQLExecute(long) SQLExecute +013 stdcall SQLFetch(long) SQLFetch +014 stdcall SQLFreeConnect(long) SQLFreeConnect +015 stdcall SQLFreeEnv(long) SQLFreeEnv +016 stdcall SQLFreeStmt(long long ) SQLFreeStmt +017 stdcall SQLGetCursorName(long str long ptr) SQLGetCursorName +018 stdcall SQLNumResultCols(long ptr) SQLNumResultCols +019 stdcall SQLPrepare(long str long) SQLPrepare +020 stdcall SQLRowCount(long ptr) SQLRowCount +021 stdcall SQLSetCursorName(long str long) SQLSetCursorName +022 stdcall SQLSetParam(long long long long long long ptr ptr) SQLSetParam +023 stdcall SQLTransact(long long long) SQLTransact +024 stdcall SQLAllocHandle(long long ptr) SQLAllocHandle +025 stdcall SQLBindParam(long long long long long long ptr ptr) SQLBindParam +026 stdcall SQLCloseCursor(long) SQLCloseCursor +027 stdcall SQLColAttribute(long long long ptr long ptr ptr) SQLColAttribute +028 stdcall SQLCopyDesc(long long) SQLCopyDesc +029 stdcall SQLEndTran(long long long) SQLEndTran +030 stdcall SQLFetchScroll(long long long) SQLFetchScroll +031 stdcall SQLFreeHandle(long long) SQLFreeHandle +032 stdcall SQLGetConnectAttr(long long ptr ptr) SQLGetConnectAttr +033 stdcall SQLGetDescField(long long long ptr long ptr) SQLGetDescField +034 stdcall SQLGetDescRec(long long str long ptr ptr ptr ptr ptr ptr ptr) SQLGetDescRec +035 stdcall SQLGetDiagField(long long long long ptr long ptr) SQLGetDiagField +036 stdcall SQLGetDiagRec(long long long str ptr str long ptr) SQLGetDiagRec +037 stdcall SQLGetEnvAttr(long long ptr long ptr) SQLGetEnvAttr +038 stdcall SQLGetStmtAttr(long long ptr long ptr) SQLGetStmtAttr +039 stdcall SQLSetConnectAttr(long long ptr long) SQLSetConnectAttr +040 stdcall SQLColumns(long str long str long str long str long) SQLColumns +041 stdcall SQLDriverConnect(long long str long str long str long) SQLDriverConnect +042 stdcall SQLGetConnectOption(long long ptr) SQLGetConnectOption +043 stdcall SQLGetData(long long long ptr long ptr) SQLGetData +044 stdcall SQLGetFunctions(long long ptr) SQLGetFunctions +045 stdcall SQLGetInfo(long long ptr long ptr) SQLGetInfo +046 stdcall SQLGetStmtOption(long long ptr) SQLGetStmtOption +047 stdcall SQLGetTypeInfo(long long) SQLGetTypeInfo +048 stdcall SQLParamData(long ptr) SQLParamData +049 stdcall SQLPutData(long ptr long) SQLPutData +050 stdcall SQLSetConnectOption(long long long) SQLSetConnectOption +051 stdcall SQLSetStmtOption(long long long) SQLSetStmtOption +052 stdcall SQLSpecialColumns(long long str long str long str long long long) SQLSpecialColumns +053 stdcall SQLStatistics(long str long str long str long long long) SQLStatistics +054 stdcall SQLTables(long str long str long str long str long) SQLTables +055 stdcall SQLBrowseConnect(long str long str long ptr) SQLBrowseConnect +056 stdcall SQLColumnPrivileges(long str long str long str long str long) SQLColumnPrivileges +057 stdcall SQLDataSources(long long str long ptr str long ptr) SQLDataSources +058 stdcall SQLDescribeParam(long long ptr ptr ptr ptr) SQLDescribeParam +059 stdcall SQLExtendedFetch(long long long ptr ptr) SQLExtendedFetch +060 stdcall SQLForeignKeys(long str long str long str long str long str long str long) SQLForeignKeys +061 stdcall SQLMoreResults(long str long str long ptr) SQLMoreResults +062 stdcall SQLNativeSql(long str long str long str long) SQLNativeSql +063 stdcall SQLNumParams(long ptr) SQLNumParams +064 stdcall SQLParamOptions(long str long str long str long) SQLParamOptions +065 stdcall SQLPrimaryKeys(long str long str long str long) SQLPrimaryKeys +066 stdcall SQLProcedureColumns(long str long str long str long str long) SQLProcedureColumns +067 stdcall SQLProcedures(long str long str long str long) SQLProcedures +068 stdcall SQLSetPos(long long long long) SQLSetPos +069 stdcall SQLSetScrollOptions(long long long long) SQLSetScrollOptions +070 stdcall SQLTablePrivileges(long str long str long str long) SQLTablePrivileges +071 stdcall SQLDrivers(long long str long ptr str long ptr) SQLDrivers +072 stdcall SQLBindParameter(long long long long long long long ptr long ptr) SQLBindParameter +073 stdcall SQLSetDescField(long long long ptr long) SQLSetDescField +074 stdcall SQLSetDescRec(long long long long long long long ptr ptr ptr) SQLSetDescRec +075 stdcall SQLSetEnvAttr(long long ptr long) SQLSetEnvAttr +076 stdcall SQLSetStmtAttr(long long ptr long) SQLSetStmtAttr +077 stdcall SQLAllocHandleStd(long long ptr) SQLAllocHandleStd +078 stdcall SQLBulkOperations(long long) SQLBulkOperations +079 stub CloseODBCPerfData +080 stub CollectODBCPerfData +081 stub CursorLibLockDbc +082 stub CursorLibLockDesc +083 stub CursorLibLockStmt +084 stub ODBCGetTryWaitValue +085 stub CursorLibTransact +086 stub ODBSetTryWaitValue +087 stub LockHandle +088 stub ODBCInternalConnectW +089 stub ODBCSharedPerfMon +090 stub ODBCSharedVSFlag +091 stub OpenODBCPerfData +092 stub PostComponentError +093 stub PostODBCComponentError +094 stub PostODBCError +095 stub SearchStatusCode +096 stub VFreeErrors +097 stub VRetrieveDriverErrorsRowCol +098 stub ValidateErrorQueue +099 stub SQLColAttributesW +100 stub SQLConnectW +101 stub SQLDescribeColW +102 stub SQLErrorW +103 stub SQLExecDirectW +104 stub SQLGetCursorNameW +105 stub SQLPrepareW +106 stub SQLSetCursorNameW +107 stub SQLColAttributeW +108 stub SQLGetConnectAttrW +109 stub SQLGetDescFieldW +110 stub SQLGetDescRecW +111 stub SQLGetDiagFieldW +112 stub SQLGetDiagRecW +113 stub SQLGetStmtAttrW +114 stub SQLSetConnectAttrW +115 stub SQLColumnsW +116 stub SQLDriverConnectW +117 stub SQLGetConnectOptionW +118 stub SQLGetInfoW +119 stub SQLGetTypeInfoW +120 stub SQLSetConnectOptionW +121 stub SQLSpecialColumnsA +122 stub SQLStatisticsW +123 stub SQLTablesW +124 stub SQLBrowseConnectW +125 stub SQLDataSourcesW +126 stub SQLColumnPrivilegesW +127 stub SQLForeignKeysW +128 stub SQLNativeSqlW +129 stub SQLPrimaryKeysW +130 stub SQLProcedureColumnsW +131 stub SQLProceduresW +132 stub SQLTablePrivilegesW +133 stub SQLDriversW +134 stub SQLSetDescFieldW +135 stub SQLSetStmtAttrW +136 stub SQLColAttributesW +137 stub SQLConnectA +138 stub SQLDescribeColA +139 stub SQLErrorA +140 stub SQLExecDirectA +141 stub SQLGetCursorNameA +142 stub SQLPrepareA +143 stub SQLSetCursorNameA +144 stub SQLColAttributeA +145 stub SQLGetConnectAttrA +146 stub SQLGetDescFieldA +147 stub SQLGetDescRecA +148 stub SQLGetDiagFieldA +149 stub SQLGetDiagRecA +150 stub SQLGetStmtAttrA +151 stub SQLSetConnectAttrA +152 stub SQLColumnsA +153 stub SQLDriverConnectA +154 stub SQLGetConnectOptionA +155 stub SQLGetInfoA +156 stub SQLGetTypeInfoA +157 stub SQLSetConnectOptionA +158 stub SQLSpecialColumnsA +159 stub SQLStatisticsA +160 stub SQLTablesA +161 stub SQLBrowseConnectA +162 stub SQLColumnPrivilegesA +163 stub SQLDataSourcesA +164 stub SQLForeignKeysA +165 stub SQLNativeSqlA +166 stub SQLPrimaryKeysA +167 stub SQLProcedureColumnsA +168 stub SQLProceduresA +169 stub SQLTablePrivilegesA +170 stub SQLDriversA +171 stub SQLSetDescFieldA +172 stub SQLSetStmtAttrA +173 stub ODBCSharedTraceFlag +174 stub ODBCQualifyFileDSNW + diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c new file mode 100644 index 00000000000..3e8ba4e0731 --- /dev/null +++ b/dlls/odbc32/proxyodbc.c @@ -0,0 +1,1825 @@ +/* + * Win32 ODBC functions + * + * Proxy ODBC driver manager. This manager delegates all ODBC calls to a real ODBC driver manager which is either: + * 1) its name is defined in the environment variable LIB_ODBC_DRIVER_MANAGER + * 2) if LIB_ODBC_DRIVER_MANAGER is not defined, a default library libodbc.so will be used. + * + * Xiang Li, Corel Corporation, Nov. 12, 1999 + * + */ + +#include +#include +#include +#include + +#include "winbase.h" +#include "debugtools.h" + +#ifndef _WINDOWS +#define _WINDOWS +#endif + +typedef char* GUID; //This definition is in sqltypes.h, but if _WINDOWS is defined, this is skipped. + +#include "sql.h" +#include "sqltypes.h" +#include "sqlext.h" + +#include "proxyodbc.h" + +/*#define SQLRETURNTYPE SQLRETURN SQL_API*/ +#define SQLRETURNTYPE SQLRETURN WINAPI + +DEFAULT_DEBUG_CHANNEL(odbc); + +static DM_FUNC template_func[] = +{ + /* 00 */ { SQL_API_SQLALLOCCONNECT, "SQLAllocConnect", SQLAllocConnect }, + /* 01 */ { SQL_API_SQLALLOCENV, "SQLAllocEnv", SQLAllocEnv }, + /* 02 */ { SQL_API_SQLALLOCHANDLE, "SQLAllocHandle", SQLAllocHandle }, + /* 03 */ { SQL_API_SQLALLOCSTMT, "SQLAllocStmt", SQLAllocStmt }, + /* 04 */ { SQL_API_SQLALLOCHANDLESTD, "SQLAllocHandleStd", SQLAllocHandleStd }, + /* 05 */ { SQL_API_SQLBINDCOL, "SQLBindCol", SQLBindCol }, + /* 06 */ { SQL_API_SQLBINDPARAM, "SQLBindParam", SQLBindParam }, + /* 07 */ { SQL_API_SQLBINDPARAMETER, "SQLBindParameter", SQLBindParameter }, + /* 08 */ { SQL_API_SQLBROWSECONNECT, "SQLBrowseConnect", SQLBrowseConnect }, + /* 09 */ { SQL_API_SQLBULKOPERATIONS, "SQLBulkOperations", SQLBulkOperations }, + /* 10 */ { SQL_API_SQLCANCEL, "SQLCancel", SQLCancel }, + /* 11 */ { SQL_API_SQLCLOSECURSOR, "SQLCloseCursor", SQLCloseCursor }, + /* 12 */ { SQL_API_SQLCOLATTRIBUTE, "SQLColAttribute", SQLColAttribute }, + /* 13 */ { SQL_API_SQLCOLATTRIBUTES, "SQLColAttributes", SQLColAttributes }, + /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES, "SQLColumnPrivileges", SQLColumnPrivileges }, + /* 15 */ { SQL_API_SQLCOLUMNS, "SQLColumns", SQLColumns }, + /* 16 */ { SQL_API_SQLCONNECT, "SQLConnect", SQLConnect }, + /* 17 */ { SQL_API_SQLCOPYDESC, "SQLCopyDesc", SQLCopyDesc }, + /* 18 */ { SQL_API_SQLDATASOURCES, "SQLDataSources", SQLDataSources }, + /* 19 */ { SQL_API_SQLDESCRIBECOL, "SQLDescribeCol", SQLDescribeCol }, + /* 20 */ { SQL_API_SQLDESCRIBEPARAM, "SQLDescribeParam", SQLDescribeParam }, + /* 21 */ { SQL_API_SQLDISCONNECT, "SQLDisconnect", SQLDisconnect }, + /* 22 */ { SQL_API_SQLDRIVERCONNECT, "SQLDriverConnect", SQLDriverConnect }, + /* 23 */ { SQL_API_SQLDRIVERS, "SQLDrivers", SQLDrivers }, + /* 24 */ { SQL_API_SQLENDTRAN, "SQLEndTran", SQLEndTran }, + /* 25 */ { SQL_API_SQLERROR, "SQLError", SQLError }, + /* 26 */ { SQL_API_SQLEXECDIRECT, "SQLExecDirect", SQLExecDirect }, + /* 27 */ { SQL_API_SQLEXECUTE, "SQLExecute", SQLExecute }, + /* 28 */ { SQL_API_SQLEXTENDEDFETCH, "SQLExtendedFetch", SQLExtendedFetch }, + /* 29 */ { SQL_API_SQLFETCH, "SQLFetch", SQLFetch }, + /* 30 */ { SQL_API_SQLFETCHSCROLL, "SQLFetchScroll", SQLFetchScroll }, + /* 31 */ { SQL_API_SQLFOREIGNKEYS, "SQLForeignKeys", SQLForeignKeys }, + /* 32 */ { SQL_API_SQLFREEENV, "SQLFreeEnv", SQLFreeEnv }, + /* 33 */ { SQL_API_SQLFREEHANDLE, "SQLFreeHandle", SQLFreeHandle }, + /* 34 */ { SQL_API_SQLFREESTMT, "SQLFreeStmt", SQLFreeStmt }, + /* 35 */ { SQL_API_SQLFREECONNECT, "SQLFreeConnect", SQLFreeConnect }, + /* 36 */ { SQL_API_SQLGETCONNECTATTR, "SQLGetConnectAttr", SQLGetConnectAttr }, + /* 37 */ { SQL_API_SQLGETCONNECTOPTION, "SQLGetConnectOption", SQLGetConnectOption }, + /* 38 */ { SQL_API_SQLGETCURSORNAME, "SQLGetCursorName", SQLGetCursorName }, + /* 39 */ { SQL_API_SQLGETDATA, "SQLGetData", SQLGetData }, + /* 40 */ { SQL_API_SQLGETDESCFIELD, "SQLGetDescField", SQLGetDescField }, + /* 41 */ { SQL_API_SQLGETDESCREC, "SQLGetDescRec", SQLGetDescRec }, + /* 42 */ { SQL_API_SQLGETDIAGFIELD, "SQLGetDiagField", SQLGetDiagField }, + /* 43 */ { SQL_API_SQLGETENVATTR, "SQLGetEnvAttr", SQLGetEnvAttr }, + /* 44 */ { SQL_API_SQLGETFUNCTIONS, "SQLGetFunctions", SQLGetFunctions }, + /* 45 */ { SQL_API_SQLGETINFO, "SQLGetInfo", SQLGetInfo }, + /* 46 */ { SQL_API_SQLGETSTMTATTR, "SQLGetStmtAttr", SQLGetStmtAttr }, + /* 47 */ { SQL_API_SQLGETSTMTOPTION, "SQLGetStmtOption", SQLGetStmtOption }, + /* 48 */ { SQL_API_SQLGETTYPEINFO, "SQLGetTypeInfo", SQLGetTypeInfo }, + /* 49 */ { SQL_API_SQLMORERESULTS, "SQLMoreResults", SQLMoreResults }, + /* 50 */ { SQL_API_SQLNATIVESQL, "SQLNativeSql", SQLNativeSql }, + /* 51 */ { SQL_API_SQLNUMPARAMS, "SQLNumParams", SQLNumParams }, + /* 52 */ { SQL_API_SQLNUMRESULTCOLS, "SQLNumResultCols", SQLNumResultCols }, + /* 53 */ { SQL_API_SQLPARAMDATA, "SQLParamData", SQLParamData }, + /* 54 */ { SQL_API_SQLPARAMOPTIONS, "SQLParamOptions", SQLParamOptions }, + /* 55 */ { SQL_API_SQLPREPARE, "SQLPrepare", SQLPrepare }, + /* 56 */ { SQL_API_SQLPRIMARYKEYS, "SQLPrimaryKeys", SQLPrimaryKeys }, + /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS, "SQLProcedureColumns", SQLProcedureColumns }, + /* 58 */ { SQL_API_SQLPROCEDURES, "SQLProcedures", SQLProcedures }, + /* 59 */ { SQL_API_SQLPUTDATA, "SQLPutData", SQLPutData }, + /* 60 */ { SQL_API_SQLROWCOUNT, "SQLRowCount", SQLRowCount }, + /* 61 */ { SQL_API_SQLSETCONNECTATTR, "SQLSetConnectAttr", SQLSetConnectAttr }, + /* 62 */ { SQL_API_SQLSETCONNECTOPTION, "SQLSetConnectOption", SQLSetConnectOption }, + /* 63 */ { SQL_API_SQLSETCURSORNAME, "SQLSetCursorName", SQLSetCursorName }, + /* 64 */ { SQL_API_SQLSETDESCFIELD, "SQLSetDescField", SQLSetDescField }, + /* 65 */ { SQL_API_SQLSETDESCREC, "SQLSetDescRec", SQLSetDescRec }, + /* 66 */ { SQL_API_SQLSETENVATTR, "SQLSetEnvAttr", SQLSetEnvAttr }, + /* 67 */ { SQL_API_SQLSETPARAM, "SQLSetParam", SQLSetParam }, + /* 68 */ { SQL_API_SQLSETPOS, "SQLSetPos", SQLSetPos }, + /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS, "SQLSetScrollOptions", SQLSetScrollOptions }, + /* 70 */ { SQL_API_SQLSETSTMTATTR, "SQLSetStmtAttr", SQLSetStmtAttr }, + /* 71 */ { SQL_API_SQLSETSTMTOPTION, "SQLSetStmtOption", SQLSetStmtOption }, + /* 72 */ { SQL_API_SQLSPECIALCOLUMNS, "SQLSpecialColumns", SQLSpecialColumns }, + /* 73 */ { SQL_API_SQLSTATISTICS, "SQLStatistics", SQLStatistics }, + /* 74 */ { SQL_API_SQLTABLEPRIVILEGES, "SQLTablePrivileges", SQLTablePrivileges }, + /* 75 */ { SQL_API_SQLTABLES, "SQLTables", SQLTables }, + /* 76 */ { SQL_API_SQLTRANSACT, "SQLTransact", SQLTransact }, + /* 77 */ { SQL_API_SQLGETDIAGREC, "SQLGetDiagRec", SQLGetDiagRec }, +}; + +static PROXYHANDLE gProxyHandle = {NULL, FALSE, FALSE, FALSE, ERROR_LIBRARY_NOT_FOUND}; + +SQLRETURNTYPE SQLDummyFunc() +{ + TRACE("SQLDummyFunc: \n"); + return SQL_SUCCESS; +} + +/*********************************************************************** + * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'. + * + * PARAMS + * hinstDLL [I] handle to the 'dlls' instance + * fdwReason [I] + * lpvReserved [I] reserverd, must be NULL + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL WINAPI +MAIN_OdbcInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + int i; + TRACE("Initializing proxy ODBC: %x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved); + + if (fdwReason == DLL_PROCESS_ATTACH) + { + TRACE("Loading ODBC...\n"); + if (ODBC_LoadDriverManager()) + ODBC_LoadDMFunctions(); + } + else if (fdwReason == DLL_PROCESS_DETACH) + { + TRACE("Unloading ODBC...\n"); + if (gProxyHandle.bFunctionReady) + { + for ( i = 0; i < NUM_SQLFUNC; i ++ ) + { + gProxyHandle.functions[i].func = SQLDummyFunc; + } + } + + if (gProxyHandle.dmHandle) + { + dlclose(gProxyHandle.dmHandle); + gProxyHandle.dmHandle = NULL; + } + } + + return TRUE; +} + + +/*********************************************************************** + * ODBC_LoadDriverManager [Internal] Load ODBC library. + * + * PARAMS + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL ODBC_LoadDriverManager() +{ + char *s = getenv("LIB_ODBC_DRIVER_MANAGER"); + + TRACE("\n"); + + gProxyHandle.bFunctionReady = FALSE; + + if (s != NULL && strlen(s) > 0) + strcpy(gProxyHandle.dmLibName, s); + else + strcpy(gProxyHandle.dmLibName, "libodbc.so"); + + gProxyHandle.dmHandle = dlopen(gProxyHandle.dmLibName, RTLD_LAZY); + + if (gProxyHandle.dmHandle == NULL) /* fail to load unixODBC driver manager */ + { + WARN("failed to open library %s\n", gProxyHandle.dmLibName); + gProxyHandle.dmLibName[0] = '\0'; + gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND; + return FALSE; + } + else + { + gProxyHandle.nErrorType = ERROR_FREE; + return TRUE; + } +} + + +/*********************************************************************** + * ODBC_LoadDMFunctions [Internal] Populate function table. + * + * PARAMS + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL ODBC_LoadDMFunctions() +{ + int i; + + if (gProxyHandle.dmHandle == NULL) + return FALSE; + + for ( i = 0; i < NUM_SQLFUNC; i ++ ) + { + gProxyHandle.functions[i] = template_func[i]; + gProxyHandle.functions[i].func = dlsym(gProxyHandle.dmHandle, + gProxyHandle.functions[i].name); + + if (dlerror()) + { + ERR("Failed to load function %s",gProxyHandle.functions[i].name); + gProxyHandle.functions[i].func = SQLDummyFunc; + } + } + + gProxyHandle.bFunctionReady = TRUE; + + return TRUE; +} + + +/************************************************************************* + * SQLAllocConnect [ODBC32.001] + */ +SQLRETURNTYPE SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + *ConnectionHandle = SQL_NULL_HDBC; + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCCONNECT].func) + (EnvironmentHandle, ConnectionHandle); +} + + +/************************************************************************* + * SQLAllocEnv [ODBC32.002] + */ +SQLRETURNTYPE SQLAllocEnv(SQLHENV *EnvironmentHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + *EnvironmentHandle = SQL_NULL_HENV; + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCENV].func) (EnvironmentHandle); +} + + +/************************************************************************* + * SQLAllocHandle [ODBC32.024] + */ +SQLRETURNTYPE SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) +{ + TRACE(".\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND) + WARN("ProxyODBC: Can not load ODBC driver manager library.\n"); + + if (HandleType == SQL_HANDLE_ENV) + *OutputHandle = SQL_NULL_HENV; + else if (HandleType == SQL_HANDLE_DBC) + *OutputHandle = SQL_NULL_HDBC; + else if (HandleType == SQL_HANDLE_STMT) + *OutputHandle = SQL_NULL_HSTMT; + else if (HandleType == SQL_HANDLE_DESC) + *OutputHandle = SQL_NULL_HDESC; + + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLE].func) + (HandleType, InputHandle, OutputHandle); +} + + +/************************************************************************* + * SQLAllocStmt [ODBC32.003] + */ +SQLRETURNTYPE SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle) +{ + + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + *StatementHandle = SQL_NULL_HSTMT; + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCSTMT].func) + (ConnectionHandle, StatementHandle); +} + + +/************************************************************************* + * SQLAllocHandleStd [ODBC32.077] + */ +SQLRETURNTYPE SQLAllocHandleStd( SQLSMALLINT HandleType, + SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) +{ + TRACE("ProxyODBC: SQLAllocHandelStd.\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND) + WARN("ProxyODBC: Can not load ODBC driver manager library.\n"); + + if (HandleType == SQL_HANDLE_ENV) + *OutputHandle = SQL_NULL_HENV; + else if (HandleType == SQL_HANDLE_DBC) + *OutputHandle = SQL_NULL_HDBC; + else if (HandleType == SQL_HANDLE_STMT) + *OutputHandle = SQL_NULL_HSTMT; + else if (HandleType == SQL_HANDLE_DESC) + *OutputHandle = SQL_NULL_HDESC; + + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLESTD].func) + (HandleType, InputHandle, OutputHandle); +} + + +/************************************************************************* + * SQLBindCol [ODBC32.004] + */ +SQLRETURNTYPE SQLBindCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLINTEGER BufferLength, + SQLINTEGER *StrLen_or_Ind) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDCOL].func) + (StatementHandle, ColumnNumber, TargetType, + TargetValue, BufferLength, StrLen_or_Ind); +} + + +/************************************************************************* + * SQLBindParam [ODBC32.025] + */ +SQLRETURNTYPE SQLBindParam(SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision, + SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, + SQLINTEGER *StrLen_or_Ind) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAM].func) + (StatementHandle, ParameterNumber, ValueType, + ParameterScale, ParameterValue, StrLen_or_Ind); +} + + +/************************************************************************* + * SQLCancel [ODBC32.005] + */ +SQLRETURNTYPE SQLCancel(SQLHSTMT StatementHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCANCEL].func) (StatementHandle); +} + + +/************************************************************************* + * SQLCloseCursor [ODBC32.026] + */ +SQLRETURNTYPE SQLCloseCursor(SQLHSTMT StatementHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCLOSECURSOR].func) (StatementHandle); +} + + +/************************************************************************* + * SQLColAttribute [ODBC32.027] + */ +SQLRETURNTYPE SQLColAttribute (SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].func) + (StatementHandle, ColumnNumber, FieldIdentifier, + CharacterAttribute, BufferLength, StringLength, NumericAttribute); +} + + +/************************************************************************* + * SQLColumns [ODBC32.040] + */ +SQLRETURNTYPE SQLColumns(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLCHAR *ColumnName, SQLSMALLINT NameLength4) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].func) + (StatementHandle, CatalogName, NameLength1, + SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4); +} + + +/************************************************************************* + * SQLConnect [ODBC32.007] + */ +SQLRETURNTYPE SQLConnect(SQLHDBC ConnectionHandle, + SQLCHAR *ServerName, SQLSMALLINT NameLength1, + SQLCHAR *UserName, SQLSMALLINT NameLength2, + SQLCHAR *Authentication, SQLSMALLINT NameLength3) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + strcpy(gProxyHandle.ServerName, ServerName); + strcpy(gProxyHandle.UserName, UserName); + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].func) + (ConnectionHandle, ServerName, NameLength1, + UserName, NameLength2, Authentication, NameLength3); +} + + +/************************************************************************* + * SQLCopyDesc [ODBC32.028] + */ +SQLRETURNTYPE SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOPYDESC].func) + (SourceDescHandle, TargetDescHandle); +} + + +/************************************************************************* + * SQLDataSources [ODBC32.057] + */ +SQLRETURNTYPE SQLDataSources(SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, SQLCHAR *ServerName, + SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, + SQLCHAR *Description, SQLSMALLINT BufferLength2, + SQLSMALLINT *NameLength2) +{ + SQLRETURN ret; + + TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n"); + return SQL_ERROR; + } + + ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].func) + (EnvironmentHandle, Direction, ServerName, + BufferLength1, NameLength1, Description, BufferLength2, NameLength2); + + if (TRACE_ON(odbc)) + { + TRACE("returns: %d \t", ret); + if (*NameLength1 > 0) + TRACE("DataSource = %s,", ServerName); + if (*NameLength2 > 0) + TRACE(" Description = %s\n", Description); + } + + return ret; +} + + +/************************************************************************* + * SQLDescribeCol [ODBC32.008] + */ +SQLRETURNTYPE SQLDescribeCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, + SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize, + SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].func) + (StatementHandle, ColumnNumber, ColumnName, + BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); +} + + +/************************************************************************* + * SQLDisconnect [ODBC32.009] + */ +SQLRETURNTYPE SQLDisconnect(SQLHDBC ConnectionHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + gProxyHandle.ServerName[0] = '\0'; + gProxyHandle.UserName[0] = '\0'; + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLDISCONNECT].func) (ConnectionHandle); +} + + +/************************************************************************* + * SQLEndTran [ODBC32.029] + */ +SQLRETURNTYPE SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLENDTRAN].func) (HandleType, Handle, CompletionType); +} + + +/************************************************************************* + * SQLError [ODBC32.010] + */ +SQLRETURNTYPE SQLError(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, + SQLCHAR *Sqlstate, SQLINTEGER *NativeError, + SQLCHAR *MessageText, SQLSMALLINT BufferLength, + SQLSMALLINT *TextLength) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].func) + (EnvironmentHandle, ConnectionHandle, StatementHandle, + Sqlstate, NativeError, MessageText, BufferLength, TextLength); +} + + +/************************************************************************* + * SQLExecDirect [ODBC32.011] + */ +SQLRETURNTYPE SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].func) + (StatementHandle, StatementText, TextLength); +} + + +/************************************************************************* + * SQLExecute [ODBC32.012] + */ +SQLRETURNTYPE SQLExecute(SQLHSTMT StatementHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECUTE].func) (StatementHandle); +} + + +/************************************************************************* + * SQLFetch [ODBC32.013] + */ +SQLRETURNTYPE SQLFetch(SQLHSTMT StatementHandle) +{ + TRACE("\n"); + + if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCH].func) (StatementHandle); +} + + +/************************************************************************* + * SQLFetchScroll [ODBC32.030] + */ +SQLRETURNTYPE SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset) +{ + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCHSCROLL].func) + (StatementHandle, FetchOrientation, FetchOffset); +} + + +/************************************************************************* + * SQLFreeConnect [ODBC32.014] + */ +SQLRETURNTYPE SQLFreeConnect(SQLHDBC ConnectionHandle) +{ + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLFREECONNECT].func) (ConnectionHandle); +} + + +/************************************************************************* + * SQLFreeEnv [ODBC32.015] + */ +SQLRETURNTYPE SQLFreeEnv(SQLHENV EnvironmentHandle) +{ + SQLRETURN ret; + + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEENV].func) (EnvironmentHandle); + /* + if (gProxyHandle.dmHandle) + { + dlclose(gProxyHandle.dmHandle); + gProxyHandle.dmHandle = NULL; + } + */ + + return ret; +} + + +/************************************************************************* + * SQLFreeHandle [ODBC32.031] + */ +SQLRETURNTYPE SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) +{ + SQLRETURN ret; + + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEHANDLE].func) + (HandleType, Handle); + + if (HandleType == SQL_HANDLE_ENV) /* it is time to close the loaded library */ + { + if (gProxyHandle.dmHandle) + { + dlclose(gProxyHandle.dmHandle); + gProxyHandle.dmHandle = NULL; + } + } + + return ret; +} + + +/************************************************************************* + * SQLFreeStmt [ODBC32.016] + */ +SQLRETURNTYPE SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) +{ + + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLFREESTMT].func) + (StatementHandle, Option); +} + + +/************************************************************************* + * SQLGetConnectAttr [ODBC32.032] + */ +SQLRETURNTYPE SQLGetConnectAttr(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength) +{ + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].func) + (ConnectionHandle, Attribute, Value, + BufferLength, StringLength); +} + + +/************************************************************************* + * SQLGetConnectOption [ODBC32.042] + */ +SQLRETURNTYPE SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value) +{ + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].func) + (ConnectionHandle, Option, Value); +} + + +/************************************************************************* + * SQLGetCursorName [ODBC32.017] + */ +SQLRETURNTYPE SQLGetCursorName(SQLHSTMT StatementHandle, + SQLCHAR *CursorName, SQLSMALLINT BufferLength, + SQLSMALLINT *NameLength) +{ + TRACE("\n"); + + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].func) + (StatementHandle, CursorName, BufferLength, NameLength); +} + + +/************************************************************************* + * SQLGetData [ODBC32.043] + */ +SQLRETURNTYPE SQLGetData(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLINTEGER BufferLength, + SQLINTEGER *StrLen_or_Ind) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDATA].func) + (StatementHandle, ColumnNumber, TargetType, + TargetValue, BufferLength, StrLen_or_Ind); +} + + +/************************************************************************* + * SQLGetDescField [ODBC32.033] + */ +SQLRETURNTYPE SQLGetDescField(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength, + SQLINTEGER *StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].func) + (DescriptorHandle, RecNumber, FieldIdentifier, + Value, BufferLength, StringLength); +} + + +/************************************************************************* + * SQLGetDescRec [ODBC32.034] + */ +SQLRETURNTYPE SQLGetDescRec(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLCHAR *Name, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, + SQLSMALLINT *Type, SQLSMALLINT *SubType, + SQLINTEGER *Length, SQLSMALLINT *Precision, + SQLSMALLINT *Scale, SQLSMALLINT *Nullable) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].func) + (DescriptorHandle, RecNumber, Name, BufferLength, + StringLength, Type, SubType, Length, Precision, Scale, Nullable); +} + + +/************************************************************************* + * SQLGetDiagField [ODBC32.035] + */ +SQLRETURNTYPE SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].func) + (HandleType, Handle, RecNumber, DiagIdentifier, + DiagInfo, BufferLength, StringLength); +} + + +/************************************************************************* + * SQLGetDiagRec [ODBC32.036] + */ +SQLRETURNTYPE SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, + SQLINTEGER *NativeError, SQLCHAR *MessageText, + SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].func) + (HandleType, Handle, RecNumber, Sqlstate, NativeError, + MessageText, BufferLength, TextLength); +} + + +/************************************************************************* + * SQLGetEnvAttr [ODBC32.037] + */ +SQLRETURNTYPE SQLGetEnvAttr(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETENVATTR].func) + (EnvironmentHandle, Attribute, Value, BufferLength, StringLength); +} + + +/************************************************************************* + * SQLGetFunctions [ODBC32.044] + */ +SQLRETURNTYPE SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETFUNCTIONS].func) + (ConnectionHandle, FunctionId, Supported); +} + + +/************************************************************************* + * SQLGetInfo [ODBC32.045] + */ +SQLRETURNTYPE SQLGetInfo(SQLHDBC ConnectionHandle, + SQLUSMALLINT InfoType, SQLPOINTER InfoValue, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].func) + (ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength); +} + + +/************************************************************************* + * SQLiGetStmtAttr [ODBC32.038] + */ +SQLRETURNTYPE SQLGetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].func) + (StatementHandle, Attribute, Value, BufferLength, StringLength); +} + + +/************************************************************************* + * SQLGetStmtOption [ODBC32.046] + */ +SQLRETURNTYPE SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTOPTION].func) + (StatementHandle, Option, Value); +} + + +/************************************************************************* + * SQLgetTypeInfo [ODBC32.047] + */ +SQLRETURNTYPE SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].func) + (StatementHandle, DataType); +} + + +/************************************************************************* + * SQLNumResultCols [ODBC32.018] + */ +SQLRETURNTYPE SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMRESULTCOLS].func) + (StatementHandle, ColumnCount); +} + + +/************************************************************************* + * SQLParamData [ODBC32.048] + */ +SQLRETURNTYPE SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMDATA].func) + (StatementHandle, Value); +} + + +/************************************************************************* + * SQLPrepare [ODBC32.019] + */ +SQLRETURNTYPE SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].func) + (StatementHandle, StatementText, TextLength); +} + + +/************************************************************************* + * SQLPutData [ODBC32.049] + */ +SQLRETURNTYPE SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLINTEGER StrLen_or_Ind) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLPUTDATA].func) + (StatementHandle, Data, StrLen_or_Ind); +} + + +/************************************************************************* + * SQLRowCount [ODBC32.020] + */ +SQLRETURNTYPE SQLRowCount(SQLHSTMT StatementHandle, SQLINTEGER *RowCount) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLROWCOUNT].func) + (StatementHandle, RowCount); +} + + +/************************************************************************* + * SQLSetConnectAttr [ODBC32.039] + */ +SQLRETURNTYPE SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, + SQLPOINTER Value, SQLINTEGER StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].func) + (ConnectionHandle, Attribute, Value, StringLength); +} + + +/************************************************************************* + * SQLSetConnectOption [ODBC32.050] + */ +SQLRETURNTYPE SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLUINTEGER Value) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].func) + (ConnectionHandle, Option, Value); +} + + +/************************************************************************* + * SQLSetCursorName [ODBC32.021] + */ +SQLRETURNTYPE SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].func) + (StatementHandle, CursorName, NameLength); +} + + +/************************************************************************* + * SQLSetDescField [ODBC32.073] + */ +SQLRETURNTYPE SQLSetDescField(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].func) + (DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength); +} + + +/************************************************************************* + * SQLSetDescRec [ODBC32.074] + */ +SQLRETURNTYPE SQLSetDescRec(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT Type, + SQLSMALLINT SubType, SQLINTEGER Length, + SQLSMALLINT Precision, SQLSMALLINT Scale, + SQLPOINTER Data, SQLINTEGER *StringLength, + SQLINTEGER *Indicator) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCREC].func) + (DescriptorHandle, RecNumber, Type, SubType, Length, + Precision, Scale, Data, StringLength, Indicator); +} + + +/************************************************************************* + * SQLSetEnvAttr [ODBC32.075] + */ +SQLRETURNTYPE SQLSetEnvAttr(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETENVATTR].func) + (EnvironmentHandle, Attribute, Value, StringLength); +} + + +/************************************************************************* + * SQLSetParam [ODBC32.022] + */ +SQLRETURNTYPE SQLSetParam(SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision, + SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, + SQLINTEGER *StrLen_or_Ind) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPARAM].func) + (StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision, + ParameterScale, ParameterValue, StrLen_or_Ind); +} + + +/************************************************************************* + * SQLSetStmtAttr [ODBC32.076] + */ +SQLRETURNTYPE SQLSetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].func) + (StatementHandle, Attribute, Value, StringLength); +} + + +/************************************************************************* + * SQLSetStmtOption [ODBC32.051] + */ +SQLRETURNTYPE SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLUINTEGER Value) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTOPTION].func) + (StatementHandle, Option, Value); +} + + +/************************************************************************* + * SQLSpecialColumns [ODBC32.052] + */ +SQLRETURNTYPE SQLSpecialColumns(SQLHSTMT StatementHandle, + SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName, + SQLSMALLINT NameLength1, SQLCHAR *SchemaName, + SQLSMALLINT NameLength2, SQLCHAR *TableName, + SQLSMALLINT NameLength3, SQLUSMALLINT Scope, + SQLUSMALLINT Nullable) +{ + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].func) + (StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName, + NameLength2, TableName, NameLength3, Scope, Nullable); +} + + +/************************************************************************* + * SQLStatisitics [ODBC32.053] + */ +SQLRETURNTYPE SQLStatistics(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLUSMALLINT Unique, SQLUSMALLINT Reserved) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].func) + (StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, + TableName, NameLength3, Unique, Reserved); +} + + +/************************************************************************* + * SQLTables [ODBC32.054] + */ +SQLRETURNTYPE SQLTables(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLCHAR *TableType, SQLSMALLINT NameLength4) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].func) + (StatementHandle, CatalogName, NameLength1, + SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4); +} + + +/************************************************************************* + * SQLTransact [ODBC32.023] + */ +SQLRETURNTYPE SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, + SQLUSMALLINT CompletionType) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLTRANSACT].func) + (EnvironmentHandle, ConnectionHandle, CompletionType); +} + + +/************************************************************************* + * SQLBrowseConnect [ODBC32.055] + */ +SQLRETURNTYPE SQLBrowseConnect( + SQLHDBC hdbc, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].func) + (hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut); +} + + +/************************************************************************* + * SQLBulkOperations [ODBC32.078] + */ +SQLRETURNTYPE SQLBulkOperations( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLBULKOPERATIONS].func) + (StatementHandle, Operation); +} + + +/************************************************************************* + * SQLColAttributes [ODBC32.006] + */ +SQLRETURNTYPE SQLColAttributes( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLINTEGER *pfDesc) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].func) + (hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); +} + + +/************************************************************************* + * SQLColumnPrivileges [ODBC32.056] + */ +SQLRETURNTYPE SQLColumnPrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].func) + (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, + szTableName, cbTableName, szColumnName, cbColumnName); +} + + +/************************************************************************* + * SQLDescribeParam [ODBC32.058] + */ +SQLRETURNTYPE SQLDescribeParam( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLUINTEGER *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBEPARAM].func) + (hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable); +} + + +/************************************************************************* + * SQLExtendedFetch [ODBC32.059] + */ +SQLRETURNTYPE SQLExtendedFetch( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLINTEGER irow, + SQLUINTEGER *pcrow, + SQLUSMALLINT *rgfRowStatus) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXTENDEDFETCH].func) + (hstmt, fFetchType, irow, pcrow, rgfRowStatus); +} + + +/************************************************************************* + * SQLForeignKeys [ODBC32.060] + */ +SQLRETURNTYPE SQLForeignKeys( + SQLHSTMT hstmt, + SQLCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLCHAR *szFkTableName, + SQLSMALLINT cbFkTableName) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].func) + (hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName, + szPkTableName, cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName, + cbFkSchemaName, szFkTableName, cbFkTableName); +} + + +/************************************************************************* + * SQLMoreResults [ODBC32.061] + */ +SQLRETURNTYPE SQLMoreResults(SQLHSTMT hstmt) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLMORERESULTS].func) (hstmt); +} + + +/************************************************************************* + * SQLNativeSql [ODBC32.062] + */ +SQLRETURNTYPE SQLNativeSql( + SQLHDBC hdbc, + SQLCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].func) + (hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); +} + + +/************************************************************************* + * SQLNumParams [ODBC32.063] + */ +SQLRETURNTYPE SQLNumParams( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMPARAMS].func) (hstmt, pcpar); +} + + +/************************************************************************* + * SQLParamOptions [ODBC32.064] + */ +SQLRETURNTYPE SQLParamOptions( + SQLHSTMT hstmt, + SQLUINTEGER crow, + SQLUINTEGER *pirow) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMOPTIONS].func) (hstmt, crow, pirow); +} + + +/************************************************************************* + * SQLPrimaryKeys [ODBC32.065] + */ +SQLRETURNTYPE SQLPrimaryKeys( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].func) + (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, + szTableName, cbTableName); +} + + +/************************************************************************* + * SQLProcedureColumns [ODBC32.066] + */ +SQLRETURNTYPE SQLProcedureColumns( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].func) + (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, + szProcName, cbProcName, szColumnName, cbColumnName); +} + + +/************************************************************************* + * SQLProcedures [ODBC32.067] + */ +SQLRETURNTYPE SQLProcedures( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].func) + (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, + szProcName, cbProcName); +} + + +/************************************************************************* + * SQLSetPos [ODBC32.068] + */ +SQLRETURNTYPE SQLSetPos( + SQLHSTMT hstmt, + SQLUSMALLINT irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPOS].func) + (hstmt, irow, fOption, fLock); +} + + +/************************************************************************* + * SQLTablePrivileges [ODBC32.070] + */ +SQLRETURNTYPE SQLTablePrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].func) + (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, + szTableName, cbTableName); +} + + +/************************************************************************* + * SQLDrivers [ODBC32.071] + */ +SQLRETURNTYPE SQLDrivers( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLCHAR *szDriverAttributes, + SQLSMALLINT cbDriverAttrMax, + SQLSMALLINT *pcbDriverAttr) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].func) + (henv, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc, + szDriverAttributes, cbDriverAttrMax, pcbDriverAttr); +} + + +/************************************************************************* + * SQLBindParameter [ODBC32.072] + */ +SQLRETURNTYPE SQLBindParameter( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLUINTEGER cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAMETER].func) + (hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, + rgbValue, cbValueMax, pcbValue); +} + + +/************************************************************************* + * SQLDriverConnect [ODBC32.041] + */ +SQLRETURNTYPE SQLDriverConnect( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *conn_str_in, + SQLSMALLINT len_conn_str_in, + SQLCHAR *conn_str_out, + SQLSMALLINT conn_str_out_max, + SQLSMALLINT *ptr_conn_str_out, + SQLUSMALLINT driver_completion ) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].func) + (hdbc, hwnd, conn_str_in, len_conn_str_in, conn_str_out, + conn_str_out_max, ptr_conn_str_out, driver_completion); +} + + +/************************************************************************* + * SQLSetScrollOptions [ODBC32.069] + */ +SQLRETURNTYPE SQLSetScrollOptions( + SQLHSTMT statement_handle, + SQLUSMALLINT f_concurrency, + SQLINTEGER crow_keyset, + SQLUSMALLINT crow_rowset ) +{ + TRACE("\n"); + if (gProxyHandle.dmHandle == NULL) + { + return SQL_ERROR; + } + + return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSCROLLOPTIONS].func) + (statement_handle, f_concurrency, crow_keyset, crow_rowset); +} + + diff --git a/dlls/odbc32/proxyodbc.h b/dlls/odbc32/proxyodbc.h new file mode 100644 index 00000000000..559ec295a8a --- /dev/null +++ b/dlls/odbc32/proxyodbc.h @@ -0,0 +1,116 @@ +#ifndef _PROXYMANAGER_H +#define _PROXYMANAGER_H + +#define NUM_SQLFUNC 78 +#define ERROR_FREE 0 +#define ERROR_SQLERROR 1 +#define ERROR_LIBRARY_NOT_FOUND 2 +#define ERROR_FUNCTIONS_NOT_LOADED 3 + +#define ODBCVER 0x0351 + +typedef struct dm_func /* driver manager functions */ +{ + int ordinal; + char *name; + void *d_func; + SQLRETURN (*func)(); +} DM_FUNC; + +typedef struct proxyhandle +{ + void *dmHandle; /* driver manager handle */ + BOOL isWindowsDriver; /* is driver a Windows version*/ + BOOL bCallbackReady; /* procs taken from Windows driver placed in driver manager as callbacks */ + BOOL bFunctionReady; + int nErrorType; + DM_FUNC functions[NUM_SQLFUNC]; /* entry point for driver manager functions */ + char driverLibName[200]; /* ODBC driver SO name */ + char dmLibName[200]; /* driver manager library name */ + char ServerName[200]; /* keep server name */ + char UserName[50]; /* keep username */ +} PROXYHANDLE; + +BOOL ODBC_LoadDriverManager(); +BOOL ODBC_LoadDMFunctions(); + +#define /* 00 */ SQLAPI_INDEX_SQLALLOCCONNECT 0 +#define /* 01 */ SQLAPI_INDEX_SQLALLOCENV 1 +#define /* 02 */ SQLAPI_INDEX_SQLALLOCHANDLE 2 +#define /* 03 */ SQLAPI_INDEX_SQLALLOCSTMT 3 +#define /* 04 */ SQLAPI_INDEX_SQLALLOCHANDLESTD 4 +#define /* 05 */ SQLAPI_INDEX_SQLBINDCOL 5 +#define /* 06 */ SQLAPI_INDEX_SQLBINDPARAM 6 +#define /* 07 */ SQLAPI_INDEX_SQLBINDPARAMETER 7 +#define /* 08 */ SQLAPI_INDEX_SQLBROWSECONNECT 8 +#define /* 09 */ SQLAPI_INDEX_SQLBULKOPERATIONS 9 +#define /* 10 */ SQLAPI_INDEX_SQLCANCEL 10 +#define /* 11 */ SQLAPI_INDEX_SQLCLOSECURSOR 11 +#define /* 12 */ SQLAPI_INDEX_SQLCOLATTRIBUTE 12 +#define /* 13 */ SQLAPI_INDEX_SQLCOLATTRIBUTES 13 +#define /* 14 */ SQLAPI_INDEX_SQLCOLUMNPRIVILEGES 14 +#define /* 15 */ SQLAPI_INDEX_SQLCOLUMNS 15 +#define /* 16 */ SQLAPI_INDEX_SQLCONNECT 16 +#define /* 17 */ SQLAPI_INDEX_SQLCOPYDESC 17 +#define /* 18 */ SQLAPI_INDEX_SQLDATASOURCES 18 +#define /* 19 */ SQLAPI_INDEX_SQLDESCRIBECOL 19 +#define /* 20 */ SQLAPI_INDEX_SQLDESCRIBEPARAM 20 +#define /* 21 */ SQLAPI_INDEX_SQLDISCONNECT 21 +#define /* 22 */ SQLAPI_INDEX_SQLDRIVERCONNECT 22 +#define /* 23 */ SQLAPI_INDEX_SQLDRIVERS 23 +#define /* 24 */ SQLAPI_INDEX_SQLENDTRAN 24 +#define /* 25 */ SQLAPI_INDEX_SQLERROR 25 +#define /* 26 */ SQLAPI_INDEX_SQLEXECDIRECT 26 +#define /* 27 */ SQLAPI_INDEX_SQLEXECUTE 27 +#define /* 28 */ SQLAPI_INDEX_SQLEXTENDEDFETCH 28 +#define /* 29 */ SQLAPI_INDEX_SQLFETCH 29 +#define /* 30 */ SQLAPI_INDEX_SQLFETCHSCROLL 30 +#define /* 31 */ SQLAPI_INDEX_SQLFOREIGNKEYS 31 +#define /* 32 */ SQLAPI_INDEX_SQLFREEENV 32 +#define /* 33 */ SQLAPI_INDEX_SQLFREEHANDLE 33 +#define /* 34 */ SQLAPI_INDEX_SQLFREESTMT 34 +#define /* 35 */ SQLAPI_INDEX_SQLFREECONNECT 35 +#define /* 36 */ SQLAPI_INDEX_SQLGETCONNECTATTR 36 +#define /* 37 */ SQLAPI_INDEX_SQLGETCONNECTOPTION 37 +#define /* 38 */ SQLAPI_INDEX_SQLGETCURSORNAME 38 +#define /* 39 */ SQLAPI_INDEX_SQLGETDATA 39 +#define /* 40 */ SQLAPI_INDEX_SQLGETDESCFIELD 40 +#define /* 41 */ SQLAPI_INDEX_SQLGETDESCREC 41 +#define /* 42 */ SQLAPI_INDEX_SQLGETDIAGFIELD 42 +#define /* 43 */ SQLAPI_INDEX_SQLGETENVATTR 43 +#define /* 44 */ SQLAPI_INDEX_SQLGETFUNCTIONS 44 +#define /* 45 */ SQLAPI_INDEX_SQLGETINFO 45 +#define /* 46 */ SQLAPI_INDEX_SQLGETSTMTATTR 46 +#define /* 47 */ SQLAPI_INDEX_SQLGETSTMTOPTION 47 +#define /* 48 */ SQLAPI_INDEX_SQLGETTYPEINFO 48 +#define /* 49 */ SQLAPI_INDEX_SQLMORERESULTS 49 +#define /* 50 */ SQLAPI_INDEX_SQLNATIVESQL 50 +#define /* 51 */ SQLAPI_INDEX_SQLNUMPARAMS 51 +#define /* 52 */ SQLAPI_INDEX_SQLNUMRESULTCOLS 52 +#define /* 53 */ SQLAPI_INDEX_SQLPARAMDATA 53 +#define /* 54 */ SQLAPI_INDEX_SQLPARAMOPTIONS 54 +#define /* 55 */ SQLAPI_INDEX_SQLPREPARE 55 +#define /* 56 */ SQLAPI_INDEX_SQLPRIMARYKEYS 56 +#define /* 57 */ SQLAPI_INDEX_SQLPROCEDURECOLUMNS 57 +#define /* 58 */ SQLAPI_INDEX_SQLPROCEDURES 58 +#define /* 59 */ SQLAPI_INDEX_SQLPUTDATA 59 +#define /* 60 */ SQLAPI_INDEX_SQLROWCOUNT 60 +#define /* 61 */ SQLAPI_INDEX_SQLSETCONNECTATTR 61 +#define /* 62 */ SQLAPI_INDEX_SQLSETCONNECTOPTION 62 +#define /* 63 */ SQLAPI_INDEX_SQLSETCURSORNAME 63 +#define /* 64 */ SQLAPI_INDEX_SQLSETDESCFIELD 64 +#define /* 65 */ SQLAPI_INDEX_SQLSETDESCREC 65 +#define /* 66 */ SQLAPI_INDEX_SQLSETENVATTR 66 +#define /* 67 */ SQLAPI_INDEX_SQLSETPARAM 67 +#define /* 68 */ SQLAPI_INDEX_SQLSETPOS 68 +#define /* 69 */ SQLAPI_INDEX_SQLSETSCROLLOPTIONS 69 +#define /* 70 */ SQLAPI_INDEX_SQLSETSTMTATTR 70 +#define /* 71 */ SQLAPI_INDEX_SQLSETSTMTOPTION 71 +#define /* 72 */ SQLAPI_INDEX_SQLSPECIALCOLUMNS 72 +#define /* 73 */ SQLAPI_INDEX_SQLSTATISTICS 73 +#define /* 74 */ SQLAPI_INDEX_SQLTABLEPRIVILEGES 74 +#define /* 75 */ SQLAPI_INDEX_SQLTABLES 75 +#define /* 76 */ SQLAPI_INDEX_SQLTRANSACT 76 +#define /* 77 */ SQLAPI_INDEX_SQLGETDIAGREC 77 + +#endif diff --git a/include/debugdefs.h b/include/debugdefs.h index 50250a815e2..dd649e449d4 100644 --- a/include/debugdefs.h +++ b/include/debugdefs.h @@ -102,73 +102,74 @@ const int dbch_msvideo = 90; const int dbch_nativefont = 91; const int dbch_nonclient = 92; const int dbch_ntdll = 93; -const int dbch_ole = 94; -const int dbch_pager = 95; -const int dbch_palette = 96; -const int dbch_pidl = 97; -const int dbch_print = 98; -const int dbch_process = 99; -const int dbch_profile = 100; -const int dbch_progress = 101; -const int dbch_prop = 102; -const int dbch_propsheet = 103; -const int dbch_psapi = 104; -const int dbch_psdrv = 105; -const int dbch_ras = 106; -const int dbch_rebar = 107; -const int dbch_reg = 108; -const int dbch_region = 109; -const int dbch_relay = 110; -const int dbch_resource = 111; -const int dbch_scroll = 112; -const int dbch_security = 113; -const int dbch_segment = 114; -const int dbch_seh = 115; -const int dbch_selector = 116; -const int dbch_sendmsg = 117; -const int dbch_server = 118; -const int dbch_shell = 119; -const int dbch_snoop = 120; -const int dbch_sound = 121; -const int dbch_static = 122; -const int dbch_statusbar = 123; -const int dbch_storage = 124; -const int dbch_stress = 125; -const int dbch_string = 126; -const int dbch_syscolor = 127; -const int dbch_system = 128; -const int dbch_tab = 129; -const int dbch_tape = 130; -const int dbch_tapi = 131; -const int dbch_task = 132; -const int dbch_text = 133; -const int dbch_thread = 134; -const int dbch_thunk = 135; -const int dbch_timer = 136; -const int dbch_toolbar = 137; -const int dbch_toolhelp = 138; -const int dbch_tooltips = 139; -const int dbch_trackbar = 140; -const int dbch_treeview = 141; -const int dbch_ttydrv = 142; -const int dbch_tweak = 143; -const int dbch_typelib = 144; -const int dbch_updown = 145; -const int dbch_ver = 146; -const int dbch_virtual = 147; -const int dbch_vxd = 148; -const int dbch_wave = 149; -const int dbch_win = 150; -const int dbch_win16drv = 151; -const int dbch_win32 = 152; -const int dbch_wing = 153; -const int dbch_winsock = 154; -const int dbch_winspool = 155; -const int dbch_wnet = 156; -const int dbch_x11 = 157; -const int dbch_x11drv = 158; +const int dbch_odbc = 94; +const int dbch_ole = 95; +const int dbch_pager = 96; +const int dbch_palette = 97; +const int dbch_pidl = 98; +const int dbch_print = 99; +const int dbch_process = 100; +const int dbch_profile = 101; +const int dbch_progress = 102; +const int dbch_prop = 103; +const int dbch_propsheet = 104; +const int dbch_psapi = 105; +const int dbch_psdrv = 106; +const int dbch_ras = 107; +const int dbch_rebar = 108; +const int dbch_reg = 109; +const int dbch_region = 110; +const int dbch_relay = 111; +const int dbch_resource = 112; +const int dbch_scroll = 113; +const int dbch_security = 114; +const int dbch_segment = 115; +const int dbch_seh = 116; +const int dbch_selector = 117; +const int dbch_sendmsg = 118; +const int dbch_server = 119; +const int dbch_shell = 120; +const int dbch_snoop = 121; +const int dbch_sound = 122; +const int dbch_static = 123; +const int dbch_statusbar = 124; +const int dbch_storage = 125; +const int dbch_stress = 126; +const int dbch_string = 127; +const int dbch_syscolor = 128; +const int dbch_system = 129; +const int dbch_tab = 130; +const int dbch_tape = 131; +const int dbch_tapi = 132; +const int dbch_task = 133; +const int dbch_text = 134; +const int dbch_thread = 135; +const int dbch_thunk = 136; +const int dbch_timer = 137; +const int dbch_toolbar = 138; +const int dbch_toolhelp = 139; +const int dbch_tooltips = 140; +const int dbch_trackbar = 141; +const int dbch_treeview = 142; +const int dbch_ttydrv = 143; +const int dbch_tweak = 144; +const int dbch_typelib = 145; +const int dbch_updown = 146; +const int dbch_ver = 147; +const int dbch_virtual = 148; +const int dbch_vxd = 149; +const int dbch_wave = 150; +const int dbch_win = 151; +const int dbch_win16drv = 152; +const int dbch_win32 = 153; +const int dbch_wing = 154; +const int dbch_winsock = 155; +const int dbch_winspool = 156; +const int dbch_wnet = 157; +const int dbch_x11 = 158; +const int dbch_x11drv = 159; -#define DEBUG_CHANNEL_COUNT 159 +#define DEBUG_CHANNEL_COUNT 160 char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = { {1, 1, 0, 0}, @@ -329,6 +330,7 @@ char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = { {1, 1, 0, 0}, {1, 1, 0, 0}, {1, 1, 0, 0}, +{1, 1, 0, 0}, {1, 1, 0, 0} }; @@ -427,6 +429,7 @@ const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = { "nativefont", "nonclient", "ntdll", +"odbc", "ole", "pager", "palette", diff --git a/include/sql.h b/include/sql.h new file mode 100644 index 00000000000..0466200f6f9 --- /dev/null +++ b/include/sql.h @@ -0,0 +1,730 @@ +/* + * ODBC definitions + * + */ +#ifndef __SQL_H +#define __SQL_H + +#ifndef ODBCVER +#define ODBCVER 0x0351 +#endif + +#include "sqltypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define SQL_NULL_DATA (-1) +#define SQL_DATA_AT_EXEC (-2) +#define SQL_SUCCESS 0 +#define SQL_SUCCESS_WITH_INFO 1 +#if (ODBCVER >= 0x0300) +#define SQL_NO_DATA 100 +#endif +#define SQL_ERROR (-1) +#define SQL_INVALID_HANDLE (-2) +#define SQL_STILL_EXECUTING 2 +#define SQL_NEED_DATA 99 +#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) + +#define SQL_NTS (-3) +#define SQL_NTSL (-3L) + +#define SQL_MAX_MESSAGE_LENGTH 512 + +#if (ODBCVER >= 0x0300) +#define SQL_DATE_LEN 10 +#define SQL_TIME_LEN 8 +#define SQL_TIMESTAMP_LEN 19 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_HANDLE_ENV 1 +#define SQL_HANDLE_DBC 2 +#define SQL_HANDLE_STMT 3 +#define SQL_HANDLE_DESC 4 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_OUTPUT_NTS 10001 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_AUTO_IPD 10001 +#define SQL_ATTR_METADATA_ID 10014 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_APP_ROW_DESC 10010 +#define SQL_ATTR_APP_PARAM_DESC 10011 +#define SQL_ATTR_IMP_ROW_DESC 10012 +#define SQL_ATTR_IMP_PARAM_DESC 10013 +#define SQL_ATTR_CURSOR_SCROLLABLE (-1) +#define SQL_ATTR_CURSOR_SENSITIVITY (-2) +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_NONSCROLLABLE 0 +#define SQL_SCROLLABLE 1 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_DESC_COUNT 1001 +#define SQL_DESC_TYPE 1002 +#define SQL_DESC_LENGTH 1003 +#define SQL_DESC_OCTET_LENGTH_PTR 1004 +#define SQL_DESC_PRECISION 1005 +#define SQL_DESC_SCALE 1006 +#define SQL_DESC_DATETIME_INTERVAL_CODE 1007 +#define SQL_DESC_NULLABLE 1008 +#define SQL_DESC_INDICATOR_PTR 1009 +#define SQL_DESC_DATA_PTR 1010 +#define SQL_DESC_NAME 1011 +#define SQL_DESC_UNNAMED 1012 +#define SQL_DESC_OCTET_LENGTH 1013 +#define SQL_DESC_ALLOC_TYPE 1099 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_RETURNCODE 1 +#define SQL_DIAG_NUMBER 2 +#define SQL_DIAG_ROW_COUNT 3 +#define SQL_DIAG_SQLSTATE 4 +#define SQL_DIAG_NATIVE 5 +#define SQL_DIAG_MESSAGE_TEXT 6 +#define SQL_DIAG_DYNAMIC_FUNCTION 7 +#define SQL_DIAG_CLASS_ORIGIN 8 +#define SQL_DIAG_SUBCLASS_ORIGIN 9 +#define SQL_DIAG_CONNECTION_NAME 10 +#define SQL_DIAG_SERVER_NAME 11 +#define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_ALTER_DOMAIN 3 +#define SQL_DIAG_ALTER_TABLE 4 +#define SQL_DIAG_CALL 7 +#define SQL_DIAG_CREATE_ASSERTION 6 +#define SQL_DIAG_CREATE_CHARACTER_SET 8 +#define SQL_DIAG_CREATE_COLLATION 10 +#define SQL_DIAG_CREATE_DOMAIN 23 +#define SQL_DIAG_CREATE_INDEX (-1) +#define SQL_DIAG_CREATE_SCHEMA 64 +#define SQL_DIAG_CREATE_TABLE 77 +#define SQL_DIAG_CREATE_TRANSLATION 79 +#define SQL_DIAG_CREATE_VIEW 84 +#define SQL_DIAG_DELETE_WHERE 19 +#define SQL_DIAG_DROP_ASSERTION 24 +#define SQL_DIAG_DROP_CHARACTER_SET 25 +#define SQL_DIAG_DROP_COLLATION 26 +#define SQL_DIAG_DROP_DOMAIN 27 +#define SQL_DIAG_DROP_INDEX (-2) +#define SQL_DIAG_DROP_SCHEMA 31 +#define SQL_DIAG_DROP_TABLE 32 +#define SQL_DIAG_DROP_TRANSLATION 33 +#define SQL_DIAG_DROP_VIEW 36 +#define SQL_DIAG_DYNAMIC_DELETE_CURSOR 38 +#define SQL_DIAG_DYNAMIC_UPDATE_CURSOR 81 +#define SQL_DIAG_GRANT 48 +#define SQL_DIAG_INSERT 50 +#define SQL_DIAG_REVOKE 59 +#define SQL_DIAG_SELECT_CURSOR 85 +#define SQL_DIAG_UNKNOWN_STATEMENT 0 +#define SQL_DIAG_UPDATE_WHERE 82 +#endif + +#define SQL_UNKNOWN_TYPE 0 +#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 +#if (ODBCVER >= 0x0300) +#define SQL_DATETIME 9 +#endif +#define SQL_VARCHAR 12 + +#if (ODBCVER >= 0x0300) +#define SQL_TYPE_DATE 91 +#define SQL_TYPE_TIME 92 +#define SQL_TYPE_TIMESTAMP 93 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_UNSPECIFIED 0 +#define SQL_INSENSITIVE 1 +#define SQL_SENSITIVE 2 +#endif + +#define SQL_ALL_TYPES 0 + +#if (ODBCVER >= 0x0300) +#define SQL_DEFAULT 99 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_ARD_TYPE (-99) +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_CODE_DATE 1 +#define SQL_CODE_TIME 2 +#define SQL_CODE_TIMESTAMP 3 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_FALSE 0 +#define SQL_TRUE 1 +#endif + +#define SQL_NO_NULLS 0 +#define SQL_NULLABLE 1 + +#define SQL_NULLABLE_UNKNOWN 2 + +#if (ODBCVER >= 0x0300) +#define SQL_PRED_NONE 0 +#define SQL_PRED_CHAR 1 +#define SQL_PRED_BASIC 2 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_NAMED 0 +#define SQL_UNNAMED 1 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_DESC_ALLOC_AUTO 1 +#define SQL_DESC_ALLOC_USER 2 +#endif + +#define SQL_CLOSE 0 +#define SQL_DROP 1 +#define SQL_UNBIND 2 +#define SQL_RESET_PARAMS 3 +#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_COMMIT 0 +#define SQL_ROLLBACK 1 + +#define SQL_NULL_HENV 0 +#define SQL_NULL_HDBC 0 +#define SQL_NULL_HSTMT 0 +#if (ODBCVER >= 0x0300) +#define SQL_NULL_HDESC 0 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_NULL_HANDLE 0L +#endif + +#define SQL_SCOPE_CURROW 0 +#define SQL_SCOPE_TRANSACTION 1 +#define SQL_SCOPE_SESSION 2 + +#define SQL_PC_UNKNOWN 0 +#if (ODBCVER >= 0x0300) +#define SQL_PC_NON_PSEUDO 1 +#endif +#define SQL_PC_PSEUDO 2 + +#if (ODBCVER >= 0x0300) +#define SQL_ROW_IDENTIFIER 1 +#endif + +#define SQL_INDEX_UNIQUE 0 +#define SQL_INDEX_ALL 1 + +#define SQL_INDEX_CLUSTERED 1 +#define SQL_INDEX_HASHED 2 +#define SQL_INDEX_OTHER 3 + +#define SQL_API_SQLALLOCCONNECT 1 +#define SQL_API_SQLALLOCENV 2 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLALLOCHANDLE 1001 +#endif +#define SQL_API_SQLALLOCSTMT 3 +#define SQL_API_SQLBINDCOL 4 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLBINDPARAM 1002 +#endif +#define SQL_API_SQLCANCEL 5 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLCLOSECURSOR 1003 +#define SQL_API_SQLCOLATTRIBUTE 6 +#endif +#define SQL_API_SQLCOLUMNS 40 +#define SQL_API_SQLCONNECT 7 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLCOPYDESC 1004 +#endif +#define SQL_API_SQLDATASOURCES 57 +#define SQL_API_SQLDESCRIBECOL 8 +#define SQL_API_SQLDISCONNECT 9 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLENDTRAN 1005 +#endif +#define SQL_API_SQLERROR 10 +#define SQL_API_SQLEXECDIRECT 11 +#define SQL_API_SQLEXECUTE 12 +#define SQL_API_SQLFETCH 13 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLFETCHSCROLL 1021 +#endif +#define SQL_API_SQLFREECONNECT 14 +#define SQL_API_SQLFREEENV 15 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLFREEHANDLE 1006 +#endif +#define SQL_API_SQLFREESTMT 16 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLGETCONNECTATTR 1007 +#endif +#define SQL_API_SQLGETCONNECTOPTION 42 +#define SQL_API_SQLGETCURSORNAME 17 +#define SQL_API_SQLGETDATA 43 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLGETDESCFIELD 1008 +#define SQL_API_SQLGETDESCREC 1009 +#define SQL_API_SQLGETDIAGFIELD 1010 +#define SQL_API_SQLGETDIAGREC 1011 +#define SQL_API_SQLGETENVATTR 1012 +#endif +#define SQL_API_SQLGETFUNCTIONS 44 +#define SQL_API_SQLGETINFO 45 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLGETSTMTATTR 1014 +#endif +#define SQL_API_SQLGETSTMTOPTION 46 +#define SQL_API_SQLGETTYPEINFO 47 +#define SQL_API_SQLNUMRESULTCOLS 18 +#define SQL_API_SQLPARAMDATA 48 +#define SQL_API_SQLPREPARE 19 +#define SQL_API_SQLPUTDATA 49 +#define SQL_API_SQLROWCOUNT 20 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLSETCONNECTATTR 1016 +#endif +#define SQL_API_SQLSETCONNECTOPTION 50 +#define SQL_API_SQLSETCURSORNAME 21 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLSETDESCFIELD 1017 +#define SQL_API_SQLSETDESCREC 1018 +#define SQL_API_SQLSETENVATTR 1019 +#endif +#define SQL_API_SQLSETPARAM 22 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLSETSTMTATTR 1020 +#endif +#define SQL_API_SQLSETSTMTOPTION 51 +#define SQL_API_SQLSPECIALCOLUMNS 52 +#define SQL_API_SQLSTATISTICS 53 +#define SQL_API_SQLTABLES 54 +#define SQL_API_SQLTRANSACT 23 + +#if (ODBCVER >= 0x0300) +#define SQL_MAX_DRIVER_CONNECTIONS 0 +#define SQL_MAXIMUM_DRIVER_CONNECTIONS SQL_MAX_DRIVER_CONNECTIONS +#define SQL_MAX_CONCURRENT_ACTIVITIES 1 +#define SQL_MAXIMUM_CONCURRENT_ACTIVITIES SQL_MAX_CONCURRENT_ACTIVITIES +#endif +#define SQL_DATA_SOURCE_NAME 2 +#define SQL_FETCH_DIRECTION 8 +#define SQL_SERVER_NAME 13 +#define SQL_SEARCH_PATTERN_ESCAPE 14 +#define SQL_DBMS_NAME 17 +#define SQL_DBMS_VER 18 +#define SQL_ACCESSIBLE_TABLES 19 +#define SQL_ACCESSIBLE_PROCEDURES 20 +#define SQL_CURSOR_COMMIT_BEHAVIOR 23 +#define SQL_DATA_SOURCE_READ_ONLY 25 +#define SQL_DEFAULT_TXN_ISOLATION 26 +#define SQL_IDENTIFIER_CASE 28 +#define SQL_IDENTIFIER_QUOTE_CHAR 29 +#define SQL_MAX_COLUMN_NAME_LEN 30 +#define SQL_MAXIMUM_COLUMN_NAME_LENGTH SQL_MAX_COLUMN_NAME_LEN +#define SQL_MAX_CURSOR_NAME_LEN 31 +#define SQL_MAXIMUM_CURSOR_NAME_LENGTH SQL_MAX_CURSOR_NAME_LEN +#define SQL_MAX_SCHEMA_NAME_LEN 32 +#define SQL_MAXIMUM_SCHEMA_NAME_LENGTH SQL_MAX_SCHEMA_NAME_LEN +#define SQL_MAX_CATALOG_NAME_LEN 34 +#define SQL_MAXIMUM_CATALOG_NAME_LENGTH SQL_MAX_CATALOG_NAME_LEN +#define SQL_MAX_TABLE_NAME_LEN 35 +#define SQL_SCROLL_CONCURRENCY 43 +#define SQL_TXN_CAPABLE 46 +#define SQL_TRANSACTION_CAPABLE SQL_TXN_CAPABLE +#define SQL_USER_NAME 47 +#define SQL_TXN_ISOLATION_OPTION 72 +#define SQL_TRANSACTION_ISOLATION_OPTION SQL_TXN_ISOLATION_OPTION +#define SQL_INTEGRITY 73 +#define SQL_GETDATA_EXTENSIONS 81 +#define SQL_NULL_COLLATION 85 +#define SQL_ALTER_TABLE 86 +#define SQL_ORDER_BY_COLUMNS_IN_SELECT 90 +#define SQL_SPECIAL_CHARACTERS 94 +#define SQL_MAX_COLUMNS_IN_GROUP_BY 97 +#define SQL_MAXIMUM_COLUMNS_IN_GROUP_BY SQL_MAX_COLUMNS_IN_GROUP_BY +#define SQL_MAX_COLUMNS_IN_INDEX 98 +#define SQL_MAXIMUM_COLUMNS_IN_INDEX SQL_MAX_COLUMNS_IN_INDEX +#define SQL_MAX_COLUMNS_IN_ORDER_BY 99 +#define SQL_MAXIMUM_COLUMNS_IN_ORDER_BY SQL_MAX_COLUMNS_IN_ORDER_BY +#define SQL_MAX_COLUMNS_IN_SELECT 100 +#define SQL_MAXIMUM_COLUMNS_IN_SELECT SQL_MAX_COLUMNS_IN_SELECT +#define SQL_MAX_COLUMNS_IN_TABLE 101 +#define SQL_MAX_INDEX_SIZE 102 +#define SQL_MAXIMUM_INDEX_SIZE SQL_MAX_INDEX_SIZE +#define SQL_MAX_ROW_SIZE 104 +#define SQL_MAXIMUM_ROW_SIZE SQL_MAX_ROW_SIZE +#define SQL_MAX_STATEMENT_LEN 105 +#define SQL_MAXIMUM_STATEMENT_LENGTH SQL_MAX_STATEMENT_LEN +#define SQL_MAX_TABLES_IN_SELECT 106 +#define SQL_MAXIMUM_TABLES_IN_SELECT SQL_MAX_TABLES_IN_SELECT +#define SQL_MAX_USER_NAME_LEN 107 +#define SQL_MAXIMUM_USER_NAME_LENGTH SQL_MAX_USER_NAME_LEN +#if (ODBCVER >= 0x0300) +#define SQL_OJ_CAPABILITIES 115 +#define SQL_OUTER_JOIN_CAPABILITIES SQL_OJ_CAPABILITIES +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_XOPEN_CLI_YEAR 10000 +#define SQL_CURSOR_SENSITIVITY 10001 +#define SQL_DESCRIBE_PARAMETER 10002 +#define SQL_CATALOG_NAME 10003 +#define SQL_COLLATION_SEQ 10004 +#define SQL_MAX_IDENTIFIER_LEN 10005 +#define SQL_MAXIMUM_IDENTIFIER_LENGTH SQL_MAX_IDENTIFIER_LEN +#endif + +#if (ODBCVER >= 0x0200) +#define SQL_AT_ADD_COLUMN 0x00000001L +#define SQL_AT_DROP_COLUMN 0x00000002L +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_AT_ADD_CONSTRAINT 0x00000008L + +#endif /* ODBCVER >= 0x0300 */ + + +#if (ODBCVER >= 0x0300) +#define SQL_AM_NONE 0 +#define SQL_AM_CONNECTION 1 +#define SQL_AM_STATEMENT 2 +#endif + +#define SQL_CB_DELETE 0 +#define SQL_CB_CLOSE 1 +#define SQL_CB_PRESERVE 2 + +#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_ABSOLUTE 0x00000010L +#define SQL_FD_FETCH_RELATIVE 0x00000020L + +#define SQL_GD_ANY_COLUMN 0x00000001L +#define SQL_GD_ANY_ORDER 0x00000002L + +#define SQL_IC_UPPER 1 +#define SQL_IC_LOWER 2 +#define SQL_IC_SENSITIVE 3 +#define SQL_IC_MIXED 4 + +#if (ODBCVER >= 0x0201) +#define SQL_OJ_LEFT 0x00000001L +#define SQL_OJ_RIGHT 0x00000002L +#define SQL_OJ_FULL 0x00000004L +#define SQL_OJ_NESTED 0x00000008L +#define SQL_OJ_NOT_ORDERED 0x00000010L +#define SQL_OJ_INNER 0x00000020L +#define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L +#endif + +#define SQL_SCCO_READ_ONLY 0x00000001L +#define SQL_SCCO_LOCK 0x00000002L +#define SQL_SCCO_OPT_ROWVER 0x00000004L +#define SQL_SCCO_OPT_VALUES 0x00000008L + +#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 + +#define SQL_TXN_READ_UNCOMMITTED 0x00000001L +#define SQL_TRANSACTION_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED +#define SQL_TXN_READ_COMMITTED 0x00000002L +#define SQL_TRANSACTION_READ_COMMITTED SQL_TXN_READ_COMMITTED +#define SQL_TXN_REPEATABLE_READ 0x00000004L +#define SQL_TRANSACTION_REPEATABLE_READ SQL_TXN_REPEATABLE_READ +#define SQL_TXN_SERIALIZABLE 0x00000008L +#define SQL_TRANSACTION_SERIALIZABLE SQL_TXN_SERIALIZABLE + +#define SQL_NC_HIGH 0 +#define SQL_NC_LOW 1 + +SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, + SQLHDBC *ConnectionHandle); + +SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, + SQLHANDLE InputHandle, SQLHANDLE *OutputHandle); +#endif + +SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, + SQLHSTMT *StatementHandle); + +SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLINTEGER BufferLength, + SQLINTEGER *StrLen_or_Ind); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision, + SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, + SQLINTEGER *StrLen_or_Ind); +#endif + +SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle); + +SQLRETURN WINAPI SQLColAttribute (SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute); +#endif + + +SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLCHAR *ColumnName, SQLSMALLINT NameLength4); + + +SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, + SQLCHAR *ServerName, SQLSMALLINT NameLength1, + SQLCHAR *UserName, SQLSMALLINT NameLength2, + SQLCHAR *Authentication, SQLSMALLINT NameLength3); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, + SQLHDESC TargetDescHandle); +#endif + +SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, SQLCHAR *ServerName, + SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, + SQLCHAR *Description, SQLSMALLINT BufferLength2, + SQLSMALLINT *NameLength2); + +SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, + SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize, + SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable); + +SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT CompletionType); +#endif + +SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, + SQLCHAR *Sqlstate, SQLINTEGER *NativeError, + SQLCHAR *MessageText, SQLSMALLINT BufferLength, + SQLSMALLINT *TextLength); + +SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength); + +SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle); + +SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset); +#endif + +SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle); + +SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle); +#endif + +SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, + SQLUSMALLINT Option); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +#endif + +SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, SQLPOINTER Value); + +SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, + SQLCHAR *CursorName, SQLSMALLINT BufferLength, + SQLSMALLINT *NameLength); + +SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLINTEGER BufferLength, + SQLINTEGER *StrLen_or_Ind); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLCHAR *Name, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, + SQLSMALLINT *Type, SQLSMALLINT *SubType, + SQLINTEGER *Length, SQLSMALLINT *Precision, + SQLSMALLINT *Scale, SQLSMALLINT *Nullable); + +SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength); + +SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, + SQLINTEGER *NativeError, SQLCHAR *MessageText, + SQLSMALLINT BufferLength, SQLSMALLINT *TextLength); + +SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +#endif + +SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, + SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported); + +SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, + SQLUSMALLINT InfoType, SQLPOINTER InfoValue, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +#endif + +SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, + SQLUSMALLINT Option, SQLPOINTER Value); + +SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, + SQLSMALLINT DataType); + +SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, + SQLSMALLINT *ColumnCount); + +SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, + SQLPOINTER *Value); + +SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength); + +SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, + SQLPOINTER Data, SQLINTEGER StrLen_or_Ind); + +SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, + SQLINTEGER *RowCount); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +#endif + +SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, SQLUINTEGER Value); + +SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, + SQLCHAR *CursorName, SQLSMALLINT NameLength); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength); + +SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT Type, + SQLSMALLINT SubType, SQLINTEGER Length, + SQLSMALLINT Precision, SQLSMALLINT Scale, + SQLPOINTER Data, SQLINTEGER *StringLength, + SQLINTEGER *Indicator); + +SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +#endif + +SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision, + SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, + SQLINTEGER *StrLen_or_Ind); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +#endif + +SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, + SQLUSMALLINT Option, SQLUINTEGER Value); + +SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, + SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName, + SQLSMALLINT NameLength1, SQLCHAR *SchemaName, + SQLSMALLINT NameLength2, SQLCHAR *TableName, + SQLSMALLINT NameLength3, SQLUSMALLINT Scope, + SQLUSMALLINT Nullable); + +SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLUSMALLINT Unique, SQLUSMALLINT Reserved); + +SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLCHAR *TableType, SQLSMALLINT NameLength4); + +SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/sqlext.h b/include/sqlext.h new file mode 100644 index 00000000000..940dd81c60b --- /dev/null +++ b/include/sqlext.h @@ -0,0 +1,1656 @@ +/* + * MS SQL Extension definitions + */ +#ifndef __SQLEXT_H +#define __SQLEXT_H + +#include "sql.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define SQL_SPEC_MAJOR 3 +#define SQL_SPEC_MINOR 51 +#define SQL_SPEC_STRING "03.51" + +#define SQL_SQLSTATE_SIZE 5 +#define SQL_MAX_DSN_LENGTH 32 + +#define SQL_MAX_OPTION_STRING_LENGTH 256 + +#if (ODBCVER < 0x0300) +#define SQL_NO_DATA_FOUND 100 +#else +#define SQL_NO_DATA_FOUND SQL_NO_DATA +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_HANDLE_SENV 5 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ODBC_VERSION 200 +#define SQL_ATTR_CONNECTION_POOLING 201 +#define SQL_ATTR_CP_MATCH 202 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_CP_OFF 0UL +#define SQL_CP_ONE_PER_DRIVER 1UL +#define SQL_CP_ONE_PER_HENV 2UL +#define SQL_CP_DEFAULT SQL_CP_OFF + +#define SQL_CP_STRICT_MATCH 0UL +#define SQL_CP_RELAXED_MATCH 1UL +#define SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH + +#define SQL_OV_ODBC2 2UL +#define SQL_OV_ODBC3 3UL +#endif + +#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 + +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE +#define SQL_ATTR_AUTOCOMMIT SQL_AUTOCOMMIT +#define SQL_ATTR_CONNECTION_TIMEOUT 113 +#define SQL_ATTR_CURRENT_CATALOG SQL_CURRENT_QUALIFIER +#define SQL_ATTR_DISCONNECT_BEHAVIOR 114 +#define SQL_ATTR_ENLIST_IN_DTC 1207 +#define SQL_ATTR_ENLIST_IN_XA 1208 +#define SQL_ATTR_LOGIN_TIMEOUT SQL_LOGIN_TIMEOUT +#define SQL_ATTR_ODBC_CURSORS SQL_ODBC_CURSORS +#define SQL_ATTR_PACKET_SIZE SQL_PACKET_SIZE +#define SQL_ATTR_QUIET_MODE SQL_QUIET_MODE +#define SQL_ATTR_TRACE SQL_OPT_TRACE +#define SQL_ATTR_TRACEFILE SQL_OPT_TRACEFILE +#define SQL_ATTR_TRANSLATE_LIB SQL_TRANSLATE_DLL +#define SQL_ATTR_TRANSLATE_OPTION SQL_TRANSLATE_OPTION +#define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION +#endif + +#define SQL_ATTR_CONNECTION_DEAD 1209 + +#if (ODBCVER >= 0x0351) +#define SQL_ATTR_ANSI_APP 115 +#endif + +#if (ODBCVER < 0x0300) +#define SQL_CONNECT_OPT_DRVR_START 1000 +#endif + +#if (ODBCVER < 0x0300) +#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE +#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE +#endif + +#define SQL_MODE_READ_WRITE 0UL +#define SQL_MODE_READ_ONLY 1UL +#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE + +#define SQL_AUTOCOMMIT_OFF 0UL +#define SQL_AUTOCOMMIT_ON 1UL +#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON + +#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL + +#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 "\\SQL.LOG" + +#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 + +#if (ODBCVER >= 0x0300) +#define SQL_DB_RETURN_TO_POOL 0UL +#define SQL_DB_DISCONNECT 1UL +#define SQL_DB_DEFAULT SQL_DB_RETURN_TO_POOL + +#define SQL_DTC_DONE 0L +#endif + +#define SQL_CD_TRUE 1L +#define SQL_CD_FALSE 0L + +#if (ODBCVER >= 0x0351) +#define SQL_AA_TRUE 1L +#define SQL_AA_FALSE 0L +#endif + +#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 +#define SQL_ROW_NUMBER 14 + +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ASYNC_ENABLE 4 +#define SQL_ATTR_CONCURRENCY SQL_CONCURRENCY +#define SQL_ATTR_CURSOR_TYPE SQL_CURSOR_TYPE +#define SQL_ATTR_ENABLE_AUTO_IPD 15 +#define SQL_ATTR_FETCH_BOOKMARK_PTR 16 +#define SQL_ATTR_KEYSET_SIZE SQL_KEYSET_SIZE +#define SQL_ATTR_MAX_LENGTH SQL_MAX_LENGTH +#define SQL_ATTR_MAX_ROWS SQL_MAX_ROWS +#define SQL_ATTR_NOSCAN SQL_NOSCAN +#define SQL_ATTR_PARAM_BIND_OFFSET_PTR 17 +#define SQL_ATTR_PARAM_BIND_TYPE 18 +#define SQL_ATTR_PARAM_OPERATION_PTR 19 +#define SQL_ATTR_PARAM_STATUS_PTR 20 +#define SQL_ATTR_PARAMS_PROCESSED_PTR 21 +#define SQL_ATTR_RETRIEVE_DATA SQL_RETRIEVE_DATA +#define SQL_ATTR_ROW_BIND_OFFSET_PTR 23 +#define SQL_ATTR_ROW_BIND_TYPE SQL_BIND_TYPE +#define SQL_ATTR_ROW_NUMBER SQL_ROW_NUMBER +#define SQL_ATTR_ROW_OPERATION_PTR 24 +#define SQL_ATTR_ROW_STATUS_PTR 25 +#define SQL_ATTR_ROWS_FETCHED_PTR 26 +#define SQL_ATTR_ROW_ARRAY_SIZE 27 +#define SQL_ATTR_SIMULATE_CURSOR SQL_SIMULATE_CURSOR +#define SQL_ATTR_USE_BOOKMARKS SQL_USE_BOOKMARKS + +#endif + +#if (ODBCVER < 0x0300) +#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER +#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_COL_PRED_CHAR SQL_LIKE_ONLY +#define SQL_COL_PRED_BASIC SQL_ALL_EXCEPT_LIKE +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_IS_POINTER (-4) +#define SQL_IS_UINTEGER (-5) +#define SQL_IS_INTEGER (-6) +#define SQL_IS_USMALLINT (-7) +#define SQL_IS_SMALLINT (-8) +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_BIND_BY_COLUMN 0UL +#define SQL_PARAM_BIND_TYPE_DEFAULT SQL_PARAM_BIND_BY_COLUMN +#endif + +#define SQL_QUERY_TIMEOUT_DEFAULT 0UL + +#define SQL_MAX_ROWS_DEFAULT 0UL + +#define SQL_NOSCAN_OFF 0UL +#define SQL_NOSCAN_ON 1UL +#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF + +#define SQL_MAX_LENGTH_DEFAULT 0UL + +#define SQL_ASYNC_ENABLE_OFF 0UL +#define SQL_ASYNC_ENABLE_ON 1UL +#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF + +#define SQL_BIND_BY_COLUMN 0UL +#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN + +#define SQL_CONCUR_READ_ONLY 1 +#define SQL_CONCUR_LOCK 2 +#define SQL_CONCUR_ROWVER 3 +#define SQL_CONCUR_VALUES 4 +#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY + +#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 + +#define SQL_ROWSET_SIZE_DEFAULT 1UL + +#define SQL_KEYSET_SIZE_DEFAULT 0UL + +#define SQL_SC_NON_UNIQUE 0UL +#define SQL_SC_TRY_UNIQUE 1UL +#define SQL_SC_UNIQUE 2UL + +#define SQL_RD_OFF 0UL +#define SQL_RD_ON 1UL +#define SQL_RD_DEFAULT SQL_RD_ON + +#define SQL_UB_OFF 0UL +#define SQL_UB_ON 01UL +#define SQL_UB_DEFAULT SQL_UB_OFF + +#if (ODBCVER >= 0x0300) +#define SQL_UB_FIXED SQL_UB_ON +#define SQL_UB_VARIABLE 2UL +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_DESC_ARRAY_SIZE 20 +#define SQL_DESC_ARRAY_STATUS_PTR 21 +#define SQL_DESC_AUTO_UNIQUE_VALUE SQL_COLUMN_AUTO_INCREMENT +#define SQL_DESC_BASE_COLUMN_NAME 22 +#define SQL_DESC_BASE_TABLE_NAME 23 +#define SQL_DESC_BIND_OFFSET_PTR 24 +#define SQL_DESC_BIND_TYPE 25 +#define SQL_DESC_CASE_SENSITIVE SQL_COLUMN_CASE_SENSITIVE +#define SQL_DESC_CATALOG_NAME SQL_COLUMN_QUALIFIER_NAME +#define SQL_DESC_CONCISE_TYPE SQL_COLUMN_TYPE +#define SQL_DESC_DATETIME_INTERVAL_PRECISION 26 +#define SQL_DESC_DISPLAY_SIZE SQL_COLUMN_DISPLAY_SIZE +#define SQL_DESC_FIXED_PREC_SCALE SQL_COLUMN_MONEY +#define SQL_DESC_LABEL SQL_COLUMN_LABEL +#define SQL_DESC_LITERAL_PREFIX 27 +#define SQL_DESC_LITERAL_SUFFIX 28 +#define SQL_DESC_LOCAL_TYPE_NAME 29 +#define SQL_DESC_MAXIMUM_SCALE 30 +#define SQL_DESC_MINIMUM_SCALE 31 +#define SQL_DESC_NUM_PREC_RADIX 32 +#define SQL_DESC_PARAMETER_TYPE 33 +#define SQL_DESC_ROWS_PROCESSED_PTR 34 +#if (ODBCVER >= 0x0350) +#define SQL_DESC_ROWVER 35 +#endif +#define SQL_DESC_SCHEMA_NAME SQL_COLUMN_OWNER_NAME +#define SQL_DESC_SEARCHABLE SQL_COLUMN_SEARCHABLE +#define SQL_DESC_TYPE_NAME SQL_COLUMN_TYPE_NAME +#define SQL_DESC_TABLE_NAME SQL_COLUMN_TABLE_NAME +#define SQL_DESC_UNSIGNED SQL_COLUMN_UNSIGNED +#define SQL_DESC_UPDATABLE SQL_COLUMN_UPDATABLE +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_CURSOR_ROW_COUNT (-1249) +#define SQL_DIAG_ROW_NUMBER (-1248) +#define SQL_DIAG_COLUMN_NUMBER (-1247) +#endif + +#define SQL_DATE 9 +#if (ODBCVER >= 0x0300) +#define SQL_INTERVAL 10 +#endif +#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) +#if (ODBCVER >= 0x0350) +#define SQL_GUID (-11) +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_CODE_YEAR 1 +#define SQL_CODE_MONTH 2 +#define SQL_CODE_DAY 3 +#define SQL_CODE_HOUR 4 +#define SQL_CODE_MINUTE 5 +#define SQL_CODE_SECOND 6 +#define SQL_CODE_YEAR_TO_MONTH 7 +#define SQL_CODE_DAY_TO_HOUR 8 +#define SQL_CODE_DAY_TO_MINUTE 9 +#define SQL_CODE_DAY_TO_SECOND 10 +#define SQL_CODE_HOUR_TO_MINUTE 11 +#define SQL_CODE_HOUR_TO_SECOND 12 +#define SQL_CODE_MINUTE_TO_SECOND 13 + +#define SQL_INTERVAL_YEAR (100 + SQL_CODE_YEAR) +#define SQL_INTERVAL_MONTH (100 + SQL_CODE_MONTH) +#define SQL_INTERVAL_DAY (100 + SQL_CODE_DAY) +#define SQL_INTERVAL_HOUR (100 + SQL_CODE_HOUR) +#define SQL_INTERVAL_MINUTE (100 + SQL_CODE_MINUTE) +#define SQL_INTERVAL_SECOND (100 + SQL_CODE_SECOND) +#define SQL_INTERVAL_YEAR_TO_MONTH (100 + SQL_CODE_YEAR_TO_MONTH) +#define SQL_INTERVAL_DAY_TO_HOUR (100 + SQL_CODE_DAY_TO_HOUR) +#define SQL_INTERVAL_DAY_TO_MINUTE (100 + SQL_CODE_DAY_TO_MINUTE) +#define SQL_INTERVAL_DAY_TO_SECOND (100 + SQL_CODE_DAY_TO_SECOND) +#define SQL_INTERVAL_HOUR_TO_MINUTE (100 + SQL_CODE_HOUR_TO_MINUTE) +#define SQL_INTERVAL_HOUR_TO_SECOND (100 + SQL_CODE_HOUR_TO_SECOND) +#define SQL_INTERVAL_MINUTE_TO_SECOND (100 + SQL_CODE_MINUTE_TO_SECOND) + +#else +#define SQL_INTERVAL_YEAR (-80) +#define SQL_INTERVAL_MONTH (-81) +#define SQL_INTERVAL_YEAR_TO_MONTH (-82) +#define SQL_INTERVAL_DAY (-83) +#define SQL_INTERVAL_HOUR (-84) +#define SQL_INTERVAL_MINUTE (-85) +#define SQL_INTERVAL_SECOND (-86) +#define SQL_INTERVAL_DAY_TO_HOUR (-87) +#define SQL_INTERVAL_DAY_TO_MINUTE (-88) +#define SQL_INTERVAL_DAY_TO_SECOND (-89) +#define SQL_INTERVAL_HOUR_TO_MINUTE (-90) +#define SQL_INTERVAL_HOUR_TO_SECOND (-91) +#define SQL_INTERVAL_MINUTE_TO_SECOND (-92) +#endif + + +#if (ODBCVER <= 0x0300) +#define SQL_UNICODE (-95) +#define SQL_UNICODE_VARCHAR (-96) +#define SQL_UNICODE_LONGVARCHAR (-97) +#define SQL_UNICODE_CHAR SQL_UNICODE +#else + +#define SQL_UNICODE SQL_WCHAR +#define SQL_UNICODE_VARCHAR SQL_WVARCHAR +#define SQL_UNICODE_LONGVARCHAR SQL_WLONGVARCHAR +#define SQL_UNICODE_CHAR SQL_WCHAR +#endif + +#if (ODBCVER < 0x0300) +#define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR +#define SQL_TYPE_DRIVER_END SQL_UNICODE_LONGVARCHAR +#endif + +#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 +#if (ODBCVER >= 0x0300) +#define SQL_C_NUMERIC SQL_NUMERIC +#endif +#define SQL_C_DEFAULT 99 + +#define SQL_SIGNED_OFFSET (-20) +#define SQL_UNSIGNED_OFFSET (-22) + +#define SQL_C_DATE SQL_DATE +#define SQL_C_TIME SQL_TIME +#define SQL_C_TIMESTAMP SQL_TIMESTAMP +#if (ODBCVER >= 0x0300) +#define SQL_C_TYPE_DATE SQL_TYPE_DATE +#define SQL_C_TYPE_TIME SQL_TYPE_TIME +#define SQL_C_TYPE_TIMESTAMP SQL_TYPE_TIMESTAMP +#define SQL_C_INTERVAL_YEAR SQL_INTERVAL_YEAR +#define SQL_C_INTERVAL_MONTH SQL_INTERVAL_MONTH +#define SQL_C_INTERVAL_DAY SQL_INTERVAL_DAY +#define SQL_C_INTERVAL_HOUR SQL_INTERVAL_HOUR +#define SQL_C_INTERVAL_MINUTE SQL_INTERVAL_MINUTE +#define SQL_C_INTERVAL_SECOND SQL_INTERVAL_SECOND +#define SQL_C_INTERVAL_YEAR_TO_MONTH SQL_INTERVAL_YEAR_TO_MONTH +#define SQL_C_INTERVAL_DAY_TO_HOUR SQL_INTERVAL_DAY_TO_HOUR +#define SQL_C_INTERVAL_DAY_TO_MINUTE SQL_INTERVAL_DAY_TO_MINUTE +#define SQL_C_INTERVAL_DAY_TO_SECOND SQL_INTERVAL_DAY_TO_SECOND +#define SQL_C_INTERVAL_HOUR_TO_MINUTE SQL_INTERVAL_HOUR_TO_MINUTE +#define SQL_C_INTERVAL_HOUR_TO_SECOND SQL_INTERVAL_HOUR_TO_SECOND +#define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND +#endif +#define SQL_C_BINARY SQL_BINARY +#define SQL_C_BIT SQL_BIT +#if (ODBCVER >= 0x0300) +#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) +#define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET) +#endif +#define SQL_C_TINYINT SQL_TINYINT +#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 (ODBCVER >= 0x0350) +#define SQL_C_GUID SQL_GUID +#endif + +#define SQL_TYPE_NULL 0 +#if (ODBCVER < 0x0300) +#define SQL_TYPE_MIN SQL_BIT +#define SQL_TYPE_MAX SQL_VARCHAR +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_C_VARBOOKMARK SQL_C_BINARY +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_NO_ROW_NUMBER (-1) +#define SQL_NO_COLUMN_NUMBER (-1) +#define SQL_ROW_NUMBER_UNKNOWN (-2) +#define SQL_COLUMN_NUMBER_UNKNOWN (-2) +#endif + +#define SQL_DEFAULT_PARAM (-5) +#define SQL_IGNORE (-6) +#if (ODBCVER >= 0x0300) +#define SQL_COLUMN_IGNORE SQL_IGNORE +#endif +#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) +#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET) + +#define SQL_LEN_BINARY_ATTR_OFFSET (-100) +#define SQL_LEN_BINARY_ATTR(length) (-(length)+SQL_LEN_BINARY_ATTR_OFFSET) + +#define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT +#define SQL_SETPARAM_VALUE_MAX (-1L) + +#define SQL_COLUMN_COUNT 0 +#define SQL_COLUMN_NAME 1 +#define SQL_COLUMN_TYPE 2 +#define SQL_COLUMN_LENGTH 3 +#define SQL_COLUMN_PRECISION 4 +#define SQL_COLUMN_SCALE 5 +#define SQL_COLUMN_DISPLAY_SIZE 6 +#define SQL_COLUMN_NULLABLE 7 +#define SQL_COLUMN_UNSIGNED 8 +#define SQL_COLUMN_MONEY 9 +#define SQL_COLUMN_UPDATABLE 10 +#define SQL_COLUMN_AUTO_INCREMENT 11 +#define SQL_COLUMN_CASE_SENSITIVE 12 +#define SQL_COLUMN_SEARCHABLE 13 +#define SQL_COLUMN_TYPE_NAME 14 +#define SQL_COLUMN_TABLE_NAME 15 +#define SQL_COLUMN_OWNER_NAME 16 +#define SQL_COLUMN_QUALIFIER_NAME 17 +#define SQL_COLUMN_LABEL 18 +#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL +#if (ODBCVER < 0x0300) +#define SQL_COLUMN_DRIVER_START 1000 +#endif + +#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT + +#define SQL_ATTR_READONLY 0 +#define SQL_ATTR_WRITE 1 +#define SQL_ATTR_READWRITE_UNKNOWN 2 + +#define SQL_UNSEARCHABLE 0 +#define SQL_LIKE_ONLY 1 +#define SQL_ALL_EXCEPT_LIKE 2 +#define SQL_SEARCHABLE 3 +#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE + + +#define SQL_NO_TOTAL (-4) + +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLALLOCHANDLESTD 73 +#define SQL_API_SQLBULKOPERATIONS 24 +#endif +#define SQL_API_SQLBINDPARAMETER 72 +#define SQL_API_SQLBROWSECONNECT 55 +#define SQL_API_SQLCOLATTRIBUTES 6 +#define SQL_API_SQLCOLUMNPRIVILEGES 56 +#define SQL_API_SQLDESCRIBEPARAM 58 +#define SQL_API_SQLDRIVERCONNECT 41 +#define SQL_API_SQLDRIVERS 71 +#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 + +#if (ODBCVER < 0x0300) +#define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER +#define SQL_NUM_FUNCTIONS 23 +#define SQL_EXT_API_START 40 +#define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1) +#endif + +#define SQL_API_ALL_FUNCTIONS 0 + +#define SQL_API_LOADBYORDINAL 199 + +#if (ODBCVER >= 0x0300) +#define SQL_API_ODBC3_ALL_FUNCTIONS 999 +#define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE 250 + + +#define SQL_FUNC_EXISTS(pfExists, uwAPI) ((*(((UWORD*) (pfExists)) + ((uwAPI) >> 4)) & (1 << ((uwAPI) & 0x000F)) ) ? SQL_TRUE : SQL_FALSE ) + +#endif + +#define SQL_INFO_FIRST 0 +#define SQL_ACTIVE_CONNECTIONS 0 +#define SQL_ACTIVE_STATEMENTS 1 +#define SQL_DRIVER_HDBC 3 +#define SQL_DRIVER_HENV 4 +#define SQL_DRIVER_HSTMT 5 +#define SQL_DRIVER_NAME 6 +#define SQL_DRIVER_VER 7 +#define SQL_ODBC_API_CONFORMANCE 9 +#define SQL_ODBC_VER 10 +#define SQL_ROW_UPDATES 11 +#define SQL_ODBC_SAG_CLI_CONFORMANCE 12 +#define SQL_ODBC_SQL_CONFORMANCE 15 +#define SQL_PROCEDURES 21 +#define SQL_CONCAT_NULL_BEHAVIOR 22 +#define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 +#define SQL_EXPRESSIONS_IN_ORDERBY 27 +#define SQL_MAX_OWNER_NAME_LEN 32 +#define SQL_MAX_PROCEDURE_NAME_LEN 33 +#define SQL_MAX_QUALIFIER_NAME_LEN 34 +#define SQL_MULT_RESULT_SETS 36 +#define SQL_MULTIPLE_ACTIVE_TXN 37 +#define SQL_OUTER_JOINS 38 +#define SQL_OWNER_TERM 39 +#define SQL_PROCEDURE_TERM 40 +#define SQL_QUALIFIER_NAME_SEPARATOR 41 +#define SQL_QUALIFIER_TERM 42 +#define SQL_SCROLL_OPTIONS 44 +#define SQL_TABLE_TERM 45 +#define SQL_CONVERT_FUNCTIONS 48 +#define SQL_NUMERIC_FUNCTIONS 49 +#define SQL_STRING_FUNCTIONS 50 +#define SQL_SYSTEM_FUNCTIONS 51 +#define SQL_TIMEDATE_FUNCTIONS 52 +#define SQL_CONVERT_BIGINT 53 +#define SQL_CONVERT_BINARY 54 +#define SQL_CONVERT_BIT 55 +#define SQL_CONVERT_CHAR 56 +#define SQL_CONVERT_DATE 57 +#define SQL_CONVERT_DECIMAL 58 +#define SQL_CONVERT_DOUBLE 59 +#define SQL_CONVERT_FLOAT 60 +#define SQL_CONVERT_INTEGER 61 +#define SQL_CONVERT_LONGVARCHAR 62 +#define SQL_CONVERT_NUMERIC 63 +#define SQL_CONVERT_REAL 64 +#define SQL_CONVERT_SMALLINT 65 +#define SQL_CONVERT_TIME 66 +#define SQL_CONVERT_TIMESTAMP 67 +#define SQL_CONVERT_TINYINT 68 +#define SQL_CONVERT_VARBINARY 69 +#define SQL_CONVERT_VARCHAR 70 +#define SQL_CONVERT_LONGVARBINARY 71 +#define SQL_ODBC_SQL_OPT_IEF 73 +#define SQL_CORRELATION_NAME 74 +#define SQL_NON_NULLABLE_COLUMNS 75 +#define SQL_DRIVER_HLIB 76 +#define SQL_DRIVER_ODBC_VER 77 +#define SQL_LOCK_TYPES 78 +#define SQL_POS_OPERATIONS 79 +#define SQL_POSITIONED_STATEMENTS 80 +#define SQL_BOOKMARK_PERSISTENCE 82 +#define SQL_STATIC_SENSITIVITY 83 +#define SQL_FILE_USAGE 84 +#define SQL_COLUMN_ALIAS 87 +#define SQL_GROUP_BY 88 +#define SQL_KEYWORDS 89 +#define SQL_OWNER_USAGE 91 +#define SQL_QUALIFIER_USAGE 92 +#define SQL_QUOTED_IDENTIFIER_CASE 93 +#define SQL_SUBQUERIES 95 +#define SQL_UNION 96 +#define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103 +#define SQL_MAX_CHAR_LITERAL_LEN 108 +#define SQL_TIMEDATE_ADD_INTERVALS 109 +#define SQL_TIMEDATE_DIFF_INTERVALS 110 +#define SQL_NEED_LONG_DATA_LEN 111 +#define SQL_MAX_BINARY_LITERAL_LEN 112 +#define SQL_LIKE_ESCAPE_CLAUSE 113 +#define SQL_QUALIFIER_LOCATION 114 + +#if (ODBCVER >= 0x0201 && ODBCVER < 0x0300) +#define SQL_OJ_CAPABILITIES 65003 +#endif + +#if (ODBCVER < 0x0300) +#define SQL_INFO_LAST SQL_QUALIFIER_LOCATION +#define SQL_INFO_DRIVER_START 1000 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_ACTIVE_ENVIRONMENTS 116 +#define SQL_ALTER_DOMAIN 117 + +#define SQL_SQL_CONFORMANCE 118 +#define SQL_DATETIME_LITERALS 119 + +#define SQL_ASYNC_MODE 10021 +#define SQL_BATCH_ROW_COUNT 120 +#define SQL_BATCH_SUPPORT 121 +#define SQL_CATALOG_LOCATION SQL_QUALIFIER_LOCATION +#define SQL_CATALOG_NAME_SEPARATOR SQL_QUALIFIER_NAME_SEPARATOR +#define SQL_CATALOG_TERM SQL_QUALIFIER_TERM +#define SQL_CATALOG_USAGE SQL_QUALIFIER_USAGE +#define SQL_CONVERT_WCHAR 122 +#define SQL_CONVERT_INTERVAL_DAY_TIME 123 +#define SQL_CONVERT_INTERVAL_YEAR_MONTH 124 +#define SQL_CONVERT_WLONGVARCHAR 125 +#define SQL_CONVERT_WVARCHAR 126 +#define SQL_CREATE_ASSERTION 127 +#define SQL_CREATE_CHARACTER_SET 128 +#define SQL_CREATE_COLLATION 129 +#define SQL_CREATE_DOMAIN 130 +#define SQL_CREATE_SCHEMA 131 +#define SQL_CREATE_TABLE 132 +#define SQL_CREATE_TRANSLATION 133 +#define SQL_CREATE_VIEW 134 +#define SQL_DRIVER_HDESC 135 +#define SQL_DROP_ASSERTION 136 +#define SQL_DROP_CHARACTER_SET 137 +#define SQL_DROP_COLLATION 138 +#define SQL_DROP_DOMAIN 139 +#define SQL_DROP_SCHEMA 140 +#define SQL_DROP_TABLE 141 +#define SQL_DROP_TRANSLATION 142 +#define SQL_DROP_VIEW 143 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES1 144 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES2 145 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 146 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 147 +#define SQL_INDEX_KEYWORDS 148 +#define SQL_INFO_SCHEMA_VIEWS 149 +#define SQL_KEYSET_CURSOR_ATTRIBUTES1 150 +#define SQL_KEYSET_CURSOR_ATTRIBUTES2 151 +#define SQL_MAX_ASYNC_CONCURRENT_STATEMENTS 10022 +#define SQL_ODBC_INTERFACE_CONFORMANCE 152 +#define SQL_PARAM_ARRAY_ROW_COUNTS 153 +#define SQL_PARAM_ARRAY_SELECTS 154 +#define SQL_SCHEMA_TERM SQL_OWNER_TERM +#define SQL_SCHEMA_USAGE SQL_OWNER_USAGE +#define SQL_SQL92_DATETIME_FUNCTIONS 155 +#define SQL_SQL92_FOREIGN_KEY_DELETE_RULE 156 +#define SQL_SQL92_FOREIGN_KEY_UPDATE_RULE 157 +#define SQL_SQL92_GRANT 158 +#define SQL_SQL92_NUMERIC_VALUE_FUNCTIONS 159 +#define SQL_SQL92_PREDICATES 160 +#define SQL_SQL92_RELATIONAL_JOIN_OPERATORS 161 +#define SQL_SQL92_REVOKE 162 +#define SQL_SQL92_ROW_VALUE_CONSTRUCTOR 163 +#define SQL_SQL92_STRING_FUNCTIONS 164 +#define SQL_SQL92_VALUE_EXPRESSIONS 165 +#define SQL_STANDARD_CLI_CONFORMANCE 166 +#define SQL_STATIC_CURSOR_ATTRIBUTES1 167 +#define SQL_STATIC_CURSOR_ATTRIBUTES2 168 + +#define SQL_AGGREGATE_FUNCTIONS 169 +#define SQL_DDL_INDEX 170 +#define SQL_DM_VER 171 +#define SQL_INSERT_STATEMENT 172 +#define SQL_UNION_STATEMENT SQL_UNION +#endif + +#define SQL_DTC_TRANSITION_COST 1750 + +#if (ODBCVER >= 0x0300) + +#define SQL_AT_ADD_COLUMN_SINGLE 0x00000020L +#define SQL_AT_ADD_COLUMN_DEFAULT 0x00000040L +#define SQL_AT_ADD_COLUMN_COLLATION 0x00000080L +#define SQL_AT_SET_COLUMN_DEFAULT 0x00000100L +#define SQL_AT_DROP_COLUMN_DEFAULT 0x00000200L +#define SQL_AT_DROP_COLUMN_CASCADE 0x00000400L +#define SQL_AT_DROP_COLUMN_RESTRICT 0x00000800L +#define SQL_AT_ADD_TABLE_CONSTRAINT 0x00001000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE 0x00002000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT 0x00004000L +#define SQL_AT_CONSTRAINT_NAME_DEFINITION 0x00008000L +#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED 0x00010000L +#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00020000L +#define SQL_AT_CONSTRAINT_DEFERRABLE 0x00040000L +#define SQL_AT_CONSTRAINT_NON_DEFERRABLE 0x00080000L +#endif + +#define SQL_CVT_CHAR 0x00000001L +#define SQL_CVT_NUMERIC 0x00000002L +#define SQL_CVT_DECIMAL 0x00000004L +#define SQL_CVT_INTEGER 0x00000008L +#define SQL_CVT_SMALLINT 0x00000010L +#define SQL_CVT_FLOAT 0x00000020L +#define SQL_CVT_REAL 0x00000040L +#define SQL_CVT_DOUBLE 0x00000080L +#define SQL_CVT_VARCHAR 0x00000100L +#define SQL_CVT_LONGVARCHAR 0x00000200L +#define SQL_CVT_BINARY 0x00000400L +#define SQL_CVT_VARBINARY 0x00000800L +#define SQL_CVT_BIT 0x00001000L +#define SQL_CVT_TINYINT 0x00002000L +#define SQL_CVT_BIGINT 0x00004000L +#define SQL_CVT_DATE 0x00008000L +#define SQL_CVT_TIME 0x00010000L +#define SQL_CVT_TIMESTAMP 0x00020000L +#define SQL_CVT_LONGVARBINARY 0x00040000L +#if (ODBCVER >= 0x0300) +#define SQL_CVT_INTERVAL_YEAR_MONTH 0x00080000L +#define SQL_CVT_INTERVAL_DAY_TIME 0x00100000L +#define SQL_CVT_WCHAR 0x00200000L +#define SQL_CVT_WLONGVARCHAR 0x00400000L +#define SQL_CVT_WVARCHAR 0x00800000L + +#endif + + +#define SQL_FN_CVT_CONVERT 0x00000001L +#if (ODBCVER >= 0x0300) +#define SQL_FN_CVT_CAST 0x00000002L +#endif + +#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 +#if (ODBCVER >= 0x0300) +#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 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_SSF_CONVERT 0x00000001L +#define SQL_SSF_LOWER 0x00000002L +#define SQL_SSF_UPPER 0x00000004L +#define SQL_SSF_SUBSTRING 0x00000008L +#define SQL_SSF_TRANSLATE 0x00000010L +#define SQL_SSF_TRIM_BOTH 0x00000020L +#define SQL_SSF_TRIM_LEADING 0x00000040L +#define SQL_SSF_TRIM_TRAILING 0x00000080L +#endif + +#define SQL_FN_NUM_ABS 0x00000001L +#define SQL_FN_NUM_ACOS 0x00000002L +#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 + +#if (ODBCVER >= 0x0300) +#define SQL_SNVF_BIT_LENGTH 0x00000001L +#define SQL_SNVF_CHAR_LENGTH 0x00000002L +#define SQL_SNVF_CHARACTER_LENGTH 0x00000004L +#define SQL_SNVF_EXTRACT 0x00000008L +#define SQL_SNVF_OCTET_LENGTH 0x00000010L +#define SQL_SNVF_POSITION 0x00000020L +#endif + +#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_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 +#if (ODBCVER >= 0x0300) +#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 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_SDF_CURRENT_DATE 0x00000001L +#define SQL_SDF_CURRENT_TIME 0x00000002L +#define SQL_SDF_CURRENT_TIMESTAMP 0x00000004L +#endif + +#define SQL_FN_SYS_USERNAME 0x00000001L +#define SQL_FN_SYS_DBNAME 0x00000002L +#define SQL_FN_SYS_IFNULL 0x00000004L + +#define SQL_FN_TSI_FRAC_SECOND 0x00000001L +#define SQL_FN_TSI_SECOND 0x00000002L +#define SQL_FN_TSI_MINUTE 0x00000004L +#define SQL_FN_TSI_HOUR 0x00000008L +#define SQL_FN_TSI_DAY 0x00000010L +#define SQL_FN_TSI_WEEK 0x00000020L +#define SQL_FN_TSI_MONTH 0x00000040L +#define SQL_FN_TSI_QUARTER 0x00000080L +#define SQL_FN_TSI_YEAR 0x00000100L + +#if (ODBCVER >= 0x0300) +#define SQL_CA1_NEXT 0x00000001L +#define SQL_CA1_ABSOLUTE 0x00000002L +#define SQL_CA1_RELATIVE 0x00000004L +#define SQL_CA1_BOOKMARK 0x00000008L + +#define SQL_CA1_LOCK_NO_CHANGE 0x00000040L +#define SQL_CA1_LOCK_EXCLUSIVE 0x00000080L +#define SQL_CA1_LOCK_UNLOCK 0x00000100L + +#define SQL_CA1_POS_POSITION 0x00000200L +#define SQL_CA1_POS_UPDATE 0x00000400L +#define SQL_CA1_POS_DELETE 0x00000800L +#define SQL_CA1_POS_REFRESH 0x00001000L + +#define SQL_CA1_POSITIONED_UPDATE 0x00002000L +#define SQL_CA1_POSITIONED_DELETE 0x00004000L +#define SQL_CA1_SELECT_FOR_UPDATE 0x00008000L + +#define SQL_CA1_BULK_ADD 0x00010000L +#define SQL_CA1_BULK_UPDATE_BY_BOOKMARK 0x00020000L +#define SQL_CA1_BULK_DELETE_BY_BOOKMARK 0x00040000L +#define SQL_CA1_BULK_FETCH_BY_BOOKMARK 0x00080000L +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_CA2_READ_ONLY_CONCURRENCY 0x00000001L +#define SQL_CA2_LOCK_CONCURRENCY 0x00000002L +#define SQL_CA2_OPT_ROWVER_CONCURRENCY 0x00000004L +#define SQL_CA2_OPT_VALUES_CONCURRENCY 0x00000008L + +#define SQL_CA2_SENSITIVITY_ADDITIONS 0x00000010L +#define SQL_CA2_SENSITIVITY_DELETIONS 0x00000020L +#define SQL_CA2_SENSITIVITY_UPDATES 0x00000040L + +#define SQL_CA2_MAX_ROWS_SELECT 0x00000080L +#define SQL_CA2_MAX_ROWS_INSERT 0x00000100L +#define SQL_CA2_MAX_ROWS_DELETE 0x00000200L +#define SQL_CA2_MAX_ROWS_UPDATE 0x00000400L +#define SQL_CA2_MAX_ROWS_CATALOG 0x00000800L +#define SQL_CA2_MAX_ROWS_AFFECTS_ALL (SQL_CA2_MAX_ROWS_SELECT | SQL_CA2_MAX_ROWS_INSERT | SQL_CA2_MAX_ROWS_DELETE | SQL_CA2_MAX_ROWS_UPDATE | SQL_CA2_MAX_ROWS_CATALOG) + +#define SQL_CA2_CRC_EXACT 0x00001000L +#define SQL_CA2_CRC_APPROXIMATE 0x00002000L + +#define SQL_CA2_SIMULATE_NON_UNIQUE 0x00004000L +#define SQL_CA2_SIMULATE_TRY_UNIQUE 0x00008000L +#define SQL_CA2_SIMULATE_UNIQUE 0x00010000L +#endif + +#define SQL_OAC_NONE 0x0000 +#define SQL_OAC_LEVEL1 0x0001 +#define SQL_OAC_LEVEL2 0x0002 + +#define SQL_OSCC_NOT_COMPLIANT 0x0000 +#define SQL_OSCC_COMPLIANT 0x0001 + +#define SQL_OSC_MINIMUM 0x0000 +#define SQL_OSC_CORE 0x0001 +#define SQL_OSC_EXTENDED 0x0002 + +#define SQL_CB_NULL 0x0000 +#define SQL_CB_NON_NULL 0x0001 + +#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 + +#define SQL_FD_FETCH_BOOKMARK 0x00000080L + +#define SQL_CN_NONE 0x0000 +#define SQL_CN_DIFFERENT 0x0001 +#define SQL_CN_ANY 0x0002 + +#define SQL_NNC_NULL 0x0000 +#define SQL_NNC_NON_NULL 0x0001 + +#define SQL_NC_START 0x0002 +#define SQL_NC_END 0x0004 + +#define SQL_FILE_NOT_SUPPORTED 0x0000 +#define SQL_FILE_TABLE 0x0001 +#define SQL_FILE_QUALIFIER 0x0002 +#define SQL_FILE_CATALOG SQL_FILE_QUALIFIER + +#define SQL_GD_BLOCK 0x00000004L +#define SQL_GD_BOUND 0x00000008L + +#define SQL_PS_POSITIONED_DELETE 0x00000001L +#define SQL_PS_POSITIONED_UPDATE 0x00000002L +#define SQL_PS_SELECT_FOR_UPDATE 0x00000004L + +#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 +#if (ODBCVER >= 0x0300) +#define SQL_GB_COLLATE 0x0004 + +#endif + +#define SQL_OU_DML_STATEMENTS 0x00000001L +#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_OU_TABLE_DEFINITION 0x00000004L +#define SQL_OU_INDEX_DEFINITION 0x00000008L +#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L + +#if (ODBCVER >= 0x0300) +#define SQL_SU_DML_STATEMENTS SQL_OU_DML_STATEMENTS +#define SQL_SU_PROCEDURE_INVOCATION SQL_OU_PROCEDURE_INVOCATION +#define SQL_SU_TABLE_DEFINITION SQL_OU_TABLE_DEFINITION +#define SQL_SU_INDEX_DEFINITION SQL_OU_INDEX_DEFINITION +#define SQL_SU_PRIVILEGE_DEFINITION SQL_OU_PRIVILEGE_DEFINITION +#endif + +#define SQL_QU_DML_STATEMENTS 0x00000001L +#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_QU_TABLE_DEFINITION 0x00000004L +#define SQL_QU_INDEX_DEFINITION 0x00000008L +#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L + +#if (ODBCVER >= 0x0300) +#define SQL_CU_DML_STATEMENTS SQL_QU_DML_STATEMENTS +#define SQL_CU_PROCEDURE_INVOCATION SQL_QU_PROCEDURE_INVOCATION +#define SQL_CU_TABLE_DEFINITION SQL_QU_TABLE_DEFINITION +#define SQL_CU_INDEX_DEFINITION SQL_QU_INDEX_DEFINITION +#define SQL_CU_PRIVILEGE_DEFINITION SQL_QU_PRIVILEGE_DEFINITION +#endif + +#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 + +#define SQL_U_UNION 0x00000001L +#define SQL_U_UNION_ALL 0x00000002L + +#define SQL_BP_CLOSE 0x00000001L +#define SQL_BP_DELETE 0x00000002L +#define SQL_BP_DROP 0x00000004L +#define SQL_BP_TRANSACTION 0x00000008L +#define SQL_BP_UPDATE 0x00000010L +#define SQL_BP_OTHER_HSTMT 0x00000020L +#define SQL_BP_SCROLL 0x00000040L + +#define SQL_SS_ADDITIONS 0x00000001L +#define SQL_SS_DELETIONS 0x00000002L +#define SQL_SS_UPDATES 0x00000004L + +#define SQL_CV_CREATE_VIEW 0x00000001L +#define SQL_CV_CHECK_OPTION 0x00000002L +#define SQL_CV_CASCADED 0x00000004L +#define SQL_CV_LOCAL 0x00000008L + +#define SQL_LCK_NO_CHANGE 0x00000001L +#define SQL_LCK_EXCLUSIVE 0x00000002L +#define SQL_LCK_UNLOCK 0x00000004L + +#define SQL_POS_POSITION 0x00000001L +#define SQL_POS_REFRESH 0x00000002L +#define SQL_POS_UPDATE 0x00000004L +#define SQL_POS_DELETE 0x00000008L +#define SQL_POS_ADD 0x00000010L + +#define SQL_QL_START 0x0001 +#define SQL_QL_END 0x0002 + +#if (ODBCVER >= 0x0300) +#define SQL_AF_AVG 0x00000001L +#define SQL_AF_COUNT 0x00000002L +#define SQL_AF_MAX 0x00000004L +#define SQL_AF_MIN 0x00000008L +#define SQL_AF_SUM 0x00000010L +#define SQL_AF_DISTINCT 0x00000020L +#define SQL_AF_ALL 0x00000040L + +#define SQL_SC_SQL92_ENTRY 0x00000001L +#define SQL_SC_FIPS127_2_TRANSITIONAL 0x00000002L +#define SQL_SC_SQL92_INTERMEDIATE 0x00000004L +#define SQL_SC_SQL92_FULL 0x00000008L + +#define SQL_DL_SQL92_DATE 0x00000001L +#define SQL_DL_SQL92_TIME 0x00000002L +#define SQL_DL_SQL92_TIMESTAMP 0x00000004L +#define SQL_DL_SQL92_INTERVAL_YEAR 0x00000008L +#define SQL_DL_SQL92_INTERVAL_MONTH 0x00000010L +#define SQL_DL_SQL92_INTERVAL_DAY 0x00000020L +#define SQL_DL_SQL92_INTERVAL_HOUR 0x00000040L +#define SQL_DL_SQL92_INTERVAL_MINUTE 0x00000080L +#define SQL_DL_SQL92_INTERVAL_SECOND 0x00000100L +#define SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH 0x00000200L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR 0x00000400L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE 0x00000800L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND 0x00001000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE 0x00002000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND 0x00004000L +#define SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND 0x00008000L + +#define SQL_CL_START SQL_QL_START +#define SQL_CL_END SQL_QL_END + +#define SQL_BRC_PROCEDURES 0x0000001 +#define SQL_BRC_EXPLICIT 0x0000002 +#define SQL_BRC_ROLLED_UP 0x0000004 + +#define SQL_BS_SELECT_EXPLICIT 0x00000001L +#define SQL_BS_ROW_COUNT_EXPLICIT 0x00000002L +#define SQL_BS_SELECT_PROC 0x00000004L +#define SQL_BS_ROW_COUNT_PROC 0x00000008L + +#define SQL_PARC_BATCH 1 +#define SQL_PARC_NO_BATCH 2 + +#define SQL_PAS_BATCH 1 +#define SQL_PAS_NO_BATCH 2 +#define SQL_PAS_NO_SELECT 3 + +#define SQL_IK_NONE 0x00000000L +#define SQL_IK_ASC 0x00000001L +#define SQL_IK_DESC 0x00000002L +#define SQL_IK_ALL (SQL_IK_ASC | SQL_IK_DESC) + +#define SQL_ISV_ASSERTIONS 0x00000001L +#define SQL_ISV_CHARACTER_SETS 0x00000002L +#define SQL_ISV_CHECK_CONSTRAINTS 0x00000004L +#define SQL_ISV_COLLATIONS 0x00000008L +#define SQL_ISV_COLUMN_DOMAIN_USAGE 0x00000010L +#define SQL_ISV_COLUMN_PRIVILEGES 0x00000020L +#define SQL_ISV_COLUMNS 0x00000040L +#define SQL_ISV_CONSTRAINT_COLUMN_USAGE 0x00000080L +#define SQL_ISV_CONSTRAINT_TABLE_USAGE 0x00000100L +#define SQL_ISV_DOMAIN_CONSTRAINTS 0x00000200L +#define SQL_ISV_DOMAINS 0x00000400L +#define SQL_ISV_KEY_COLUMN_USAGE 0x00000800L +#define SQL_ISV_REFERENTIAL_CONSTRAINTS 0x00001000L +#define SQL_ISV_SCHEMATA 0x00002000L +#define SQL_ISV_SQL_LANGUAGES 0x00004000L +#define SQL_ISV_TABLE_CONSTRAINTS 0x00008000L +#define SQL_ISV_TABLE_PRIVILEGES 0x00010000L +#define SQL_ISV_TABLES 0x00020000L +#define SQL_ISV_TRANSLATIONS 0x00040000L +#define SQL_ISV_USAGE_PRIVILEGES 0x00080000L +#define SQL_ISV_VIEW_COLUMN_USAGE 0x00100000L +#define SQL_ISV_VIEW_TABLE_USAGE 0x00200000L +#define SQL_ISV_VIEWS 0x00400000L + +#define SQL_AM_NONE 0 +#define SQL_AM_CONNECTION 1 +#define SQL_AM_STATEMENT 2 + +#define SQL_AD_CONSTRAINT_NAME_DEFINITION 0x00000001L +#define SQL_AD_ADD_DOMAIN_CONSTRAINT 0x00000002L +#define SQL_AD_DROP_DOMAIN_CONSTRAINT 0x00000004L +#define SQL_AD_ADD_DOMAIN_DEFAULT 0x00000008L +#define SQL_AD_DROP_DOMAIN_DEFAULT 0x00000010L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_AD_ADD_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE 0x00000100L + +#define SQL_CS_CREATE_SCHEMA 0x00000001L +#define SQL_CS_AUTHORIZATION 0x00000002L +#define SQL_CS_DEFAULT_CHARACTER_SET 0x00000004L + +#define SQL_CTR_CREATE_TRANSLATION 0x00000001L + +#define SQL_CA_CREATE_ASSERTION 0x00000001L +#define SQL_CA_CONSTRAINT_INITIALLY_DEFERRED 0x00000010L +#define SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000020L +#define SQL_CA_CONSTRAINT_DEFERRABLE 0x00000040L +#define SQL_CA_CONSTRAINT_NON_DEFERRABLE 0x00000080L + +#define SQL_CCS_CREATE_CHARACTER_SET 0x00000001L +#define SQL_CCS_COLLATE_CLAUSE 0x00000002L +#define SQL_CCS_LIMITED_COLLATION 0x00000004L + +#define SQL_CCOL_CREATE_COLLATION 0x00000001L + +#define SQL_CDO_CREATE_DOMAIN 0x00000001L +#define SQL_CDO_DEFAULT 0x00000002L +#define SQL_CDO_CONSTRAINT 0x00000004L +#define SQL_CDO_COLLATION 0x00000008L +#define SQL_CDO_CONSTRAINT_NAME_DEFINITION 0x00000010L +#define SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CDO_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CDO_CONSTRAINT_NON_DEFERRABLE 0x00000100L + +#define SQL_CT_CREATE_TABLE 0x00000001L +#define SQL_CT_COMMIT_PRESERVE 0x00000002L +#define SQL_CT_COMMIT_DELETE 0x00000004L +#define SQL_CT_GLOBAL_TEMPORARY 0x00000008L +#define SQL_CT_LOCAL_TEMPORARY 0x00000010L +#define SQL_CT_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CT_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CT_CONSTRAINT_NON_DEFERRABLE 0x00000100L +#define SQL_CT_COLUMN_CONSTRAINT 0x00000200L +#define SQL_CT_COLUMN_DEFAULT 0x00000400L +#define SQL_CT_COLUMN_COLLATION 0x00000800L +#define SQL_CT_TABLE_CONSTRAINT 0x00001000L +#define SQL_CT_CONSTRAINT_NAME_DEFINITION 0x00002000L + +#define SQL_DI_CREATE_INDEX 0x00000001L +#define SQL_DI_DROP_INDEX 0x00000002L + +#define SQL_DC_DROP_COLLATION 0x00000001L + +#define SQL_DD_DROP_DOMAIN 0x00000001L +#define SQL_DD_RESTRICT 0x00000002L +#define SQL_DD_CASCADE 0x00000004L + +#define SQL_DS_DROP_SCHEMA 0x00000001L +#define SQL_DS_RESTRICT 0x00000002L +#define SQL_DS_CASCADE 0x00000004L + +#define SQL_DCS_DROP_CHARACTER_SET 0x00000001L + +#define SQL_DA_DROP_ASSERTION 0x00000001L + +#define SQL_DT_DROP_TABLE 0x00000001L +#define SQL_DT_RESTRICT 0x00000002L +#define SQL_DT_CASCADE 0x00000004L + +#define SQL_DTR_DROP_TRANSLATION 0x00000001L + +#define SQL_DV_DROP_VIEW 0x00000001L +#define SQL_DV_RESTRICT 0x00000002L +#define SQL_DV_CASCADE 0x00000004L + +#define SQL_IS_INSERT_LITERALS 0x00000001L +#define SQL_IS_INSERT_SEARCHED 0x00000002L +#define SQL_IS_SELECT_INTO 0x00000004L + +#define SQL_OIC_CORE 1UL +#define SQL_OIC_LEVEL1 2UL +#define SQL_OIC_LEVEL2 3UL + +#define SQL_SFKD_CASCADE 0x00000001L +#define SQL_SFKD_NO_ACTION 0x00000002L +#define SQL_SFKD_SET_DEFAULT 0x00000004L +#define SQL_SFKD_SET_NULL 0x00000008L + +#define SQL_SFKU_CASCADE 0x00000001L +#define SQL_SFKU_NO_ACTION 0x00000002L +#define SQL_SFKU_SET_DEFAULT 0x00000004L +#define SQL_SFKU_SET_NULL 0x00000008L + +#define SQL_SG_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SG_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SG_USAGE_ON_COLLATION 0x00000004L +#define SQL_SG_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SG_WITH_GRANT_OPTION 0x00000010L +#define SQL_SG_DELETE_TABLE 0x00000020L +#define SQL_SG_INSERT_TABLE 0x00000040L +#define SQL_SG_INSERT_COLUMN 0x00000080L +#define SQL_SG_REFERENCES_TABLE 0x00000100L +#define SQL_SG_REFERENCES_COLUMN 0x00000200L +#define SQL_SG_SELECT_TABLE 0x00000400L +#define SQL_SG_UPDATE_TABLE 0x00000800L +#define SQL_SG_UPDATE_COLUMN 0x00001000L + +#define SQL_SP_EXISTS 0x00000001L +#define SQL_SP_ISNOTNULL 0x00000002L +#define SQL_SP_ISNULL 0x00000004L +#define SQL_SP_MATCH_FULL 0x00000008L +#define SQL_SP_MATCH_PARTIAL 0x00000010L +#define SQL_SP_MATCH_UNIQUE_FULL 0x00000020L +#define SQL_SP_MATCH_UNIQUE_PARTIAL 0x00000040L +#define SQL_SP_OVERLAPS 0x00000080L +#define SQL_SP_UNIQUE 0x00000100L +#define SQL_SP_LIKE 0x00000200L +#define SQL_SP_IN 0x00000400L +#define SQL_SP_BETWEEN 0x00000800L +#define SQL_SP_COMPARISON 0x00001000L +#define SQL_SP_QUANTIFIED_COMPARISON 0x00002000L + +#define SQL_SRJO_CORRESPONDING_CLAUSE 0x00000001L +#define SQL_SRJO_CROSS_JOIN 0x00000002L +#define SQL_SRJO_EXCEPT_JOIN 0x00000004L +#define SQL_SRJO_FULL_OUTER_JOIN 0x00000008L +#define SQL_SRJO_INNER_JOIN 0x00000010L +#define SQL_SRJO_INTERSECT_JOIN 0x00000020L +#define SQL_SRJO_LEFT_OUTER_JOIN 0x00000040L +#define SQL_SRJO_NATURAL_JOIN 0x00000080L +#define SQL_SRJO_RIGHT_OUTER_JOIN 0x00000100L +#define SQL_SRJO_UNION_JOIN 0x00000200L + +#define SQL_SR_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SR_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SR_USAGE_ON_COLLATION 0x00000004L +#define SQL_SR_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SR_GRANT_OPTION_FOR 0x00000010L +#define SQL_SR_CASCADE 0x00000020L +#define SQL_SR_RESTRICT 0x00000040L +#define SQL_SR_DELETE_TABLE 0x00000080L +#define SQL_SR_INSERT_TABLE 0x00000100L +#define SQL_SR_INSERT_COLUMN 0x00000200L +#define SQL_SR_REFERENCES_TABLE 0x00000400L +#define SQL_SR_REFERENCES_COLUMN 0x00000800L +#define SQL_SR_SELECT_TABLE 0x00001000L +#define SQL_SR_UPDATE_TABLE 0x00002000L +#define SQL_SR_UPDATE_COLUMN 0x00004000L + +#define SQL_SRVC_VALUE_EXPRESSION 0x00000001L +#define SQL_SRVC_NULL 0x00000002L +#define SQL_SRVC_DEFAULT 0x00000004L +#define SQL_SRVC_ROW_SUBQUERY 0x00000008L + +#define SQL_SVE_CASE 0x00000001L +#define SQL_SVE_CAST 0x00000002L +#define SQL_SVE_COALESCE 0x00000004L +#define SQL_SVE_NULLIF 0x00000008L + +#define SQL_SCC_XOPEN_CLI_VERSION1 0x00000001L +#define SQL_SCC_ISO92_CLI 0x00000002L + +#define SQL_US_UNION SQL_U_UNION +#define SQL_US_UNION_ALL SQL_U_UNION_ALL + +#endif + +#define SQL_DTC_ENLIST_EXPENSIVE 0x00000001L +#define SQL_DTC_UNENLIST_EXPENSIVE 0x00000002L + +#if (ODBCVER >= 0x0300) +#define SQL_FETCH_FIRST_USER 31 +#define SQL_FETCH_FIRST_SYSTEM 32 +#endif + +#define SQL_ENTIRE_ROWSET 0 + +#define SQL_POSITION 0 +#define SQL_REFRESH 1 +#define SQL_UPDATE 2 +#define SQL_DELETE 3 + +#define SQL_ADD 4 +#define SQL_SETPOS_MAX_OPTION_VALUE SQL_ADD +#if (ODBCVER >= 0x0300) +#define SQL_UPDATE_BY_BOOKMARK 5 +#define SQL_DELETE_BY_BOOKMARK 6 +#define SQL_FETCH_BY_BOOKMARK 7 + +#endif + +#define SQL_LOCK_NO_CHANGE 0 +#define SQL_LOCK_EXCLUSIVE 1 +#define SQL_LOCK_UNLOCK 2 + +#define SQL_SETPOS_MAX_LOCK_VALUE SQL_LOCK_UNLOCK + +#define SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE) +#define SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock) +#define SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock) +#define SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE) +#define SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE) +#define SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE) + +#define SQL_BEST_ROWID 1 +#define SQL_ROWVER 2 + +#define SQL_PC_NOT_PSEUDO 1 + +#define SQL_QUICK 0 +#define SQL_ENSURE 1 + +#define SQL_TABLE_STAT 0 + +#if (ODBCVER >= 0x0300) +#define SQL_ALL_CATALOGS "%" +#define SQL_ALL_SCHEMAS "%" +#define SQL_ALL_TABLE_TYPES "%" +#endif /* ODBCVER >= 0x0300 */ + +#define SQL_DRIVER_NOPROMPT 0 +#define SQL_DRIVER_COMPLETE 1 +#define SQL_DRIVER_PROMPT 2 +#define SQL_DRIVER_COMPLETE_REQUIRED 3 + +SQLRETURN WINAPI SQLDriverConnect( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + +#define SQL_FETCH_BOOKMARK 8 + +#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 +#if (ODBCVER >= 0x0300) +#define SQL_ROW_SUCCESS_WITH_INFO 6 +#define SQL_ROW_PROCEED 0 +#define SQL_ROW_IGNORE 1 +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_SUCCESS 0 +#define SQL_PARAM_SUCCESS_WITH_INFO 6 +#define SQL_PARAM_ERROR 5 +#define SQL_PARAM_UNUSED 7 +#define SQL_PARAM_DIAG_UNAVAILABLE 1 + +#define SQL_PARAM_PROCEED 0 +#define SQL_PARAM_IGNORE 1 +#endif + +#define SQL_CASCADE 0 +#define SQL_RESTRICT 1 +#define SQL_SET_NULL 2 +#if (ODBCVER >= 0x0250) +#define SQL_NO_ACTION 3 +#define SQL_SET_DEFAULT 4 +#endif + +#if (ODBCVER >= 0x0300) + +#define SQL_INITIALLY_DEFERRED 5 +#define SQL_INITIALLY_IMMEDIATE 6 +#define SQL_NOT_DEFERRABLE 7 + +#endif + +#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 +#define SQL_RETURN_VALUE 5 + +#define SQL_PT_UNKNOWN 0 +#define SQL_PT_PROCEDURE 1 +#define SQL_PT_FUNCTION 2 + +#define SQL_ODBC_KEYWORDS "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS," + +SQLRETURN WINAPI SQLBrowseConnect( + SQLHDBC hdbc, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLBulkOperations( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +#endif + +SQLRETURN WINAPI SQLColAttributes( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLINTEGER *pfDesc); + +SQLRETURN WINAPI SQLColumnPrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN WINAPI SQLDescribeParam( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLUINTEGER *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + +SQLRETURN WINAPI SQLExtendedFetch( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLINTEGER irow, + SQLUINTEGER *pcrow, + SQLUSMALLINT *rgfRowStatus); + +SQLRETURN WINAPI SQLForeignKeys( + SQLHSTMT hstmt, + SQLCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + +SQLRETURN WINAPI SQLMoreResults( + SQLHSTMT hstmt); + +SQLRETURN WINAPI SQLNativeSql( + SQLHDBC hdbc, + SQLCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + +SQLRETURN WINAPI SQLNumParams( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); + +SQLRETURN WINAPI SQLParamOptions( + SQLHSTMT hstmt, + SQLUINTEGER crow, + SQLUINTEGER *pirow); + +SQLRETURN WINAPI SQLPrimaryKeys( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN WINAPI SQLProcedureColumns( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN WINAPI SQLProcedures( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName); + +SQLRETURN WINAPI SQLSetPos( + SQLHSTMT hstmt, + SQLUSMALLINT irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); + +SQLRETURN WINAPI SQLTablePrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN WINAPI SQLDrivers( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); + +SQLRETURN WINAPI SQLBindParameter( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLUINTEGER cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +#ifdef ODBC_STD +#define SQLAllocHandle SQLAllocHandleStd +#define SQLAllocEnv(phenv) SQLAllocHandleStd(SQL_HANDLE_ENV, SQL_NULL_HANDLE, phenv) + +#define SQL_YEAR SQL_CODE_YEAR +#define SQL_MONTH SQL_CODE_MONTH +#define SQL_DAY SQL_CODE_DAY +#define SQL_HOUR SQL_CODE_HOUR +#define SQL_MINUTE SQL_CODE_MINUTE +#define SQL_SECOND SQL_CODE_SECOND +#define SQL_YEAR_TO_MONTH SQL_CODE_YEAR_TO_MONTH +#define SQL_DAY_TO_HOUR SQL_CODE_DAY_TO_HOUR +#define SQL_DAY_TO_MINUTE SQL_CODE_DAY_TO_MINUTE +#define SQL_DAY_TO_SECOND SQL_CODE_DAY_TO_SECOND +#define SQL_HOUR_TO_MINUTE SQL_CODE_HOUR_TO_MINUTE +#define SQL_HOUR_TO_SECOND SQL_CODE_HOUR_TO_SECOND +#define SQL_MINUTE_TO_SECOND SQL_CODE_MINUTE_TO_SECOND +#endif + +#if (ODBCVER >= 0x0300) +SQLRETURN WINAPI SQLAllocHandleStd( + SQLSMALLINT fHandleType, + SQLHANDLE hInput, + SQLHANDLE *phOutput); +#endif + +#define SQL_DATABASE_NAME 16 +#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR +#define SQL_FETCH_PREV SQL_FETCH_PRIOR +#define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER +#define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER +#define SQL_CC_DELETE SQL_CB_DELETE +#define SQL_CR_DELETE SQL_CB_DELETE +#define SQL_CC_CLOSE SQL_CB_CLOSE +#define SQL_CR_CLOSE SQL_CB_CLOSE +#define SQL_CC_PRESERVE SQL_CB_PRESERVE +#define SQL_CR_PRESERVE SQL_CB_PRESERVE +#define SQL_SCROLL_FORWARD_ONLY 0L +#define SQL_SCROLL_KEYSET_DRIVEN (-1L) +#define SQL_SCROLL_DYNAMIC (-2L) +#define SQL_SCROLL_STATIC (-3L) + +SQLRETURN WINAPI SQLSetScrollOptions( + SQLHSTMT hstmt, + SQLUSMALLINT fConcurrency, + SQLINTEGER crowKeyset, + SQLUSMALLINT crowRowset); + +#define TRACE_VERSION 1000 + +RETCODE TraceOpenLogFile(LPWSTR,LPWSTR,DWORD); +RETCODE TraceCloseLogFile(); +VOID TraceReturn(RETCODE,RETCODE); +DWORD TraceVersion(); + +/*#define TRACE_ON 0x00000001L*/ +#define TRACE_VS_EVENT_ON 0x00000002L + +RETCODE TraceVSControl(DWORD); + +#define ODBC_VS_FLAG_UNICODE_ARG 0x00000001L +#define ODBC_VS_FLAG_UNICODE_COR 0x00000002L +#define ODBC_VS_FLAG_RETCODE 0x00000004L +#define ODBC_VS_FLAG_STOP 0x00000008L + +typedef struct tagODBC_VS_ARGS { + const GUID *pguidEvent; + DWORD dwFlags; + union { + WCHAR *wszArg; + CHAR *szArg; + }u1; + union { + WCHAR *wszCorrelation; + CHAR *szCorrelation; + }u2; + RETCODE RetCode; +} ODBC_VS_ARGS, *PODBC_VS_ARGS; + +VOID FireVSDebugEvent(PODBC_VS_ARGS); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/sqltypes.h b/include/sqltypes.h new file mode 100644 index 00000000000..5a3761fa6c6 --- /dev/null +++ b/include/sqltypes.h @@ -0,0 +1,237 @@ +/* + * sqltypes.h + */ +#ifndef __SQLTYPES_H +#define __SQLTYPES_H + +#ifndef ODBCVER +#define ODBCVER 0x0351 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WINDOWS +#define FAR +#define CALLBACK +#define SQL_API +#define BOOL int +typedef void* HWND; +typedef char* GUID; +#define GUID_DEFINED +typedef char CHAR; +typedef void VOID; +typedef unsigned short WORD; +typedef unsigned long DWORD; +typedef unsigned char BYTE; +typedef unsigned short WCHAR; +typedef WCHAR* LPWSTR; +typedef const char* LPCSTR; +typedef char* LPSTR; +typedef DWORD* LPDWORD; +#endif + +typedef unsigned char SQLCHAR; + +#if (ODBCVER >= 0x0300) +typedef unsigned char SQLDATE; +typedef unsigned char SQLDECIMAL; +typedef double SQLDOUBLE; +typedef double SQLFLOAT; +#endif + +typedef long SQLINTEGER; + +#if (ODBCVER >= 0x0300) +typedef unsigned char SQLNUMERIC; +#endif + +typedef void * SQLPOINTER; + +#if (ODBCVER >= 0x0300) +typedef float SQLREAL; +#endif + +typedef signed short int SQLSMALLINT; +typedef unsigned short SQLUSMALLINT; + +#if (ODBCVER >= 0x0300) +typedef unsigned char SQLTIME; +typedef unsigned char SQLTIMESTAMP; +typedef unsigned char SQLVARCHAR; +#endif + +typedef SQLSMALLINT SQLRETURN; + +/* typedef void * SQLHANDLE; */ + +typedef SQLINTEGER SQLHANDLE; +#if (ODBCVER >= 0x0300) + +typedef SQLHANDLE SQLHENV; +typedef SQLHANDLE SQLHDBC; +typedef SQLHANDLE SQLHSTMT; +typedef SQLHANDLE SQLHDESC; + +#else +typedef SQLINTEGER SQLHENV; +typedef SQLINTEGER SQLHDBC; +typedef SQLINTEGER SQLHSTMT; +#endif + +typedef signed char SCHAR; +typedef SCHAR SQLSCHAR; +typedef long int SDWORD; +typedef signed short int SWORD; +typedef unsigned long int UDWORD; +typedef unsigned short int UWORD; +typedef UDWORD SQLUINTEGER; +typedef signed long SLONG; +typedef signed short SSHORT; +typedef double SDOUBLE; +typedef double LDOUBLE; +typedef float SFLOAT; +typedef void* PTR; +typedef signed short RETCODE; +typedef void* SQLHWND; + +typedef SQLHANDLE HENV; +typedef SQLHANDLE HDBC; +typedef SQLHANDLE HSTMT; + +#ifndef __SQLDATE +#define __SQLDATE +typedef struct tagDATE_STRUCT +{ + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; +} DATE_STRUCT; + +#if (ODBCVER >= 0x0300) +typedef DATE_STRUCT SQL_DATE_STRUCT; +#endif + +typedef struct tagTIME_STRUCT +{ + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; +} TIME_STRUCT; + +#if (ODBCVER >= 0x0300) +typedef TIME_STRUCT SQL_TIME_STRUCT; +#endif + +typedef struct tagTIMESTAMP_STRUCT +{ + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + SQLUINTEGER fraction; +} TIMESTAMP_STRUCT; + +#if (ODBCVER >= 0x0300) +typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT; +#endif + + +#if (ODBCVER >= 0x0300) +typedef enum +{ + SQL_IS_YEAR = 1, + SQL_IS_MONTH = 2, + SQL_IS_DAY = 3, + SQL_IS_HOUR = 4, + SQL_IS_MINUTE = 5, + SQL_IS_SECOND = 6, + SQL_IS_YEAR_TO_MONTH = 7, + SQL_IS_DAY_TO_HOUR = 8, + SQL_IS_DAY_TO_MINUTE = 9, + SQL_IS_DAY_TO_SECOND = 10, + SQL_IS_HOUR_TO_MINUTE = 11, + SQL_IS_HOUR_TO_SECOND = 12, + SQL_IS_MINUTE_TO_SECOND = 13 +} SQLINTERVAL; + +#endif + +#if (ODBCVER >= 0x0300) +typedef struct tagSQL_YEAR_MONTH +{ + SQLUINTEGER year; + SQLUINTEGER month; +} SQL_YEAR_MONTH_STRUCT; + +typedef struct tagSQL_DAY_SECOND +{ + SQLUINTEGER day; + SQLUINTEGER hour; + SQLUINTEGER minute; + SQLUINTEGER second; + SQLUINTEGER fraction; +} SQL_DAY_SECOND_STRUCT; + +typedef struct tagSQL_INTERVAL_STRUCT +{ + SQLINTERVAL interval_type; + SQLSMALLINT interval_sign; + union { + SQL_YEAR_MONTH_STRUCT year_month; + SQL_DAY_SECOND_STRUCT day_second; + } intval; + +} SQL_INTERVAL_STRUCT; + +#endif + +#endif + +#if (ODBCVER >= 0x0300) +#define ODBCINT64 long +#ifdef ODBCINT64 +typedef ODBCINT64 SQLBIGINT; +typedef unsigned ODBCINT64 SQLUBIGINT; +#endif +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_MAX_NUMERIC_LEN 16 +typedef struct tagSQL_NUMERIC_STRUCT +{ + SQLCHAR precision; + SQLSCHAR scale; + SQLCHAR sign; /* 1=pos 0=neg */ + SQLCHAR val[SQL_MAX_NUMERIC_LEN]; +} SQL_NUMERIC_STRUCT; +#endif + +#if (ODBCVER >= 0x0350) +#ifdef GUID_DEFINED +typedef GUID SQLGUID; +#else +typedef struct tagSQLGUID +{ + DWORD Data1; + WORD Data2; + WORD Data3; + BYTE Data4[ 8 ]; +} SQLGUID; +#endif +#endif + + +typedef unsigned long int BOOKMARK; + +#define SQL_WCHAR (-8) +#define SQL_C_WCHAR SQL_WCHAR + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/loader/loadorder.c b/loader/loadorder.c index ea47c59b6c8..70575bee000 100644 --- a/loader/loadorder.c +++ b/loader/loadorder.c @@ -58,6 +58,7 @@ static struct tagDllOverride { {"icmp", "builtin"}, /* we have to use libglide2x.so instead of glide2x.dll ... */ {"glide2x", "so,native"}, + {"odbc32", "builtin"}, {NULL,NULL}, }; diff --git a/relay32/builtin32.c b/relay32/builtin32.c index 7944c2e9a17..7a99671e477 100644 --- a/relay32/builtin32.c +++ b/relay32/builtin32.c @@ -77,6 +77,7 @@ extern const BUILTIN32_DESCRIPTOR MSACMMAP_Descriptor; extern const BUILTIN32_DESCRIPTOR MSNET32_Descriptor; extern const BUILTIN32_DESCRIPTOR MSVFW32_Descriptor; extern const BUILTIN32_DESCRIPTOR NTDLL_Descriptor; +extern const BUILTIN32_DESCRIPTOR ODBC32_Descriptor; extern const BUILTIN32_DESCRIPTOR OLE32_Descriptor; extern const BUILTIN32_DESCRIPTOR OLEAUT32_Descriptor; extern const BUILTIN32_DESCRIPTOR OLECLI32_Descriptor; @@ -134,6 +135,7 @@ static BUILTIN32_DLL BuiltinDLLs[] = { &MSNET32_Descriptor, 0, 0, NULL }, { &MSVFW32_Descriptor, 0, 0, NULL }, { &NTDLL_Descriptor, 0, 0, NULL }, + { &ODBC32_Descriptor, 0, 0, NULL }, { &OLE32_Descriptor, 0, 0, NULL }, { &OLEAUT32_Descriptor, 0, 0, NULL }, { &OLECLI32_Descriptor, 0, 0, NULL },