4 * Proxy ODBC driver manager. This manager delegates all ODBC calls to a real ODBC driver manager which is either:
5 * 1) its name is defined in the environment variable LIB_ODBC_DRIVER_MANAGER
6 * 2) if LIB_ODBC_DRIVER_MANAGER is not defined, a default library libodbc.so will be used.
8 * Copyright 1999 Xiang Li, Corel Corporation
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "wine/port.h"
34 #include "wine/debug.h"
35 #include "wine/library.h"
41 #include "proxyodbc.h"
43 static BOOL ODBC_LoadDriverManager(void);
44 static BOOL ODBC_LoadDMFunctions(void);
46 WINE_DEFAULT_DEBUG_CHANNEL(odbc);
48 static const DM_FUNC template_func[] =
50 /* 00 */ { SQL_API_SQLALLOCCONNECT, "SQLAllocConnect", SQLAllocConnect, NULL },
51 /* 01 */ { SQL_API_SQLALLOCENV, "SQLAllocEnv", SQLAllocEnv, NULL },
52 /* 02 */ { SQL_API_SQLALLOCHANDLE, "SQLAllocHandle", SQLAllocHandle, NULL },
53 /* 03 */ { SQL_API_SQLALLOCSTMT, "SQLAllocStmt", SQLAllocStmt, NULL },
54 /* 04 */ { SQL_API_SQLALLOCHANDLESTD, "SQLAllocHandleStd", SQLAllocHandleStd, NULL },
55 /* 05 */ { SQL_API_SQLBINDCOL, "SQLBindCol", SQLBindCol, NULL },
56 /* 06 */ { SQL_API_SQLBINDPARAM, "SQLBindParam", SQLBindParam, NULL },
57 /* 07 */ { SQL_API_SQLBINDPARAMETER, "SQLBindParameter", SQLBindParameter, NULL },
58 /* 08 */ { SQL_API_SQLBROWSECONNECT, "SQLBrowseConnect", SQLBrowseConnect, NULL },
59 /* 09 */ { SQL_API_SQLBULKOPERATIONS, "SQLBulkOperations", SQLBulkOperations, NULL },
60 /* 10 */ { SQL_API_SQLCANCEL, "SQLCancel", SQLCancel, NULL },
61 /* 11 */ { SQL_API_SQLCLOSECURSOR, "SQLCloseCursor", SQLCloseCursor, NULL },
62 /* 12 */ { SQL_API_SQLCOLATTRIBUTE, "SQLColAttribute", SQLColAttribute, NULL },
63 /* 13 */ { SQL_API_SQLCOLATTRIBUTES, "SQLColAttributes", SQLColAttributes, NULL },
64 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES, "SQLColumnPrivileges", SQLColumnPrivileges, NULL },
65 /* 15 */ { SQL_API_SQLCOLUMNS, "SQLColumns", SQLColumns, NULL },
66 /* 16 */ { SQL_API_SQLCONNECT, "SQLConnect", SQLConnect, NULL },
67 /* 17 */ { SQL_API_SQLCOPYDESC, "SQLCopyDesc", SQLCopyDesc, NULL },
68 /* 18 */ { SQL_API_SQLDATASOURCES, "SQLDataSources", SQLDataSources, NULL },
69 /* 19 */ { SQL_API_SQLDESCRIBECOL, "SQLDescribeCol", SQLDescribeCol, NULL },
70 /* 20 */ { SQL_API_SQLDESCRIBEPARAM, "SQLDescribeParam", SQLDescribeParam, NULL },
71 /* 21 */ { SQL_API_SQLDISCONNECT, "SQLDisconnect", SQLDisconnect, NULL },
72 /* 22 */ { SQL_API_SQLDRIVERCONNECT, "SQLDriverConnect", SQLDriverConnect, NULL },
73 /* 23 */ { SQL_API_SQLDRIVERS, "SQLDrivers", SQLDrivers, NULL },
74 /* 24 */ { SQL_API_SQLENDTRAN, "SQLEndTran", SQLEndTran, NULL },
75 /* 25 */ { SQL_API_SQLERROR, "SQLError", SQLError, NULL },
76 /* 26 */ { SQL_API_SQLEXECDIRECT, "SQLExecDirect", SQLExecDirect, NULL },
77 /* 27 */ { SQL_API_SQLEXECUTE, "SQLExecute", SQLExecute, NULL },
78 /* 28 */ { SQL_API_SQLEXTENDEDFETCH, "SQLExtendedFetch", SQLExtendedFetch, NULL },
79 /* 29 */ { SQL_API_SQLFETCH, "SQLFetch", SQLFetch, NULL },
80 /* 30 */ { SQL_API_SQLFETCHSCROLL, "SQLFetchScroll", SQLFetchScroll, NULL },
81 /* 31 */ { SQL_API_SQLFOREIGNKEYS, "SQLForeignKeys", SQLForeignKeys, NULL },
82 /* 32 */ { SQL_API_SQLFREEENV, "SQLFreeEnv", SQLFreeEnv, NULL },
83 /* 33 */ { SQL_API_SQLFREEHANDLE, "SQLFreeHandle", SQLFreeHandle, NULL },
84 /* 34 */ { SQL_API_SQLFREESTMT, "SQLFreeStmt", SQLFreeStmt, NULL },
85 /* 35 */ { SQL_API_SQLFREECONNECT, "SQLFreeConnect", SQLFreeConnect, NULL },
86 /* 36 */ { SQL_API_SQLGETCONNECTATTR, "SQLGetConnectAttr", SQLGetConnectAttr, NULL },
87 /* 37 */ { SQL_API_SQLGETCONNECTOPTION, "SQLGetConnectOption", SQLGetConnectOption, NULL },
88 /* 38 */ { SQL_API_SQLGETCURSORNAME, "SQLGetCursorName", SQLGetCursorName, NULL },
89 /* 39 */ { SQL_API_SQLGETDATA, "SQLGetData", SQLGetData, NULL },
90 /* 40 */ { SQL_API_SQLGETDESCFIELD, "SQLGetDescField", SQLGetDescField, NULL },
91 /* 41 */ { SQL_API_SQLGETDESCREC, "SQLGetDescRec", SQLGetDescRec, NULL },
92 /* 42 */ { SQL_API_SQLGETDIAGFIELD, "SQLGetDiagField", SQLGetDiagField, NULL },
93 /* 43 */ { SQL_API_SQLGETENVATTR, "SQLGetEnvAttr", SQLGetEnvAttr, NULL },
94 /* 44 */ { SQL_API_SQLGETFUNCTIONS, "SQLGetFunctions", SQLGetFunctions, NULL },
95 /* 45 */ { SQL_API_SQLGETINFO, "SQLGetInfo", SQLGetInfo, NULL },
96 /* 46 */ { SQL_API_SQLGETSTMTATTR, "SQLGetStmtAttr", SQLGetStmtAttr, NULL },
97 /* 47 */ { SQL_API_SQLGETSTMTOPTION, "SQLGetStmtOption", SQLGetStmtOption, NULL },
98 /* 48 */ { SQL_API_SQLGETTYPEINFO, "SQLGetTypeInfo", SQLGetTypeInfo, NULL },
99 /* 49 */ { SQL_API_SQLMORERESULTS, "SQLMoreResults", SQLMoreResults, NULL },
100 /* 50 */ { SQL_API_SQLNATIVESQL, "SQLNativeSql", SQLNativeSql, NULL },
101 /* 51 */ { SQL_API_SQLNUMPARAMS, "SQLNumParams", SQLNumParams, NULL },
102 /* 52 */ { SQL_API_SQLNUMRESULTCOLS, "SQLNumResultCols", SQLNumResultCols, NULL },
103 /* 53 */ { SQL_API_SQLPARAMDATA, "SQLParamData", SQLParamData, NULL },
104 /* 54 */ { SQL_API_SQLPARAMOPTIONS, "SQLParamOptions", SQLParamOptions, NULL },
105 /* 55 */ { SQL_API_SQLPREPARE, "SQLPrepare", SQLPrepare, NULL },
106 /* 56 */ { SQL_API_SQLPRIMARYKEYS, "SQLPrimaryKeys", SQLPrimaryKeys, NULL },
107 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS, "SQLProcedureColumns", SQLProcedureColumns, NULL },
108 /* 58 */ { SQL_API_SQLPROCEDURES, "SQLProcedures", SQLProcedures, NULL },
109 /* 59 */ { SQL_API_SQLPUTDATA, "SQLPutData", SQLPutData, NULL },
110 /* 60 */ { SQL_API_SQLROWCOUNT, "SQLRowCount", SQLRowCount, NULL },
111 /* 61 */ { SQL_API_SQLSETCONNECTATTR, "SQLSetConnectAttr", SQLSetConnectAttr, NULL },
112 /* 62 */ { SQL_API_SQLSETCONNECTOPTION, "SQLSetConnectOption", SQLSetConnectOption, NULL },
113 /* 63 */ { SQL_API_SQLSETCURSORNAME, "SQLSetCursorName", SQLSetCursorName, NULL },
114 /* 64 */ { SQL_API_SQLSETDESCFIELD, "SQLSetDescField", SQLSetDescField, NULL },
115 /* 65 */ { SQL_API_SQLSETDESCREC, "SQLSetDescRec", SQLSetDescRec, NULL },
116 /* 66 */ { SQL_API_SQLSETENVATTR, "SQLSetEnvAttr", SQLSetEnvAttr, NULL },
117 /* 67 */ { SQL_API_SQLSETPARAM, "SQLSetParam", SQLSetParam, NULL },
118 /* 68 */ { SQL_API_SQLSETPOS, "SQLSetPos", SQLSetPos, NULL },
119 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS, "SQLSetScrollOptions", SQLSetScrollOptions, NULL },
120 /* 70 */ { SQL_API_SQLSETSTMTATTR, "SQLSetStmtAttr", SQLSetStmtAttr, NULL },
121 /* 71 */ { SQL_API_SQLSETSTMTOPTION, "SQLSetStmtOption", SQLSetStmtOption, NULL },
122 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS, "SQLSpecialColumns", SQLSpecialColumns, NULL },
123 /* 73 */ { SQL_API_SQLSTATISTICS, "SQLStatistics", SQLStatistics, NULL },
124 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES, "SQLTablePrivileges", SQLTablePrivileges, NULL },
125 /* 75 */ { SQL_API_SQLTABLES, "SQLTables", SQLTables, NULL },
126 /* 76 */ { SQL_API_SQLTRANSACT, "SQLTransact", SQLTransact, NULL },
127 /* 77 */ { SQL_API_SQLGETDIAGREC, "SQLGetDiagRec", SQLGetDiagRec, NULL },
130 static PROXYHANDLE gProxyHandle;
132 /* What is the difference between these two (dmHandle cf READY_AND_dmHandle)? When does one use one and when the other? */
134 #define CHECK_dmHandle() \
136 if (gProxyHandle.dmHandle == NULL) \
138 TRACE ("Not ready\n"); \
143 #define CHECK_READY_AND_dmHandle() \
145 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) \
147 TRACE ("Not ready\n"); \
152 SQLRETURN SQLDummyFunc()
154 TRACE("SQLDummyFunc: \n");
158 /***********************************************************************
159 * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'.
162 * hinstDLL [I] handle to the DLL's instance
164 * lpvReserved [I] reserved, must be NULL
172 MAIN_OdbcInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
175 TRACE("Initializing or Finalizing proxy ODBC: %p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
177 if (fdwReason == DLL_PROCESS_ATTACH)
179 TRACE("Loading ODBC...\n");
180 if (ODBC_LoadDriverManager())
181 ODBC_LoadDMFunctions();
183 else if (fdwReason == DLL_PROCESS_DETACH)
185 TRACE("Unloading ODBC...\n");
186 if (gProxyHandle.bFunctionReady)
188 for ( i = 0; i < NUM_SQLFUNC; i ++ )
190 gProxyHandle.functions[i].func = SQLDummyFunc;
194 if (gProxyHandle.dmHandle)
196 wine_dlclose(gProxyHandle.dmHandle,NULL,0);
197 gProxyHandle.dmHandle = NULL;
205 /***********************************************************************
206 * ODBC_LoadDriverManager [Internal] Load ODBC library.
215 static BOOL ODBC_LoadDriverManager(void)
217 const char *s = getenv("LIB_ODBC_DRIVER_MANAGER");
222 gProxyHandle.bFunctionReady = FALSE;
223 gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND;
225 if (s!= NULL && strlen (s) >= sizeof(gProxyHandle.dmLibName))
227 ERR("Driver name too long (%s)\n",s);
230 if (s == NULL || strlen(s) == 0)
232 strcpy(gProxyHandle.dmLibName, s);
234 gProxyHandle.dmHandle = wine_dlopen(gProxyHandle.dmLibName, RTLD_LAZY, error, sizeof(error));
236 if (gProxyHandle.dmHandle == NULL) /* fail to load unixODBC driver manager */
238 WARN("failed to open library %s: %s\n", gProxyHandle.dmLibName, error);
239 gProxyHandle.dmLibName[0] = '\0';
240 gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND;
245 gProxyHandle.nErrorType = ERROR_FREE;
251 /***********************************************************************
252 * ODBC_LoadDMFunctions [Internal] Populate function table.
261 static BOOL ODBC_LoadDMFunctions(void)
266 if (gProxyHandle.dmHandle == NULL)
269 for ( i = 0; i < NUM_SQLFUNC; i ++ )
271 gProxyHandle.functions[i] = template_func[i];
272 gProxyHandle.functions[i].func = wine_dlsym(gProxyHandle.dmHandle,
273 gProxyHandle.functions[i].name, error, sizeof(error));
277 ERR("Failed to load function %s\n",gProxyHandle.functions[i].name);
278 gProxyHandle.functions[i].func = SQLDummyFunc;
282 gProxyHandle.bFunctionReady = TRUE;
288 /*************************************************************************
289 * SQLAllocConnect [ODBC32.001]
291 SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
294 TRACE("Env=%lx\n",EnvironmentHandle);
296 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
298 *ConnectionHandle = SQL_NULL_HDBC;
299 TRACE("Not ready\n");
303 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCCONNECT].func);
304 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCCONNECT].func)
305 (EnvironmentHandle, ConnectionHandle);
306 TRACE("Returns ret=%d, Handle %lx\n",ret, *ConnectionHandle);
311 /*************************************************************************
312 * SQLAllocEnv [ODBC32.002]
314 SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
319 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
321 *EnvironmentHandle = SQL_NULL_HENV;
322 TRACE("Not ready\n");
326 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCENV].func);
327 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCENV].func) (EnvironmentHandle);
328 TRACE("Returns ret=%d, Env=%lx\n",ret, *EnvironmentHandle);
333 /*************************************************************************
334 * SQLAllocHandle [ODBC32.024]
336 SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
339 TRACE("(Type=%d, Handle=%lx)\n",HandleType,InputHandle);
341 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
343 if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
344 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
346 if (HandleType == SQL_HANDLE_ENV)
347 *OutputHandle = SQL_NULL_HENV;
348 else if (HandleType == SQL_HANDLE_DBC)
349 *OutputHandle = SQL_NULL_HDBC;
350 else if (HandleType == SQL_HANDLE_STMT)
351 *OutputHandle = SQL_NULL_HSTMT;
352 else if (HandleType == SQL_HANDLE_DESC)
353 *OutputHandle = SQL_NULL_HDESC;
355 TRACE ("Not ready\n");
359 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLE].func);
360 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLE].func)
361 (HandleType, InputHandle, OutputHandle);
362 TRACE("Returns ret=%d, Handle=%lx\n",ret, *OutputHandle);
367 /*************************************************************************
368 * SQLAllocStmt [ODBC32.003]
370 SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
374 TRACE("(Connection=%lx)\n",ConnectionHandle);
376 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
378 *StatementHandle = SQL_NULL_HSTMT;
379 TRACE ("Not ready\n");
383 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCSTMT].func);
384 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCSTMT].func)
385 (ConnectionHandle, StatementHandle);
386 TRACE ("Returns ret=%d, Handle=%lx\n", ret, *StatementHandle);
391 /*************************************************************************
392 * SQLAllocHandleStd [ODBC32.077]
394 SQLRETURN WINAPI SQLAllocHandleStd( SQLSMALLINT HandleType,
395 SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
397 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
399 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
401 if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
402 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
404 if (HandleType == SQL_HANDLE_ENV)
405 *OutputHandle = SQL_NULL_HENV;
406 else if (HandleType == SQL_HANDLE_DBC)
407 *OutputHandle = SQL_NULL_HDBC;
408 else if (HandleType == SQL_HANDLE_STMT)
409 *OutputHandle = SQL_NULL_HSTMT;
410 else if (HandleType == SQL_HANDLE_DESC)
411 *OutputHandle = SQL_NULL_HDESC;
416 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLESTD].func);
417 return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLESTD].func)
418 (HandleType, InputHandle, OutputHandle);
422 /*************************************************************************
423 * SQLBindCol [ODBC32.004]
425 SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle,
426 SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
427 SQLPOINTER TargetValue, SQLINTEGER BufferLength,
428 SQLINTEGER *StrLen_or_Ind)
432 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
434 TRACE ("Not ready\n");
438 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDCOL].func);
439 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDCOL].func)
440 (StatementHandle, ColumnNumber, TargetType,
441 TargetValue, BufferLength, StrLen_or_Ind);
445 /*************************************************************************
446 * SQLBindParam [ODBC32.025]
448 SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle,
449 SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
450 SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
451 SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
452 SQLINTEGER *StrLen_or_Ind)
456 CHECK_READY_AND_dmHandle();
458 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAM].func);
459 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAM].func)
460 (StatementHandle, ParameterNumber, ValueType,
461 ParameterScale, ParameterValue, StrLen_or_Ind);
465 /*************************************************************************
466 * SQLCancel [ODBC32.005]
468 SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle)
472 CHECK_READY_AND_dmHandle();
474 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCANCEL].func);
475 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCANCEL].func) (StatementHandle);
479 /*************************************************************************
480 * SQLCloseCursor [ODBC32.026]
482 SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle)
485 TRACE("(Handle=%lx)\n",StatementHandle);
487 CHECK_READY_AND_dmHandle();
489 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLCLOSECURSOR].func);
490 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLCLOSECURSOR].func) (StatementHandle);
491 TRACE("returns %d\n",ret);
496 /*************************************************************************
497 * SQLColAttribute [ODBC32.027]
499 SQLRETURN WINAPI SQLColAttribute (SQLHSTMT StatementHandle,
500 SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
501 SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
502 SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute)
506 CHECK_READY_AND_dmHandle();
508 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].func);
509 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].func)
510 (StatementHandle, ColumnNumber, FieldIdentifier,
511 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
515 /*************************************************************************
516 * SQLColumns [ODBC32.040]
518 SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle,
519 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
520 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
521 SQLCHAR *TableName, SQLSMALLINT NameLength3,
522 SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
526 CHECK_READY_AND_dmHandle();
528 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].func);
529 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].func)
530 (StatementHandle, CatalogName, NameLength1,
531 SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
535 /*************************************************************************
536 * SQLConnect [ODBC32.007]
538 SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle,
539 SQLCHAR *ServerName, SQLSMALLINT NameLength1,
540 SQLCHAR *UserName, SQLSMALLINT NameLength2,
541 SQLCHAR *Authentication, SQLSMALLINT NameLength3)
544 TRACE("(Server=%.*s)\n",NameLength1, ServerName);
546 CHECK_READY_AND_dmHandle();
548 strcpy(gProxyHandle.ServerName, ServerName);
549 strcpy(gProxyHandle.UserName, UserName);
551 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].func);
552 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].func)
553 (ConnectionHandle, ServerName, NameLength1,
554 UserName, NameLength2, Authentication, NameLength3);
556 TRACE("returns %d\n",ret);
561 /*************************************************************************
562 * SQLCopyDesc [ODBC32.028]
564 SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
568 CHECK_READY_AND_dmHandle();
570 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOPYDESC].func);
571 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOPYDESC].func)
572 (SourceDescHandle, TargetDescHandle);
576 /*************************************************************************
577 * SQLDataSources [ODBC32.057]
579 SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle,
580 SQLUSMALLINT Direction, SQLCHAR *ServerName,
581 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
582 SQLCHAR *Description, SQLSMALLINT BufferLength2,
583 SQLSMALLINT *NameLength2)
587 TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle);
589 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
591 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
595 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].func);
596 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].func)
597 (EnvironmentHandle, Direction, ServerName,
598 BufferLength1, NameLength1, Description, BufferLength2, NameLength2);
602 TRACE("returns: %d \t", ret);
603 if (*NameLength1 > 0)
604 DPRINTF("DataSource = %s,", ServerName);
605 if (*NameLength2 > 0)
606 DPRINTF(" Description = %s", Description);
614 /*************************************************************************
615 * SQLDescribeCol [ODBC32.008]
617 SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle,
618 SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
619 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
620 SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize,
621 SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
625 CHECK_READY_AND_dmHandle();
627 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].func);
628 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].func)
629 (StatementHandle, ColumnNumber, ColumnName,
630 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
634 /*************************************************************************
635 * SQLDisconnect [ODBC32.009]
637 SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
640 TRACE("(Handle=%lx)\n", ConnectionHandle);
642 CHECK_READY_AND_dmHandle();
644 gProxyHandle.ServerName[0] = '\0';
645 gProxyHandle.UserName[0] = '\0';
647 assert(gProxyHandle.functions[SQLAPI_INDEX_SQLDISCONNECT].func);
648 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDISCONNECT].func) (ConnectionHandle);
649 TRACE("returns %d\n",ret);
654 /*************************************************************************
655 * SQLEndTran [ODBC32.029]
657 SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
661 CHECK_READY_AND_dmHandle();
663 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLENDTRAN].func);
664 return (gProxyHandle.functions[SQLAPI_INDEX_SQLENDTRAN].func) (HandleType, Handle, CompletionType);
668 /*************************************************************************
669 * SQLError [ODBC32.010]
671 SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle,
672 SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
673 SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
674 SQLCHAR *MessageText, SQLSMALLINT BufferLength,
675 SQLSMALLINT *TextLength)
679 CHECK_READY_AND_dmHandle();
681 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].func);
682 return (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].func)
683 (EnvironmentHandle, ConnectionHandle, StatementHandle,
684 Sqlstate, NativeError, MessageText, BufferLength, TextLength);
688 /*************************************************************************
689 * SQLExecDirect [ODBC32.011]
691 SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
695 CHECK_READY_AND_dmHandle();
697 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].func);
698 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].func)
699 (StatementHandle, StatementText, TextLength);
703 /*************************************************************************
704 * SQLExecute [ODBC32.012]
706 SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
710 CHECK_READY_AND_dmHandle();
712 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECUTE].func);
713 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECUTE].func) (StatementHandle);
717 /*************************************************************************
718 * SQLFetch [ODBC32.013]
720 SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
724 CHECK_READY_AND_dmHandle();
726 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCH].func);
727 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCH].func) (StatementHandle);
731 /*************************************************************************
732 * SQLFetchScroll [ODBC32.030]
734 SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset)
740 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCHSCROLL].func);
741 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCHSCROLL].func)
742 (StatementHandle, FetchOrientation, FetchOffset);
746 /*************************************************************************
747 * SQLFreeConnect [ODBC32.014]
749 SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
752 TRACE("(Handle=%lx)\n",ConnectionHandle);
756 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREECONNECT].func);
757 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLFREECONNECT].func) (ConnectionHandle);
758 TRACE("Returns %d\n",ret);
763 /*************************************************************************
764 * SQLFreeEnv [ODBC32.015]
766 SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
769 TRACE("(Env=%lx)\n",EnvironmentHandle);
773 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEENV].func);
774 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEENV].func) (EnvironmentHandle);
775 TRACE("Returns %d\n",ret);
780 /*************************************************************************
781 * SQLFreeHandle [ODBC32.031]
783 SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
786 TRACE("(Type=%d, Handle=%lx)\n",HandleType,Handle);
790 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEHANDLE].func);
791 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEHANDLE].func)
792 (HandleType, Handle);
793 TRACE ("Returns %d\n",ret);
798 /*************************************************************************
799 * SQLFreeStmt [ODBC32.016]
801 SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
804 TRACE("(Handle %lx, Option=%d)\n",StatementHandle, Option);
808 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFREESTMT].func);
809 ret=(gProxyHandle.functions[SQLAPI_INDEX_SQLFREESTMT].func)
810 (StatementHandle, Option);
811 TRACE("Returns %d\n",ret);
816 /*************************************************************************
817 * SQLGetConnectAttr [ODBC32.032]
819 SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle,
820 SQLINTEGER Attribute, SQLPOINTER Value,
821 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
827 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].func);
828 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].func)
829 (ConnectionHandle, Attribute, Value,
830 BufferLength, StringLength);
834 /*************************************************************************
835 * SQLGetConnectOption [ODBC32.042]
837 SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
843 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].func);
844 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].func)
845 (ConnectionHandle, Option, Value);
849 /*************************************************************************
850 * SQLGetCursorName [ODBC32.017]
852 SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle,
853 SQLCHAR *CursorName, SQLSMALLINT BufferLength,
854 SQLSMALLINT *NameLength)
860 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].func);
861 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].func)
862 (StatementHandle, CursorName, BufferLength, NameLength);
866 /*************************************************************************
867 * SQLGetData [ODBC32.043]
869 SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle,
870 SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
871 SQLPOINTER TargetValue, SQLINTEGER BufferLength,
872 SQLINTEGER *StrLen_or_Ind)
878 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDATA].func);
879 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDATA].func)
880 (StatementHandle, ColumnNumber, TargetType,
881 TargetValue, BufferLength, StrLen_or_Ind);
885 /*************************************************************************
886 * SQLGetDescField [ODBC32.033]
888 SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle,
889 SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
890 SQLPOINTER Value, SQLINTEGER BufferLength,
891 SQLINTEGER *StringLength)
897 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].func);
898 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].func)
899 (DescriptorHandle, RecNumber, FieldIdentifier,
900 Value, BufferLength, StringLength);
904 /*************************************************************************
905 * SQLGetDescRec [ODBC32.034]
907 SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle,
908 SQLSMALLINT RecNumber, SQLCHAR *Name,
909 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
910 SQLSMALLINT *Type, SQLSMALLINT *SubType,
911 SQLINTEGER *Length, SQLSMALLINT *Precision,
912 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
918 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].func);
919 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].func)
920 (DescriptorHandle, RecNumber, Name, BufferLength,
921 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
925 /*************************************************************************
926 * SQLGetDiagField [ODBC32.035]
928 SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
929 SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
930 SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
931 SQLSMALLINT *StringLength)
937 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].func);
938 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].func)
939 (HandleType, Handle, RecNumber, DiagIdentifier,
940 DiagInfo, BufferLength, StringLength);
944 /*************************************************************************
945 * SQLGetDiagRec [ODBC32.036]
947 SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
948 SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
949 SQLINTEGER *NativeError, SQLCHAR *MessageText,
950 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
956 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].func);
957 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].func)
958 (HandleType, Handle, RecNumber, Sqlstate, NativeError,
959 MessageText, BufferLength, TextLength);
963 /*************************************************************************
964 * SQLGetEnvAttr [ODBC32.037]
966 SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle,
967 SQLINTEGER Attribute, SQLPOINTER Value,
968 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
974 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETENVATTR].func);
975 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETENVATTR].func)
976 (EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
980 /*************************************************************************
981 * SQLGetFunctions [ODBC32.044]
983 SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
989 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETFUNCTIONS].func);
990 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETFUNCTIONS].func)
991 (ConnectionHandle, FunctionId, Supported);
995 /*************************************************************************
996 * SQLGetInfo [ODBC32.045]
998 SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle,
999 SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
1000 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
1006 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].func);
1007 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].func)
1008 (ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
1012 /*************************************************************************
1013 * SQLGetStmtAttr [ODBC32.038]
1015 SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle,
1016 SQLINTEGER Attribute, SQLPOINTER Value,
1017 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1023 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].func);
1024 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].func)
1025 (StatementHandle, Attribute, Value, BufferLength, StringLength);
1029 /*************************************************************************
1030 * SQLGetStmtOption [ODBC32.046]
1032 SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1038 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTOPTION].func);
1039 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTOPTION].func)
1040 (StatementHandle, Option, Value);
1044 /*************************************************************************
1045 * SQLGetTypeInfo [ODBC32.047]
1047 SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1053 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].func);
1054 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].func)
1055 (StatementHandle, DataType);
1059 /*************************************************************************
1060 * SQLNumResultCols [ODBC32.018]
1062 SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1068 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMRESULTCOLS].func);
1069 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMRESULTCOLS].func)
1070 (StatementHandle, ColumnCount);
1074 /*************************************************************************
1075 * SQLParamData [ODBC32.048]
1077 SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1083 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMDATA].func);
1084 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMDATA].func)
1085 (StatementHandle, Value);
1089 /*************************************************************************
1090 * SQLPrepare [ODBC32.019]
1092 SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1098 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].func);
1099 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].func)
1100 (StatementHandle, StatementText, TextLength);
1104 /*************************************************************************
1105 * SQLPutData [ODBC32.049]
1107 SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLINTEGER StrLen_or_Ind)
1113 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPUTDATA].func);
1114 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPUTDATA].func)
1115 (StatementHandle, Data, StrLen_or_Ind);
1119 /*************************************************************************
1120 * SQLRowCount [ODBC32.020]
1122 SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLINTEGER *RowCount)
1128 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLROWCOUNT].func);
1129 return (gProxyHandle.functions[SQLAPI_INDEX_SQLROWCOUNT].func)
1130 (StatementHandle, RowCount);
1134 /*************************************************************************
1135 * SQLSetConnectAttr [ODBC32.039]
1137 SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute,
1138 SQLPOINTER Value, SQLINTEGER StringLength)
1144 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].func);
1145 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].func)
1146 (ConnectionHandle, Attribute, Value, StringLength);
1150 /*************************************************************************
1151 * SQLSetConnectOption [ODBC32.050]
1153 SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1159 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].func);
1160 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].func)
1161 (ConnectionHandle, Option, Value);
1165 /*************************************************************************
1166 * SQLSetCursorName [ODBC32.021]
1168 SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
1174 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].func);
1175 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].func)
1176 (StatementHandle, CursorName, NameLength);
1180 /*************************************************************************
1181 * SQLSetDescField [ODBC32.073]
1183 SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle,
1184 SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1185 SQLPOINTER Value, SQLINTEGER BufferLength)
1191 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].func);
1192 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].func)
1193 (DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
1197 /*************************************************************************
1198 * SQLSetDescRec [ODBC32.074]
1200 SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle,
1201 SQLSMALLINT RecNumber, SQLSMALLINT Type,
1202 SQLSMALLINT SubType, SQLINTEGER Length,
1203 SQLSMALLINT Precision, SQLSMALLINT Scale,
1204 SQLPOINTER Data, SQLINTEGER *StringLength,
1205 SQLINTEGER *Indicator)
1211 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCREC].func);
1212 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCREC].func)
1213 (DescriptorHandle, RecNumber, Type, SubType, Length,
1214 Precision, Scale, Data, StringLength, Indicator);
1218 /*************************************************************************
1219 * SQLSetEnvAttr [ODBC32.075]
1221 SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle,
1222 SQLINTEGER Attribute, SQLPOINTER Value,
1223 SQLINTEGER StringLength)
1229 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETENVATTR].func);
1230 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETENVATTR].func)
1231 (EnvironmentHandle, Attribute, Value, StringLength);
1235 /*************************************************************************
1236 * SQLSetParam [ODBC32.022]
1238 SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle,
1239 SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1240 SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
1241 SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
1242 SQLINTEGER *StrLen_or_Ind)
1248 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPARAM].func);
1249 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPARAM].func)
1250 (StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision,
1251 ParameterScale, ParameterValue, StrLen_or_Ind);
1255 /*************************************************************************
1256 * SQLSetStmtAttr [ODBC32.076]
1258 SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle,
1259 SQLINTEGER Attribute, SQLPOINTER Value,
1260 SQLINTEGER StringLength)
1266 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].func);
1267 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].func)
1268 (StatementHandle, Attribute, Value, StringLength);
1272 /*************************************************************************
1273 * SQLSetStmtOption [ODBC32.051]
1275 SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1281 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTOPTION].func);
1282 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTOPTION].func)
1283 (StatementHandle, Option, Value);
1287 /*************************************************************************
1288 * SQLSpecialColumns [ODBC32.052]
1290 SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle,
1291 SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
1292 SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
1293 SQLSMALLINT NameLength2, SQLCHAR *TableName,
1294 SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
1295 SQLUSMALLINT Nullable)
1300 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].func);
1301 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].func)
1302 (StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
1303 NameLength2, TableName, NameLength3, Scope, Nullable);
1307 /*************************************************************************
1308 * SQLStatistics [ODBC32.053]
1310 SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle,
1311 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1312 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1313 SQLCHAR *TableName, SQLSMALLINT NameLength3,
1314 SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
1320 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].func);
1321 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].func)
1322 (StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
1323 TableName, NameLength3, Unique, Reserved);
1327 /*************************************************************************
1328 * SQLTables [ODBC32.054]
1330 SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle,
1331 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1332 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1333 SQLCHAR *TableName, SQLSMALLINT NameLength3,
1334 SQLCHAR *TableType, SQLSMALLINT NameLength4)
1340 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].func);
1341 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].func)
1342 (StatementHandle, CatalogName, NameLength1,
1343 SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
1347 /*************************************************************************
1348 * SQLTransact [ODBC32.023]
1350 SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle,
1351 SQLUSMALLINT CompletionType)
1357 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTRANSACT].func);
1358 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTRANSACT].func)
1359 (EnvironmentHandle, ConnectionHandle, CompletionType);
1363 /*************************************************************************
1364 * SQLBrowseConnect [ODBC32.055]
1366 SQLRETURN WINAPI SQLBrowseConnect(
1368 SQLCHAR *szConnStrIn,
1369 SQLSMALLINT cbConnStrIn,
1370 SQLCHAR *szConnStrOut,
1371 SQLSMALLINT cbConnStrOutMax,
1372 SQLSMALLINT *pcbConnStrOut)
1378 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].func);
1379 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].func)
1380 (hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
1384 /*************************************************************************
1385 * SQLBulkOperations [ODBC32.078]
1387 SQLRETURN WINAPI SQLBulkOperations(
1388 SQLHSTMT StatementHandle,
1389 SQLSMALLINT Operation)
1395 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBULKOPERATIONS].func);
1396 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBULKOPERATIONS].func)
1397 (StatementHandle, Operation);
1401 /*************************************************************************
1402 * SQLColAttributes [ODBC32.006]
1404 SQLRETURN WINAPI SQLColAttributes(
1407 SQLUSMALLINT fDescType,
1409 SQLSMALLINT cbDescMax,
1410 SQLSMALLINT *pcbDesc,
1417 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].func);
1418 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].func)
1419 (hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1423 /*************************************************************************
1424 * SQLColumnPrivileges [ODBC32.056]
1426 SQLRETURN WINAPI SQLColumnPrivileges(
1428 SQLCHAR *szCatalogName,
1429 SQLSMALLINT cbCatalogName,
1430 SQLCHAR *szSchemaName,
1431 SQLSMALLINT cbSchemaName,
1432 SQLCHAR *szTableName,
1433 SQLSMALLINT cbTableName,
1434 SQLCHAR *szColumnName,
1435 SQLSMALLINT cbColumnName)
1441 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].func);
1442 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].func)
1443 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1444 szTableName, cbTableName, szColumnName, cbColumnName);
1448 /*************************************************************************
1449 * SQLDescribeParam [ODBC32.058]
1451 SQLRETURN WINAPI SQLDescribeParam(
1454 SQLSMALLINT *pfSqlType,
1455 SQLUINTEGER *pcbParamDef,
1456 SQLSMALLINT *pibScale,
1457 SQLSMALLINT *pfNullable)
1463 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBEPARAM].func);
1464 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBEPARAM].func)
1465 (hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable);
1469 /*************************************************************************
1470 * SQLExtendedFetch [ODBC32.059]
1472 SQLRETURN WINAPI SQLExtendedFetch(
1474 SQLUSMALLINT fFetchType,
1477 SQLUSMALLINT *rgfRowStatus)
1483 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLEXTENDEDFETCH].func);
1484 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXTENDEDFETCH].func)
1485 (hstmt, fFetchType, irow, pcrow, rgfRowStatus);
1489 /*************************************************************************
1490 * SQLForeignKeys [ODBC32.060]
1492 SQLRETURN WINAPI SQLForeignKeys(
1494 SQLCHAR *szPkCatalogName,
1495 SQLSMALLINT cbPkCatalogName,
1496 SQLCHAR *szPkSchemaName,
1497 SQLSMALLINT cbPkSchemaName,
1498 SQLCHAR *szPkTableName,
1499 SQLSMALLINT cbPkTableName,
1500 SQLCHAR *szFkCatalogName,
1501 SQLSMALLINT cbFkCatalogName,
1502 SQLCHAR *szFkSchemaName,
1503 SQLSMALLINT cbFkSchemaName,
1504 SQLCHAR *szFkTableName,
1505 SQLSMALLINT cbFkTableName)
1511 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].func);
1512 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].func)
1513 (hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName,
1514 szPkTableName, cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName,
1515 cbFkSchemaName, szFkTableName, cbFkTableName);
1519 /*************************************************************************
1520 * SQLMoreResults [ODBC32.061]
1522 SQLRETURN WINAPI SQLMoreResults(SQLHSTMT hstmt)
1528 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLMORERESULTS].func);
1529 return (gProxyHandle.functions[SQLAPI_INDEX_SQLMORERESULTS].func) (hstmt);
1533 /*************************************************************************
1534 * SQLNativeSql [ODBC32.062]
1536 SQLRETURN WINAPI SQLNativeSql(
1538 SQLCHAR *szSqlStrIn,
1539 SQLINTEGER cbSqlStrIn,
1541 SQLINTEGER cbSqlStrMax,
1542 SQLINTEGER *pcbSqlStr)
1548 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].func);
1549 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].func)
1550 (hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
1554 /*************************************************************************
1555 * SQLNumParams [ODBC32.063]
1557 SQLRETURN WINAPI SQLNumParams(
1565 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMPARAMS].func);
1566 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMPARAMS].func) (hstmt, pcpar);
1570 /*************************************************************************
1571 * SQLParamOptions [ODBC32.064]
1573 SQLRETURN WINAPI SQLParamOptions(
1582 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMOPTIONS].func);
1583 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMOPTIONS].func) (hstmt, crow, pirow);
1587 /*************************************************************************
1588 * SQLPrimaryKeys [ODBC32.065]
1590 SQLRETURN WINAPI SQLPrimaryKeys(
1592 SQLCHAR *szCatalogName,
1593 SQLSMALLINT cbCatalogName,
1594 SQLCHAR *szSchemaName,
1595 SQLSMALLINT cbSchemaName,
1596 SQLCHAR *szTableName,
1597 SQLSMALLINT cbTableName)
1603 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].func);
1604 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].func)
1605 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1606 szTableName, cbTableName);
1610 /*************************************************************************
1611 * SQLProcedureColumns [ODBC32.066]
1613 SQLRETURN WINAPI SQLProcedureColumns(
1615 SQLCHAR *szCatalogName,
1616 SQLSMALLINT cbCatalogName,
1617 SQLCHAR *szSchemaName,
1618 SQLSMALLINT cbSchemaName,
1619 SQLCHAR *szProcName,
1620 SQLSMALLINT cbProcName,
1621 SQLCHAR *szColumnName,
1622 SQLSMALLINT cbColumnName)
1628 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].func);
1629 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].func)
1630 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1631 szProcName, cbProcName, szColumnName, cbColumnName);
1635 /*************************************************************************
1636 * SQLProcedures [ODBC32.067]
1638 SQLRETURN WINAPI SQLProcedures(
1640 SQLCHAR *szCatalogName,
1641 SQLSMALLINT cbCatalogName,
1642 SQLCHAR *szSchemaName,
1643 SQLSMALLINT cbSchemaName,
1644 SQLCHAR *szProcName,
1645 SQLSMALLINT cbProcName)
1651 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].func);
1652 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].func)
1653 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1654 szProcName, cbProcName);
1658 /*************************************************************************
1659 * SQLSetPos [ODBC32.068]
1661 SQLRETURN WINAPI SQLSetPos(
1664 SQLUSMALLINT fOption,
1671 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPOS].func);
1672 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPOS].func)
1673 (hstmt, irow, fOption, fLock);
1677 /*************************************************************************
1678 * SQLTablePrivileges [ODBC32.070]
1680 SQLRETURN WINAPI SQLTablePrivileges(
1682 SQLCHAR *szCatalogName,
1683 SQLSMALLINT cbCatalogName,
1684 SQLCHAR *szSchemaName,
1685 SQLSMALLINT cbSchemaName,
1686 SQLCHAR *szTableName,
1687 SQLSMALLINT cbTableName)
1693 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].func);
1694 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].func)
1695 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1696 szTableName, cbTableName);
1700 /*************************************************************************
1701 * SQLDrivers [ODBC32.071]
1703 SQLRETURN WINAPI SQLDrivers(
1705 SQLUSMALLINT fDirection,
1706 SQLCHAR *szDriverDesc,
1707 SQLSMALLINT cbDriverDescMax,
1708 SQLSMALLINT *pcbDriverDesc,
1709 SQLCHAR *szDriverAttributes,
1710 SQLSMALLINT cbDriverAttrMax,
1711 SQLSMALLINT *pcbDriverAttr)
1717 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].func);
1718 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].func)
1719 (henv, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
1720 szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
1724 /*************************************************************************
1725 * SQLBindParameter [ODBC32.072]
1727 SQLRETURN WINAPI SQLBindParameter(
1730 SQLSMALLINT fParamType,
1732 SQLSMALLINT fSqlType,
1733 SQLUINTEGER cbColDef,
1734 SQLSMALLINT ibScale,
1735 SQLPOINTER rgbValue,
1736 SQLINTEGER cbValueMax,
1737 SQLINTEGER *pcbValue)
1743 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAMETER].func);
1744 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAMETER].func)
1745 (hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale,
1746 rgbValue, cbValueMax, pcbValue);
1750 /*************************************************************************
1751 * SQLDriverConnect [ODBC32.041]
1753 SQLRETURN WINAPI SQLDriverConnect(
1756 SQLCHAR *conn_str_in,
1757 SQLSMALLINT len_conn_str_in,
1758 SQLCHAR *conn_str_out,
1759 SQLSMALLINT conn_str_out_max,
1760 SQLSMALLINT *ptr_conn_str_out,
1761 SQLUSMALLINT driver_completion )
1767 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].func);
1768 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].func)
1769 (hdbc, hwnd, conn_str_in, len_conn_str_in, conn_str_out,
1770 conn_str_out_max, ptr_conn_str_out, driver_completion);
1774 /*************************************************************************
1775 * SQLSetScrollOptions [ODBC32.069]
1777 SQLRETURN WINAPI SQLSetScrollOptions(
1778 SQLHSTMT statement_handle,
1779 SQLUSMALLINT f_concurrency,
1780 SQLINTEGER crow_keyset,
1781 SQLUSMALLINT crow_rowset )
1787 assert (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSCROLLOPTIONS].func);
1788 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSCROLLOPTIONS].func)
1789 (statement_handle, f_concurrency, crow_keyset, crow_rowset);