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