Moved standard syslevel APIs declaration to winbase.h.
[wine] / dlls / odbc32 / proxyodbc.c
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.
7  *
8  * Xiang Li, Corel Corporation, Nov. 12, 1999
9  *
10  */
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <dlfcn.h>
15 #include <string.h>
16
17 #include "winbase.h"
18 #include "debugtools.h"
19
20 #include "sql.h"
21 #include "sqltypes.h"
22 #include "sqlext.h"
23
24 #include "proxyodbc.h"
25
26 DEFAULT_DEBUG_CHANNEL(odbc);
27
28 static const DM_FUNC template_func[] =
29 {
30     /* 00 */ { SQL_API_SQLALLOCCONNECT,      "SQLAllocConnect", SQLAllocConnect, NULL },
31     /* 01 */ { SQL_API_SQLALLOCENV,          "SQLAllocEnv", SQLAllocEnv, NULL  },
32     /* 02 */ { SQL_API_SQLALLOCHANDLE,       "SQLAllocHandle", SQLAllocHandle, NULL },
33     /* 03 */ { SQL_API_SQLALLOCSTMT,         "SQLAllocStmt", SQLAllocStmt, NULL },
34     /* 04 */ { SQL_API_SQLALLOCHANDLESTD,    "SQLAllocHandleStd", SQLAllocHandleStd, NULL },
35     /* 05 */ { SQL_API_SQLBINDCOL,           "SQLBindCol", SQLBindCol, NULL },
36     /* 06 */ { SQL_API_SQLBINDPARAM,         "SQLBindParam", SQLBindParam, NULL },
37     /* 07 */ { SQL_API_SQLBINDPARAMETER,     "SQLBindParameter", SQLBindParameter, NULL },
38     /* 08 */ { SQL_API_SQLBROWSECONNECT,     "SQLBrowseConnect", SQLBrowseConnect, NULL },
39     /* 09 */ { SQL_API_SQLBULKOPERATIONS,    "SQLBulkOperations", SQLBulkOperations, NULL },
40     /* 10 */ { SQL_API_SQLCANCEL,            "SQLCancel", SQLCancel, NULL },
41     /* 11 */ { SQL_API_SQLCLOSECURSOR,       "SQLCloseCursor", SQLCloseCursor, NULL },
42     /* 12 */ { SQL_API_SQLCOLATTRIBUTE,      "SQLColAttribute", SQLColAttribute, NULL },
43     /* 13 */ { SQL_API_SQLCOLATTRIBUTES,     "SQLColAttributes", SQLColAttributes, NULL },
44     /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES,  "SQLColumnPrivileges", SQLColumnPrivileges, NULL },
45     /* 15 */ { SQL_API_SQLCOLUMNS,           "SQLColumns", SQLColumns, NULL },
46     /* 16 */ { SQL_API_SQLCONNECT,           "SQLConnect", SQLConnect, NULL },
47     /* 17 */ { SQL_API_SQLCOPYDESC,          "SQLCopyDesc", SQLCopyDesc, NULL },
48     /* 18 */ { SQL_API_SQLDATASOURCES,       "SQLDataSources", SQLDataSources, NULL },
49     /* 19 */ { SQL_API_SQLDESCRIBECOL,       "SQLDescribeCol", SQLDescribeCol, NULL },
50     /* 20 */ { SQL_API_SQLDESCRIBEPARAM,     "SQLDescribeParam", SQLDescribeParam, NULL },
51     /* 21 */ { SQL_API_SQLDISCONNECT,        "SQLDisconnect", SQLDisconnect, NULL },
52     /* 22 */ { SQL_API_SQLDRIVERCONNECT,     "SQLDriverConnect", SQLDriverConnect, NULL },
53     /* 23 */ { SQL_API_SQLDRIVERS,           "SQLDrivers", SQLDrivers, NULL },
54     /* 24 */ { SQL_API_SQLENDTRAN,           "SQLEndTran", SQLEndTran, NULL },
55     /* 25 */ { SQL_API_SQLERROR,             "SQLError", SQLError, NULL },
56     /* 26 */ { SQL_API_SQLEXECDIRECT,        "SQLExecDirect", SQLExecDirect, NULL },
57     /* 27 */ { SQL_API_SQLEXECUTE,           "SQLExecute", SQLExecute, NULL },
58     /* 28 */ { SQL_API_SQLEXTENDEDFETCH,     "SQLExtendedFetch", SQLExtendedFetch, NULL },
59     /* 29 */ { SQL_API_SQLFETCH,             "SQLFetch", SQLFetch, NULL },
60     /* 30 */ { SQL_API_SQLFETCHSCROLL,       "SQLFetchScroll", SQLFetchScroll, NULL },
61     /* 31 */ { SQL_API_SQLFOREIGNKEYS,       "SQLForeignKeys", SQLForeignKeys, NULL },
62     /* 32 */ { SQL_API_SQLFREEENV,           "SQLFreeEnv", SQLFreeEnv, NULL },
63     /* 33 */ { SQL_API_SQLFREEHANDLE,        "SQLFreeHandle", SQLFreeHandle, NULL },
64     /* 34 */ { SQL_API_SQLFREESTMT,          "SQLFreeStmt", SQLFreeStmt, NULL },
65     /* 35 */ { SQL_API_SQLFREECONNECT,       "SQLFreeConnect", SQLFreeConnect, NULL },
66     /* 36 */ { SQL_API_SQLGETCONNECTATTR,    "SQLGetConnectAttr", SQLGetConnectAttr, NULL },
67     /* 37 */ { SQL_API_SQLGETCONNECTOPTION,  "SQLGetConnectOption", SQLGetConnectOption, NULL },
68     /* 38 */ { SQL_API_SQLGETCURSORNAME,     "SQLGetCursorName", SQLGetCursorName, NULL },
69     /* 39 */ { SQL_API_SQLGETDATA,           "SQLGetData", SQLGetData, NULL },
70     /* 40 */ { SQL_API_SQLGETDESCFIELD,      "SQLGetDescField", SQLGetDescField, NULL },
71     /* 41 */ { SQL_API_SQLGETDESCREC,        "SQLGetDescRec", SQLGetDescRec, NULL },
72     /* 42 */ { SQL_API_SQLGETDIAGFIELD,      "SQLGetDiagField", SQLGetDiagField, NULL },
73     /* 43 */ { SQL_API_SQLGETENVATTR,        "SQLGetEnvAttr", SQLGetEnvAttr, NULL },
74     /* 44 */ { SQL_API_SQLGETFUNCTIONS,      "SQLGetFunctions", SQLGetFunctions, NULL },
75     /* 45 */ { SQL_API_SQLGETINFO,           "SQLGetInfo", SQLGetInfo, NULL },
76     /* 46 */ { SQL_API_SQLGETSTMTATTR,       "SQLGetStmtAttr", SQLGetStmtAttr, NULL },
77     /* 47 */ { SQL_API_SQLGETSTMTOPTION,     "SQLGetStmtOption", SQLGetStmtOption, NULL },
78     /* 48 */ { SQL_API_SQLGETTYPEINFO,       "SQLGetTypeInfo", SQLGetTypeInfo, NULL },
79     /* 49 */ { SQL_API_SQLMORERESULTS,       "SQLMoreResults", SQLMoreResults, NULL },
80     /* 50 */ { SQL_API_SQLNATIVESQL,         "SQLNativeSql", SQLNativeSql, NULL },
81     /* 51 */ { SQL_API_SQLNUMPARAMS,         "SQLNumParams", SQLNumParams, NULL },
82     /* 52 */ { SQL_API_SQLNUMRESULTCOLS,     "SQLNumResultCols", SQLNumResultCols, NULL },
83     /* 53 */ { SQL_API_SQLPARAMDATA,         "SQLParamData", SQLParamData, NULL },
84     /* 54 */ { SQL_API_SQLPARAMOPTIONS,      "SQLParamOptions", SQLParamOptions, NULL },
85     /* 55 */ { SQL_API_SQLPREPARE,           "SQLPrepare", SQLPrepare, NULL },
86     /* 56 */ { SQL_API_SQLPRIMARYKEYS,       "SQLPrimaryKeys", SQLPrimaryKeys, NULL },
87     /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS,  "SQLProcedureColumns", SQLProcedureColumns, NULL },
88     /* 58 */ { SQL_API_SQLPROCEDURES,        "SQLProcedures", SQLProcedures, NULL },
89     /* 59 */ { SQL_API_SQLPUTDATA,           "SQLPutData", SQLPutData, NULL },
90     /* 60 */ { SQL_API_SQLROWCOUNT,          "SQLRowCount", SQLRowCount, NULL },
91     /* 61 */ { SQL_API_SQLSETCONNECTATTR,    "SQLSetConnectAttr", SQLSetConnectAttr, NULL },
92     /* 62 */ { SQL_API_SQLSETCONNECTOPTION,  "SQLSetConnectOption", SQLSetConnectOption, NULL },
93     /* 63 */ { SQL_API_SQLSETCURSORNAME,     "SQLSetCursorName", SQLSetCursorName, NULL },
94     /* 64 */ { SQL_API_SQLSETDESCFIELD,      "SQLSetDescField", SQLSetDescField, NULL },
95     /* 65 */ { SQL_API_SQLSETDESCREC,        "SQLSetDescRec", SQLSetDescRec, NULL },
96     /* 66 */ { SQL_API_SQLSETENVATTR,        "SQLSetEnvAttr", SQLSetEnvAttr, NULL },
97     /* 67 */ { SQL_API_SQLSETPARAM,          "SQLSetParam", SQLSetParam, NULL },
98     /* 68 */ { SQL_API_SQLSETPOS,            "SQLSetPos", SQLSetPos, NULL },
99     /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS,  "SQLSetScrollOptions", SQLSetScrollOptions, NULL },
100     /* 70 */ { SQL_API_SQLSETSTMTATTR,       "SQLSetStmtAttr", SQLSetStmtAttr, NULL },
101     /* 71 */ { SQL_API_SQLSETSTMTOPTION,     "SQLSetStmtOption", SQLSetStmtOption, NULL },
102     /* 72 */ { SQL_API_SQLSPECIALCOLUMNS,    "SQLSpecialColumns", SQLSpecialColumns, NULL },
103     /* 73 */ { SQL_API_SQLSTATISTICS,        "SQLStatistics", SQLStatistics, NULL },
104     /* 74 */ { SQL_API_SQLTABLEPRIVILEGES,   "SQLTablePrivileges", SQLTablePrivileges, NULL },
105     /* 75 */ { SQL_API_SQLTABLES,            "SQLTables", SQLTables, NULL },
106     /* 76 */ { SQL_API_SQLTRANSACT,          "SQLTransact", SQLTransact, NULL },
107     /* 77 */ { SQL_API_SQLGETDIAGREC,        "SQLGetDiagRec", SQLGetDiagRec, NULL },
108 };
109
110 static PROXYHANDLE gProxyHandle = {
111   NULL,
112   FALSE,
113   FALSE,
114   FALSE,
115   ERROR_LIBRARY_NOT_FOUND,
116   { },
117   "",
118   "",
119   "",
120   ""
121 }; 
122
123 SQLRETURN SQLDummyFunc()
124 {
125     TRACE("SQLDummyFunc: \n");
126     return SQL_SUCCESS;
127 }
128
129 /***********************************************************************
130  * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'.
131  *
132  * PARAMS
133  *     hinstDLL    [I] handle to the DLL's instance
134  *     fdwReason   [I]
135  *     lpvReserved [I] reserved, must be NULL
136  *
137  * RETURNS
138  *     Success: TRUE
139  *     Failure: FALSE
140  */
141
142 BOOL WINAPI
143 MAIN_OdbcInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
144 {
145     int i;
146     TRACE("Initializing proxy ODBC: %x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
147
148     if (fdwReason == DLL_PROCESS_ATTACH)
149     {
150        TRACE("Loading ODBC...\n");
151        if (ODBC_LoadDriverManager())
152           ODBC_LoadDMFunctions();
153     }
154     else if (fdwReason == DLL_PROCESS_DETACH)
155     {
156       TRACE("Unloading ODBC...\n");
157       if (gProxyHandle.bFunctionReady)
158       {
159          for ( i = 0; i < NUM_SQLFUNC; i ++ )
160          {
161             gProxyHandle.functions[i].func = SQLDummyFunc;
162          }
163       }
164
165       if (gProxyHandle.dmHandle)
166       {
167          dlclose(gProxyHandle.dmHandle);
168          gProxyHandle.dmHandle = NULL;
169       }
170     }
171
172     return TRUE;
173 }
174
175
176 /***********************************************************************
177  * ODBC_LoadDriverManager [Internal] Load ODBC library.
178  *
179  * PARAMS
180  *
181  * RETURNS
182  *     Success: TRUE
183  *     Failure: FALSE
184  */
185
186 BOOL ODBC_LoadDriverManager()
187 {
188    char *s = getenv("LIB_ODBC_DRIVER_MANAGER");
189
190    TRACE("\n");
191
192    gProxyHandle.bFunctionReady = FALSE;
193
194    if (s != NULL && strlen(s) > 0)
195           strcpy(gProxyHandle.dmLibName, s);
196    else
197           strcpy(gProxyHandle.dmLibName, "libodbc.so");
198
199    gProxyHandle.dmHandle = dlopen(gProxyHandle.dmLibName, RTLD_LAZY);
200
201    if (gProxyHandle.dmHandle == NULL)           /* fail to load unixODBC driver manager */
202    {
203            WARN("failed to open library %s\n", gProxyHandle.dmLibName);
204            gProxyHandle.dmLibName[0] = '\0';
205            gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND;
206            return FALSE;
207    }
208    else
209    {
210       gProxyHandle.nErrorType = ERROR_FREE;
211       return TRUE;
212    }
213 }
214
215
216 /***********************************************************************
217  * ODBC_LoadDMFunctions [Internal] Populate function table.
218  *
219  * PARAMS
220  *
221  * RETURNS
222  *     Success: TRUE
223  *     Failure: FALSE
224  */
225
226 BOOL ODBC_LoadDMFunctions()
227 {
228     int i;
229
230     if (gProxyHandle.dmHandle == NULL)
231         return FALSE;
232
233     for ( i = 0; i < NUM_SQLFUNC; i ++ )
234     {
235         gProxyHandle.functions[i] = template_func[i];
236         gProxyHandle.functions[i].func = dlsym(gProxyHandle.dmHandle,
237                 gProxyHandle.functions[i].name);
238
239         if (dlerror())
240         {
241             ERR("Failed to load function %s",gProxyHandle.functions[i].name);
242             gProxyHandle.functions[i].func = SQLDummyFunc;
243         }
244     }
245
246     gProxyHandle.bFunctionReady = TRUE;
247
248     return TRUE;
249 }
250
251
252 /*************************************************************************
253  *                              SQLAllocConnect           [ODBC32.001]
254  */
255 SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
256 {
257         TRACE("\n");
258
259         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
260         {
261            *ConnectionHandle = SQL_NULL_HDBC;
262            return SQL_ERROR;
263         }
264
265         return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCCONNECT].func)
266             (EnvironmentHandle, ConnectionHandle);
267 }
268
269
270 /*************************************************************************
271  *                              SQLAllocEnv           [ODBC32.002]
272  */
273 SQLRETURN WINAPI  SQLAllocEnv(SQLHENV *EnvironmentHandle)
274 {
275         TRACE("\n");
276
277         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
278         {
279            *EnvironmentHandle = SQL_NULL_HENV;
280            return SQL_ERROR;
281         }
282
283         return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCENV].func) (EnvironmentHandle);
284 }
285
286
287 /*************************************************************************
288  *                              SQLAllocHandle           [ODBC32.024]
289  */
290 SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
291 {
292        TRACE(".\n");
293
294         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
295         {
296             if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
297                 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
298
299             if (HandleType == SQL_HANDLE_ENV)
300                 *OutputHandle = SQL_NULL_HENV;
301             else if (HandleType == SQL_HANDLE_DBC)
302                 *OutputHandle = SQL_NULL_HDBC;
303             else if (HandleType == SQL_HANDLE_STMT)
304                 *OutputHandle = SQL_NULL_HSTMT;
305             else if (HandleType == SQL_HANDLE_DESC)
306                 *OutputHandle = SQL_NULL_HDESC;
307
308             return SQL_ERROR;
309         }
310
311         return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLE].func)
312                    (HandleType, InputHandle, OutputHandle);
313 }
314
315
316 /*************************************************************************
317  *                              SQLAllocStmt           [ODBC32.003]
318  */
319 SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
320 {
321
322         TRACE("\n");
323
324         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
325         {
326            *StatementHandle = SQL_NULL_HSTMT;
327            return SQL_ERROR;
328         }
329
330         return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCSTMT].func)
331             (ConnectionHandle, StatementHandle);
332 }
333
334
335 /*************************************************************************
336  *                              SQLAllocHandleStd           [ODBC32.077]
337  */
338 SQLRETURN WINAPI SQLAllocHandleStd( SQLSMALLINT HandleType,
339                                                          SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
340 {
341         TRACE("ProxyODBC: SQLAllocHandelStd.\n");
342
343         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
344         {
345             if (gProxyHandle.nErrorType == ERROR_LIBRARY_NOT_FOUND)
346                 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
347
348             if (HandleType == SQL_HANDLE_ENV)
349                 *OutputHandle = SQL_NULL_HENV;
350             else if (HandleType == SQL_HANDLE_DBC)
351                 *OutputHandle = SQL_NULL_HDBC;
352             else if (HandleType == SQL_HANDLE_STMT)
353                 *OutputHandle = SQL_NULL_HSTMT;
354             else if (HandleType == SQL_HANDLE_DESC)
355                 *OutputHandle = SQL_NULL_HDESC;
356
357             return SQL_ERROR;
358         }
359
360         return (gProxyHandle.functions[SQLAPI_INDEX_SQLALLOCHANDLESTD].func)
361                    (HandleType, InputHandle, OutputHandle);
362 }
363
364
365 /*************************************************************************
366  *                              SQLBindCol           [ODBC32.004]
367  */
368 SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle,
369                      SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
370                      SQLPOINTER TargetValue, SQLINTEGER BufferLength,
371                      SQLINTEGER *StrLen_or_Ind)
372 {
373         TRACE("\n");
374
375         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
376         {
377                 return SQL_ERROR;
378         }
379
380         return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDCOL].func)
381             (StatementHandle, ColumnNumber, TargetType,
382             TargetValue, BufferLength, StrLen_or_Ind);
383 }
384
385
386 /*************************************************************************
387  *                              SQLBindParam           [ODBC32.025]
388  */
389 SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle,
390              SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
391              SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
392              SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
393              SQLINTEGER *StrLen_or_Ind)
394 {
395         TRACE("\n");
396
397         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
398         {
399                 return SQL_ERROR;
400         }
401
402         return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAM].func)
403                    (StatementHandle, ParameterNumber, ValueType,
404                     ParameterScale, ParameterValue, StrLen_or_Ind);
405 }
406
407
408 /*************************************************************************
409  *                              SQLCancel           [ODBC32.005]
410  */
411 SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle)
412 {
413         TRACE("\n");
414
415         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
416         {
417                 return SQL_ERROR;
418         }
419
420         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCANCEL].func) (StatementHandle);
421 }
422
423
424 /*************************************************************************
425  *                              SQLCloseCursor           [ODBC32.026]
426  */
427 SQLRETURN WINAPI  SQLCloseCursor(SQLHSTMT StatementHandle)
428 {
429         TRACE("\n");
430
431         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
432         {
433                 return SQL_ERROR;
434         }
435
436         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCLOSECURSOR].func) (StatementHandle);
437 }
438
439
440 /*************************************************************************
441  *                              SQLColAttribute           [ODBC32.027]
442  */
443 SQLRETURN WINAPI SQLColAttribute (SQLHSTMT StatementHandle,
444              SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
445              SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
446              SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute)
447 {
448         TRACE("\n");
449
450         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
451         {
452                 return SQL_ERROR;
453         }
454
455         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTE].func)
456             (StatementHandle, ColumnNumber, FieldIdentifier,
457             CharacterAttribute, BufferLength, StringLength, NumericAttribute);
458 }
459
460
461 /*************************************************************************
462  *                              SQLColumns           [ODBC32.040]
463  */
464 SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle,
465              SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
466              SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
467              SQLCHAR *TableName, SQLSMALLINT NameLength3,
468              SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
469 {
470         TRACE("\n");
471
472         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
473         {
474                 return SQL_ERROR;
475         }
476
477         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNS].func)
478             (StatementHandle, CatalogName, NameLength1,
479             SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
480 }
481
482
483 /*************************************************************************
484  *                              SQLConnect           [ODBC32.007]
485  */
486 SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle,
487              SQLCHAR *ServerName, SQLSMALLINT NameLength1,
488              SQLCHAR *UserName, SQLSMALLINT NameLength2,
489              SQLCHAR *Authentication, SQLSMALLINT NameLength3)
490 {
491         TRACE("\n");
492
493         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
494         {
495                   return SQL_ERROR;
496         }
497
498         strcpy(gProxyHandle.ServerName, ServerName);
499         strcpy(gProxyHandle.UserName, UserName);
500
501         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCONNECT].func)
502             (ConnectionHandle, ServerName, NameLength1,
503             UserName, NameLength2, Authentication, NameLength3);
504 }
505
506
507 /*************************************************************************
508  *                              SQLCopyDesc           [ODBC32.028]
509  */
510 SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
511 {
512         TRACE("\n");
513
514         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
515         {
516                 return SQL_ERROR;
517         }
518
519         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOPYDESC].func)
520             (SourceDescHandle, TargetDescHandle);
521 }
522
523
524 /*************************************************************************
525  *                              SQLDataSources           [ODBC32.057]
526  */
527 SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle,
528              SQLUSMALLINT Direction, SQLCHAR *ServerName,
529              SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
530              SQLCHAR *Description, SQLSMALLINT BufferLength2,
531              SQLSMALLINT *NameLength2)
532 {
533         SQLRETURN ret;
534
535         TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle);
536
537         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
538         {
539             ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
540             return SQL_ERROR;
541         }
542
543         ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLDATASOURCES].func)
544             (EnvironmentHandle, Direction, ServerName,
545             BufferLength1, NameLength1, Description, BufferLength2, NameLength2);
546
547         if (TRACE_ON(odbc))
548         {
549            TRACE("returns: %d \t", ret);
550            if (*NameLength1 > 0)
551              TRACE("DataSource = %s,", ServerName);
552            if (*NameLength2 > 0)
553              TRACE(" Description = %s\n", Description);
554         }
555
556         return ret;
557 }
558
559
560 /*************************************************************************
561  *                              SQLDescribeCol           [ODBC32.008]
562  */
563 SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle,
564              SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
565              SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
566              SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize,
567              SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
568 {
569         TRACE("\n");
570
571         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
572         {
573                 return SQL_ERROR;
574         }
575
576         return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBECOL].func)
577             (StatementHandle, ColumnNumber, ColumnName,
578             BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
579 }
580
581
582 /*************************************************************************
583  *                              SQLDisconnect           [ODBC32.009]
584  */
585 SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
586 {
587         TRACE("\n");
588
589         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
590         {
591                 return SQL_ERROR;
592         }
593
594         gProxyHandle.ServerName[0] = '\0';
595         gProxyHandle.UserName[0]   = '\0';
596
597         return (gProxyHandle.functions[SQLAPI_INDEX_SQLDISCONNECT].func) (ConnectionHandle);
598 }
599
600
601 /*************************************************************************
602  *                              SQLEndTran           [ODBC32.029]
603  */
604 SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
605 {
606         TRACE("\n");
607
608         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
609         {
610                 return SQL_ERROR;
611         }
612
613         return (gProxyHandle.functions[SQLAPI_INDEX_SQLENDTRAN].func) (HandleType, Handle, CompletionType);
614 }
615
616
617 /*************************************************************************
618  *                              SQLError           [ODBC32.010]
619  */
620 SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle,
621              SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
622              SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
623              SQLCHAR *MessageText, SQLSMALLINT BufferLength,
624              SQLSMALLINT *TextLength)
625 {
626         TRACE("\n");
627
628         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
629         {
630                 return SQL_ERROR;
631         }
632
633         return (gProxyHandle.functions[SQLAPI_INDEX_SQLERROR].func)
634             (EnvironmentHandle, ConnectionHandle, StatementHandle,
635             Sqlstate, NativeError, MessageText, BufferLength, TextLength);
636 }
637
638
639 /*************************************************************************
640  *                              SQLExecDirect           [ODBC32.011]
641  */
642 SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
643 {
644         TRACE("\n");
645
646         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
647         {
648                 return SQL_ERROR;
649         }
650
651         return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECDIRECT].func)
652             (StatementHandle, StatementText, TextLength);
653 }
654
655
656 /*************************************************************************
657  *                              SQLExecute           [ODBC32.012]
658  */
659 SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
660 {
661         TRACE("\n");
662
663         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
664         {
665                 return SQL_ERROR;
666         }
667
668         return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXECUTE].func) (StatementHandle);
669 }
670
671
672 /*************************************************************************
673  *                              SQLFetch           [ODBC32.013]
674  */
675 SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
676 {
677         TRACE("\n");
678
679         if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL)
680         {
681                 return SQL_ERROR;
682         }
683
684         return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCH].func) (StatementHandle);
685 }
686
687
688 /*************************************************************************
689  *                              SQLFetchScroll          [ODBC32.030]
690  */
691 SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset)
692 {
693         TRACE("\n");
694
695         if (gProxyHandle.dmHandle == NULL)
696         {
697                 return SQL_ERROR;
698         }
699
700         return (gProxyHandle.functions[SQLAPI_INDEX_SQLFETCHSCROLL].func)
701             (StatementHandle, FetchOrientation, FetchOffset);
702 }
703
704
705 /*************************************************************************
706  *                              SQLFreeConnect           [ODBC32.014]
707  */
708 SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
709 {
710         TRACE("\n");
711
712         if (gProxyHandle.dmHandle == NULL)
713         {
714                 return SQL_ERROR;
715         }
716
717         return (gProxyHandle.functions[SQLAPI_INDEX_SQLFREECONNECT].func) (ConnectionHandle);
718 }
719
720
721 /*************************************************************************
722  *                              SQLFreeEnv           [ODBC32.015]
723  */
724 SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
725 {
726         SQLRETURN ret;
727
728         TRACE("\n");
729
730         if (gProxyHandle.dmHandle == NULL)
731         {
732                 return SQL_ERROR;
733         }
734
735         ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEENV].func) (EnvironmentHandle);
736         /*
737         if (gProxyHandle.dmHandle)
738         {
739            dlclose(gProxyHandle.dmHandle);
740            gProxyHandle.dmHandle = NULL;
741         }
742         */
743
744         return ret;
745 }
746
747
748 /*************************************************************************
749  *                              SQLFreeHandle           [ODBC32.031]
750  */
751 SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
752 {
753         SQLRETURN ret;
754
755        TRACE("\n");
756
757         if (gProxyHandle.dmHandle == NULL)
758         {
759                 return SQL_ERROR;
760         }
761
762         ret = (gProxyHandle.functions[SQLAPI_INDEX_SQLFREEHANDLE].func)
763             (HandleType, Handle);
764
765         if (HandleType == SQL_HANDLE_ENV)   /* it is time to close the loaded library */
766         {
767             if (gProxyHandle.dmHandle)
768             {
769                dlclose(gProxyHandle.dmHandle);
770                gProxyHandle.dmHandle = NULL;
771             }
772         }
773
774         return ret;
775 }
776
777
778 /*************************************************************************
779  *                              SQLFreeStmt           [ODBC32.016]
780  */
781 SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
782 {
783
784         TRACE("\n");
785
786         if (gProxyHandle.dmHandle == NULL)
787         {
788                 return SQL_ERROR;
789         }
790
791         return (gProxyHandle.functions[SQLAPI_INDEX_SQLFREESTMT].func)
792             (StatementHandle, Option);
793 }
794
795
796 /*************************************************************************
797  *                              SQLGetConnectAttr           [ODBC32.032]
798  */
799 SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle,
800              SQLINTEGER Attribute, SQLPOINTER Value,
801              SQLINTEGER BufferLength, SQLINTEGER *StringLength)
802 {
803         TRACE("\n");
804
805         if (gProxyHandle.dmHandle == NULL)
806         {
807                 return SQL_ERROR;
808         }
809
810         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTATTR].func)
811             (ConnectionHandle, Attribute, Value,
812             BufferLength, StringLength);
813 }
814
815
816 /*************************************************************************
817  *                              SQLGetConnectOption       [ODBC32.042]
818  */
819 SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
820 {
821         TRACE("\n");
822
823         if (gProxyHandle.dmHandle == NULL)
824         {
825                 return SQL_ERROR;
826         }
827
828         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCONNECTOPTION].func)
829             (ConnectionHandle, Option, Value);
830 }
831
832
833 /*************************************************************************
834  *                              SQLGetCursorName           [ODBC32.017]
835  */
836 SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle,
837              SQLCHAR *CursorName, SQLSMALLINT BufferLength,
838              SQLSMALLINT *NameLength)
839 {
840         TRACE("\n");
841
842         if (gProxyHandle.dmHandle == NULL)
843         {
844                 return SQL_ERROR;
845         }
846
847         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETCURSORNAME].func)
848             (StatementHandle, CursorName, BufferLength, NameLength);
849 }
850
851
852 /*************************************************************************
853  *                              SQLGetData           [ODBC32.043]
854  */
855 SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle,
856              SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
857              SQLPOINTER TargetValue, SQLINTEGER BufferLength,
858              SQLINTEGER *StrLen_or_Ind)
859 {
860         TRACE("\n");
861         if (gProxyHandle.dmHandle == NULL)
862         {
863                 return SQL_ERROR;
864         }
865
866         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDATA].func)
867             (StatementHandle, ColumnNumber, TargetType,
868             TargetValue, BufferLength, StrLen_or_Ind);
869 }
870
871
872 /*************************************************************************
873  *                              SQLGetDescField           [ODBC32.033]
874  */
875 SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle,
876              SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
877              SQLPOINTER Value, SQLINTEGER BufferLength,
878              SQLINTEGER *StringLength)
879 {
880         TRACE("\n");
881         if (gProxyHandle.dmHandle == NULL)
882         {
883                 return SQL_ERROR;
884         }
885
886         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCFIELD].func)
887             (DescriptorHandle, RecNumber, FieldIdentifier,
888             Value, BufferLength, StringLength);
889 }
890
891
892 /*************************************************************************
893  *                              SQLGetDescRec           [ODBC32.034]
894  */
895 SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle,
896              SQLSMALLINT RecNumber, SQLCHAR *Name,
897              SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
898              SQLSMALLINT *Type, SQLSMALLINT *SubType,
899              SQLINTEGER *Length, SQLSMALLINT *Precision,
900              SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
901 {
902         TRACE("\n");
903         if (gProxyHandle.dmHandle == NULL)
904         {
905                 return SQL_ERROR;
906         }
907
908         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDESCREC].func)
909             (DescriptorHandle, RecNumber, Name, BufferLength,
910             StringLength, Type, SubType, Length, Precision, Scale, Nullable);
911 }
912
913
914 /*************************************************************************
915  *                              SQLGetDiagField           [ODBC32.035]
916  */
917 SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
918              SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
919              SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
920              SQLSMALLINT *StringLength)
921 {
922         TRACE("\n");
923         if (gProxyHandle.dmHandle == NULL)
924         {
925                 return SQL_ERROR;
926         }
927
928         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGFIELD].func)
929             (HandleType, Handle, RecNumber, DiagIdentifier,
930             DiagInfo, BufferLength, StringLength);
931 }
932
933
934 /*************************************************************************
935  *                              SQLGetDiagRec           [ODBC32.036]
936  */
937 SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
938              SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
939              SQLINTEGER *NativeError, SQLCHAR *MessageText,
940              SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
941 {
942         TRACE("\n");
943         if (gProxyHandle.dmHandle == NULL)
944         {
945                 return SQL_ERROR;
946         }
947
948         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETDIAGREC].func)
949             (HandleType, Handle, RecNumber, Sqlstate, NativeError,
950             MessageText, BufferLength, TextLength);
951 }
952
953
954 /*************************************************************************
955  *                              SQLGetEnvAttr           [ODBC32.037]
956  */
957 SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle,
958              SQLINTEGER Attribute, SQLPOINTER Value,
959              SQLINTEGER BufferLength, SQLINTEGER *StringLength)
960 {
961         TRACE("\n");
962         if (gProxyHandle.dmHandle == NULL)
963         {
964                 return SQL_ERROR;
965         }
966
967         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETENVATTR].func)
968             (EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
969 }
970
971
972 /*************************************************************************
973  *                              SQLGetFunctions           [ODBC32.044]
974  */
975 SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
976 {
977         TRACE("\n");
978         if (gProxyHandle.dmHandle == NULL)
979         {
980                 return SQL_ERROR;
981         }
982
983         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETFUNCTIONS].func)
984             (ConnectionHandle, FunctionId, Supported);
985 }
986
987
988 /*************************************************************************
989  *                              SQLGetInfo           [ODBC32.045]
990  */
991 SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle,
992              SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
993              SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
994 {
995         TRACE("\n");
996         if (gProxyHandle.dmHandle == NULL)
997         {
998                 return SQL_ERROR;
999         }
1000
1001         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETINFO].func)
1002             (ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
1003 }
1004
1005
1006 /*************************************************************************
1007  *                              SQLGetStmtAttr           [ODBC32.038]
1008  */
1009 SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle,
1010              SQLINTEGER Attribute, SQLPOINTER Value,
1011              SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1012 {
1013         TRACE("\n");
1014         if (gProxyHandle.dmHandle == NULL)
1015         {
1016                 return SQL_ERROR;
1017         }
1018
1019         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTATTR].func)
1020             (StatementHandle, Attribute, Value, BufferLength, StringLength);
1021 }
1022
1023
1024 /*************************************************************************
1025  *                              SQLGetStmtOption           [ODBC32.046]
1026  */
1027 SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1028 {
1029         TRACE("\n");
1030         if (gProxyHandle.dmHandle == NULL)
1031         {
1032                 return SQL_ERROR;
1033         }
1034
1035         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETSTMTOPTION].func)
1036                 (StatementHandle, Option, Value);
1037 }
1038
1039
1040 /*************************************************************************
1041  *                              SQLGetTypeInfo           [ODBC32.047]
1042  */
1043 SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1044 {
1045         TRACE("\n");
1046         if (gProxyHandle.dmHandle == NULL)
1047         {
1048                 return SQL_ERROR;
1049         }
1050
1051         return (gProxyHandle.functions[SQLAPI_INDEX_SQLGETTYPEINFO].func)
1052             (StatementHandle, DataType);
1053 }
1054
1055
1056 /*************************************************************************
1057  *                              SQLNumResultCols           [ODBC32.018]
1058  */
1059 SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1060 {
1061         TRACE("\n");
1062         if (gProxyHandle.dmHandle == NULL)
1063         {
1064                 return SQL_ERROR;
1065         }
1066
1067         return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMRESULTCOLS].func)
1068             (StatementHandle, ColumnCount);
1069 }
1070
1071
1072 /*************************************************************************
1073  *                              SQLParamData           [ODBC32.048]
1074  */
1075 SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1076 {
1077         TRACE("\n");
1078         if (gProxyHandle.dmHandle == NULL)
1079         {
1080                 return SQL_ERROR;
1081         }
1082
1083         return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMDATA].func)
1084             (StatementHandle, Value);
1085 }
1086
1087
1088 /*************************************************************************
1089  *                              SQLPrepare           [ODBC32.019]
1090  */
1091 SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1092 {
1093         TRACE("\n");
1094         if (gProxyHandle.dmHandle == NULL)
1095         {
1096                 return SQL_ERROR;
1097         }
1098
1099         return (gProxyHandle.functions[SQLAPI_INDEX_SQLPREPARE].func)
1100             (StatementHandle, StatementText, TextLength);
1101 }
1102
1103
1104 /*************************************************************************
1105  *                              SQLPutData           [ODBC32.049]
1106  */
1107 SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLINTEGER StrLen_or_Ind)
1108 {
1109         TRACE("\n");
1110         if (gProxyHandle.dmHandle == NULL)
1111         {
1112                 return SQL_ERROR;
1113         }
1114
1115         return (gProxyHandle.functions[SQLAPI_INDEX_SQLPUTDATA].func)
1116             (StatementHandle, Data, StrLen_or_Ind);
1117 }
1118
1119
1120 /*************************************************************************
1121  *                              SQLRowCount           [ODBC32.020]
1122  */
1123 SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLINTEGER *RowCount)
1124 {
1125         TRACE("\n");
1126         if (gProxyHandle.dmHandle == NULL)
1127         {
1128                 return SQL_ERROR;
1129         }
1130
1131         return (gProxyHandle.functions[SQLAPI_INDEX_SQLROWCOUNT].func)
1132             (StatementHandle, RowCount);
1133 }
1134
1135
1136 /*************************************************************************
1137  *                              SQLSetConnectAttr           [ODBC32.039]
1138  */
1139 SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute,
1140         SQLPOINTER Value, SQLINTEGER StringLength)
1141 {
1142         TRACE("\n");
1143         if (gProxyHandle.dmHandle == NULL)
1144         {
1145                 return SQL_ERROR;
1146         }
1147
1148         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTATTR].func)
1149             (ConnectionHandle, Attribute, Value, StringLength);
1150 }
1151
1152
1153 /*************************************************************************
1154  *                              SQLSetConnectOption           [ODBC32.050]
1155  */
1156 SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1157 {
1158         TRACE("\n");
1159         if (gProxyHandle.dmHandle == NULL)
1160         {
1161                 return SQL_ERROR;
1162         }
1163
1164         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCONNECTOPTION].func)
1165             (ConnectionHandle, Option, Value);
1166 }
1167
1168
1169 /*************************************************************************
1170  *                              SQLSetCursorName           [ODBC32.021]
1171  */
1172 SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
1173 {
1174         TRACE("\n");
1175         if (gProxyHandle.dmHandle == NULL)
1176         {
1177                 return SQL_ERROR;
1178         }
1179
1180         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETCURSORNAME].func)
1181             (StatementHandle, CursorName, NameLength);
1182 }
1183
1184
1185 /*************************************************************************
1186  *                              SQLSetDescField           [ODBC32.073]
1187  */
1188 SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle,
1189              SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1190              SQLPOINTER Value, SQLINTEGER BufferLength)
1191 {
1192         TRACE("\n");
1193         if (gProxyHandle.dmHandle == NULL)
1194         {
1195                 return SQL_ERROR;
1196         }
1197
1198         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCFIELD].func)
1199             (DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
1200 }
1201
1202
1203 /*************************************************************************
1204  *                              SQLSetDescRec           [ODBC32.074]
1205  */
1206 SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle,
1207              SQLSMALLINT RecNumber, SQLSMALLINT Type,
1208              SQLSMALLINT SubType, SQLINTEGER Length,
1209              SQLSMALLINT Precision, SQLSMALLINT Scale,
1210              SQLPOINTER Data, SQLINTEGER *StringLength,
1211              SQLINTEGER *Indicator)
1212 {
1213         TRACE("\n");
1214         if (gProxyHandle.dmHandle == NULL)
1215         {
1216                 return SQL_ERROR;
1217         }
1218
1219         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETDESCREC].func)
1220             (DescriptorHandle, RecNumber, Type, SubType, Length,
1221             Precision, Scale, Data, StringLength, Indicator);
1222 }
1223
1224
1225 /*************************************************************************
1226  *                              SQLSetEnvAttr           [ODBC32.075]
1227  */
1228 SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle,
1229              SQLINTEGER Attribute, SQLPOINTER Value,
1230              SQLINTEGER StringLength)
1231 {
1232         TRACE("\n");
1233         if (gProxyHandle.dmHandle == NULL)
1234         {
1235                 return SQL_ERROR;
1236         }
1237
1238         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETENVATTR].func)
1239             (EnvironmentHandle, Attribute, Value, StringLength);
1240 }
1241
1242
1243 /*************************************************************************
1244  *                              SQLSetParam           [ODBC32.022]
1245  */
1246 SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle,
1247              SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1248              SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
1249              SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
1250              SQLINTEGER *StrLen_or_Ind)
1251 {
1252         TRACE("\n");
1253         if (gProxyHandle.dmHandle == NULL)
1254         {
1255                 return SQL_ERROR;
1256         }
1257
1258         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPARAM].func)
1259             (StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision,
1260              ParameterScale, ParameterValue, StrLen_or_Ind);
1261 }
1262
1263
1264 /*************************************************************************
1265  *                              SQLSetStmtAttr           [ODBC32.076]
1266  */
1267 SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle,
1268                  SQLINTEGER Attribute, SQLPOINTER Value,
1269                  SQLINTEGER StringLength)
1270 {
1271         TRACE("\n");
1272         if (gProxyHandle.dmHandle == NULL)
1273         {
1274                 return SQL_ERROR;
1275         }
1276
1277         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTATTR].func)
1278             (StatementHandle, Attribute, Value, StringLength);
1279 }
1280
1281
1282 /*************************************************************************
1283  *                              SQLSetStmtOption           [ODBC32.051]
1284  */
1285 SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLUINTEGER Value)
1286 {
1287         TRACE("\n");
1288         if (gProxyHandle.dmHandle == NULL)
1289         {
1290                 return SQL_ERROR;
1291         }
1292
1293         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSTMTOPTION].func)
1294             (StatementHandle, Option, Value);
1295 }
1296
1297
1298 /*************************************************************************
1299  *                              SQLSpecialColumns           [ODBC32.052]
1300  */
1301 SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle,
1302              SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
1303              SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
1304              SQLSMALLINT NameLength2, SQLCHAR *TableName,
1305              SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
1306              SQLUSMALLINT Nullable)
1307 {
1308         if (gProxyHandle.dmHandle == NULL)
1309         {
1310                 return SQL_ERROR;
1311         }
1312
1313         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSPECIALCOLUMNS].func)
1314             (StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
1315              NameLength2, TableName, NameLength3, Scope, Nullable);
1316 }
1317
1318
1319 /*************************************************************************
1320  *                              SQLStatistics           [ODBC32.053]
1321  */
1322 SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle,
1323              SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1324              SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1325              SQLCHAR *TableName, SQLSMALLINT NameLength3,
1326              SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
1327 {
1328         TRACE("\n");
1329         if (gProxyHandle.dmHandle == NULL)
1330         {
1331                 return SQL_ERROR;
1332         }
1333
1334         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSTATISTICS].func)
1335             (StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
1336              TableName, NameLength3, Unique, Reserved);
1337 }
1338
1339
1340 /*************************************************************************
1341  *                              SQLTables           [ODBC32.054]
1342  */
1343 SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle,
1344              SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1345              SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1346              SQLCHAR *TableName, SQLSMALLINT NameLength3,
1347              SQLCHAR *TableType, SQLSMALLINT NameLength4)
1348 {
1349         TRACE("\n");
1350         if (gProxyHandle.dmHandle == NULL)
1351         {
1352                 return SQL_ERROR;
1353         }
1354
1355         return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLES].func)
1356                 (StatementHandle, CatalogName, NameLength1,
1357                 SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
1358 }
1359
1360
1361 /*************************************************************************
1362  *                              SQLTransact           [ODBC32.023]
1363  */
1364 SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle,
1365         SQLUSMALLINT CompletionType)
1366 {
1367         TRACE("\n");
1368         if (gProxyHandle.dmHandle == NULL)
1369         {
1370                 return SQL_ERROR;
1371         }
1372
1373         return (gProxyHandle.functions[SQLAPI_INDEX_SQLTRANSACT].func)
1374             (EnvironmentHandle, ConnectionHandle, CompletionType);
1375 }
1376
1377
1378 /*************************************************************************
1379  *                              SQLBrowseConnect           [ODBC32.055]
1380  */
1381 SQLRETURN WINAPI SQLBrowseConnect(
1382     SQLHDBC            hdbc,
1383     SQLCHAR               *szConnStrIn,
1384     SQLSMALLINT        cbConnStrIn,
1385     SQLCHAR               *szConnStrOut,
1386     SQLSMALLINT        cbConnStrOutMax,
1387     SQLSMALLINT       *pcbConnStrOut)
1388 {
1389         TRACE("\n");
1390         if (gProxyHandle.dmHandle == NULL)
1391         {
1392                 return SQL_ERROR;
1393         }
1394
1395         return (gProxyHandle.functions[SQLAPI_INDEX_SQLBROWSECONNECT].func)
1396                 (hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
1397 }
1398
1399
1400 /*************************************************************************
1401  *                              SQLBulkOperations           [ODBC32.078]
1402  */
1403 SQLRETURN WINAPI  SQLBulkOperations(
1404         SQLHSTMT                        StatementHandle,
1405         SQLSMALLINT                     Operation)
1406 {
1407         TRACE("\n");
1408         if (gProxyHandle.dmHandle == NULL)
1409         {
1410                 return SQL_ERROR;
1411         }
1412
1413         return (gProxyHandle.functions[SQLAPI_INDEX_SQLBULKOPERATIONS].func)
1414                    (StatementHandle, Operation);
1415 }
1416
1417
1418 /*************************************************************************
1419  *                              SQLColAttributes           [ODBC32.006]
1420  */
1421 SQLRETURN WINAPI SQLColAttributes(
1422     SQLHSTMT           hstmt,
1423     SQLUSMALLINT       icol,
1424     SQLUSMALLINT       fDescType,
1425     SQLPOINTER         rgbDesc,
1426     SQLSMALLINT        cbDescMax,
1427     SQLSMALLINT           *pcbDesc,
1428     SQLINTEGER            *pfDesc)
1429 {
1430         TRACE("\n");
1431         if (gProxyHandle.dmHandle == NULL)
1432         {
1433                 return SQL_ERROR;
1434         }
1435
1436         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLATTRIBUTES].func)
1437                    (hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1438 }
1439
1440
1441 /*************************************************************************
1442  *                              SQLColumnPrivileges           [ODBC32.056]
1443  */
1444 SQLRETURN WINAPI SQLColumnPrivileges(
1445     SQLHSTMT           hstmt,
1446     SQLCHAR               *szCatalogName,
1447     SQLSMALLINT        cbCatalogName,
1448     SQLCHAR               *szSchemaName,
1449     SQLSMALLINT        cbSchemaName,
1450     SQLCHAR               *szTableName,
1451     SQLSMALLINT        cbTableName,
1452     SQLCHAR               *szColumnName,
1453     SQLSMALLINT        cbColumnName)
1454 {
1455         TRACE("\n");
1456         if (gProxyHandle.dmHandle == NULL)
1457         {
1458                 return SQL_ERROR;
1459         }
1460
1461         return (gProxyHandle.functions[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES].func)
1462                    (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1463                     szTableName, cbTableName, szColumnName, cbColumnName);
1464 }
1465
1466
1467 /*************************************************************************
1468  *                              SQLDescribeParam          [ODBC32.058]
1469  */
1470 SQLRETURN WINAPI SQLDescribeParam(
1471     SQLHSTMT           hstmt,
1472     SQLUSMALLINT       ipar,
1473     SQLSMALLINT           *pfSqlType,
1474     SQLUINTEGER           *pcbParamDef,
1475     SQLSMALLINT           *pibScale,
1476     SQLSMALLINT           *pfNullable)
1477 {
1478         TRACE("\n");
1479         if (gProxyHandle.dmHandle == NULL)
1480         {
1481                 return SQL_ERROR;
1482         }
1483
1484         return (gProxyHandle.functions[SQLAPI_INDEX_SQLDESCRIBEPARAM].func)
1485                    (hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable);
1486 }
1487
1488
1489 /*************************************************************************
1490  *                              SQLExtendedFetch           [ODBC32.059]
1491  */
1492 SQLRETURN WINAPI SQLExtendedFetch(
1493     SQLHSTMT           hstmt,
1494     SQLUSMALLINT       fFetchType,
1495     SQLINTEGER         irow,
1496     SQLUINTEGER           *pcrow,
1497     SQLUSMALLINT          *rgfRowStatus)
1498 {
1499         TRACE("\n");
1500         if (gProxyHandle.dmHandle == NULL)
1501         {
1502                 return SQL_ERROR;
1503         }
1504
1505         return (gProxyHandle.functions[SQLAPI_INDEX_SQLEXTENDEDFETCH].func)
1506                    (hstmt, fFetchType, irow, pcrow, rgfRowStatus);
1507 }
1508
1509
1510 /*************************************************************************
1511  *                              SQLForeignKeys           [ODBC32.060]
1512  */
1513 SQLRETURN WINAPI SQLForeignKeys(
1514     SQLHSTMT           hstmt,
1515     SQLCHAR               *szPkCatalogName,
1516     SQLSMALLINT        cbPkCatalogName,
1517     SQLCHAR               *szPkSchemaName,
1518     SQLSMALLINT        cbPkSchemaName,
1519     SQLCHAR               *szPkTableName,
1520     SQLSMALLINT        cbPkTableName,
1521     SQLCHAR               *szFkCatalogName,
1522     SQLSMALLINT        cbFkCatalogName,
1523     SQLCHAR               *szFkSchemaName,
1524     SQLSMALLINT        cbFkSchemaName,
1525     SQLCHAR               *szFkTableName,
1526     SQLSMALLINT        cbFkTableName)
1527 {
1528         TRACE("\n");
1529         if (gProxyHandle.dmHandle == NULL)
1530         {
1531                 return SQL_ERROR;
1532         }
1533
1534         return (gProxyHandle.functions[SQLAPI_INDEX_SQLFOREIGNKEYS].func)
1535                    (hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName,
1536                     szPkTableName, cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName,
1537                         cbFkSchemaName, szFkTableName, cbFkTableName);
1538 }
1539
1540
1541 /*************************************************************************
1542  *                              SQLMoreResults           [ODBC32.061]
1543  */
1544 SQLRETURN WINAPI SQLMoreResults(SQLHSTMT hstmt)
1545 {
1546         TRACE("\n");
1547         if (gProxyHandle.dmHandle == NULL)
1548         {
1549                 return SQL_ERROR;
1550         }
1551
1552         return (gProxyHandle.functions[SQLAPI_INDEX_SQLMORERESULTS].func) (hstmt);
1553 }
1554
1555
1556 /*************************************************************************
1557  *                              SQLNativeSql           [ODBC32.062]
1558  */
1559 SQLRETURN WINAPI SQLNativeSql(
1560     SQLHDBC            hdbc,
1561     SQLCHAR               *szSqlStrIn,
1562     SQLINTEGER         cbSqlStrIn,
1563     SQLCHAR               *szSqlStr,
1564     SQLINTEGER         cbSqlStrMax,
1565     SQLINTEGER            *pcbSqlStr)
1566 {
1567         TRACE("\n");
1568         if (gProxyHandle.dmHandle == NULL)
1569         {
1570                 return SQL_ERROR;
1571         }
1572
1573         return (gProxyHandle.functions[SQLAPI_INDEX_SQLNATIVESQL].func)
1574                    (hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
1575 }
1576
1577
1578 /*************************************************************************
1579  *                              SQLNumParams           [ODBC32.063]
1580  */
1581 SQLRETURN WINAPI SQLNumParams(
1582     SQLHSTMT           hstmt,
1583     SQLSMALLINT           *pcpar)
1584 {
1585         TRACE("\n");
1586         if (gProxyHandle.dmHandle == NULL)
1587         {
1588                 return SQL_ERROR;
1589         }
1590
1591         return (gProxyHandle.functions[SQLAPI_INDEX_SQLNUMPARAMS].func) (hstmt, pcpar);
1592 }
1593
1594
1595 /*************************************************************************
1596  *                              SQLParamOptions           [ODBC32.064]
1597  */
1598 SQLRETURN WINAPI SQLParamOptions(
1599     SQLHSTMT           hstmt,
1600     SQLUINTEGER        crow,
1601     SQLUINTEGER           *pirow)
1602 {
1603         TRACE("\n");
1604         if (gProxyHandle.dmHandle == NULL)
1605         {
1606                 return SQL_ERROR;
1607         }
1608
1609         return (gProxyHandle.functions[SQLAPI_INDEX_SQLPARAMOPTIONS].func) (hstmt, crow, pirow);
1610 }
1611
1612
1613 /*************************************************************************
1614  *                              SQLPrimaryKeys           [ODBC32.065]
1615  */
1616 SQLRETURN WINAPI SQLPrimaryKeys(
1617     SQLHSTMT           hstmt,
1618     SQLCHAR               *szCatalogName,
1619     SQLSMALLINT        cbCatalogName,
1620     SQLCHAR               *szSchemaName,
1621     SQLSMALLINT        cbSchemaName,
1622     SQLCHAR               *szTableName,
1623     SQLSMALLINT        cbTableName)
1624 {
1625         TRACE("\n");
1626         if (gProxyHandle.dmHandle == NULL)
1627         {
1628                 return SQL_ERROR;
1629         }
1630
1631         return (gProxyHandle.functions[SQLAPI_INDEX_SQLPRIMARYKEYS].func)
1632                    (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1633                     szTableName, cbTableName);
1634 }
1635
1636
1637 /*************************************************************************
1638  *                              SQLProcedureColumns           [ODBC32.066]
1639  */
1640 SQLRETURN WINAPI SQLProcedureColumns(
1641     SQLHSTMT           hstmt,
1642     SQLCHAR               *szCatalogName,
1643     SQLSMALLINT        cbCatalogName,
1644     SQLCHAR               *szSchemaName,
1645     SQLSMALLINT        cbSchemaName,
1646     SQLCHAR               *szProcName,
1647     SQLSMALLINT        cbProcName,
1648     SQLCHAR               *szColumnName,
1649     SQLSMALLINT        cbColumnName)
1650 {
1651         TRACE("\n");
1652         if (gProxyHandle.dmHandle == NULL)
1653         {
1654                 return SQL_ERROR;
1655         }
1656
1657         return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURECOLUMNS].func)
1658                    (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1659                     szProcName, cbProcName, szColumnName, cbColumnName);
1660 }
1661
1662
1663 /*************************************************************************
1664  *                              SQLProcedures           [ODBC32.067]
1665  */
1666 SQLRETURN WINAPI SQLProcedures(
1667     SQLHSTMT           hstmt,
1668     SQLCHAR               *szCatalogName,
1669     SQLSMALLINT        cbCatalogName,
1670     SQLCHAR               *szSchemaName,
1671     SQLSMALLINT        cbSchemaName,
1672     SQLCHAR               *szProcName,
1673     SQLSMALLINT        cbProcName)
1674 {
1675         TRACE("\n");
1676         if (gProxyHandle.dmHandle == NULL)
1677         {
1678                 return SQL_ERROR;
1679         }
1680
1681         return (gProxyHandle.functions[SQLAPI_INDEX_SQLPROCEDURES].func)
1682                    (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1683                     szProcName, cbProcName);
1684 }
1685
1686
1687 /*************************************************************************
1688  *                              SQLSetPos           [ODBC32.068]
1689  */
1690 SQLRETURN WINAPI SQLSetPos(
1691     SQLHSTMT           hstmt,
1692     SQLUSMALLINT       irow,
1693     SQLUSMALLINT       fOption,
1694     SQLUSMALLINT       fLock)
1695 {
1696         TRACE("\n");
1697         if (gProxyHandle.dmHandle == NULL)
1698         {
1699                 return SQL_ERROR;
1700         }
1701
1702         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETPOS].func)
1703                    (hstmt, irow, fOption, fLock);
1704 }
1705
1706
1707 /*************************************************************************
1708  *                              SQLTablePrivileges           [ODBC32.070]
1709  */
1710 SQLRETURN WINAPI SQLTablePrivileges(
1711     SQLHSTMT           hstmt,
1712     SQLCHAR               *szCatalogName,
1713     SQLSMALLINT        cbCatalogName,
1714     SQLCHAR               *szSchemaName,
1715     SQLSMALLINT        cbSchemaName,
1716     SQLCHAR               *szTableName,
1717     SQLSMALLINT        cbTableName)
1718 {
1719         TRACE("\n");
1720         if (gProxyHandle.dmHandle == NULL)
1721         {
1722                 return SQL_ERROR;
1723         }
1724
1725         return (gProxyHandle.functions[SQLAPI_INDEX_SQLTABLEPRIVILEGES].func)
1726                    (hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1727                     szTableName, cbTableName);
1728 }
1729
1730
1731 /*************************************************************************
1732  *                              SQLDrivers           [ODBC32.071]
1733  */
1734 SQLRETURN WINAPI SQLDrivers(
1735     SQLHENV            henv,
1736     SQLUSMALLINT       fDirection,
1737     SQLCHAR               *szDriverDesc,
1738     SQLSMALLINT        cbDriverDescMax,
1739     SQLSMALLINT           *pcbDriverDesc,
1740     SQLCHAR               *szDriverAttributes,
1741     SQLSMALLINT        cbDriverAttrMax,
1742     SQLSMALLINT           *pcbDriverAttr)
1743 {
1744         TRACE("\n");
1745         if (gProxyHandle.dmHandle == NULL)
1746         {
1747                 return SQL_ERROR;
1748         }
1749
1750         return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERS].func)
1751                 (henv, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
1752                  szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
1753 }
1754
1755
1756 /*************************************************************************
1757  *                              SQLBindParameter           [ODBC32.072]
1758  */
1759 SQLRETURN WINAPI SQLBindParameter(
1760     SQLHSTMT           hstmt,
1761     SQLUSMALLINT       ipar,
1762     SQLSMALLINT        fParamType,
1763     SQLSMALLINT        fCType,
1764     SQLSMALLINT        fSqlType,
1765     SQLUINTEGER        cbColDef,
1766     SQLSMALLINT        ibScale,
1767     SQLPOINTER         rgbValue,
1768     SQLINTEGER         cbValueMax,
1769     SQLINTEGER            *pcbValue)
1770 {
1771         TRACE("\n");
1772         if (gProxyHandle.dmHandle == NULL)
1773         {
1774                 return SQL_ERROR;
1775         }
1776
1777         return (gProxyHandle.functions[SQLAPI_INDEX_SQLBINDPARAMETER].func)
1778                 (hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale,
1779                  rgbValue, cbValueMax, pcbValue);
1780 }
1781
1782
1783 /*************************************************************************
1784  *                              SQLDriverConnect           [ODBC32.041]
1785  */
1786 SQLRETURN WINAPI SQLDriverConnect(
1787     SQLHDBC            hdbc,
1788     SQLHWND            hwnd,
1789     SQLCHAR            *conn_str_in,
1790     SQLSMALLINT        len_conn_str_in,
1791     SQLCHAR            *conn_str_out,
1792     SQLSMALLINT        conn_str_out_max,
1793     SQLSMALLINT        *ptr_conn_str_out,
1794     SQLUSMALLINT       driver_completion )
1795 {
1796         TRACE("\n");
1797         if (gProxyHandle.dmHandle == NULL)
1798         {
1799                 return SQL_ERROR;
1800         }
1801
1802         return (gProxyHandle.functions[SQLAPI_INDEX_SQLDRIVERCONNECT].func)
1803                  (hdbc, hwnd, conn_str_in, len_conn_str_in, conn_str_out,
1804                   conn_str_out_max, ptr_conn_str_out, driver_completion);
1805 }
1806
1807
1808 /*************************************************************************
1809  *                              SQLSetScrollOptions           [ODBC32.069]
1810  */
1811 SQLRETURN WINAPI SQLSetScrollOptions(
1812     SQLHSTMT           statement_handle,
1813     SQLUSMALLINT       f_concurrency,
1814     SQLINTEGER         crow_keyset,
1815     SQLUSMALLINT       crow_rowset )
1816 {
1817         TRACE("\n");
1818         if (gProxyHandle.dmHandle == NULL)
1819         {
1820                 return SQL_ERROR;
1821         }
1822
1823         return (gProxyHandle.functions[SQLAPI_INDEX_SQLSETSCROLLOPTIONS].func)
1824                    (statement_handle, f_concurrency, crow_keyset, crow_rowset);
1825 }
1826
1827