Added Unicode ctype support.
[wine.git] / dlls / odbc32 / proxyodbc.c
blobe522965d32f1abda73ce55594bc2f88c66192192
1 /*
2 * Win32 ODBC functions
3 *
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 * Xiang Li, Corel Corporation, Nov. 12, 1999
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <dlfcn.h>
15 #include <string.h>
17 #include "winbase.h"
18 #include "debugtools.h"
20 #ifndef _WINDOWS
21 #define _WINDOWS
22 #endif
24 typedef char* GUID; /* This definition is in sqltypes.h, but if _WINDOWS is defined, this is skipped. */
26 #include "sql.h"
27 #include "sqltypes.h"
28 #include "sqlext.h"
30 #include "proxyodbc.h"
32 DEFAULT_DEBUG_CHANNEL(odbc);
34 static DM_FUNC template_func[] =
36 /* 00 */ { SQL_API_SQLALLOCCONNECT, "SQLAllocConnect", SQLAllocConnect },
37 /* 01 */ { SQL_API_SQLALLOCENV, "SQLAllocEnv", SQLAllocEnv },
38 /* 02 */ { SQL_API_SQLALLOCHANDLE, "SQLAllocHandle", SQLAllocHandle },
39 /* 03 */ { SQL_API_SQLALLOCSTMT, "SQLAllocStmt", SQLAllocStmt },
40 /* 04 */ { SQL_API_SQLALLOCHANDLESTD, "SQLAllocHandleStd", SQLAllocHandleStd },
41 /* 05 */ { SQL_API_SQLBINDCOL, "SQLBindCol", SQLBindCol },
42 /* 06 */ { SQL_API_SQLBINDPARAM, "SQLBindParam", SQLBindParam },
43 /* 07 */ { SQL_API_SQLBINDPARAMETER, "SQLBindParameter", SQLBindParameter },
44 /* 08 */ { SQL_API_SQLBROWSECONNECT, "SQLBrowseConnect", SQLBrowseConnect },
45 /* 09 */ { SQL_API_SQLBULKOPERATIONS, "SQLBulkOperations", SQLBulkOperations },
46 /* 10 */ { SQL_API_SQLCANCEL, "SQLCancel", SQLCancel },
47 /* 11 */ { SQL_API_SQLCLOSECURSOR, "SQLCloseCursor", SQLCloseCursor },
48 /* 12 */ { SQL_API_SQLCOLATTRIBUTE, "SQLColAttribute", SQLColAttribute },
49 /* 13 */ { SQL_API_SQLCOLATTRIBUTES, "SQLColAttributes", SQLColAttributes },
50 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES, "SQLColumnPrivileges", SQLColumnPrivileges },
51 /* 15 */ { SQL_API_SQLCOLUMNS, "SQLColumns", SQLColumns },
52 /* 16 */ { SQL_API_SQLCONNECT, "SQLConnect", SQLConnect },
53 /* 17 */ { SQL_API_SQLCOPYDESC, "SQLCopyDesc", SQLCopyDesc },
54 /* 18 */ { SQL_API_SQLDATASOURCES, "SQLDataSources", SQLDataSources },
55 /* 19 */ { SQL_API_SQLDESCRIBECOL, "SQLDescribeCol", SQLDescribeCol },
56 /* 20 */ { SQL_API_SQLDESCRIBEPARAM, "SQLDescribeParam", SQLDescribeParam },
57 /* 21 */ { SQL_API_SQLDISCONNECT, "SQLDisconnect", SQLDisconnect },
58 /* 22 */ { SQL_API_SQLDRIVERCONNECT, "SQLDriverConnect", SQLDriverConnect },
59 /* 23 */ { SQL_API_SQLDRIVERS, "SQLDrivers", SQLDrivers },
60 /* 24 */ { SQL_API_SQLENDTRAN, "SQLEndTran", SQLEndTran },
61 /* 25 */ { SQL_API_SQLERROR, "SQLError", SQLError },
62 /* 26 */ { SQL_API_SQLEXECDIRECT, "SQLExecDirect", SQLExecDirect },
63 /* 27 */ { SQL_API_SQLEXECUTE, "SQLExecute", SQLExecute },
64 /* 28 */ { SQL_API_SQLEXTENDEDFETCH, "SQLExtendedFetch", SQLExtendedFetch },
65 /* 29 */ { SQL_API_SQLFETCH, "SQLFetch", SQLFetch },
66 /* 30 */ { SQL_API_SQLFETCHSCROLL, "SQLFetchScroll", SQLFetchScroll },
67 /* 31 */ { SQL_API_SQLFOREIGNKEYS, "SQLForeignKeys", SQLForeignKeys },
68 /* 32 */ { SQL_API_SQLFREEENV, "SQLFreeEnv", SQLFreeEnv },
69 /* 33 */ { SQL_API_SQLFREEHANDLE, "SQLFreeHandle", SQLFreeHandle },
70 /* 34 */ { SQL_API_SQLFREESTMT, "SQLFreeStmt", SQLFreeStmt },
71 /* 35 */ { SQL_API_SQLFREECONNECT, "SQLFreeConnect", SQLFreeConnect },
72 /* 36 */ { SQL_API_SQLGETCONNECTATTR, "SQLGetConnectAttr", SQLGetConnectAttr },
73 /* 37 */ { SQL_API_SQLGETCONNECTOPTION, "SQLGetConnectOption", SQLGetConnectOption },
74 /* 38 */ { SQL_API_SQLGETCURSORNAME, "SQLGetCursorName", SQLGetCursorName },
75 /* 39 */ { SQL_API_SQLGETDATA, "SQLGetData", SQLGetData },
76 /* 40 */ { SQL_API_SQLGETDESCFIELD, "SQLGetDescField", SQLGetDescField },
77 /* 41 */ { SQL_API_SQLGETDESCREC, "SQLGetDescRec", SQLGetDescRec },
78 /* 42 */ { SQL_API_SQLGETDIAGFIELD, "SQLGetDiagField", SQLGetDiagField },
79 /* 43 */ { SQL_API_SQLGETENVATTR, "SQLGetEnvAttr", SQLGetEnvAttr },
80 /* 44 */ { SQL_API_SQLGETFUNCTIONS, "SQLGetFunctions", SQLGetFunctions },
81 /* 45 */ { SQL_API_SQLGETINFO, "SQLGetInfo", SQLGetInfo },
82 /* 46 */ { SQL_API_SQLGETSTMTATTR, "SQLGetStmtAttr", SQLGetStmtAttr },
83 /* 47 */ { SQL_API_SQLGETSTMTOPTION, "SQLGetStmtOption", SQLGetStmtOption },
84 /* 48 */ { SQL_API_SQLGETTYPEINFO, "SQLGetTypeInfo", SQLGetTypeInfo },
85 /* 49 */ { SQL_API_SQLMORERESULTS, "SQLMoreResults", SQLMoreResults },
86 /* 50 */ { SQL_API_SQLNATIVESQL, "SQLNativeSql", SQLNativeSql },
87 /* 51 */ { SQL_API_SQLNUMPARAMS, "SQLNumParams", SQLNumParams },
88 /* 52 */ { SQL_API_SQLNUMRESULTCOLS, "SQLNumResultCols", SQLNumResultCols },
89 /* 53 */ { SQL_API_SQLPARAMDATA, "SQLParamData", SQLParamData },
90 /* 54 */ { SQL_API_SQLPARAMOPTIONS, "SQLParamOptions", SQLParamOptions },
91 /* 55 */ { SQL_API_SQLPREPARE, "SQLPrepare", SQLPrepare },
92 /* 56 */ { SQL_API_SQLPRIMARYKEYS, "SQLPrimaryKeys", SQLPrimaryKeys },
93 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS, "SQLProcedureColumns", SQLProcedureColumns },
94 /* 58 */ { SQL_API_SQLPROCEDURES, "SQLProcedures", SQLProcedures },
95 /* 59 */ { SQL_API_SQLPUTDATA, "SQLPutData", SQLPutData },
96 /* 60 */ { SQL_API_SQLROWCOUNT, "SQLRowCount", SQLRowCount },
97 /* 61 */ { SQL_API_SQLSETCONNECTATTR, "SQLSetConnectAttr", SQLSetConnectAttr },
98 /* 62 */ { SQL_API_SQLSETCONNECTOPTION, "SQLSetConnectOption", SQLSetConnectOption },
99 /* 63 */ { SQL_API_SQLSETCURSORNAME, "SQLSetCursorName", SQLSetCursorName },
100 /* 64 */ { SQL_API_SQLSETDESCFIELD, "SQLSetDescField", SQLSetDescField },
101 /* 65 */ { SQL_API_SQLSETDESCREC, "SQLSetDescRec", SQLSetDescRec },
102 /* 66 */ { SQL_API_SQLSETENVATTR, "SQLSetEnvAttr", SQLSetEnvAttr },
103 /* 67 */ { SQL_API_SQLSETPARAM, "SQLSetParam", SQLSetParam },
104 /* 68 */ { SQL_API_SQLSETPOS, "SQLSetPos", SQLSetPos },
105 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS, "SQLSetScrollOptions", SQLSetScrollOptions },
106 /* 70 */ { SQL_API_SQLSETSTMTATTR, "SQLSetStmtAttr", SQLSetStmtAttr },
107 /* 71 */ { SQL_API_SQLSETSTMTOPTION, "SQLSetStmtOption", SQLSetStmtOption },
108 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS, "SQLSpecialColumns", SQLSpecialColumns },
109 /* 73 */ { SQL_API_SQLSTATISTICS, "SQLStatistics", SQLStatistics },
110 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES, "SQLTablePrivileges", SQLTablePrivileges },
111 /* 75 */ { SQL_API_SQLTABLES, "SQLTables", SQLTables },
112 /* 76 */ { SQL_API_SQLTRANSACT, "SQLTransact", SQLTransact },
113 /* 77 */ { SQL_API_SQLGETDIAGREC, "SQLGetDiagRec", SQLGetDiagRec },
116 static PROXYHANDLE gProxyHandle = {NULL, FALSE, FALSE, FALSE, ERROR_LIBRARY_NOT_FOUND};
118 SQLRETURN SQLDummyFunc()
120 TRACE("SQLDummyFunc: \n");
121 return SQL_SUCCESS;
124 /***********************************************************************
125 * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'.
127 * PARAMS
128 * hinstDLL [I] handle to the DLL's instance
129 * fdwReason [I]
130 * lpvReserved [I] reserved, must be NULL
132 * RETURNS
133 * Success: TRUE
134 * Failure: FALSE
137 BOOL WINAPI
138 MAIN_OdbcInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
140 int i;
141 TRACE("Initializing proxy ODBC: %x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
143 if (fdwReason == DLL_PROCESS_ATTACH)
145 TRACE("Loading ODBC...\n");
146 if (ODBC_LoadDriverManager())
147 ODBC_LoadDMFunctions();
149 else if (fdwReason == DLL_PROCESS_DETACH)
151 TRACE("Unloading ODBC...\n");
152 if (gProxyHandle.bFunctionReady)
154 for ( i = 0; i < NUM_SQLFUNC; i ++ )
156 gProxyHandle.functions[i].func = SQLDummyFunc;
160 if (gProxyHandle.dmHandle)
162 dlclose(gProxyHandle.dmHandle);
163 gProxyHandle.dmHandle = NULL;
167 return TRUE;
171 /***********************************************************************
172 * ODBC_LoadDriverManager [Internal] Load ODBC library.
174 * PARAMS
176 * RETURNS
177 * Success: TRUE
178 * Failure: FALSE
181 BOOL ODBC_LoadDriverManager()
183 char *s = getenv("LIB_ODBC_DRIVER_MANAGER");
185 TRACE("\n");
187 gProxyHandle.bFunctionReady = FALSE;
189 if (s != NULL && strlen(s) > 0)
190 strcpy(gProxyHandle.dmLibName, s);
191 else
192 strcpy(gProxyHandle.dmLibName, "libodbc.so");
194 gProxyHandle.dmHandle = dlopen(gProxyHandle.dmLibName, RTLD_LAZY);
196 if (gProxyHandle.dmHandle == NULL) /* fail to load unixODBC driver manager */
198 WARN("failed to open library %s\n", gProxyHandle.dmLibName);
199 gProxyHandle.dmLibName[0] = '\0';
200 gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND;
201 return FALSE;
203 else
205 gProxyHandle.nErrorType = ERROR_FREE;
206 return TRUE;
211 /***********************************************************************
212 * ODBC_LoadDMFunctions [Internal] Populate function table.
214 * PARAMS
216 * RETURNS
217 * Success: TRUE
218 * Failure: FALSE
221 BOOL ODBC_LoadDMFunctions()
223 int i;
225 if (gProxyHandle.dmHandle == NULL)
226 return FALSE;
228 for ( i = 0; i < NUM_SQLFUNC; i ++ )
230 gProxyHandle.functions[i] = template_func[i];
231 gProxyHandle.functions[i].func = dlsym(gProxyHandle.dmHandle,
232 gProxyHandle.functions[i].name);
234 if (dlerror())
236 ERR("Failed to load function %s",gProxyHandle.functions[i].name);
237 gProxyHandle.functions[i].func = SQLDummyFunc;
241 gProxyHandle.bFunctionReady = TRUE;
243 return TRUE;
247 /*************************************************************************
248 * SQLAllocConnect [ODBC32.001]
250 SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
252 TRACE("\n");
254 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
256 *ConnectionHandle = SQL_NULL_HDBC;
257 return SQL_ERROR;
260 return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCCONNECT].func)
261 (EnvironmentHandle, ConnectionHandle);
265 /*************************************************************************
266 * SQLAllocEnv [ODBC32.002]
268 SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
270 TRACE("\n");
272 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
274 *EnvironmentHandle = SQL_NULL_HENV;
275 return SQL_ERROR;
278 return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCENV].func) (EnvironmentHandle);
282 /*************************************************************************
283 * SQLAllocHandle [ODBC32.024]
285 SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
287 TRACE(".\n");
289 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
291 if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
292 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
294 if (HandleType == SQL_HANDLE_ENV)
295 *OutputHandle = SQL_NULL_HENV;
296 else if (HandleType == SQL_HANDLE_DBC)
297 *OutputHandle = SQL_NULL_HDBC;
298 else if (HandleType == SQL_HANDLE_STMT)
299 *OutputHandle = SQL_NULL_HSTMT;
300 else if (HandleType == SQL_HANDLE_DESC)
301 *OutputHandle = SQL_NULL_HDESC;
303 return SQL_ERROR;
306 return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLE].func)
307 (HandleType, InputHandle, OutputHandle);
311 /*************************************************************************
312 * SQLAllocStmt [ODBC32.003]
314 SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
317 TRACE("\n");
319 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
321 *StatementHandle = SQL_NULL_HSTMT;
322 return SQL_ERROR;
325 return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCSTMT].func)
326 (ConnectionHandle, StatementHandle);
330 /*************************************************************************
331 * SQLAllocHandleStd [ODBC32.077]
333 SQLRETURN WINAPI SQLAllocHandleStd( SQLSMALLINT HandleType,
334 SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
336 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
338 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
340 if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
341 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
343 if (HandleType == SQL_HANDLE_ENV)
344 *OutputHandle = SQL_NULL_HENV;
345 else if (HandleType == SQL_HANDLE_DBC)
346 *OutputHandle = SQL_NULL_HDBC;
347 else if (HandleType == SQL_HANDLE_STMT)
348 *OutputHandle = SQL_NULL_HSTMT;
349 else if (HandleType == SQL_HANDLE_DESC)
350 *OutputHandle = SQL_NULL_HDESC;
352 return SQL_ERROR;
355 return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLESTD].func)
356 (HandleType, InputHandle, OutputHandle);
360 /*************************************************************************
361 * SQLBindCol [ODBC32.004]
363 SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle,
364 SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
365 SQLPOINTER TargetValue, SQLINTEGER BufferLength,
366 SQLINTEGER *StrLen_or_Ind)
368 TRACE("\n");
370 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
372 return SQL_ERROR;
375 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDCOL].func)
376 (StatementHandle, ColumnNumber, TargetType,
377 TargetValue, BufferLength, StrLen_or_Ind);
381 /*************************************************************************
382 * SQLBindParam [ODBC32.025]
384 SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle,
385 SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
386 SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
387 SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
388 SQLINTEGER *StrLen_or_Ind)
390 TRACE("\n");
392 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
394 return SQL_ERROR;
397 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAM].func)
398 (StatementHandle, ParameterNumber, ValueType,
399 ParameterScale, ParameterValue, StrLen_or_Ind);
403 /*************************************************************************
404 * SQLCancel [ODBC32.005]
406 SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle)
408 TRACE("\n");
410 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
412 return SQL_ERROR;
415 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCANCEL].func) (StatementHandle);
419 /*************************************************************************
420 * SQLCloseCursor [ODBC32.026]
422 SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle)
424 TRACE("\n");
426 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
428 return SQL_ERROR;
431 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCLOSECURSOR].func) (StatementHandle);
435 /*************************************************************************
436 * SQLColAttribute [ODBC32.027]
438 SQLRETURN WINAPI SQLColAttribute (SQLHSTMT StatementHandle,
439 SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
440 SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
441 SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute)
443 TRACE("\n");
445 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
447 return SQL_ERROR;
450 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].func)
451 (StatementHandle, ColumnNumber, FieldIdentifier,
452 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
456 /*************************************************************************
457 * SQLColumns [ODBC32.040]
459 SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle,
460 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
461 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
462 SQLCHAR *TableName, SQLSMALLINT NameLength3,
463 SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
465 TRACE("\n");
467 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
469 return SQL_ERROR;
472 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].func)
473 (StatementHandle, CatalogName, NameLength1,
474 SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
478 /*************************************************************************
479 * SQLConnect [ODBC32.007]
481 SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle,
482 SQLCHAR *ServerName, SQLSMALLINT NameLength1,
483 SQLCHAR *UserName, SQLSMALLINT NameLength2,
484 SQLCHAR *Authentication, SQLSMALLINT NameLength3)
486 TRACE("\n");
488 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
490 return SQL_ERROR;
493 strcpy(gProxyHandle.ServerName, ServerName);
494 strcpy(gProxyHandle.UserName, UserName);
496 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].func)
497 (ConnectionHandle, ServerName, NameLength1,
498 UserName, NameLength2, Authentication, NameLength3);
502 /*************************************************************************
503 * SQLCopyDesc [ODBC32.028]
505 SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
507 TRACE("\n");
509 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
511 return SQL_ERROR;
514 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOPYDESC].func)
515 (SourceDescHandle, TargetDescHandle);
519 /*************************************************************************
520 * SQLDataSources [ODBC32.057]
522 SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle,
523 SQLUSMALLINT Direction, SQLCHAR *ServerName,
524 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
525 SQLCHAR *Description, SQLSMALLINT BufferLength2,
526 SQLSMALLINT *NameLength2)
528 SQLRETURN ret;
530 TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle);
532 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
534 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
535 return SQL_ERROR;
538 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].func)
539 (EnvironmentHandle, Direction, ServerName,
540 BufferLength1, NameLength1, Description, BufferLength2, NameLength2);
542 if (TRACE_ON(odbc))
544 TRACE("returns: %d \t", ret);
545 if (*NameLength1 > 0)
546 TRACE("DataSource = %s,", ServerName);
547 if (*NameLength2 > 0)
548 TRACE(" Description = %s\n", Description);
551 return ret;
555 /*************************************************************************
556 * SQLDescribeCol [ODBC32.008]
558 SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle,
559 SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
560 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
561 SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize,
562 SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
564 TRACE("\n");
566 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
568 return SQL_ERROR;
571 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].func)
572 (StatementHandle, ColumnNumber, ColumnName,
573 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
577 /*************************************************************************
578 * SQLDisconnect [ODBC32.009]
580 SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
582 TRACE("\n");
584 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
586 return SQL_ERROR;
589 gProxyHandle.ServerName[0] = '\0';
590 gProxyHandle.UserName[0] = '\0';
592 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDISCONNECT].func) (ConnectionHandle);
596 /*************************************************************************
597 * SQLEndTran [ODBC32.029]
599 SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
601 TRACE("\n");
603 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
605 return SQL_ERROR;
608 return (gProxyHandle.functions[SQLAPI_INDEX_SQLENDTRAN].func) (HandleType, Handle, CompletionType);
612 /*************************************************************************
613 * SQLError [ODBC32.010]
615 SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle,
616 SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
617 SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
618 SQLCHAR *MessageText, SQLSMALLINT BufferLength,
619 SQLSMALLINT *TextLength)
621 TRACE("\n");
623 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
625 return SQL_ERROR;
628 return (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].func)
629 (EnvironmentHandle, ConnectionHandle, StatementHandle,
630 Sqlstate, NativeError, MessageText, BufferLength, TextLength);
634 /*************************************************************************
635 * SQLExecDirect [ODBC32.011]
637 SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
639 TRACE("\n");
641 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
643 return SQL_ERROR;
646 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].func)
647 (StatementHandle, StatementText, TextLength);
651 /*************************************************************************
652 * SQLExecute [ODBC32.012]
654 SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
656 TRACE("\n");
658 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
660 return SQL_ERROR;
663 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECUTE].func) (StatementHandle);
667 /*************************************************************************
668 * SQLFetch [ODBC32.013]
670 SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
672 TRACE("\n");
674 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
676 return SQL_ERROR;
679 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCH].func) (StatementHandle);
683 /*************************************************************************
684 * SQLFetchScroll [ODBC32.030]
686 SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset)
688 TRACE("\n");
690 if (gProxyHandle.dmHandle == NULL)
692 return SQL_ERROR;
695 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCHSCROLL].func)
696 (StatementHandle, FetchOrientation, FetchOffset);
700 /*************************************************************************
701 * SQLFreeConnect [ODBC32.014]
703 SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
705 TRACE("\n");
707 if (gProxyHandle.dmHandle == NULL)
709 return SQL_ERROR;
712 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFREECONNECT].func) (ConnectionHandle);
716 /*************************************************************************
717 * SQLFreeEnv [ODBC32.015]
719 SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
721 SQLRETURN ret;
723 TRACE("\n");
725 if (gProxyHandle.dmHandle == NULL)
727 return SQL_ERROR;
730 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEENV].func) (EnvironmentHandle);
732 if (gProxyHandle.dmHandle)
734 dlclose(gProxyHandle.dmHandle);
735 gProxyHandle.dmHandle = NULL;
739 return ret;
743 /*************************************************************************
744 * SQLFreeHandle [ODBC32.031]
746 SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
748 SQLRETURN ret;
750 TRACE("\n");
752 if (gProxyHandle.dmHandle == NULL)
754 return SQL_ERROR;
757 ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEHANDLE].func)
758 (HandleType, Handle);
760 if (HandleType == SQL_HANDLE_ENV) /* it is time to close the loaded library */
762 if (gProxyHandle.dmHandle)
764 dlclose(gProxyHandle.dmHandle);
765 gProxyHandle.dmHandle = NULL;
769 return ret;
773 /*************************************************************************
774 * SQLFreeStmt [ODBC32.016]
776 SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
779 TRACE("\n");
781 if (gProxyHandle.dmHandle == NULL)
783 return SQL_ERROR;
786 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFREESTMT].func)
787 (StatementHandle, Option);
791 /*************************************************************************
792 * SQLGetConnectAttr [ODBC32.032]
794 SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle,
795 SQLINTEGER Attribute, SQLPOINTER Value,
796 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
798 TRACE("\n");
800 if (gProxyHandle.dmHandle == NULL)
802 return SQL_ERROR;
805 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].func)
806 (ConnectionHandle, Attribute, Value,
807 BufferLength, StringLength);
811 /*************************************************************************
812 * SQLGetConnectOption [ODBC32.042]
814 SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
816 TRACE("\n");
818 if (gProxyHandle.dmHandle == NULL)
820 return SQL_ERROR;
823 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].func)
824 (ConnectionHandle, Option, Value);
828 /*************************************************************************
829 * SQLGetCursorName [ODBC32.017]
831 SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle,
832 SQLCHAR *CursorName, SQLSMALLINT BufferLength,
833 SQLSMALLINT *NameLength)
835 TRACE("\n");
837 if (gProxyHandle.dmHandle == NULL)
839 return SQL_ERROR;
842 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].func)
843 (StatementHandle, CursorName, BufferLength, NameLength);
847 /*************************************************************************
848 * SQLGetData [ODBC32.043]
850 SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle,
851 SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
852 SQLPOINTER TargetValue, SQLINTEGER BufferLength,
853 SQLINTEGER *StrLen_or_Ind)
855 TRACE("\n");
856 if (gProxyHandle.dmHandle == NULL)
858 return SQL_ERROR;
861 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDATA].func)
862 (StatementHandle, ColumnNumber, TargetType,
863 TargetValue, BufferLength, StrLen_or_Ind);
867 /*************************************************************************
868 * SQLGetDescField [ODBC32.033]
870 SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle,
871 SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
872 SQLPOINTER Value, SQLINTEGER BufferLength,
873 SQLINTEGER *StringLength)
875 TRACE("\n");
876 if (gProxyHandle.dmHandle == NULL)
878 return SQL_ERROR;
881 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].func)
882 (DescriptorHandle, RecNumber, FieldIdentifier,
883 Value, BufferLength, StringLength);
887 /*************************************************************************
888 * SQLGetDescRec [ODBC32.034]
890 SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle,
891 SQLSMALLINT RecNumber, SQLCHAR *Name,
892 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
893 SQLSMALLINT *Type, SQLSMALLINT *SubType,
894 SQLINTEGER *Length, SQLSMALLINT *Precision,
895 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
897 TRACE("\n");
898 if (gProxyHandle.dmHandle == NULL)
900 return SQL_ERROR;
903 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].func)
904 (DescriptorHandle, RecNumber, Name, BufferLength,
905 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
909 /*************************************************************************
910 * SQLGetDiagField [ODBC32.035]
912 SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
913 SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
914 SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
915 SQLSMALLINT *StringLength)
917 TRACE("\n");
918 if (gProxyHandle.dmHandle == NULL)
920 return SQL_ERROR;
923 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].func)
924 (HandleType, Handle, RecNumber, DiagIdentifier,
925 DiagInfo, BufferLength, StringLength);
929 /*************************************************************************
930 * SQLGetDiagRec [ODBC32.036]
932 SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
933 SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
934 SQLINTEGER *NativeError, SQLCHAR *MessageText,
935 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
937 TRACE("\n");
938 if (gProxyHandle.dmHandle == NULL)
940 return SQL_ERROR;
943 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].func)
944 (HandleType, Handle, RecNumber, Sqlstate, NativeError,
945 MessageText, BufferLength, TextLength);
949 /*************************************************************************
950 * SQLGetEnvAttr [ODBC32.037]
952 SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle,
953 SQLINTEGER Attribute, SQLPOINTER Value,
954 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
956 TRACE("\n");
957 if (gProxyHandle.dmHandle == NULL)
959 return SQL_ERROR;
962 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETENVATTR].func)
963 (EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
967 /*************************************************************************
968 * SQLGetFunctions [ODBC32.044]
970 SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
972 TRACE("\n");
973 if (gProxyHandle.dmHandle == NULL)
975 return SQL_ERROR;
978 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETFUNCTIONS].func)
979 (ConnectionHandle, FunctionId, Supported);
983 /*************************************************************************
984 * SQLGetInfo [ODBC32.045]
986 SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle,
987 SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
988 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
990 TRACE("\n");
991 if (gProxyHandle.dmHandle == NULL)
993 return SQL_ERROR;
996 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].func)
997 (ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
1001 /*************************************************************************
1002 * SQLGetStmtAttr [ODBC32.038]
1004 SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle,
1005 SQLINTEGER Attribute, SQLPOINTER Value,
1006 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1008 TRACE("\n");
1009 if (gProxyHandle.dmHandle == NULL)
1011 return SQL_ERROR;
1014 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].func)
1015 (StatementHandle, Attribute, Value, BufferLength, StringLength);
1019 /*************************************************************************
1020 * SQLGetStmtOption [ODBC32.046]
1022 SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1024 TRACE("\n");
1025 if (gProxyHandle.dmHandle == NULL)
1027 return SQL_ERROR;
1030 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTOPTION].func)
1031 (StatementHandle, Option, Value);
1035 /*************************************************************************
1036 * SQLGetTypeInfo [ODBC32.047]
1038 SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1040 TRACE("\n");
1041 if (gProxyHandle.dmHandle == NULL)
1043 return SQL_ERROR;
1046 return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].func)
1047 (StatementHandle, DataType);
1051 /*************************************************************************
1052 * SQLNumResultCols [ODBC32.018]
1054 SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1056 TRACE("\n");
1057 if (gProxyHandle.dmHandle == NULL)
1059 return SQL_ERROR;
1062 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMRESULTCOLS].func)
1063 (StatementHandle, ColumnCount);
1067 /*************************************************************************
1068 * SQLParamData [ODBC32.048]
1070 SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1072 TRACE("\n");
1073 if (gProxyHandle.dmHandle == NULL)
1075 return SQL_ERROR;
1078 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMDATA].func)
1079 (StatementHandle, Value);
1083 /*************************************************************************
1084 * SQLPrepare [ODBC32.019]
1086 SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1088 TRACE("\n");
1089 if (gProxyHandle.dmHandle == NULL)
1091 return SQL_ERROR;
1094 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].func)
1095 (StatementHandle, StatementText, TextLength);
1099 /*************************************************************************
1100 * SQLPutData [ODBC32.049]
1102 SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLINTEGER StrLen_or_Ind)
1104 TRACE("\n");
1105 if (gProxyHandle.dmHandle == NULL)
1107 return SQL_ERROR;
1110 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPUTDATA].func)
1111 (StatementHandle, Data, StrLen_or_Ind);
1115 /*************************************************************************
1116 * SQLRowCount [ODBC32.020]
1118 SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLINTEGER *RowCount)
1120 TRACE("\n");
1121 if (gProxyHandle.dmHandle == NULL)
1123 return SQL_ERROR;
1126 return (gProxyHandle.functions[SQLAPI_INDEX_SQLROWCOUNT].func)
1127 (StatementHandle, RowCount);
1131 /*************************************************************************
1132 * SQLSetConnectAttr [ODBC32.039]
1134 SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute,
1135 SQLPOINTER Value, SQLINTEGER StringLength)
1137 TRACE("\n");
1138 if (gProxyHandle.dmHandle == NULL)
1140 return SQL_ERROR;
1143 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].func)
1144 (ConnectionHandle, Attribute, Value, StringLength);
1148 /*************************************************************************
1149 * SQLSetConnectOption [ODBC32.050]
1151 SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1153 TRACE("\n");
1154 if (gProxyHandle.dmHandle == NULL)
1156 return SQL_ERROR;
1159 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].func)
1160 (ConnectionHandle, Option, Value);
1164 /*************************************************************************
1165 * SQLSetCursorName [ODBC32.021]
1167 SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
1169 TRACE("\n");
1170 if (gProxyHandle.dmHandle == NULL)
1172 return SQL_ERROR;
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)
1187 TRACE("\n");
1188 if (gProxyHandle.dmHandle == NULL)
1190 return SQL_ERROR;
1193 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].func)
1194 (DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
1198 /*************************************************************************
1199 * SQLSetDescRec [ODBC32.074]
1201 SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle,
1202 SQLSMALLINT RecNumber, SQLSMALLINT Type,
1203 SQLSMALLINT SubType, SQLINTEGER Length,
1204 SQLSMALLINT Precision, SQLSMALLINT Scale,
1205 SQLPOINTER Data, SQLINTEGER *StringLength,
1206 SQLINTEGER *Indicator)
1208 TRACE("\n");
1209 if (gProxyHandle.dmHandle == NULL)
1211 return SQL_ERROR;
1214 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCREC].func)
1215 (DescriptorHandle, RecNumber, Type, SubType, Length,
1216 Precision, Scale, Data, StringLength, Indicator);
1220 /*************************************************************************
1221 * SQLSetEnvAttr [ODBC32.075]
1223 SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle,
1224 SQLINTEGER Attribute, SQLPOINTER Value,
1225 SQLINTEGER StringLength)
1227 TRACE("\n");
1228 if (gProxyHandle.dmHandle == NULL)
1230 return SQL_ERROR;
1233 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETENVATTR].func)
1234 (EnvironmentHandle, Attribute, Value, StringLength);
1238 /*************************************************************************
1239 * SQLSetParam [ODBC32.022]
1241 SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle,
1242 SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1243 SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
1244 SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
1245 SQLINTEGER *StrLen_or_Ind)
1247 TRACE("\n");
1248 if (gProxyHandle.dmHandle == NULL)
1250 return SQL_ERROR;
1253 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPARAM].func)
1254 (StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision,
1255 ParameterScale, ParameterValue, StrLen_or_Ind);
1259 /*************************************************************************
1260 * SQLSetStmtAttr [ODBC32.076]
1262 SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle,
1263 SQLINTEGER Attribute, SQLPOINTER Value,
1264 SQLINTEGER StringLength)
1266 TRACE("\n");
1267 if (gProxyHandle.dmHandle == NULL)
1269 return SQL_ERROR;
1272 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].func)
1273 (StatementHandle, Attribute, Value, StringLength);
1277 /*************************************************************************
1278 * SQLSetStmtOption [ODBC32.051]
1280 SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1282 TRACE("\n");
1283 if (gProxyHandle.dmHandle == NULL)
1285 return SQL_ERROR;
1288 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTOPTION].func)
1289 (StatementHandle, Option, Value);
1293 /*************************************************************************
1294 * SQLSpecialColumns [ODBC32.052]
1296 SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle,
1297 SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
1298 SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
1299 SQLSMALLINT NameLength2, SQLCHAR *TableName,
1300 SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
1301 SQLUSMALLINT Nullable)
1303 if (gProxyHandle.dmHandle == NULL)
1305 return SQL_ERROR;
1308 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].func)
1309 (StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
1310 NameLength2, TableName, NameLength3, Scope, Nullable);
1314 /*************************************************************************
1315 * SQLStatistics [ODBC32.053]
1317 SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle,
1318 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1319 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1320 SQLCHAR *TableName, SQLSMALLINT NameLength3,
1321 SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
1323 TRACE("\n");
1324 if (gProxyHandle.dmHandle == NULL)
1326 return SQL_ERROR;
1329 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].func)
1330 (StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
1331 TableName, NameLength3, Unique, Reserved);
1335 /*************************************************************************
1336 * SQLTables [ODBC32.054]
1338 SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle,
1339 SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1340 SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1341 SQLCHAR *TableName, SQLSMALLINT NameLength3,
1342 SQLCHAR *TableType, SQLSMALLINT NameLength4)
1344 TRACE("\n");
1345 if (gProxyHandle.dmHandle == NULL)
1347 return SQL_ERROR;
1350 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].func)
1351 (StatementHandle, CatalogName, NameLength1,
1352 SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
1356 /*************************************************************************
1357 * SQLTransact [ODBC32.023]
1359 SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle,
1360 SQLUSMALLINT CompletionType)
1362 TRACE("\n");
1363 if (gProxyHandle.dmHandle == NULL)
1365 return SQL_ERROR;
1368 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTRANSACT].func)
1369 (EnvironmentHandle, ConnectionHandle, CompletionType);
1373 /*************************************************************************
1374 * SQLBrowseConnect [ODBC32.055]
1376 SQLRETURN WINAPI SQLBrowseConnect(
1377 SQLHDBC hdbc,
1378 SQLCHAR *szConnStrIn,
1379 SQLSMALLINT cbConnStrIn,
1380 SQLCHAR *szConnStrOut,
1381 SQLSMALLINT cbConnStrOutMax,
1382 SQLSMALLINT *pcbConnStrOut)
1384 TRACE("\n");
1385 if (gProxyHandle.dmHandle == NULL)
1387 return SQL_ERROR;
1390 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].func)
1391 (hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
1395 /*************************************************************************
1396 * SQLBulkOperations [ODBC32.078]
1398 SQLRETURN WINAPI SQLBulkOperations(
1399 SQLHSTMT StatementHandle,
1400 SQLSMALLINT Operation)
1402 TRACE("\n");
1403 if (gProxyHandle.dmHandle == NULL)
1405 return SQL_ERROR;
1408 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBULKOPERATIONS].func)
1409 (StatementHandle, Operation);
1413 /*************************************************************************
1414 * SQLColAttributes [ODBC32.006]
1416 SQLRETURN WINAPI SQLColAttributes(
1417 SQLHSTMT hstmt,
1418 SQLUSMALLINT icol,
1419 SQLUSMALLINT fDescType,
1420 SQLPOINTER rgbDesc,
1421 SQLSMALLINT cbDescMax,
1422 SQLSMALLINT *pcbDesc,
1423 SQLINTEGER *pfDesc)
1425 TRACE("\n");
1426 if (gProxyHandle.dmHandle == NULL)
1428 return SQL_ERROR;
1431 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].func)
1432 (hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1436 /*************************************************************************
1437 * SQLColumnPrivileges [ODBC32.056]
1439 SQLRETURN WINAPI SQLColumnPrivileges(
1440 SQLHSTMT hstmt,
1441 SQLCHAR *szCatalogName,
1442 SQLSMALLINT cbCatalogName,
1443 SQLCHAR *szSchemaName,
1444 SQLSMALLINT cbSchemaName,
1445 SQLCHAR *szTableName,
1446 SQLSMALLINT cbTableName,
1447 SQLCHAR *szColumnName,
1448 SQLSMALLINT cbColumnName)
1450 TRACE("\n");
1451 if (gProxyHandle.dmHandle == NULL)
1453 return SQL_ERROR;
1456 return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].func)
1457 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1458 szTableName, cbTableName, szColumnName, cbColumnName);
1462 /*************************************************************************
1463 * SQLDescribeParam [ODBC32.058]
1465 SQLRETURN WINAPI SQLDescribeParam(
1466 SQLHSTMT hstmt,
1467 SQLUSMALLINT ipar,
1468 SQLSMALLINT *pfSqlType,
1469 SQLUINTEGER *pcbParamDef,
1470 SQLSMALLINT *pibScale,
1471 SQLSMALLINT *pfNullable)
1473 TRACE("\n");
1474 if (gProxyHandle.dmHandle == NULL)
1476 return SQL_ERROR;
1479 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBEPARAM].func)
1480 (hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable);
1484 /*************************************************************************
1485 * SQLExtendedFetch [ODBC32.059]
1487 SQLRETURN WINAPI SQLExtendedFetch(
1488 SQLHSTMT hstmt,
1489 SQLUSMALLINT fFetchType,
1490 SQLINTEGER irow,
1491 SQLUINTEGER *pcrow,
1492 SQLUSMALLINT *rgfRowStatus)
1494 TRACE("\n");
1495 if (gProxyHandle.dmHandle == NULL)
1497 return SQL_ERROR;
1500 return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXTENDEDFETCH].func)
1501 (hstmt, fFetchType, irow, pcrow, rgfRowStatus);
1505 /*************************************************************************
1506 * SQLForeignKeys [ODBC32.060]
1508 SQLRETURN WINAPI SQLForeignKeys(
1509 SQLHSTMT hstmt,
1510 SQLCHAR *szPkCatalogName,
1511 SQLSMALLINT cbPkCatalogName,
1512 SQLCHAR *szPkSchemaName,
1513 SQLSMALLINT cbPkSchemaName,
1514 SQLCHAR *szPkTableName,
1515 SQLSMALLINT cbPkTableName,
1516 SQLCHAR *szFkCatalogName,
1517 SQLSMALLINT cbFkCatalogName,
1518 SQLCHAR *szFkSchemaName,
1519 SQLSMALLINT cbFkSchemaName,
1520 SQLCHAR *szFkTableName,
1521 SQLSMALLINT cbFkTableName)
1523 TRACE("\n");
1524 if (gProxyHandle.dmHandle == NULL)
1526 return SQL_ERROR;
1529 return (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].func)
1530 (hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName,
1531 szPkTableName, cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName,
1532 cbFkSchemaName, szFkTableName, cbFkTableName);
1536 /*************************************************************************
1537 * SQLMoreResults [ODBC32.061]
1539 SQLRETURN WINAPI SQLMoreResults(SQLHSTMT hstmt)
1541 TRACE("\n");
1542 if (gProxyHandle.dmHandle == NULL)
1544 return SQL_ERROR;
1547 return (gProxyHandle.functions[SQLAPI_INDEX_SQLMORERESULTS].func) (hstmt);
1551 /*************************************************************************
1552 * SQLNativeSql [ODBC32.062]
1554 SQLRETURN WINAPI SQLNativeSql(
1555 SQLHDBC hdbc,
1556 SQLCHAR *szSqlStrIn,
1557 SQLINTEGER cbSqlStrIn,
1558 SQLCHAR *szSqlStr,
1559 SQLINTEGER cbSqlStrMax,
1560 SQLINTEGER *pcbSqlStr)
1562 TRACE("\n");
1563 if (gProxyHandle.dmHandle == NULL)
1565 return SQL_ERROR;
1568 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].func)
1569 (hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
1573 /*************************************************************************
1574 * SQLNumParams [ODBC32.063]
1576 SQLRETURN WINAPI SQLNumParams(
1577 SQLHSTMT hstmt,
1578 SQLSMALLINT *pcpar)
1580 TRACE("\n");
1581 if (gProxyHandle.dmHandle == NULL)
1583 return SQL_ERROR;
1586 return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMPARAMS].func) (hstmt, pcpar);
1590 /*************************************************************************
1591 * SQLParamOptions [ODBC32.064]
1593 SQLRETURN WINAPI SQLParamOptions(
1594 SQLHSTMT hstmt,
1595 SQLUINTEGER crow,
1596 SQLUINTEGER *pirow)
1598 TRACE("\n");
1599 if (gProxyHandle.dmHandle == NULL)
1601 return SQL_ERROR;
1604 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMOPTIONS].func) (hstmt, crow, pirow);
1608 /*************************************************************************
1609 * SQLPrimaryKeys [ODBC32.065]
1611 SQLRETURN WINAPI SQLPrimaryKeys(
1612 SQLHSTMT hstmt,
1613 SQLCHAR *szCatalogName,
1614 SQLSMALLINT cbCatalogName,
1615 SQLCHAR *szSchemaName,
1616 SQLSMALLINT cbSchemaName,
1617 SQLCHAR *szTableName,
1618 SQLSMALLINT cbTableName)
1620 TRACE("\n");
1621 if (gProxyHandle.dmHandle == NULL)
1623 return SQL_ERROR;
1626 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].func)
1627 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1628 szTableName, cbTableName);
1632 /*************************************************************************
1633 * SQLProcedureColumns [ODBC32.066]
1635 SQLRETURN WINAPI SQLProcedureColumns(
1636 SQLHSTMT hstmt,
1637 SQLCHAR *szCatalogName,
1638 SQLSMALLINT cbCatalogName,
1639 SQLCHAR *szSchemaName,
1640 SQLSMALLINT cbSchemaName,
1641 SQLCHAR *szProcName,
1642 SQLSMALLINT cbProcName,
1643 SQLCHAR *szColumnName,
1644 SQLSMALLINT cbColumnName)
1646 TRACE("\n");
1647 if (gProxyHandle.dmHandle == NULL)
1649 return SQL_ERROR;
1652 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].func)
1653 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1654 szProcName, cbProcName, szColumnName, cbColumnName);
1658 /*************************************************************************
1659 * SQLProcedures [ODBC32.067]
1661 SQLRETURN WINAPI SQLProcedures(
1662 SQLHSTMT hstmt,
1663 SQLCHAR *szCatalogName,
1664 SQLSMALLINT cbCatalogName,
1665 SQLCHAR *szSchemaName,
1666 SQLSMALLINT cbSchemaName,
1667 SQLCHAR *szProcName,
1668 SQLSMALLINT cbProcName)
1670 TRACE("\n");
1671 if (gProxyHandle.dmHandle == NULL)
1673 return SQL_ERROR;
1676 return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].func)
1677 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1678 szProcName, cbProcName);
1682 /*************************************************************************
1683 * SQLSetPos [ODBC32.068]
1685 SQLRETURN WINAPI SQLSetPos(
1686 SQLHSTMT hstmt,
1687 SQLUSMALLINT irow,
1688 SQLUSMALLINT fOption,
1689 SQLUSMALLINT fLock)
1691 TRACE("\n");
1692 if (gProxyHandle.dmHandle == NULL)
1694 return SQL_ERROR;
1697 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPOS].func)
1698 (hstmt, irow, fOption, fLock);
1702 /*************************************************************************
1703 * SQLTablePrivileges [ODBC32.070]
1705 SQLRETURN WINAPI SQLTablePrivileges(
1706 SQLHSTMT hstmt,
1707 SQLCHAR *szCatalogName,
1708 SQLSMALLINT cbCatalogName,
1709 SQLCHAR *szSchemaName,
1710 SQLSMALLINT cbSchemaName,
1711 SQLCHAR *szTableName,
1712 SQLSMALLINT cbTableName)
1714 TRACE("\n");
1715 if (gProxyHandle.dmHandle == NULL)
1717 return SQL_ERROR;
1720 return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].func)
1721 (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1722 szTableName, cbTableName);
1726 /*************************************************************************
1727 * SQLDrivers [ODBC32.071]
1729 SQLRETURN WINAPI SQLDrivers(
1730 SQLHENV henv,
1731 SQLUSMALLINT fDirection,
1732 SQLCHAR *szDriverDesc,
1733 SQLSMALLINT cbDriverDescMax,
1734 SQLSMALLINT *pcbDriverDesc,
1735 SQLCHAR *szDriverAttributes,
1736 SQLSMALLINT cbDriverAttrMax,
1737 SQLSMALLINT *pcbDriverAttr)
1739 TRACE("\n");
1740 if (gProxyHandle.dmHandle == NULL)
1742 return SQL_ERROR;
1745 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].func)
1746 (henv, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
1747 szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
1751 /*************************************************************************
1752 * SQLBindParameter [ODBC32.072]
1754 SQLRETURN WINAPI SQLBindParameter(
1755 SQLHSTMT hstmt,
1756 SQLUSMALLINT ipar,
1757 SQLSMALLINT fParamType,
1758 SQLSMALLINT fCType,
1759 SQLSMALLINT fSqlType,
1760 SQLUINTEGER cbColDef,
1761 SQLSMALLINT ibScale,
1762 SQLPOINTER rgbValue,
1763 SQLINTEGER cbValueMax,
1764 SQLINTEGER *pcbValue)
1766 TRACE("\n");
1767 if (gProxyHandle.dmHandle == NULL)
1769 return SQL_ERROR;
1772 return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAMETER].func)
1773 (hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale,
1774 rgbValue, cbValueMax, pcbValue);
1778 /*************************************************************************
1779 * SQLDriverConnect [ODBC32.041]
1781 SQLRETURN WINAPI SQLDriverConnect(
1782 SQLHDBC hdbc,
1783 SQLHWND hwnd,
1784 SQLCHAR *conn_str_in,
1785 SQLSMALLINT len_conn_str_in,
1786 SQLCHAR *conn_str_out,
1787 SQLSMALLINT conn_str_out_max,
1788 SQLSMALLINT *ptr_conn_str_out,
1789 SQLUSMALLINT driver_completion )
1791 TRACE("\n");
1792 if (gProxyHandle.dmHandle == NULL)
1794 return SQL_ERROR;
1797 return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].func)
1798 (hdbc, hwnd, conn_str_in, len_conn_str_in, conn_str_out,
1799 conn_str_out_max, ptr_conn_str_out, driver_completion);
1803 /*************************************************************************
1804 * SQLSetScrollOptions [ODBC32.069]
1806 SQLRETURN WINAPI SQLSetScrollOptions(
1807 SQLHSTMT statement_handle,
1808 SQLUSMALLINT f_concurrency,
1809 SQLINTEGER crow_keyset,
1810 SQLUSMALLINT crow_rowset )
1812 TRACE("\n");
1813 if (gProxyHandle.dmHandle == NULL)
1815 return SQL_ERROR;
1818 return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSCROLLOPTIONS].func)
1819 (statement_handle, f_concurrency, crow_keyset, crow_rowset);