4 * Copyright 1999 Xiang Li, Corel Corporation
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * Proxy ODBC driver manager. This manager delegates all ODBC
22 * calls to a real ODBC driver manager named by the environment
23 * variable LIB_ODBC_DRIVER_MANAGER, or to libodbc.so if the
24 * variable is not set.
29 #include "wine/port.h"
40 #include "wine/debug.h"
41 #include "wine/library.h"
42 #include "wine/unicode.h"
48 #include "proxyodbc.h"
50 static BOOL ODBC_LoadDriverManager(void);
51 static BOOL ODBC_LoadDMFunctions(void);
53 WINE_DEFAULT_DEBUG_CHANNEL(odbc);
55 static const DM_FUNC template_func[] =
57 /* 00 */ { SQL_API_SQLALLOCCONNECT, "SQLAllocConnect", SQLAllocConnect, NULL, NULL },
58 /* 01 */ { SQL_API_SQLALLOCENV, "SQLAllocEnv", SQLAllocEnv, NULL, NULL },
59 /* 02 */ { SQL_API_SQLALLOCHANDLE, "SQLAllocHandle", SQLAllocHandle, NULL, NULL },
60 /* 03 */ { SQL_API_SQLALLOCSTMT, "SQLAllocStmt", SQLAllocStmt, NULL, NULL },
61 /* 04 */ { SQL_API_SQLALLOCHANDLESTD, "SQLAllocHandleStd", SQLAllocHandleStd, NULL, NULL },
62 /* 05 */ { SQL_API_SQLBINDCOL, "SQLBindCol", SQLBindCol, NULL, NULL },
63 /* 06 */ { SQL_API_SQLBINDPARAM, "SQLBindParam", SQLBindParam, NULL, NULL },
64 /* 07 */ { SQL_API_SQLBINDPARAMETER, "SQLBindParameter", SQLBindParameter, NULL, NULL },
65 /* 08 */ { SQL_API_SQLBROWSECONNECT, "SQLBrowseConnect", SQLBrowseConnect, NULL, NULL },
66 /* 09 */ { SQL_API_SQLBULKOPERATIONS, "SQLBulkOperations", SQLBulkOperations, NULL, NULL },
67 /* 10 */ { SQL_API_SQLCANCEL, "SQLCancel", SQLCancel, NULL, NULL },
68 /* 11 */ { SQL_API_SQLCLOSECURSOR, "SQLCloseCursor", SQLCloseCursor, NULL, NULL },
69 /* 12 */ { SQL_API_SQLCOLATTRIBUTE, "SQLColAttribute", SQLColAttribute, NULL, NULL },
70 /* 13 */ { SQL_API_SQLCOLATTRIBUTES, "SQLColAttributes", SQLColAttributes, NULL, NULL },
71 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES, "SQLColumnPrivileges", SQLColumnPrivileges, NULL, NULL },
72 /* 15 */ { SQL_API_SQLCOLUMNS, "SQLColumns", SQLColumns, NULL, NULL },
73 /* 16 */ { SQL_API_SQLCONNECT, "SQLConnect", SQLConnect, NULL, NULL },
74 /* 17 */ { SQL_API_SQLCOPYDESC, "SQLCopyDesc", SQLCopyDesc, NULL, NULL },
75 /* 18 */ { SQL_API_SQLDATASOURCES, "SQLDataSources", SQLDataSources, NULL, NULL },
76 /* 19 */ { SQL_API_SQLDESCRIBECOL, "SQLDescribeCol", SQLDescribeCol, NULL, NULL },
77 /* 20 */ { SQL_API_SQLDESCRIBEPARAM, "SQLDescribeParam", SQLDescribeParam, NULL, NULL },
78 /* 21 */ { SQL_API_SQLDISCONNECT, "SQLDisconnect", SQLDisconnect, NULL, NULL },
79 /* 22 */ { SQL_API_SQLDRIVERCONNECT, "SQLDriverConnect", SQLDriverConnect, NULL, NULL },
80 /* 23 */ { SQL_API_SQLDRIVERS, "SQLDrivers", SQLDrivers, NULL, NULL },
81 /* 24 */ { SQL_API_SQLENDTRAN, "SQLEndTran", SQLEndTran, NULL, NULL },
82 /* 25 */ { SQL_API_SQLERROR, "SQLError", SQLError, NULL, NULL },
83 /* 26 */ { SQL_API_SQLEXECDIRECT, "SQLExecDirect", SQLExecDirect, NULL, NULL },
84 /* 27 */ { SQL_API_SQLEXECUTE, "SQLExecute", SQLExecute, NULL, NULL },
85 /* 28 */ { SQL_API_SQLEXTENDEDFETCH, "SQLExtendedFetch", SQLExtendedFetch, NULL, NULL },
86 /* 29 */ { SQL_API_SQLFETCH, "SQLFetch", SQLFetch, NULL, NULL },
87 /* 30 */ { SQL_API_SQLFETCHSCROLL, "SQLFetchScroll", SQLFetchScroll, NULL, NULL },
88 /* 31 */ { SQL_API_SQLFOREIGNKEYS, "SQLForeignKeys", SQLForeignKeys, NULL, NULL },
89 /* 32 */ { SQL_API_SQLFREEENV, "SQLFreeEnv", SQLFreeEnv, NULL, NULL },
90 /* 33 */ { SQL_API_SQLFREEHANDLE, "SQLFreeHandle", SQLFreeHandle, NULL, NULL },
91 /* 34 */ { SQL_API_SQLFREESTMT, "SQLFreeStmt", SQLFreeStmt, NULL, NULL },
92 /* 35 */ { SQL_API_SQLFREECONNECT, "SQLFreeConnect", SQLFreeConnect, NULL, NULL },
93 /* 36 */ { SQL_API_SQLGETCONNECTATTR, "SQLGetConnectAttr", SQLGetConnectAttr, NULL, NULL },
94 /* 37 */ { SQL_API_SQLGETCONNECTOPTION, "SQLGetConnectOption", SQLGetConnectOption, NULL, NULL },
95 /* 38 */ { SQL_API_SQLGETCURSORNAME, "SQLGetCursorName", SQLGetCursorName, NULL, NULL },
96 /* 39 */ { SQL_API_SQLGETDATA, "SQLGetData", SQLGetData, NULL, NULL },
97 /* 40 */ { SQL_API_SQLGETDESCFIELD, "SQLGetDescField", SQLGetDescField, NULL, NULL },
98 /* 41 */ { SQL_API_SQLGETDESCREC, "SQLGetDescRec", SQLGetDescRec, NULL, NULL },
99 /* 42 */ { SQL_API_SQLGETDIAGFIELD, "SQLGetDiagField", SQLGetDiagField, NULL, NULL },
100 /* 43 */ { SQL_API_SQLGETENVATTR, "SQLGetEnvAttr", SQLGetEnvAttr, NULL, NULL },
101 /* 44 */ { SQL_API_SQLGETFUNCTIONS, "SQLGetFunctions", SQLGetFunctions, NULL, NULL },
102 /* 45 */ { SQL_API_SQLGETINFO, "SQLGetInfo", SQLGetInfo, NULL, NULL },
103 /* 46 */ { SQL_API_SQLGETSTMTATTR, "SQLGetStmtAttr", SQLGetStmtAttr, NULL, NULL },
104 /* 47 */ { SQL_API_SQLGETSTMTOPTION, "SQLGetStmtOption", SQLGetStmtOption, NULL, NULL },
105 /* 48 */ { SQL_API_SQLGETTYPEINFO, "SQLGetTypeInfo", SQLGetTypeInfo, NULL, NULL },
106 /* 49 */ { SQL_API_SQLMORERESULTS, "SQLMoreResults", SQLMoreResults, NULL, NULL },
107 /* 50 */ { SQL_API_SQLNATIVESQL, "SQLNativeSql", SQLNativeSql, NULL, NULL },
108 /* 51 */ { SQL_API_SQLNUMPARAMS, "SQLNumParams", SQLNumParams, NULL, NULL },
109 /* 52 */ { SQL_API_SQLNUMRESULTCOLS, "SQLNumResultCols", SQLNumResultCols, NULL, NULL },
110 /* 53 */ { SQL_API_SQLPARAMDATA, "SQLParamData", SQLParamData, NULL, NULL },
111 /* 54 */ { SQL_API_SQLPARAMOPTIONS, "SQLParamOptions", SQLParamOptions, NULL, NULL },
112 /* 55 */ { SQL_API_SQLPREPARE, "SQLPrepare", SQLPrepare, NULL, NULL },
113 /* 56 */ { SQL_API_SQLPRIMARYKEYS, "SQLPrimaryKeys", SQLPrimaryKeys, NULL, NULL },
114 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS, "SQLProcedureColumns", SQLProcedureColumns, NULL, NULL },
115 /* 58 */ { SQL_API_SQLPROCEDURES, "SQLProcedures", SQLProcedures, NULL, NULL },
116 /* 59 */ { SQL_API_SQLPUTDATA, "SQLPutData", SQLPutData, NULL, NULL },
117 /* 60 */ { SQL_API_SQLROWCOUNT, "SQLRowCount", SQLRowCount, NULL, NULL },
118 /* 61 */ { SQL_API_SQLSETCONNECTATTR, "SQLSetConnectAttr", SQLSetConnectAttr, NULL, NULL },
119 /* 62 */ { SQL_API_SQLSETCONNECTOPTION, "SQLSetConnectOption", SQLSetConnectOption, NULL, NULL },
120 /* 63 */ { SQL_API_SQLSETCURSORNAME, "SQLSetCursorName", SQLSetCursorName, NULL, NULL },
121 /* 64 */ { SQL_API_SQLSETDESCFIELD, "SQLSetDescField", SQLSetDescField, NULL, NULL },
122 /* 65 */ { SQL_API_SQLSETDESCREC, "SQLSetDescRec", SQLSetDescRec, NULL, NULL },
123 /* 66 */ { SQL_API_SQLSETENVATTR, "SQLSetEnvAttr", SQLSetEnvAttr, NULL, NULL },
124 /* 67 */ { SQL_API_SQLSETPARAM, "SQLSetParam", SQLSetParam, NULL, NULL },
125 /* 68 */ { SQL_API_SQLSETPOS, "SQLSetPos", SQLSetPos, NULL, NULL },
126 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS, "SQLSetScrollOptions", SQLSetScrollOptions, NULL, NULL },
127 /* 70 */ { SQL_API_SQLSETSTMTATTR, "SQLSetStmtAttr", SQLSetStmtAttr, NULL, NULL },
128 /* 71 */ { SQL_API_SQLSETSTMTOPTION, "SQLSetStmtOption", SQLSetStmtOption, NULL, NULL },
129 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS, "SQLSpecialColumns", SQLSpecialColumns, NULL, NULL },
130 /* 73 */ { SQL_API_SQLSTATISTICS, "SQLStatistics", SQLStatistics, NULL, NULL },
131 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES, "SQLTablePrivileges", SQLTablePrivileges, NULL, NULL },
132 /* 75 */ { SQL_API_SQLTABLES, "SQLTables", SQLTables, NULL, NULL },
133 /* 76 */ { SQL_API_SQLTRANSACT, "SQLTransact", SQLTransact, NULL, NULL },
134 /* 77 */ { SQL_API_SQLGETDIAGREC, "SQLGetDiagRec", SQLGetDiagRec, NULL, NULL },
137 static PROXYHANDLE gProxyHandle;
139 /* What is the difference between these two (dmHandle cf READY_AND_dmHandle)? When does one use one and when the other? */
141 #define CHECK_dmHandle() \
143 if (gProxyHandle.dmHandle == NULL) \
145 TRACE ("Not ready\n"); \
150 #define CHECK_READY_AND_dmHandle() \
152 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) \
154 TRACE ("Not ready\n"); \
159 static SQLRETURN SQLDummyFunc(void)
161 TRACE("SQLDummyFunc:\n");
165 /***********************************************************************
166 * ODBC_ReplicateODBCInstToRegistry
172 * Utility to ODBC_ReplicateToRegistry to replicate the drivers of the
173 * ODBCINST.INI settings
175 * The driver settings are not replicated to the registry. If we were to
176 * replicate them we would need to decide whether to replicate all settings
177 * or to do some translation; whether to remove any entries present only in
178 * the windows registry, etc.
181 static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv)
188 TRACE ("Driver settings are not currently replicated to the registry\n");
189 if ((reg_ret = RegCreateKeyExA (HKEY_LOCAL_MACHINE,
190 "Software\\ODBC\\ODBCINST.INI", 0, NULL,
191 REG_OPTION_NON_VOLATILE,
192 KEY_ALL_ACCESS /* a couple more than we need */, NULL,
193 &hODBCInst, NULL)) == ERROR_SUCCESS)
196 if ((reg_ret = RegCreateKeyExA (hODBCInst, "ODBC Drivers", 0,
197 NULL, REG_OPTION_NON_VOLATILE,
198 KEY_ALL_ACCESS /* overkill */, NULL, &hDrivers, NULL))
204 SQLSMALLINT sizedesc;
207 dirn = SQL_FETCH_FIRST;
208 while ((sql_ret = SQLDrivers (hEnv, dirn, (SQLCHAR*)desc, sizeof(desc),
209 &sizedesc, NULL, 0, NULL)) == SQL_SUCCESS ||
210 sql_ret == SQL_SUCCESS_WITH_INFO)
212 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
213 dirn = SQL_FETCH_NEXT;
214 if (sizedesc == strlen(desc))
217 if ((reg_ret = RegQueryValueExA (hDrivers, desc, NULL,
218 NULL, NULL, NULL)) == ERROR_FILE_NOT_FOUND)
220 if ((reg_ret = RegSetValueExA (hDrivers, desc, 0,
221 REG_SZ, (const BYTE *)"Installed", 10)) != ERROR_SUCCESS)
223 TRACE ("Error %d replicating driver %s\n",
228 else if (reg_ret != ERROR_SUCCESS)
230 TRACE ("Error %d checking for %s in drivers\n",
234 if ((reg_ret = RegCreateKeyExA (hODBCInst, desc, 0,
235 NULL, REG_OPTION_NON_VOLATILE,
236 KEY_ALL_ACCESS, NULL, &hThis, NULL))
239 /* FIXME This is where the settings go.
240 * I suggest that if the disposition says it
241 * exists then we leave it alone. Alternatively
242 * include an extra value to flag that it is
243 * a replication of the unixODBC/iODBC/...
245 if ((reg_ret = RegCloseKey (hThis)) !=
247 TRACE ("Error %d closing %s key\n", reg_ret,
252 TRACE ("Error %d ensuring driver key %s\n",
259 WARN ("Unusually long driver name %s not replicated\n",
264 if (sql_ret != SQL_NO_DATA)
266 TRACE ("Error %d enumerating drivers\n", (int)sql_ret);
269 if ((reg_ret = RegCloseKey (hDrivers)) != ERROR_SUCCESS)
271 TRACE ("Error %d closing hDrivers\n", reg_ret);
276 TRACE ("Error %d opening HKLM\\S\\O\\OI\\Drivers\n", reg_ret);
278 if ((reg_ret = RegCloseKey (hODBCInst)) != ERROR_SUCCESS)
280 TRACE ("Error %d closing HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
285 TRACE ("Error %d opening HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
289 WARN ("May not have replicated all ODBC drivers to the registry\n");
293 /***********************************************************************
294 * ODBC_ReplicateODBCToRegistry
300 * Utility to ODBC_ReplicateToRegistry to replicate either the USER or
303 * For now simply place the "Driver description" (as returned by SQLDataSources)
304 * into the registry as the driver. This is enough to satisfy Crystal's
305 * requirement that there be a driver entry. (It doesn't seem to care what
307 * A slightly more accurate setting would be to access the registry to find
308 * the actual driver library for the given description (which appears to map
309 * to one of the HKLM/Software/ODBC/ODBCINST.INI keys). (If you do this note
310 * that this will add a requirement that this function be called after
311 * ODBC_ReplicateODBCInstToRegistry)
313 static void ODBC_ReplicateODBCToRegistry (int is_user, SQLHENV hEnv)
319 CHAR dsn [SQL_MAX_DSN_LENGTH + 1];
322 SQLSMALLINT sizedesc;
324 const char *which = is_user ? "user" : "system";
327 if ((reg_ret = RegCreateKeyExA (
328 is_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
329 "Software\\ODBC\\ODBC.INI", 0, NULL, REG_OPTION_NON_VOLATILE,
330 KEY_ALL_ACCESS /* a couple more than we need */, NULL, &hODBC,
331 NULL)) == ERROR_SUCCESS)
334 dirn = is_user ? SQL_FETCH_FIRST_USER : SQL_FETCH_FIRST_SYSTEM;
335 while ((sql_ret = SQLDataSources (hEnv, dirn,
336 (SQLCHAR*)dsn, sizeof(dsn), &sizedsn,
337 (SQLCHAR*)desc, sizeof(desc), &sizedesc)) == SQL_SUCCESS
338 || sql_ret == SQL_SUCCESS_WITH_INFO)
340 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
341 dirn = SQL_FETCH_NEXT;
342 if (sizedsn == strlen(dsn) && sizedesc == strlen(desc))
345 if ((reg_ret = RegCreateKeyExA (hODBC, dsn, 0,
346 NULL, REG_OPTION_NON_VOLATILE,
347 KEY_ALL_ACCESS, NULL, &hDSN, NULL))
350 static const char DRIVERKEY[] = "Driver";
351 if ((reg_ret = RegQueryValueExA (hDSN, DRIVERKEY,
352 NULL, NULL, NULL, NULL))
353 == ERROR_FILE_NOT_FOUND)
355 if ((reg_ret = RegSetValueExA (hDSN, DRIVERKEY, 0,
356 REG_SZ, (LPBYTE)desc, sizedesc)) != ERROR_SUCCESS)
358 TRACE ("Error %d replicating description of "
359 "%s(%s)\n", reg_ret, dsn, desc);
363 else if (reg_ret != ERROR_SUCCESS)
365 TRACE ("Error %d checking for description of %s\n",
369 if ((reg_ret = RegCloseKey (hDSN)) != ERROR_SUCCESS)
371 TRACE ("Error %d closing %s DSN key %s\n",
372 reg_ret, which, dsn);
377 TRACE ("Error %d opening %s DSN key %s\n",
378 reg_ret, which, dsn);
384 WARN ("Unusually long %s data source name %s (%s) not "
385 "replicated\n", which, dsn, desc);
389 if (sql_ret != SQL_NO_DATA)
391 TRACE ("Error %d enumerating %s datasources\n",
392 (int)sql_ret, which);
395 if ((reg_ret = RegCloseKey (hODBC)) != ERROR_SUCCESS)
397 TRACE ("Error %d closing %s ODBC.INI registry key\n", reg_ret,
403 TRACE ("Error %d creating/opening %s ODBC.INI registry key\n",
408 WARN ("May not have replicated all %s ODBC DSNs to the registry\n",
413 /***********************************************************************
414 * ODBC_ReplicateToRegistry
420 * Unfortunately some of the functions that Windows documents as being part
421 * of the ODBC API it implements directly during compilation or something
422 * in terms of registry access functions.
423 * e.g. SQLGetInstalledDrivers queries the list at
424 * HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC Drivers
426 * This function is called when the driver manager is loaded and is used
427 * to replicate the appropriate details into the Wine registry
430 static void ODBC_ReplicateToRegistry (void)
435 if ((sql_ret = SQLAllocEnv (&hEnv)) == SQL_SUCCESS)
437 ODBC_ReplicateODBCInstToRegistry (hEnv);
438 ODBC_ReplicateODBCToRegistry (0 /* system dsns */, hEnv);
439 ODBC_ReplicateODBCToRegistry (1 /* user dsns */, hEnv);
441 if ((sql_ret = SQLFreeEnv (hEnv)) != SQL_SUCCESS)
443 TRACE ("Error %d freeing the SQL environment.\n", (int)sql_ret);
448 TRACE ("Error %d opening an SQL environment.\n", (int)sql_ret);
449 WARN ("The external ODBC settings have not been replicated to the"
454 /***********************************************************************
455 * DllMain [Internal] Initializes the internal 'ODBC32.DLL'.
458 * hinstDLL [I] handle to the DLL's instance
460 * lpvReserved [I] reserved, must be NULL
467 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
470 TRACE("Initializing or Finalizing proxy ODBC: %p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
472 if (fdwReason == DLL_PROCESS_ATTACH)
474 TRACE("Loading ODBC...\n");
475 DisableThreadLibraryCalls(hinstDLL);
476 if (ODBC_LoadDriverManager())
478 ODBC_LoadDMFunctions();
479 ODBC_ReplicateToRegistry();
482 else if (fdwReason == DLL_PROCESS_DETACH)
484 TRACE("Unloading ODBC...\n");
485 if (gProxyHandle.bFunctionReady)
487 for ( i = 0; i < NUM_SQLFUNC; i ++ )
489 gProxyHandle.functions[i].func = SQLDummyFunc;
493 if (gProxyHandle.dmHandle)
495 wine_dlclose(gProxyHandle.dmHandle,NULL,0);
496 gProxyHandle.dmHandle = NULL;
503 /***********************************************************************
504 * ODBC_LoadDriverManager [Internal] Load ODBC library.
513 static BOOL ODBC_LoadDriverManager(void)
515 const char *s = getenv("LIB_ODBC_DRIVER_MANAGER");
520 gProxyHandle.bFunctionReady = FALSE;
521 gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND;
523 if (s!= NULL && strlen (s) >= sizeof(gProxyHandle.dmLibName))
525 ERR("Driver name too long (%s)\n",s);
528 if (s == NULL || strlen(s) == 0)
530 strcpy(gProxyHandle.dmLibName, s);
532 gProxyHandle.dmHandle = wine_dlopen(gProxyHandle.dmLibName, RTLD_LAZY | RTLD_GLOBAL, error, sizeof(error));
534 if (gProxyHandle.dmHandle == NULL) /* fail to load unixODBC driver manager */
536 WARN("failed to open library %s: %s\n", gProxyHandle.dmLibName, error);
537 gProxyHandle.dmLibName[0] = '\0';
538 gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND;
543 gProxyHandle.nErrorType = ERROR_FREE;
549 /***********************************************************************
550 * ODBC_LoadDMFunctions [Internal] Populate function table.
559 static BOOL ODBC_LoadDMFunctions(void)
564 if (gProxyHandle.dmHandle == NULL)
567 for ( i = 0; i < NUM_SQLFUNC; i ++ )
571 gProxyHandle.functions[i] = template_func[i];
572 gProxyHandle.functions[i].func = wine_dlsym(gProxyHandle.dmHandle,
573 gProxyHandle.functions[i].name, error, sizeof(error));
577 ERR("Failed to load function %s\n",gProxyHandle.functions[i].name);
578 gProxyHandle.functions[i].func = SQLDummyFunc;
582 /* Build Unicode function name for this function */
583 pFuncNameW = HeapAlloc(GetProcessHeap(), 0, strlen(gProxyHandle.functions[i].name) + 2);
584 strcpy(pFuncNameW, gProxyHandle.functions[i].name);
585 pFuncNameW[strlen(gProxyHandle.functions[i].name) + 1] = '\0';
586 pFuncNameW[strlen(gProxyHandle.functions[i].name)] = 'W';
588 gProxyHandle.functions[i].funcW = wine_dlsym(gProxyHandle.dmHandle,
589 pFuncNameW, error, sizeof(error));
592 /* TRACE("Failed to load function %s, possibly no Unicode version is required\n", pFuncNameW); */
593 gProxyHandle.functions[i].funcW = NULL;
595 HeapFree(GetProcessHeap(), 0, pFuncNameW);
599 gProxyHandle.bFunctionReady = TRUE;
605 /*************************************************************************
606 * SQLAllocConnect [ODBC32.001]
608 SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
611 TRACE("Env=%lx\n",EnvironmentHandle);
613 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
615 *ConnectionHandle = SQL_NULL_HDBC;
616 TRACE("Not ready\n");
620 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCCONNECT].func);
621 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCCONNECT].func)
622 (EnvironmentHandle, ConnectionHandle);
623 TRACE("Returns ret=%d, Handle %lx\n",ret, *ConnectionHandle);
628 /*************************************************************************
629 * SQLAllocEnv [ODBC32.002]
631 SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
636 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
638 *EnvironmentHandle = SQL_NULL_HENV;
639 TRACE("Not ready\n");
643 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCENV].func);
644 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCENV].func) (EnvironmentHandle);
645 TRACE("Returns ret=%d, Env=%lx\n",ret, *EnvironmentHandle);
650 /*************************************************************************
651 * SQLAllocHandle [ODBC32.024]
653 SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
656 TRACE("(Type=%d, Handle=%lx)\n",HandleType,InputHandle);
658 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
660 if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
661 WARN("ProxyODBC: Cannot load ODBC driver manager library.\n");
663 if (HandleType == SQL_HANDLE_ENV)
664 *OutputHandle = SQL_NULL_HENV;
665 else if (HandleType == SQL_HANDLE_DBC)
666 *OutputHandle = SQL_NULL_HDBC;
667 else if (HandleType == SQL_HANDLE_STMT)
668 *OutputHandle = SQL_NULL_HSTMT;
669 else if (HandleType == SQL_HANDLE_DESC)
670 *OutputHandle = SQL_NULL_HDESC;
672 TRACE ("Not ready\n");
676 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLE].func);
677 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLE].func)
678 (HandleType, InputHandle, OutputHandle);
679 TRACE("Returns ret=%d, Handle=%lx\n",ret, *OutputHandle);
684 /*************************************************************************
685 * SQLAllocStmt [ODBC32.003]
687 SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
691 TRACE("(Connection=%lx)\n",ConnectionHandle);
693 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
695 *StatementHandle = SQL_NULL_HSTMT;
696 TRACE ("Not ready\n");
700 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCSTMT].func);
701 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCSTMT].func)
702 (ConnectionHandle, StatementHandle);
703 TRACE ("Returns ret=%d, Handle=%lx\n", ret, *StatementHandle);
708 /*************************************************************************
709 * SQLAllocHandleStd [ODBC32.077]
711 SQLRETURN WINAPI SQLAllocHandleStd( SQLSMALLINT HandleType,
712 SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
714 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
716 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
718 if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
719 WARN("ProxyODBC: Cannot load ODBC driver manager library.\n");
721 if (HandleType == SQL_HANDLE_ENV)
722 *OutputHandle = SQL_NULL_HENV;
723 else if (HandleType == SQL_HANDLE_DBC)
724 *OutputHandle = SQL_NULL_HDBC;
725 else if (HandleType == SQL_HANDLE_STMT)
726 *OutputHandle = SQL_NULL_HSTMT;
727 else if (HandleType == SQL_HANDLE_DESC)
728 *OutputHandle = SQL_NULL_HDESC;
733 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLESTD].func);
734 return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLESTD].func)
735 (HandleType, InputHandle, OutputHandle);
739 /*************************************************************************
740 * SQLBindCol [ODBC32.004]
742 SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle,
743 SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
744 SQLPOINTER TargetValue, SQLINTEGER BufferLength,
745 SQLINTEGER *StrLen_or_Ind)
749 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
751 TRACE ("Not ready\n");
755 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDCOL].func);
756 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDCOL].func)
757 (StatementHandle, ColumnNumber, TargetType,
758 TargetValue, BufferLength, StrLen_or_Ind);
762 /*************************************************************************
763 * SQLBindParam [ODBC32.025]
765 SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle,
766 SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
767 SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
768 SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
769 SQLINTEGER *StrLen_or_Ind)
773 CHECK_READY_AND_dmHandle();
775 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAM].func);
776 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAM].func)
777 (StatementHandle, ParameterNumber, ValueType,
778 ParameterScale, ParameterValue, StrLen_or_Ind);
782 /*************************************************************************
783 * SQLCancel [ODBC32.005]
785 SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle)
789 CHECK_READY_AND_dmHandle();
791 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCANCEL].func);
792 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCANCEL].func) (StatementHandle);
796 /*************************************************************************
797 * SQLCloseCursor [ODBC32.026]
799 SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle)
802 TRACE("(Handle=%lx)\n",StatementHandle);
804 CHECK_READY_AND_dmHandle();
806 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLCLOSECURSOR].func);
807 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLCLOSECURSOR].func) (StatementHandle);
808 TRACE("returns %d\n",ret);
813 /*************************************************************************
814 * SQLColAttribute [ODBC32.027]
816 SQLRETURN WINAPI SQLColAttribute (SQLHSTMT StatementHandle,
817 SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
818 SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
819 SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute)
823 CHECK_READY_AND_dmHandle();
825 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].func);
826 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].func)
827 (StatementHandle, ColumnNumber, FieldIdentifier,
828 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
832 /*************************************************************************
833 * SQLColumns [ODBC32.040]
835 SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle,
836 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
837 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
838 SQLCHAR *TableName, SQLSMALLINT NameLength3,
839 SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
843 CHECK_READY_AND_dmHandle();
845 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].func);
846 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].func)
847 (StatementHandle, CatalogName, NameLength1,
848 SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
852 /*************************************************************************
853 * SQLConnect [ODBC32.007]
855 SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle,
856 SQLCHAR *ServerName, SQLSMALLINT NameLength1,
857 SQLCHAR *UserName, SQLSMALLINT NameLength2,
858 SQLCHAR *Authentication, SQLSMALLINT NameLength3)
861 TRACE("(Server=%.*s)\n",NameLength1, ServerName);
863 CHECK_READY_AND_dmHandle();
865 strcpy( (LPSTR)gProxyHandle.ServerName, (LPSTR)ServerName );
866 strcpy( (LPSTR)gProxyHandle.UserName, (LPSTR)UserName );
868 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].func);
869 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].func)
870 (ConnectionHandle, ServerName, NameLength1,
871 UserName, NameLength2, Authentication, NameLength3);
873 TRACE("returns %d\n",ret);
878 /*************************************************************************
879 * SQLCopyDesc [ODBC32.028]
881 SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
885 CHECK_READY_AND_dmHandle();
887 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOPYDESC].func);
888 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOPYDESC].func)
889 (SourceDescHandle, TargetDescHandle);
893 /*************************************************************************
894 * SQLDataSources [ODBC32.057]
896 SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle,
897 SQLUSMALLINT Direction, SQLCHAR *ServerName,
898 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
899 SQLCHAR *Description, SQLSMALLINT BufferLength2,
900 SQLSMALLINT *NameLength2)
904 TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle);
906 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
908 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
912 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].func);
913 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].func)
914 (EnvironmentHandle, Direction, ServerName,
915 BufferLength1, NameLength1, Description, BufferLength2, NameLength2);
919 TRACE("returns: %d \t", ret);
920 if (*NameLength1 > 0)
921 TRACE("DataSource = %s,", ServerName);
922 if (*NameLength2 > 0)
923 TRACE(" Description = %s", Description);
931 /*************************************************************************
932 * SQLDescribeCol [ODBC32.008]
934 SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle,
935 SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
936 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
937 SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize,
938 SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
942 CHECK_READY_AND_dmHandle();
944 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].func);
945 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].func)
946 (StatementHandle, ColumnNumber, ColumnName,
947 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
951 /*************************************************************************
952 * SQLDisconnect [ODBC32.009]
954 SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
957 TRACE("(Handle=%lx)\n", ConnectionHandle);
959 CHECK_READY_AND_dmHandle();
961 gProxyHandle.ServerName[0] = '\0';
962 gProxyHandle.UserName[0] = '\0';
964 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLDISCONNECT].func);
965 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDISCONNECT].func) (ConnectionHandle);
966 TRACE("returns %d\n",ret);
971 /*************************************************************************
972 * SQLEndTran [ODBC32.029]
974 SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
978 CHECK_READY_AND_dmHandle();
980 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLENDTRAN].func);
981 return (gProxyHandle.functions[SQLAPI_INDEX_SQLENDTRAN].func) (HandleType, Handle, CompletionType);
985 /*************************************************************************
986 * SQLError [ODBC32.010]
988 SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle,
989 SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
990 SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
991 SQLCHAR *MessageText, SQLSMALLINT BufferLength,
992 SQLSMALLINT *TextLength)
996 CHECK_READY_AND_dmHandle();
998 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].func);
999 return (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].func)
1000 (EnvironmentHandle, ConnectionHandle, StatementHandle,
1001 Sqlstate, NativeError, MessageText, BufferLength, TextLength);
1005 /*************************************************************************
1006 * SQLExecDirect [ODBC32.011]
1008 SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1012 CHECK_READY_AND_dmHandle();
1014 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].func);
1015 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].func)
1016 (StatementHandle, StatementText, TextLength);
1020 /*************************************************************************
1021 * SQLExecute [ODBC32.012]
1023 SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
1027 CHECK_READY_AND_dmHandle();
1029 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECUTE].func);
1030 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECUTE].func) (StatementHandle);
1034 /*************************************************************************
1035 * SQLFetch [ODBC32.013]
1037 SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
1041 CHECK_READY_AND_dmHandle();
1043 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCH].func);
1044 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCH].func) (StatementHandle);
1048 /*************************************************************************
1049 * SQLFetchScroll [ODBC32.030]
1051 SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset)
1057 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCHSCROLL].func);
1058 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCHSCROLL].func)
1059 (StatementHandle, FetchOrientation, FetchOffset);
1063 /*************************************************************************
1064 * SQLFreeConnect [ODBC32.014]
1066 SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
1069 TRACE("(Handle=%lx)\n",ConnectionHandle);
1073 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREECONNECT].func);
1074 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLFREECONNECT].func) (ConnectionHandle);
1075 TRACE("Returns %d\n",ret);
1080 /*************************************************************************
1081 * SQLFreeEnv [ODBC32.015]
1083 SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
1086 TRACE("(Env=%lx)\n",EnvironmentHandle);
1090 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEENV].func);
1091 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEENV].func) (EnvironmentHandle);
1092 TRACE("Returns %d\n",ret);
1097 /*************************************************************************
1098 * SQLFreeHandle [ODBC32.031]
1100 SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
1103 TRACE("(Type=%d, Handle=%lx)\n",HandleType,Handle);
1107 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEHANDLE].func);
1108 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEHANDLE].func)
1109 (HandleType, Handle);
1110 TRACE ("Returns %d\n",ret);
1115 /*************************************************************************
1116 * SQLFreeStmt [ODBC32.016]
1118 SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
1121 TRACE("(Handle %lx, Option=%d)\n",StatementHandle, Option);
1125 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREESTMT].func);
1126 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLFREESTMT].func)
1127 (StatementHandle, Option);
1128 TRACE("Returns %d\n",ret);
1133 /*************************************************************************
1134 * SQLGetConnectAttr [ODBC32.032]
1136 SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle,
1137 SQLINTEGER Attribute, SQLPOINTER Value,
1138 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1144 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].func);
1145 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].func)
1146 (ConnectionHandle, Attribute, Value,
1147 BufferLength, StringLength);
1151 /*************************************************************************
1152 * SQLGetConnectOption [ODBC32.042]
1154 SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1160 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].func);
1161 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].func)
1162 (ConnectionHandle, Option, Value);
1166 /*************************************************************************
1167 * SQLGetCursorName [ODBC32.017]
1169 SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle,
1170 SQLCHAR *CursorName, SQLSMALLINT BufferLength,
1171 SQLSMALLINT *NameLength)
1177 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].func);
1178 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].func)
1179 (StatementHandle, CursorName, BufferLength, NameLength);
1183 /*************************************************************************
1184 * SQLGetData [ODBC32.043]
1186 SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle,
1187 SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
1188 SQLPOINTER TargetValue, SQLINTEGER BufferLength,
1189 SQLINTEGER *StrLen_or_Ind)
1195 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDATA].func);
1196 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDATA].func)
1197 (StatementHandle, ColumnNumber, TargetType,
1198 TargetValue, BufferLength, StrLen_or_Ind);
1202 /*************************************************************************
1203 * SQLGetDescField [ODBC32.033]
1205 SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle,
1206 SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1207 SQLPOINTER Value, SQLINTEGER BufferLength,
1208 SQLINTEGER *StringLength)
1214 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].func);
1215 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].func)
1216 (DescriptorHandle, RecNumber, FieldIdentifier,
1217 Value, BufferLength, StringLength);
1221 /*************************************************************************
1222 * SQLGetDescRec [ODBC32.034]
1224 SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle,
1225 SQLSMALLINT RecNumber, SQLCHAR *Name,
1226 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
1227 SQLSMALLINT *Type, SQLSMALLINT *SubType,
1228 SQLINTEGER *Length, SQLSMALLINT *Precision,
1229 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
1235 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].func);
1236 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].func)
1237 (DescriptorHandle, RecNumber, Name, BufferLength,
1238 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
1242 /*************************************************************************
1243 * SQLGetDiagField [ODBC32.035]
1245 SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
1246 SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
1247 SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
1248 SQLSMALLINT *StringLength)
1254 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].func);
1255 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].func)
1256 (HandleType, Handle, RecNumber, DiagIdentifier,
1257 DiagInfo, BufferLength, StringLength);
1261 /*************************************************************************
1262 * SQLGetDiagRec [ODBC32.036]
1264 SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
1265 SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
1266 SQLINTEGER *NativeError, SQLCHAR *MessageText,
1267 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
1273 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].func);
1274 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].func)
1275 (HandleType, Handle, RecNumber, Sqlstate, NativeError,
1276 MessageText, BufferLength, TextLength);
1280 /*************************************************************************
1281 * SQLGetEnvAttr [ODBC32.037]
1283 SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle,
1284 SQLINTEGER Attribute, SQLPOINTER Value,
1285 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1291 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETENVATTR].func);
1292 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETENVATTR].func)
1293 (EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
1297 /*************************************************************************
1298 * SQLGetFunctions [ODBC32.044]
1300 SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
1306 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETFUNCTIONS].func);
1307 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETFUNCTIONS].func)
1308 (ConnectionHandle, FunctionId, Supported);
1312 /*************************************************************************
1313 * SQLGetInfo [ODBC32.045]
1315 SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle,
1316 SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
1317 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
1323 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].func);
1324 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].func)
1325 (ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
1329 /*************************************************************************
1330 * SQLGetStmtAttr [ODBC32.038]
1332 SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle,
1333 SQLINTEGER Attribute, SQLPOINTER Value,
1334 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1340 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].func);
1341 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].func)
1342 (StatementHandle, Attribute, Value, BufferLength, StringLength);
1346 /*************************************************************************
1347 * SQLGetStmtOption [ODBC32.046]
1349 SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1355 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTOPTION].func);
1356 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTOPTION].func)
1357 (StatementHandle, Option, Value);
1361 /*************************************************************************
1362 * SQLGetTypeInfo [ODBC32.047]
1364 SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1370 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].func);
1371 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].func)
1372 (StatementHandle, DataType);
1376 /*************************************************************************
1377 * SQLNumResultCols [ODBC32.018]
1379 SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1385 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMRESULTCOLS].func);
1386 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMRESULTCOLS].func)
1387 (StatementHandle, ColumnCount);
1391 /*************************************************************************
1392 * SQLParamData [ODBC32.048]
1394 SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1400 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMDATA].func);
1401 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMDATA].func)
1402 (StatementHandle, Value);
1406 /*************************************************************************
1407 * SQLPrepare [ODBC32.019]
1409 SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1415 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].func);
1416 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].func)
1417 (StatementHandle, StatementText, TextLength);
1421 /*************************************************************************
1422 * SQLPutData [ODBC32.049]
1424 SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLINTEGER StrLen_or_Ind)
1430 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPUTDATA].func);
1431 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPUTDATA].func)
1432 (StatementHandle, Data, StrLen_or_Ind);
1436 /*************************************************************************
1437 * SQLRowCount [ODBC32.020]
1439 SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLINTEGER *RowCount)
1445 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLROWCOUNT].func);
1446 return (gProxyHandle.functions[SQLAPI_INDEX_SQLROWCOUNT].func)
1447 (StatementHandle, RowCount);
1451 /*************************************************************************
1452 * SQLSetConnectAttr [ODBC32.039]
1454 SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute,
1455 SQLPOINTER Value, SQLINTEGER StringLength)
1461 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].func);
1462 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].func)
1463 (ConnectionHandle, Attribute, Value, StringLength);
1467 /*************************************************************************
1468 * SQLSetConnectOption [ODBC32.050]
1470 SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1476 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].func);
1477 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].func)
1478 (ConnectionHandle, Option, Value);
1482 /*************************************************************************
1483 * SQLSetCursorName [ODBC32.021]
1485 SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
1491 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].func);
1492 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].func)
1493 (StatementHandle, CursorName, NameLength);
1497 /*************************************************************************
1498 * SQLSetDescField [ODBC32.073]
1500 SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle,
1501 SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1502 SQLPOINTER Value, SQLINTEGER BufferLength)
1508 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].func);
1509 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].func)
1510 (DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
1514 /*************************************************************************
1515 * SQLSetDescRec [ODBC32.074]
1517 SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle,
1518 SQLSMALLINT RecNumber, SQLSMALLINT Type,
1519 SQLSMALLINT SubType, SQLINTEGER Length,
1520 SQLSMALLINT Precision, SQLSMALLINT Scale,
1521 SQLPOINTER Data, SQLINTEGER *StringLength,
1522 SQLINTEGER *Indicator)
1528 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCREC].func);
1529 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCREC].func)
1530 (DescriptorHandle, RecNumber, Type, SubType, Length,
1531 Precision, Scale, Data, StringLength, Indicator);
1535 /*************************************************************************
1536 * SQLSetEnvAttr [ODBC32.075]
1538 SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle,
1539 SQLINTEGER Attribute, SQLPOINTER Value,
1540 SQLINTEGER StringLength)
1546 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETENVATTR].func);
1547 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETENVATTR].func)
1548 (EnvironmentHandle, Attribute, Value, StringLength);
1552 /*************************************************************************
1553 * SQLSetParam [ODBC32.022]
1555 SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle,
1556 SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1557 SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
1558 SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
1559 SQLINTEGER *StrLen_or_Ind)
1565 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPARAM].func);
1566 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPARAM].func)
1567 (StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision,
1568 ParameterScale, ParameterValue, StrLen_or_Ind);
1572 /*************************************************************************
1573 * SQLSetStmtAttr [ODBC32.076]
1575 SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle,
1576 SQLINTEGER Attribute, SQLPOINTER Value,
1577 SQLINTEGER StringLength)
1583 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].func);
1584 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].func)
1585 (StatementHandle, Attribute, Value, StringLength);
1589 /*************************************************************************
1590 * SQLSetStmtOption [ODBC32.051]
1592 SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1598 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTOPTION].func);
1599 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTOPTION].func)
1600 (StatementHandle, Option, Value);
1604 /*************************************************************************
1605 * SQLSpecialColumns [ODBC32.052]
1607 SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle,
1608 SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
1609 SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
1610 SQLSMALLINT NameLength2, SQLCHAR *TableName,
1611 SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
1612 SQLUSMALLINT Nullable)
1617 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].func);
1618 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].func)
1619 (StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
1620 NameLength2, TableName, NameLength3, Scope, Nullable);
1624 /*************************************************************************
1625 * SQLStatistics [ODBC32.053]
1627 SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle,
1628 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1629 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1630 SQLCHAR *TableName, SQLSMALLINT NameLength3,
1631 SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
1637 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].func);
1638 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].func)
1639 (StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
1640 TableName, NameLength3, Unique, Reserved);
1644 /*************************************************************************
1645 * SQLTables [ODBC32.054]
1647 SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle,
1648 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1649 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1650 SQLCHAR *TableName, SQLSMALLINT NameLength3,
1651 SQLCHAR *TableType, SQLSMALLINT NameLength4)
1657 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].func);
1658 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].func)
1659 (StatementHandle, CatalogName, NameLength1,
1660 SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
1664 /*************************************************************************
1665 * SQLTransact [ODBC32.023]
1667 SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle,
1668 SQLUSMALLINT CompletionType)
1674 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTRANSACT].func);
1675 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTRANSACT].func)
1676 (EnvironmentHandle, ConnectionHandle, CompletionType);
1680 /*************************************************************************
1681 * SQLBrowseConnect [ODBC32.055]
1683 SQLRETURN WINAPI SQLBrowseConnect(
1685 SQLCHAR *szConnStrIn,
1686 SQLSMALLINT cbConnStrIn,
1687 SQLCHAR *szConnStrOut,
1688 SQLSMALLINT cbConnStrOutMax,
1689 SQLSMALLINT *pcbConnStrOut)
1695 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].func);
1696 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].func)
1697 (hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
1701 /*************************************************************************
1702 * SQLBulkOperations [ODBC32.078]
1704 SQLRETURN WINAPI SQLBulkOperations(
1705 SQLHSTMT StatementHandle,
1706 SQLSMALLINT Operation)
1712 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBULKOPERATIONS].func);
1713 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBULKOPERATIONS].func)
1714 (StatementHandle, Operation);
1718 /*************************************************************************
1719 * SQLColAttributes [ODBC32.006]
1721 SQLRETURN WINAPI SQLColAttributes(
1724 SQLUSMALLINT fDescType,
1726 SQLSMALLINT cbDescMax,
1727 SQLSMALLINT *pcbDesc,
1734 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].func);
1735 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].func)
1736 (hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1740 /*************************************************************************
1741 * SQLColumnPrivileges [ODBC32.056]
1743 SQLRETURN WINAPI SQLColumnPrivileges(
1745 SQLCHAR *szCatalogName,
1746 SQLSMALLINT cbCatalogName,
1747 SQLCHAR *szSchemaName,
1748 SQLSMALLINT cbSchemaName,
1749 SQLCHAR *szTableName,
1750 SQLSMALLINT cbTableName,
1751 SQLCHAR *szColumnName,
1752 SQLSMALLINT cbColumnName)
1758 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].func);
1759 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].func)
1760 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1761 szTableName, cbTableName, szColumnName, cbColumnName);
1765 /*************************************************************************
1766 * SQLDescribeParam [ODBC32.058]
1768 SQLRETURN WINAPI SQLDescribeParam(
1771 SQLSMALLINT *pfSqlType,
1772 SQLUINTEGER *pcbParamDef,
1773 SQLSMALLINT *pibScale,
1774 SQLSMALLINT *pfNullable)
1780 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBEPARAM].func);
1781 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBEPARAM].func)
1782 (hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable);
1786 /*************************************************************************
1787 * SQLExtendedFetch [ODBC32.059]
1789 SQLRETURN WINAPI SQLExtendedFetch(
1791 SQLUSMALLINT fFetchType,
1794 SQLUSMALLINT *rgfRowStatus)
1800 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLEXTENDEDFETCH].func);
1801 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXTENDEDFETCH].func)
1802 (hstmt, fFetchType, irow, pcrow, rgfRowStatus);
1806 /*************************************************************************
1807 * SQLForeignKeys [ODBC32.060]
1809 SQLRETURN WINAPI SQLForeignKeys(
1811 SQLCHAR *szPkCatalogName,
1812 SQLSMALLINT cbPkCatalogName,
1813 SQLCHAR *szPkSchemaName,
1814 SQLSMALLINT cbPkSchemaName,
1815 SQLCHAR *szPkTableName,
1816 SQLSMALLINT cbPkTableName,
1817 SQLCHAR *szFkCatalogName,
1818 SQLSMALLINT cbFkCatalogName,
1819 SQLCHAR *szFkSchemaName,
1820 SQLSMALLINT cbFkSchemaName,
1821 SQLCHAR *szFkTableName,
1822 SQLSMALLINT cbFkTableName)
1828 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].func);
1829 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].func)
1830 (hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName,
1831 szPkTableName, cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName,
1832 cbFkSchemaName, szFkTableName, cbFkTableName);
1836 /*************************************************************************
1837 * SQLMoreResults [ODBC32.061]
1839 SQLRETURN WINAPI SQLMoreResults(SQLHSTMT hstmt)
1845 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLMORERESULTS].func);
1846 return (gProxyHandle.functions[SQLAPI_INDEX_SQLMORERESULTS].func) (hstmt);
1850 /*************************************************************************
1851 * SQLNativeSql [ODBC32.062]
1853 SQLRETURN WINAPI SQLNativeSql(
1855 SQLCHAR *szSqlStrIn,
1856 SQLINTEGER cbSqlStrIn,
1858 SQLINTEGER cbSqlStrMax,
1859 SQLINTEGER *pcbSqlStr)
1865 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].func);
1866 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].func)
1867 (hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
1871 /*************************************************************************
1872 * SQLNumParams [ODBC32.063]
1874 SQLRETURN WINAPI SQLNumParams(
1882 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMPARAMS].func);
1883 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMPARAMS].func) (hstmt, pcpar);
1887 /*************************************************************************
1888 * SQLParamOptions [ODBC32.064]
1890 SQLRETURN WINAPI SQLParamOptions(
1899 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMOPTIONS].func);
1900 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMOPTIONS].func) (hstmt, crow, pirow);
1904 /*************************************************************************
1905 * SQLPrimaryKeys [ODBC32.065]
1907 SQLRETURN WINAPI SQLPrimaryKeys(
1909 SQLCHAR *szCatalogName,
1910 SQLSMALLINT cbCatalogName,
1911 SQLCHAR *szSchemaName,
1912 SQLSMALLINT cbSchemaName,
1913 SQLCHAR *szTableName,
1914 SQLSMALLINT cbTableName)
1920 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].func);
1921 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].func)
1922 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1923 szTableName, cbTableName);
1927 /*************************************************************************
1928 * SQLProcedureColumns [ODBC32.066]
1930 SQLRETURN WINAPI SQLProcedureColumns(
1932 SQLCHAR *szCatalogName,
1933 SQLSMALLINT cbCatalogName,
1934 SQLCHAR *szSchemaName,
1935 SQLSMALLINT cbSchemaName,
1936 SQLCHAR *szProcName,
1937 SQLSMALLINT cbProcName,
1938 SQLCHAR *szColumnName,
1939 SQLSMALLINT cbColumnName)
1945 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].func);
1946 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].func)
1947 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1948 szProcName, cbProcName, szColumnName, cbColumnName);
1952 /*************************************************************************
1953 * SQLProcedures [ODBC32.067]
1955 SQLRETURN WINAPI SQLProcedures(
1957 SQLCHAR *szCatalogName,
1958 SQLSMALLINT cbCatalogName,
1959 SQLCHAR *szSchemaName,
1960 SQLSMALLINT cbSchemaName,
1961 SQLCHAR *szProcName,
1962 SQLSMALLINT cbProcName)
1968 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].func);
1969 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].func)
1970 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1971 szProcName, cbProcName);
1975 /*************************************************************************
1976 * SQLSetPos [ODBC32.068]
1978 SQLRETURN WINAPI SQLSetPos(
1981 SQLUSMALLINT fOption,
1988 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPOS].func);
1989 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPOS].func)
1990 (hstmt, irow, fOption, fLock);
1994 /*************************************************************************
1995 * SQLTablePrivileges [ODBC32.070]
1997 SQLRETURN WINAPI SQLTablePrivileges(
1999 SQLCHAR *szCatalogName,
2000 SQLSMALLINT cbCatalogName,
2001 SQLCHAR *szSchemaName,
2002 SQLSMALLINT cbSchemaName,
2003 SQLCHAR *szTableName,
2004 SQLSMALLINT cbTableName)
2010 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].func);
2011 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].func)
2012 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
2013 szTableName, cbTableName);
2017 /*************************************************************************
2018 * SQLDrivers [ODBC32.071]
2020 SQLRETURN WINAPI SQLDrivers(
2022 SQLUSMALLINT fDirection,
2023 SQLCHAR *szDriverDesc,
2024 SQLSMALLINT cbDriverDescMax,
2025 SQLSMALLINT *pcbDriverDesc,
2026 SQLCHAR *szDriverAttributes,
2027 SQLSMALLINT cbDriverAttrMax,
2028 SQLSMALLINT *pcbDriverAttr)
2034 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].func);
2035 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].func)
2036 (henv, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
2037 szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2041 /*************************************************************************
2042 * SQLBindParameter [ODBC32.072]
2044 SQLRETURN WINAPI SQLBindParameter(
2047 SQLSMALLINT fParamType,
2049 SQLSMALLINT fSqlType,
2050 SQLUINTEGER cbColDef,
2051 SQLSMALLINT ibScale,
2052 SQLPOINTER rgbValue,
2053 SQLINTEGER cbValueMax,
2054 SQLINTEGER *pcbValue)
2060 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAMETER].func);
2061 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAMETER].func)
2062 (hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale,
2063 rgbValue, cbValueMax, pcbValue);
2067 /*************************************************************************
2068 * SQLDriverConnect [ODBC32.041]
2070 SQLRETURN WINAPI SQLDriverConnect(
2073 SQLCHAR *conn_str_in,
2074 SQLSMALLINT len_conn_str_in,
2075 SQLCHAR *conn_str_out,
2076 SQLSMALLINT conn_str_out_max,
2077 SQLSMALLINT *ptr_conn_str_out,
2078 SQLUSMALLINT driver_completion )
2084 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].func);
2085 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].func)
2086 (hdbc, hwnd, conn_str_in, len_conn_str_in, conn_str_out,
2087 conn_str_out_max, ptr_conn_str_out, driver_completion);
2091 /*************************************************************************
2092 * SQLSetScrollOptions [ODBC32.069]
2094 SQLRETURN WINAPI SQLSetScrollOptions(
2095 SQLHSTMT statement_handle,
2096 SQLUSMALLINT f_concurrency,
2097 SQLINTEGER crow_keyset,
2098 SQLUSMALLINT crow_rowset )
2104 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSCROLLOPTIONS].func);
2105 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSCROLLOPTIONS].func)
2106 (statement_handle, f_concurrency, crow_keyset, crow_rowset);
2109 static int SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType)
2111 static const SQLUSMALLINT attrList[] =
2113 SQL_COLUMN_OWNER_NAME,
2114 SQL_COLUMN_QUALIFIER_NAME,
2117 SQL_COLUMN_TABLE_NAME,
2118 SQL_COLUMN_TYPE_NAME,
2119 SQL_DESC_BASE_COLUMN_NAME,
2120 SQL_DESC_BASE_TABLE_NAME,
2121 SQL_DESC_CATALOG_NAME,
2123 SQL_DESC_LITERAL_PREFIX,
2124 SQL_DESC_LITERAL_SUFFIX,
2125 SQL_DESC_LOCAL_TYPE_NAME,
2127 SQL_DESC_SCHEMA_NAME,
2128 SQL_DESC_TABLE_NAME,
2133 for (i = 0; i < sizeof(attrList) / sizeof(SQLUSMALLINT); i++) {
2134 if (attrList[i] == fDescType) return 1;
2139 /*************************************************************************
2140 * SQLColAttributesW [ODBC32.106]
2142 SQLRETURN WINAPI SQLColAttributesW(
2145 SQLUSMALLINT fDescType,
2147 SQLSMALLINT cbDescMax,
2148 SQLSMALLINT *pcbDesc,
2153 TRACE("hstmt=0x%08lx icol=%d fDescType=%d rgbDesc=%p cbDescMax=%d pcbDesc=%p pfDesc=%p\n",
2154 hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2157 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].funcW);
2158 iResult = (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].funcW)
2159 (hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2160 if (iResult == SQL_SUCCESS && rgbDesc != NULL && SQLColAttributes_KnownStringAttribute(fDescType)) {
2162 TRACE("Dumping values fetched via SQLColAttributesW:\n");
2163 TRACE(" Attribute name : %s\n", debugstr_w(rgbDesc));
2164 TRACE(" Declared length: %d\n", *pcbDesc);
2166 if (*pcbDesc != strlenW(rgbDesc) * 2) {
2167 TRACE("CHEAT: resetting name length for ADO\n");
2168 *pcbDesc = strlenW(rgbDesc) * 2;
2174 /*************************************************************************
2175 * SQLConnectW [ODBC32.107]
2177 SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle,
2178 WCHAR *ServerName, SQLSMALLINT NameLength1,
2179 WCHAR *UserName, SQLSMALLINT NameLength2,
2180 WCHAR *Authentication, SQLSMALLINT NameLength3)
2183 TRACE("(Server=%.*s)\n",NameLength1+3, debugstr_w(ServerName));
2185 CHECK_READY_AND_dmHandle();
2187 WideCharToMultiByte(
2189 ServerName, NameLength1,
2190 gProxyHandle.ServerName, sizeof(gProxyHandle.ServerName),
2192 WideCharToMultiByte(
2194 UserName, NameLength2,
2195 gProxyHandle.UserName, sizeof(gProxyHandle.UserName),
2198 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].funcW);
2199 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].funcW)
2200 (ConnectionHandle, ServerName, NameLength1,
2201 UserName, NameLength2, Authentication, NameLength3);
2203 TRACE("returns %d\n",ret);
2207 /*************************************************************************
2208 * SQLDescribeColW [ODBC32.108]
2210 SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle,
2211 SQLUSMALLINT ColumnNumber, WCHAR *ColumnName,
2212 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
2213 SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize,
2214 SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
2219 CHECK_READY_AND_dmHandle();
2221 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].funcW);
2222 iResult = (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].funcW)
2223 (StatementHandle, ColumnNumber, ColumnName,
2224 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
2226 TRACE("Successfully recovered the following column information:\n");
2227 TRACE("\tRequested column index: %d\n", ColumnNumber);
2228 TRACE("\tAvailable length for column name: %d\n", BufferLength);
2229 if (NameLength != NULL)
2230 TRACE("\tActual length for column name: %d\n", *NameLength);
2231 else TRACE("\tActual length for column name: (null)\n");
2232 TRACE("\tReturned column name: %s\n", debugstr_w(ColumnName));
2237 /*************************************************************************
2238 * SQLErrorW [ODBC32.110]
2240 SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle,
2241 SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
2242 WCHAR *Sqlstate, SQLINTEGER *NativeError,
2243 WCHAR *MessageText, SQLSMALLINT BufferLength,
2244 SQLSMALLINT *TextLength)
2248 CHECK_READY_AND_dmHandle();
2250 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].funcW);
2251 return (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].funcW)
2252 (EnvironmentHandle, ConnectionHandle, StatementHandle,
2253 Sqlstate, NativeError, MessageText, BufferLength, TextLength);
2256 /*************************************************************************
2257 * SQLExecDirectW [ODBC32.111]
2259 SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle,
2260 WCHAR *StatementText, SQLINTEGER TextLength)
2264 CHECK_READY_AND_dmHandle();
2266 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].funcW);
2267 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].funcW)
2268 (StatementHandle, StatementText, TextLength);
2271 /*************************************************************************
2272 * SQLGetCursorNameW [ODBC32.117]
2274 SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle,
2275 WCHAR *CursorName, SQLSMALLINT BufferLength,
2276 SQLSMALLINT *NameLength)
2282 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].funcW);
2283 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].funcW)
2284 (StatementHandle, CursorName, BufferLength, NameLength);
2287 /*************************************************************************
2288 * SQLPrepareW [ODBC32.119]
2290 SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle,
2291 WCHAR *StatementText, SQLINTEGER TextLength)
2297 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].funcW);
2298 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].funcW)
2299 (StatementHandle, StatementText, TextLength);
2302 /*************************************************************************
2303 * SQLSetCursorNameW [ODBC32.121]
2305 SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength)
2311 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].funcW);
2312 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].funcW)
2313 (StatementHandle, CursorName, NameLength);
2316 /*************************************************************************
2317 * SQLColAttributeW [ODBC32.127]
2319 SQLRETURN WINAPI SQLColAttributeW (SQLHSTMT StatementHandle,
2320 SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
2321 SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
2322 SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute)
2326 TRACE("StatementHandle=0x%08lx ColumnNumber=%d FieldIdentifier=%d CharacterAttribute=%p BufferLength=%d StringLength=%p NumericAttribute=%p\n",
2327 StatementHandle, ColumnNumber, FieldIdentifier,
2328 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
2330 CHECK_READY_AND_dmHandle();
2332 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].funcW);
2333 iResult = (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].funcW)
2334 (StatementHandle, ColumnNumber, FieldIdentifier,
2335 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
2336 if (iResult == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier)) {
2338 TRACE("Dumping values fetched via SQLColAttributeW:\n");
2339 TRACE(" Attribute name : %s\n", debugstr_w(rgbDesc));
2340 TRACE(" Declared length: %d\n", *pcbDesc);
2342 if (*StringLength != strlenW(CharacterAttribute) * 2) {
2343 TRACE("CHEAT: resetting name length for ADO\n");
2344 *StringLength = strlenW(CharacterAttribute) * 2;
2350 /*************************************************************************
2351 * SQLGetConnectAttrW [ODBC32.132]
2353 SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle,
2354 SQLINTEGER Attribute, SQLPOINTER Value,
2355 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2361 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].funcW);
2362 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].funcW)
2363 (ConnectionHandle, Attribute, Value,
2364 BufferLength, StringLength);
2367 /*************************************************************************
2368 * SQLGetDescFieldW [ODBC32.133]
2370 SQLRETURN WINAPI SQLGetDescFieldW(SQLHDESC DescriptorHandle,
2371 SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2372 SQLPOINTER Value, SQLINTEGER BufferLength,
2373 SQLINTEGER *StringLength)
2379 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].funcW);
2380 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].funcW)
2381 (DescriptorHandle, RecNumber, FieldIdentifier,
2382 Value, BufferLength, StringLength);
2385 /*************************************************************************
2386 * SQLGetDescRecW [ODBC32.134]
2388 SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle,
2389 SQLSMALLINT RecNumber, WCHAR *Name,
2390 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
2391 SQLSMALLINT *Type, SQLSMALLINT *SubType,
2392 SQLINTEGER *Length, SQLSMALLINT *Precision,
2393 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
2399 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].funcW);
2400 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].funcW)
2401 (DescriptorHandle, RecNumber, Name, BufferLength,
2402 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
2405 /*************************************************************************
2406 * SQLGetDiagFieldW [ODBC32.135]
2408 SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle,
2409 SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
2410 SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
2411 SQLSMALLINT *StringLength)
2417 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].funcW);
2418 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].funcW)
2419 (HandleType, Handle, RecNumber, DiagIdentifier,
2420 DiagInfo, BufferLength, StringLength);
2423 /*************************************************************************
2424 * SQLGetDiagRecW [ODBC32.136]
2426 SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle,
2427 SQLSMALLINT RecNumber, WCHAR *Sqlstate,
2428 SQLINTEGER *NativeError, WCHAR *MessageText,
2429 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2435 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].funcW);
2436 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].funcW)
2437 (HandleType, Handle, RecNumber, Sqlstate, NativeError,
2438 MessageText, BufferLength, TextLength);
2441 /*************************************************************************
2442 * SQLGetStmtAttrW [ODBC32.138]
2444 SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle,
2445 SQLINTEGER Attribute, SQLPOINTER Value,
2446 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2450 TRACE("Attribute = (%02ld) Value = %p BufferLength = (%ld) StringLength = %p\n",
2451 Attribute, Value, BufferLength, StringLength);
2453 if (Value == NULL) {
2454 WARN("Unexpected NULL in Value return address\n");
2455 iResult = SQL_ERROR;
2457 } else if (StringLength == NULL) {
2458 WARN("Unexpected NULL in StringLength return address\n");
2459 iResult = SQL_ERROR;
2464 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].funcW);
2465 iResult = (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].funcW)
2466 (StatementHandle, Attribute, Value, BufferLength, StringLength);
2467 TRACE("returning %d...\n", iResult);
2472 /*************************************************************************
2473 * SQLSetConnectAttrW [ODBC32.139]
2475 SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute,
2476 SQLPOINTER Value, SQLINTEGER StringLength)
2482 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].funcW);
2483 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].funcW)
2484 (ConnectionHandle, Attribute, Value, StringLength);
2487 /*************************************************************************
2488 * SQLColumnsW [ODBC32.140]
2490 SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle,
2491 WCHAR *CatalogName, SQLSMALLINT NameLength1,
2492 WCHAR *SchemaName, SQLSMALLINT NameLength2,
2493 WCHAR *TableName, SQLSMALLINT NameLength3,
2494 WCHAR *ColumnName, SQLSMALLINT NameLength4)
2498 CHECK_READY_AND_dmHandle();
2500 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].funcW);
2501 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].funcW)
2502 (StatementHandle, CatalogName, NameLength1,
2503 SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
2506 /*************************************************************************
2507 * SQLDriverConnectW [ODBC32.141]
2509 SQLRETURN WINAPI SQLDriverConnectW(
2513 SQLSMALLINT len_conn_str_in,
2514 WCHAR *conn_str_out,
2515 SQLSMALLINT conn_str_out_max,
2516 SQLSMALLINT *ptr_conn_str_out,
2517 SQLUSMALLINT driver_completion )
2519 TRACE("ConnStrIn (%d bytes) --> %s\n", len_conn_str_in, debugstr_w(conn_str_in));
2523 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].funcW);
2524 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].funcW)
2525 (hdbc, hwnd, conn_str_in, len_conn_str_in, conn_str_out,
2526 conn_str_out_max, ptr_conn_str_out, driver_completion);
2529 /*************************************************************************
2530 * SQLGetConnectOptionW [ODBC32.142]
2532 SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
2538 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].funcW);
2539 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].funcW)
2540 (ConnectionHandle, Option, Value);
2543 /*************************************************************************
2544 * SQLGetInfoW [ODBC32.145]
2546 SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle,
2547 SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
2548 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
2552 TRACE("InfoType = (%02u), InfoValue = %p, BufferLength = %d bytes\n", InfoType, InfoValue, BufferLength);
2553 if (InfoValue == NULL) {
2554 WARN("Unexpected NULL in InfoValue address\n");
2555 iResult = SQL_ERROR;
2559 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].funcW);
2560 iResult = (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].funcW)
2561 (ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
2562 TRACE("returning %d...\n", iResult);
2567 /*************************************************************************
2568 * SQLGetTypeInfoW [ODBC32.147]
2570 SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
2576 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].funcW);
2577 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].funcW)
2578 (StatementHandle, DataType);
2581 /*************************************************************************
2582 * SQLSetConnectOptionW [ODBC32.150]
2584 SQLRETURN WINAPI SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
2590 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].funcW);
2591 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].funcW)
2592 (ConnectionHandle, Option, Value);
2595 /*************************************************************************
2596 * SQLSpecialColumnsW [ODBC32.152]
2598 SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle,
2599 SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
2600 SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
2601 SQLSMALLINT NameLength2, SQLCHAR *TableName,
2602 SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
2603 SQLUSMALLINT Nullable)
2608 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].funcW);
2609 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].funcW)
2610 (StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
2611 NameLength2, TableName, NameLength3, Scope, Nullable);
2614 /*************************************************************************
2615 * SQLStatisticsW [ODBC32.153]
2617 SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle,
2618 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
2619 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
2620 SQLCHAR *TableName, SQLSMALLINT NameLength3,
2621 SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
2627 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].funcW);
2628 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].funcW)
2629 (StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
2630 TableName, NameLength3, Unique, Reserved);
2633 /*************************************************************************
2634 * SQLTablesW [ODBC32.154]
2636 SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle,
2637 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
2638 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
2639 SQLCHAR *TableName, SQLSMALLINT NameLength3,
2640 SQLCHAR *TableType, SQLSMALLINT NameLength4)
2646 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].funcW);
2647 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].funcW)
2648 (StatementHandle, CatalogName, NameLength1,
2649 SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
2652 /*************************************************************************
2653 * SQLBrowseConnectW [ODBC32.155]
2655 SQLRETURN WINAPI SQLBrowseConnectW(
2657 SQLCHAR *szConnStrIn,
2658 SQLSMALLINT cbConnStrIn,
2659 SQLCHAR *szConnStrOut,
2660 SQLSMALLINT cbConnStrOutMax,
2661 SQLSMALLINT *pcbConnStrOut)
2667 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].funcW);
2668 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].funcW)
2669 (hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
2672 /*************************************************************************
2673 * SQLColumnPrivilegesW [ODBC32.156]
2675 SQLRETURN WINAPI SQLColumnPrivilegesW(
2677 SQLCHAR *szCatalogName,
2678 SQLSMALLINT cbCatalogName,
2679 SQLCHAR *szSchemaName,
2680 SQLSMALLINT cbSchemaName,
2681 SQLCHAR *szTableName,
2682 SQLSMALLINT cbTableName,
2683 SQLCHAR *szColumnName,
2684 SQLSMALLINT cbColumnName)
2690 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].funcW);
2691 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].funcW)
2692 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
2693 szTableName, cbTableName, szColumnName, cbColumnName);
2696 /*************************************************************************
2697 * SQLDataSourcesW [ODBC32.157]
2699 SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle,
2700 SQLUSMALLINT Direction, WCHAR *ServerName,
2701 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
2702 WCHAR *Description, SQLSMALLINT BufferLength2,
2703 SQLSMALLINT *NameLength2)
2707 TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle);
2709 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
2711 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
2715 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].funcW);
2716 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].funcW)
2717 (EnvironmentHandle, Direction, ServerName,
2718 BufferLength1, NameLength1, Description, BufferLength2, NameLength2);
2722 TRACE("returns: %d \t", ret);
2723 if (*NameLength1 > 0)
2724 TRACE("DataSource = %s,", debugstr_w(ServerName));
2725 if (*NameLength2 > 0)
2726 TRACE(" Description = %s", debugstr_w(Description));
2733 /*************************************************************************
2734 * SQLForeignKeysW [ODBC32.160]
2736 SQLRETURN WINAPI SQLForeignKeysW(
2738 SQLCHAR *szPkCatalogName,
2739 SQLSMALLINT cbPkCatalogName,
2740 SQLCHAR *szPkSchemaName,
2741 SQLSMALLINT cbPkSchemaName,
2742 SQLCHAR *szPkTableName,
2743 SQLSMALLINT cbPkTableName,
2744 SQLCHAR *szFkCatalogName,
2745 SQLSMALLINT cbFkCatalogName,
2746 SQLCHAR *szFkSchemaName,
2747 SQLSMALLINT cbFkSchemaName,
2748 SQLCHAR *szFkTableName,
2749 SQLSMALLINT cbFkTableName)
2755 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].funcW);
2756 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].funcW)
2757 (hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName,
2758 szPkTableName, cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName,
2759 cbFkSchemaName, szFkTableName, cbFkTableName);
2762 /*************************************************************************
2763 * SQLNativeSqlW [ODBC32.162]
2765 SQLRETURN WINAPI SQLNativeSqlW(
2767 SQLCHAR *szSqlStrIn,
2768 SQLINTEGER cbSqlStrIn,
2770 SQLINTEGER cbSqlStrMax,
2771 SQLINTEGER *pcbSqlStr)
2777 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].funcW);
2778 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].funcW)
2779 (hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2782 /*************************************************************************
2783 * SQLPrimaryKeysW [ODBC32.165]
2785 SQLRETURN WINAPI SQLPrimaryKeysW(
2787 SQLCHAR *szCatalogName,
2788 SQLSMALLINT cbCatalogName,
2789 SQLCHAR *szSchemaName,
2790 SQLSMALLINT cbSchemaName,
2791 SQLCHAR *szTableName,
2792 SQLSMALLINT cbTableName)
2798 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].funcW);
2799 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].funcW)
2800 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
2801 szTableName, cbTableName);
2804 /*************************************************************************
2805 * SQLProcedureColumnsW [ODBC32.166]
2807 SQLRETURN WINAPI SQLProcedureColumnsW(
2809 SQLCHAR *szCatalogName,
2810 SQLSMALLINT cbCatalogName,
2811 SQLCHAR *szSchemaName,
2812 SQLSMALLINT cbSchemaName,
2813 SQLCHAR *szProcName,
2814 SQLSMALLINT cbProcName,
2815 SQLCHAR *szColumnName,
2816 SQLSMALLINT cbColumnName)
2822 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].funcW);
2823 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].funcW)
2824 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
2825 szProcName, cbProcName, szColumnName, cbColumnName);
2828 /*************************************************************************
2829 * SQLProceduresW [ODBC32.167]
2831 SQLRETURN WINAPI SQLProceduresW(
2833 SQLCHAR *szCatalogName,
2834 SQLSMALLINT cbCatalogName,
2835 SQLCHAR *szSchemaName,
2836 SQLSMALLINT cbSchemaName,
2837 SQLCHAR *szProcName,
2838 SQLSMALLINT cbProcName)
2844 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].funcW);
2845 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].funcW)
2846 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
2847 szProcName, cbProcName);
2850 /*************************************************************************
2851 * SQLTablePrivilegesW [ODBC32.170]
2853 SQLRETURN WINAPI SQLTablePrivilegesW(
2855 SQLCHAR *szCatalogName,
2856 SQLSMALLINT cbCatalogName,
2857 SQLCHAR *szSchemaName,
2858 SQLSMALLINT cbSchemaName,
2859 SQLCHAR *szTableName,
2860 SQLSMALLINT cbTableName)
2866 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].funcW);
2867 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].funcW)
2868 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
2869 szTableName, cbTableName);
2872 /*************************************************************************
2873 * SQLDriversW [ODBC32.171]
2875 SQLRETURN WINAPI SQLDriversW(
2877 SQLUSMALLINT fDirection,
2878 SQLCHAR *szDriverDesc,
2879 SQLSMALLINT cbDriverDescMax,
2880 SQLSMALLINT *pcbDriverDesc,
2881 SQLCHAR *szDriverAttributes,
2882 SQLSMALLINT cbDriverAttrMax,
2883 SQLSMALLINT *pcbDriverAttr)
2889 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].funcW);
2890 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].funcW)
2891 (henv, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
2892 szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2895 /*************************************************************************
2896 * SQLSetDescFieldW [ODBC32.173]
2898 SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle,
2899 SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2900 SQLPOINTER Value, SQLINTEGER BufferLength)
2906 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].funcW);
2907 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].funcW)
2908 (DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
2911 /*************************************************************************
2912 * SQLSetStmtAttrW [ODBC32.176]
2914 SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle,
2915 SQLINTEGER Attribute, SQLPOINTER Value,
2916 SQLINTEGER StringLength)
2919 TRACE("Attribute = (%02ld) Value = %p StringLength = (%ld)\n",
2920 Attribute, Value, StringLength);
2924 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].funcW);
2925 iResult = (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].funcW)
2926 (StatementHandle, Attribute, Value, StringLength);
2927 if (iResult == SQL_ERROR && (Attribute == SQL_ROWSET_SIZE || Attribute == SQL_ATTR_ROW_ARRAY_SIZE)) {
2928 TRACE("CHEAT: returning SQL_SUCCESS to ADO...\n");
2929 iResult = SQL_SUCCESS;
2931 TRACE("returning %d...\n", iResult);