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