4 * Proxy ODBC driver manager. This manager delegates all ODBC calls to a real ODBC driver manager which is either:
5 * 1) its name is defined in the environment variable LIB_ODBC_DRIVER_MANAGER
6 * 2) if LIB_ODBC_DRIVER_MANAGER is not defined, a default library libodbc.so will be used.
8 * Copyright 1999 Xiang Li, Corel Corporation
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "wine/port.h"
34 #include "wine/debug.h"
35 #include "wine/library.h"
41 #include "proxyodbc.h"
43 static BOOL
ODBC_LoadDriverManager(void);
44 static BOOL
ODBC_LoadDMFunctions(void);
46 WINE_DEFAULT_DEBUG_CHANNEL(odbc
);
48 static const DM_FUNC template_func
[] =
50 /* 00 */ { SQL_API_SQLALLOCCONNECT
, "SQLAllocConnect", SQLAllocConnect
, NULL
},
51 /* 01 */ { SQL_API_SQLALLOCENV
, "SQLAllocEnv", SQLAllocEnv
, NULL
},
52 /* 02 */ { SQL_API_SQLALLOCHANDLE
, "SQLAllocHandle", SQLAllocHandle
, NULL
},
53 /* 03 */ { SQL_API_SQLALLOCSTMT
, "SQLAllocStmt", SQLAllocStmt
, NULL
},
54 /* 04 */ { SQL_API_SQLALLOCHANDLESTD
, "SQLAllocHandleStd", SQLAllocHandleStd
, NULL
},
55 /* 05 */ { SQL_API_SQLBINDCOL
, "SQLBindCol", SQLBindCol
, NULL
},
56 /* 06 */ { SQL_API_SQLBINDPARAM
, "SQLBindParam", SQLBindParam
, NULL
},
57 /* 07 */ { SQL_API_SQLBINDPARAMETER
, "SQLBindParameter", SQLBindParameter
, NULL
},
58 /* 08 */ { SQL_API_SQLBROWSECONNECT
, "SQLBrowseConnect", SQLBrowseConnect
, NULL
},
59 /* 09 */ { SQL_API_SQLBULKOPERATIONS
, "SQLBulkOperations", SQLBulkOperations
, NULL
},
60 /* 10 */ { SQL_API_SQLCANCEL
, "SQLCancel", SQLCancel
, NULL
},
61 /* 11 */ { SQL_API_SQLCLOSECURSOR
, "SQLCloseCursor", SQLCloseCursor
, NULL
},
62 /* 12 */ { SQL_API_SQLCOLATTRIBUTE
, "SQLColAttribute", SQLColAttribute
, NULL
},
63 /* 13 */ { SQL_API_SQLCOLATTRIBUTES
, "SQLColAttributes", SQLColAttributes
, NULL
},
64 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES
, "SQLColumnPrivileges", SQLColumnPrivileges
, NULL
},
65 /* 15 */ { SQL_API_SQLCOLUMNS
, "SQLColumns", SQLColumns
, NULL
},
66 /* 16 */ { SQL_API_SQLCONNECT
, "SQLConnect", SQLConnect
, NULL
},
67 /* 17 */ { SQL_API_SQLCOPYDESC
, "SQLCopyDesc", SQLCopyDesc
, NULL
},
68 /* 18 */ { SQL_API_SQLDATASOURCES
, "SQLDataSources", SQLDataSources
, NULL
},
69 /* 19 */ { SQL_API_SQLDESCRIBECOL
, "SQLDescribeCol", SQLDescribeCol
, NULL
},
70 /* 20 */ { SQL_API_SQLDESCRIBEPARAM
, "SQLDescribeParam", SQLDescribeParam
, NULL
},
71 /* 21 */ { SQL_API_SQLDISCONNECT
, "SQLDisconnect", SQLDisconnect
, NULL
},
72 /* 22 */ { SQL_API_SQLDRIVERCONNECT
, "SQLDriverConnect", SQLDriverConnect
, NULL
},
73 /* 23 */ { SQL_API_SQLDRIVERS
, "SQLDrivers", SQLDrivers
, NULL
},
74 /* 24 */ { SQL_API_SQLENDTRAN
, "SQLEndTran", SQLEndTran
, NULL
},
75 /* 25 */ { SQL_API_SQLERROR
, "SQLError", SQLError
, NULL
},
76 /* 26 */ { SQL_API_SQLEXECDIRECT
, "SQLExecDirect", SQLExecDirect
, NULL
},
77 /* 27 */ { SQL_API_SQLEXECUTE
, "SQLExecute", SQLExecute
, NULL
},
78 /* 28 */ { SQL_API_SQLEXTENDEDFETCH
, "SQLExtendedFetch", SQLExtendedFetch
, NULL
},
79 /* 29 */ { SQL_API_SQLFETCH
, "SQLFetch", SQLFetch
, NULL
},
80 /* 30 */ { SQL_API_SQLFETCHSCROLL
, "SQLFetchScroll", SQLFetchScroll
, NULL
},
81 /* 31 */ { SQL_API_SQLFOREIGNKEYS
, "SQLForeignKeys", SQLForeignKeys
, NULL
},
82 /* 32 */ { SQL_API_SQLFREEENV
, "SQLFreeEnv", SQLFreeEnv
, NULL
},
83 /* 33 */ { SQL_API_SQLFREEHANDLE
, "SQLFreeHandle", SQLFreeHandle
, NULL
},
84 /* 34 */ { SQL_API_SQLFREESTMT
, "SQLFreeStmt", SQLFreeStmt
, NULL
},
85 /* 35 */ { SQL_API_SQLFREECONNECT
, "SQLFreeConnect", SQLFreeConnect
, NULL
},
86 /* 36 */ { SQL_API_SQLGETCONNECTATTR
, "SQLGetConnectAttr", SQLGetConnectAttr
, NULL
},
87 /* 37 */ { SQL_API_SQLGETCONNECTOPTION
, "SQLGetConnectOption", SQLGetConnectOption
, NULL
},
88 /* 38 */ { SQL_API_SQLGETCURSORNAME
, "SQLGetCursorName", SQLGetCursorName
, NULL
},
89 /* 39 */ { SQL_API_SQLGETDATA
, "SQLGetData", SQLGetData
, NULL
},
90 /* 40 */ { SQL_API_SQLGETDESCFIELD
, "SQLGetDescField", SQLGetDescField
, NULL
},
91 /* 41 */ { SQL_API_SQLGETDESCREC
, "SQLGetDescRec", SQLGetDescRec
, NULL
},
92 /* 42 */ { SQL_API_SQLGETDIAGFIELD
, "SQLGetDiagField", SQLGetDiagField
, NULL
},
93 /* 43 */ { SQL_API_SQLGETENVATTR
, "SQLGetEnvAttr", SQLGetEnvAttr
, NULL
},
94 /* 44 */ { SQL_API_SQLGETFUNCTIONS
, "SQLGetFunctions", SQLGetFunctions
, NULL
},
95 /* 45 */ { SQL_API_SQLGETINFO
, "SQLGetInfo", SQLGetInfo
, NULL
},
96 /* 46 */ { SQL_API_SQLGETSTMTATTR
, "SQLGetStmtAttr", SQLGetStmtAttr
, NULL
},
97 /* 47 */ { SQL_API_SQLGETSTMTOPTION
, "SQLGetStmtOption", SQLGetStmtOption
, NULL
},
98 /* 48 */ { SQL_API_SQLGETTYPEINFO
, "SQLGetTypeInfo", SQLGetTypeInfo
, NULL
},
99 /* 49 */ { SQL_API_SQLMORERESULTS
, "SQLMoreResults", SQLMoreResults
, NULL
},
100 /* 50 */ { SQL_API_SQLNATIVESQL
, "SQLNativeSql", SQLNativeSql
, NULL
},
101 /* 51 */ { SQL_API_SQLNUMPARAMS
, "SQLNumParams", SQLNumParams
, NULL
},
102 /* 52 */ { SQL_API_SQLNUMRESULTCOLS
, "SQLNumResultCols", SQLNumResultCols
, NULL
},
103 /* 53 */ { SQL_API_SQLPARAMDATA
, "SQLParamData", SQLParamData
, NULL
},
104 /* 54 */ { SQL_API_SQLPARAMOPTIONS
, "SQLParamOptions", SQLParamOptions
, NULL
},
105 /* 55 */ { SQL_API_SQLPREPARE
, "SQLPrepare", SQLPrepare
, NULL
},
106 /* 56 */ { SQL_API_SQLPRIMARYKEYS
, "SQLPrimaryKeys", SQLPrimaryKeys
, NULL
},
107 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS
, "SQLProcedureColumns", SQLProcedureColumns
, NULL
},
108 /* 58 */ { SQL_API_SQLPROCEDURES
, "SQLProcedures", SQLProcedures
, NULL
},
109 /* 59 */ { SQL_API_SQLPUTDATA
, "SQLPutData", SQLPutData
, NULL
},
110 /* 60 */ { SQL_API_SQLROWCOUNT
, "SQLRowCount", SQLRowCount
, NULL
},
111 /* 61 */ { SQL_API_SQLSETCONNECTATTR
, "SQLSetConnectAttr", SQLSetConnectAttr
, NULL
},
112 /* 62 */ { SQL_API_SQLSETCONNECTOPTION
, "SQLSetConnectOption", SQLSetConnectOption
, NULL
},
113 /* 63 */ { SQL_API_SQLSETCURSORNAME
, "SQLSetCursorName", SQLSetCursorName
, NULL
},
114 /* 64 */ { SQL_API_SQLSETDESCFIELD
, "SQLSetDescField", SQLSetDescField
, NULL
},
115 /* 65 */ { SQL_API_SQLSETDESCREC
, "SQLSetDescRec", SQLSetDescRec
, NULL
},
116 /* 66 */ { SQL_API_SQLSETENVATTR
, "SQLSetEnvAttr", SQLSetEnvAttr
, NULL
},
117 /* 67 */ { SQL_API_SQLSETPARAM
, "SQLSetParam", SQLSetParam
, NULL
},
118 /* 68 */ { SQL_API_SQLSETPOS
, "SQLSetPos", SQLSetPos
, NULL
},
119 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS
, "SQLSetScrollOptions", SQLSetScrollOptions
, NULL
},
120 /* 70 */ { SQL_API_SQLSETSTMTATTR
, "SQLSetStmtAttr", SQLSetStmtAttr
, NULL
},
121 /* 71 */ { SQL_API_SQLSETSTMTOPTION
, "SQLSetStmtOption", SQLSetStmtOption
, NULL
},
122 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS
, "SQLSpecialColumns", SQLSpecialColumns
, NULL
},
123 /* 73 */ { SQL_API_SQLSTATISTICS
, "SQLStatistics", SQLStatistics
, NULL
},
124 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES
, "SQLTablePrivileges", SQLTablePrivileges
, NULL
},
125 /* 75 */ { SQL_API_SQLTABLES
, "SQLTables", SQLTables
, NULL
},
126 /* 76 */ { SQL_API_SQLTRANSACT
, "SQLTransact", SQLTransact
, NULL
},
127 /* 77 */ { SQL_API_SQLGETDIAGREC
, "SQLGetDiagRec", SQLGetDiagRec
, NULL
},
130 static PROXYHANDLE gProxyHandle
= {
135 ERROR_LIBRARY_NOT_FOUND
,
143 /* What is the difference between these two (dmHandle cf READY_AND_dmHandle)? When does one use one and when the other? */
145 #define CHECK_dmHandle() \
147 if (gProxyHandle.dmHandle == NULL) \
149 TRACE ("Not ready\n"); \
154 #define CHECK_READY_AND_dmHandle() \
156 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) \
158 TRACE ("Not ready\n"); \
163 SQLRETURN
SQLDummyFunc()
165 TRACE("SQLDummyFunc: \n");
169 /***********************************************************************
170 * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'.
173 * hinstDLL [I] handle to the DLL's instance
175 * lpvReserved [I] reserved, must be NULL
183 MAIN_OdbcInit(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
186 TRACE("Initializing or Finalizing proxy ODBC: %x,%lx,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
188 if (fdwReason
== DLL_PROCESS_ATTACH
)
190 TRACE("Loading ODBC...\n");
191 if (ODBC_LoadDriverManager())
192 ODBC_LoadDMFunctions();
194 else if (fdwReason
== DLL_PROCESS_DETACH
)
196 TRACE("Unloading ODBC...\n");
197 if (gProxyHandle
.bFunctionReady
)
199 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
201 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
205 if (gProxyHandle
.dmHandle
)
207 wine_dlclose(gProxyHandle
.dmHandle
,NULL
,0);
208 gProxyHandle
.dmHandle
= NULL
;
216 /***********************************************************************
217 * ODBC_LoadDriverManager [Internal] Load ODBC library.
226 static BOOL
ODBC_LoadDriverManager(void)
228 const char *s
= getenv("LIB_ODBC_DRIVER_MANAGER");
233 gProxyHandle
.bFunctionReady
= FALSE
;
235 if (s
!= NULL
&& strlen (s
) >= sizeof(gProxyHandle
.dmLibName
))
237 ERR("Driver name too long (%s)\n",s
);
240 if (s
== NULL
|| strlen(s
) == 0)
242 strcpy(gProxyHandle
.dmLibName
, s
);
244 gProxyHandle
.dmHandle
= wine_dlopen(gProxyHandle
.dmLibName
, RTLD_LAZY
, error
, sizeof(error
));
246 if (gProxyHandle
.dmHandle
== NULL
) /* fail to load unixODBC driver manager */
248 WARN("failed to open library %s: %s\n", gProxyHandle
.dmLibName
, error
);
249 gProxyHandle
.dmLibName
[0] = '\0';
250 gProxyHandle
.nErrorType
= ERROR_LIBRARY_NOT_FOUND
;
255 gProxyHandle
.nErrorType
= ERROR_FREE
;
261 /***********************************************************************
262 * ODBC_LoadDMFunctions [Internal] Populate function table.
271 static BOOL
ODBC_LoadDMFunctions(void)
276 if (gProxyHandle
.dmHandle
== NULL
)
279 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
281 gProxyHandle
.functions
[i
] = template_func
[i
];
282 gProxyHandle
.functions
[i
].func
= wine_dlsym(gProxyHandle
.dmHandle
,
283 gProxyHandle
.functions
[i
].name
, error
, sizeof(error
));
287 ERR("Failed to load function %s\n",gProxyHandle
.functions
[i
].name
);
288 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
292 gProxyHandle
.bFunctionReady
= TRUE
;
298 /*************************************************************************
299 * SQLAllocConnect [ODBC32.001]
301 SQLRETURN WINAPI
SQLAllocConnect(SQLHENV EnvironmentHandle
, SQLHDBC
*ConnectionHandle
)
304 TRACE("Env=%lx\n",EnvironmentHandle
);
306 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
308 *ConnectionHandle
= SQL_NULL_HDBC
;
309 TRACE("Not ready\n");
313 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
);
314 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
)
315 (EnvironmentHandle
, ConnectionHandle
);
316 TRACE("Returns ret=%d, Handle %lx\n",ret
, *ConnectionHandle
);
321 /*************************************************************************
322 * SQLAllocEnv [ODBC32.002]
324 SQLRETURN WINAPI
SQLAllocEnv(SQLHENV
*EnvironmentHandle
)
329 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
331 *EnvironmentHandle
= SQL_NULL_HENV
;
332 TRACE("Not ready\n");
336 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
);
337 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
) (EnvironmentHandle
);
338 TRACE("Returns ret=%d, Env=%lx\n",ret
, *EnvironmentHandle
);
343 /*************************************************************************
344 * SQLAllocHandle [ODBC32.024]
346 SQLRETURN WINAPI
SQLAllocHandle(SQLSMALLINT HandleType
, SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
349 TRACE("(Type=%d, Handle=%lx)\n",HandleType
,InputHandle
);
351 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
353 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
354 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
356 if (HandleType
== SQL_HANDLE_ENV
)
357 *OutputHandle
= SQL_NULL_HENV
;
358 else if (HandleType
== SQL_HANDLE_DBC
)
359 *OutputHandle
= SQL_NULL_HDBC
;
360 else if (HandleType
== SQL_HANDLE_STMT
)
361 *OutputHandle
= SQL_NULL_HSTMT
;
362 else if (HandleType
== SQL_HANDLE_DESC
)
363 *OutputHandle
= SQL_NULL_HDESC
;
365 TRACE ("Not ready\n");
369 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
);
370 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
)
371 (HandleType
, InputHandle
, OutputHandle
);
372 TRACE("Returns ret=%d, Handle=%lx\n",ret
, *OutputHandle
);
377 /*************************************************************************
378 * SQLAllocStmt [ODBC32.003]
380 SQLRETURN WINAPI
SQLAllocStmt(SQLHDBC ConnectionHandle
, SQLHSTMT
*StatementHandle
)
384 TRACE("(Connection=%lx)\n",ConnectionHandle
);
386 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
388 *StatementHandle
= SQL_NULL_HSTMT
;
389 TRACE ("Not ready\n");
393 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
);
394 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
)
395 (ConnectionHandle
, StatementHandle
);
396 TRACE ("Returns ret=%d, Handle=%lx\n", ret
, *StatementHandle
);
401 /*************************************************************************
402 * SQLAllocHandleStd [ODBC32.077]
404 SQLRETURN WINAPI
SQLAllocHandleStd( SQLSMALLINT HandleType
,
405 SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
407 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
409 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
411 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
412 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
414 if (HandleType
== SQL_HANDLE_ENV
)
415 *OutputHandle
= SQL_NULL_HENV
;
416 else if (HandleType
== SQL_HANDLE_DBC
)
417 *OutputHandle
= SQL_NULL_HDBC
;
418 else if (HandleType
== SQL_HANDLE_STMT
)
419 *OutputHandle
= SQL_NULL_HSTMT
;
420 else if (HandleType
== SQL_HANDLE_DESC
)
421 *OutputHandle
= SQL_NULL_HDESC
;
426 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
);
427 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
)
428 (HandleType
, InputHandle
, OutputHandle
);
432 /*************************************************************************
433 * SQLBindCol [ODBC32.004]
435 SQLRETURN WINAPI
SQLBindCol(SQLHSTMT StatementHandle
,
436 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
437 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
438 SQLINTEGER
*StrLen_or_Ind
)
442 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
444 TRACE ("Not ready\n");
448 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
);
449 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
)
450 (StatementHandle
, ColumnNumber
, TargetType
,
451 TargetValue
, BufferLength
, StrLen_or_Ind
);
455 /*************************************************************************
456 * SQLBindParam [ODBC32.025]
458 SQLRETURN WINAPI
SQLBindParam(SQLHSTMT StatementHandle
,
459 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
460 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
461 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
462 SQLINTEGER
*StrLen_or_Ind
)
466 CHECK_READY_AND_dmHandle();
468 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
);
469 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
)
470 (StatementHandle
, ParameterNumber
, ValueType
,
471 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
475 /*************************************************************************
476 * SQLCancel [ODBC32.005]
478 SQLRETURN WINAPI
SQLCancel(SQLHSTMT StatementHandle
)
482 CHECK_READY_AND_dmHandle();
484 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
);
485 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
) (StatementHandle
);
489 /*************************************************************************
490 * SQLCloseCursor [ODBC32.026]
492 SQLRETURN WINAPI
SQLCloseCursor(SQLHSTMT StatementHandle
)
495 TRACE("(Handle=%lx)\n",StatementHandle
);
497 CHECK_READY_AND_dmHandle();
499 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
);
500 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
) (StatementHandle
);
501 TRACE("returns %d\n",ret
);
506 /*************************************************************************
507 * SQLColAttribute [ODBC32.027]
509 SQLRETURN WINAPI
SQLColAttribute (SQLHSTMT StatementHandle
,
510 SQLUSMALLINT ColumnNumber
, SQLUSMALLINT FieldIdentifier
,
511 SQLPOINTER CharacterAttribute
, SQLSMALLINT BufferLength
,
512 SQLSMALLINT
*StringLength
, SQLPOINTER NumericAttribute
)
516 CHECK_READY_AND_dmHandle();
518 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
);
519 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
)
520 (StatementHandle
, ColumnNumber
, FieldIdentifier
,
521 CharacterAttribute
, BufferLength
, StringLength
, NumericAttribute
);
525 /*************************************************************************
526 * SQLColumns [ODBC32.040]
528 SQLRETURN WINAPI
SQLColumns(SQLHSTMT StatementHandle
,
529 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
530 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
531 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
532 SQLCHAR
*ColumnName
, SQLSMALLINT NameLength4
)
536 CHECK_READY_AND_dmHandle();
538 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
);
539 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
)
540 (StatementHandle
, CatalogName
, NameLength1
,
541 SchemaName
, NameLength2
, TableName
, NameLength3
, ColumnName
, NameLength4
);
545 /*************************************************************************
546 * SQLConnect [ODBC32.007]
548 SQLRETURN WINAPI
SQLConnect(SQLHDBC ConnectionHandle
,
549 SQLCHAR
*ServerName
, SQLSMALLINT NameLength1
,
550 SQLCHAR
*UserName
, SQLSMALLINT NameLength2
,
551 SQLCHAR
*Authentication
, SQLSMALLINT NameLength3
)
554 TRACE("(Server=%.*s)\n",NameLength1
, ServerName
);
556 CHECK_READY_AND_dmHandle();
558 strcpy(gProxyHandle
.ServerName
, ServerName
);
559 strcpy(gProxyHandle
.UserName
, UserName
);
561 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
);
562 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
)
563 (ConnectionHandle
, ServerName
, NameLength1
,
564 UserName
, NameLength2
, Authentication
, NameLength3
);
566 TRACE("returns %d\n",ret
);
571 /*************************************************************************
572 * SQLCopyDesc [ODBC32.028]
574 SQLRETURN WINAPI
SQLCopyDesc(SQLHDESC SourceDescHandle
, SQLHDESC TargetDescHandle
)
578 CHECK_READY_AND_dmHandle();
580 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
);
581 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
)
582 (SourceDescHandle
, TargetDescHandle
);
586 /*************************************************************************
587 * SQLDataSources [ODBC32.057]
589 SQLRETURN WINAPI
SQLDataSources(SQLHENV EnvironmentHandle
,
590 SQLUSMALLINT Direction
, SQLCHAR
*ServerName
,
591 SQLSMALLINT BufferLength1
, SQLSMALLINT
*NameLength1
,
592 SQLCHAR
*Description
, SQLSMALLINT BufferLength2
,
593 SQLSMALLINT
*NameLength2
)
597 TRACE("EnvironmentHandle = %p\n", (LPVOID
)EnvironmentHandle
);
599 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
601 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
605 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
);
606 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
)
607 (EnvironmentHandle
, Direction
, ServerName
,
608 BufferLength1
, NameLength1
, Description
, BufferLength2
, NameLength2
);
612 TRACE("returns: %d \t", ret
);
613 if (*NameLength1
> 0)
614 DPRINTF("DataSource = %s,", ServerName
);
615 if (*NameLength2
> 0)
616 DPRINTF(" Description = %s", Description
);
624 /*************************************************************************
625 * SQLDescribeCol [ODBC32.008]
627 SQLRETURN WINAPI
SQLDescribeCol(SQLHSTMT StatementHandle
,
628 SQLUSMALLINT ColumnNumber
, SQLCHAR
*ColumnName
,
629 SQLSMALLINT BufferLength
, SQLSMALLINT
*NameLength
,
630 SQLSMALLINT
*DataType
, SQLUINTEGER
*ColumnSize
,
631 SQLSMALLINT
*DecimalDigits
, SQLSMALLINT
*Nullable
)
635 CHECK_READY_AND_dmHandle();
637 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
);
638 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
)
639 (StatementHandle
, ColumnNumber
, ColumnName
,
640 BufferLength
, NameLength
, DataType
, ColumnSize
, DecimalDigits
, Nullable
);
644 /*************************************************************************
645 * SQLDisconnect [ODBC32.009]
647 SQLRETURN WINAPI
SQLDisconnect(SQLHDBC ConnectionHandle
)
650 TRACE("(Handle=%lx)\n", ConnectionHandle
);
652 CHECK_READY_AND_dmHandle();
654 gProxyHandle
.ServerName
[0] = '\0';
655 gProxyHandle
.UserName
[0] = '\0';
657 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
);
658 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
) (ConnectionHandle
);
659 TRACE("returns %d\n",ret
);
664 /*************************************************************************
665 * SQLEndTran [ODBC32.029]
667 SQLRETURN WINAPI
SQLEndTran(SQLSMALLINT HandleType
, SQLHANDLE Handle
, SQLSMALLINT CompletionType
)
671 CHECK_READY_AND_dmHandle();
673 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
);
674 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
) (HandleType
, Handle
, CompletionType
);
678 /*************************************************************************
679 * SQLError [ODBC32.010]
681 SQLRETURN WINAPI
SQLError(SQLHENV EnvironmentHandle
,
682 SQLHDBC ConnectionHandle
, SQLHSTMT StatementHandle
,
683 SQLCHAR
*Sqlstate
, SQLINTEGER
*NativeError
,
684 SQLCHAR
*MessageText
, SQLSMALLINT BufferLength
,
685 SQLSMALLINT
*TextLength
)
689 CHECK_READY_AND_dmHandle();
691 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
);
692 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
)
693 (EnvironmentHandle
, ConnectionHandle
, StatementHandle
,
694 Sqlstate
, NativeError
, MessageText
, BufferLength
, TextLength
);
698 /*************************************************************************
699 * SQLExecDirect [ODBC32.011]
701 SQLRETURN WINAPI
SQLExecDirect(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
705 CHECK_READY_AND_dmHandle();
707 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
);
708 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
)
709 (StatementHandle
, StatementText
, TextLength
);
713 /*************************************************************************
714 * SQLExecute [ODBC32.012]
716 SQLRETURN WINAPI
SQLExecute(SQLHSTMT StatementHandle
)
720 CHECK_READY_AND_dmHandle();
722 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
);
723 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
) (StatementHandle
);
727 /*************************************************************************
728 * SQLFetch [ODBC32.013]
730 SQLRETURN WINAPI
SQLFetch(SQLHSTMT StatementHandle
)
734 CHECK_READY_AND_dmHandle();
736 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
);
737 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
) (StatementHandle
);
741 /*************************************************************************
742 * SQLFetchScroll [ODBC32.030]
744 SQLRETURN WINAPI
SQLFetchScroll(SQLHSTMT StatementHandle
, SQLSMALLINT FetchOrientation
, SQLINTEGER FetchOffset
)
750 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
);
751 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
)
752 (StatementHandle
, FetchOrientation
, FetchOffset
);
756 /*************************************************************************
757 * SQLFreeConnect [ODBC32.014]
759 SQLRETURN WINAPI
SQLFreeConnect(SQLHDBC ConnectionHandle
)
762 TRACE("(Handle=%lx)\n",ConnectionHandle
);
766 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
);
767 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
) (ConnectionHandle
);
768 TRACE("Returns %d\n",ret
);
773 /*************************************************************************
774 * SQLFreeEnv [ODBC32.015]
776 SQLRETURN WINAPI
SQLFreeEnv(SQLHENV EnvironmentHandle
)
779 TRACE("(Env=%lx)\n",EnvironmentHandle
);
783 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
);
784 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
) (EnvironmentHandle
);
785 TRACE("Returns %d\n",ret
);
790 /*************************************************************************
791 * SQLFreeHandle [ODBC32.031]
793 SQLRETURN WINAPI
SQLFreeHandle(SQLSMALLINT HandleType
, SQLHANDLE Handle
)
796 TRACE("(Type=%d, Handle=%lx)\n",HandleType
,Handle
);
800 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
);
801 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
)
802 (HandleType
, Handle
);
803 TRACE ("Returns %d\n",ret
);
808 /*************************************************************************
809 * SQLFreeStmt [ODBC32.016]
811 SQLRETURN WINAPI
SQLFreeStmt(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
)
814 TRACE("(Handle %lx, Option=%d)\n",StatementHandle
, Option
);
818 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
);
819 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
)
820 (StatementHandle
, Option
);
821 TRACE("Returns %d\n",ret
);
826 /*************************************************************************
827 * SQLGetConnectAttr [ODBC32.032]
829 SQLRETURN WINAPI
SQLGetConnectAttr(SQLHDBC ConnectionHandle
,
830 SQLINTEGER Attribute
, SQLPOINTER Value
,
831 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
837 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
);
838 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
)
839 (ConnectionHandle
, Attribute
, Value
,
840 BufferLength
, StringLength
);
844 /*************************************************************************
845 * SQLGetConnectOption [ODBC32.042]
847 SQLRETURN WINAPI
SQLGetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
853 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
);
854 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
)
855 (ConnectionHandle
, Option
, Value
);
859 /*************************************************************************
860 * SQLGetCursorName [ODBC32.017]
862 SQLRETURN WINAPI
SQLGetCursorName(SQLHSTMT StatementHandle
,
863 SQLCHAR
*CursorName
, SQLSMALLINT BufferLength
,
864 SQLSMALLINT
*NameLength
)
870 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
);
871 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
)
872 (StatementHandle
, CursorName
, BufferLength
, NameLength
);
876 /*************************************************************************
877 * SQLGetData [ODBC32.043]
879 SQLRETURN WINAPI
SQLGetData(SQLHSTMT StatementHandle
,
880 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
881 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
882 SQLINTEGER
*StrLen_or_Ind
)
888 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
);
889 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
)
890 (StatementHandle
, ColumnNumber
, TargetType
,
891 TargetValue
, BufferLength
, StrLen_or_Ind
);
895 /*************************************************************************
896 * SQLGetDescField [ODBC32.033]
898 SQLRETURN WINAPI
SQLGetDescField(SQLHDESC DescriptorHandle
,
899 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
900 SQLPOINTER Value
, SQLINTEGER BufferLength
,
901 SQLINTEGER
*StringLength
)
907 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
);
908 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
)
909 (DescriptorHandle
, RecNumber
, FieldIdentifier
,
910 Value
, BufferLength
, StringLength
);
914 /*************************************************************************
915 * SQLGetDescRec [ODBC32.034]
917 SQLRETURN WINAPI
SQLGetDescRec(SQLHDESC DescriptorHandle
,
918 SQLSMALLINT RecNumber
, SQLCHAR
*Name
,
919 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
,
920 SQLSMALLINT
*Type
, SQLSMALLINT
*SubType
,
921 SQLINTEGER
*Length
, SQLSMALLINT
*Precision
,
922 SQLSMALLINT
*Scale
, SQLSMALLINT
*Nullable
)
928 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
);
929 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
)
930 (DescriptorHandle
, RecNumber
, Name
, BufferLength
,
931 StringLength
, Type
, SubType
, Length
, Precision
, Scale
, Nullable
);
935 /*************************************************************************
936 * SQLGetDiagField [ODBC32.035]
938 SQLRETURN WINAPI
SQLGetDiagField(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
939 SQLSMALLINT RecNumber
, SQLSMALLINT DiagIdentifier
,
940 SQLPOINTER DiagInfo
, SQLSMALLINT BufferLength
,
941 SQLSMALLINT
*StringLength
)
947 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
);
948 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
)
949 (HandleType
, Handle
, RecNumber
, DiagIdentifier
,
950 DiagInfo
, BufferLength
, StringLength
);
954 /*************************************************************************
955 * SQLGetDiagRec [ODBC32.036]
957 SQLRETURN WINAPI
SQLGetDiagRec(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
958 SQLSMALLINT RecNumber
, SQLCHAR
*Sqlstate
,
959 SQLINTEGER
*NativeError
, SQLCHAR
*MessageText
,
960 SQLSMALLINT BufferLength
, SQLSMALLINT
*TextLength
)
966 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
);
967 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
)
968 (HandleType
, Handle
, RecNumber
, Sqlstate
, NativeError
,
969 MessageText
, BufferLength
, TextLength
);
973 /*************************************************************************
974 * SQLGetEnvAttr [ODBC32.037]
976 SQLRETURN WINAPI
SQLGetEnvAttr(SQLHENV EnvironmentHandle
,
977 SQLINTEGER Attribute
, SQLPOINTER Value
,
978 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
984 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
);
985 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
)
986 (EnvironmentHandle
, Attribute
, Value
, BufferLength
, StringLength
);
990 /*************************************************************************
991 * SQLGetFunctions [ODBC32.044]
993 SQLRETURN WINAPI
SQLGetFunctions(SQLHDBC ConnectionHandle
, SQLUSMALLINT FunctionId
, SQLUSMALLINT
*Supported
)
999 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
);
1000 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
)
1001 (ConnectionHandle
, FunctionId
, Supported
);
1005 /*************************************************************************
1006 * SQLGetInfo [ODBC32.045]
1008 SQLRETURN WINAPI
SQLGetInfo(SQLHDBC ConnectionHandle
,
1009 SQLUSMALLINT InfoType
, SQLPOINTER InfoValue
,
1010 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
)
1016 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
);
1017 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
)
1018 (ConnectionHandle
, InfoType
, InfoValue
, BufferLength
, StringLength
);
1022 /*************************************************************************
1023 * SQLGetStmtAttr [ODBC32.038]
1025 SQLRETURN WINAPI
SQLGetStmtAttr(SQLHSTMT StatementHandle
,
1026 SQLINTEGER Attribute
, SQLPOINTER Value
,
1027 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
1033 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
);
1034 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
)
1035 (StatementHandle
, Attribute
, Value
, BufferLength
, StringLength
);
1039 /*************************************************************************
1040 * SQLGetStmtOption [ODBC32.046]
1042 SQLRETURN WINAPI
SQLGetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
1048 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
);
1049 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
)
1050 (StatementHandle
, Option
, Value
);
1054 /*************************************************************************
1055 * SQLGetTypeInfo [ODBC32.047]
1057 SQLRETURN WINAPI
SQLGetTypeInfo(SQLHSTMT StatementHandle
, SQLSMALLINT DataType
)
1063 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
);
1064 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
)
1065 (StatementHandle
, DataType
);
1069 /*************************************************************************
1070 * SQLNumResultCols [ODBC32.018]
1072 SQLRETURN WINAPI
SQLNumResultCols(SQLHSTMT StatementHandle
, SQLSMALLINT
*ColumnCount
)
1078 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
);
1079 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
)
1080 (StatementHandle
, ColumnCount
);
1084 /*************************************************************************
1085 * SQLParamData [ODBC32.048]
1087 SQLRETURN WINAPI
SQLParamData(SQLHSTMT StatementHandle
, SQLPOINTER
*Value
)
1093 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
);
1094 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
)
1095 (StatementHandle
, Value
);
1099 /*************************************************************************
1100 * SQLPrepare [ODBC32.019]
1102 SQLRETURN WINAPI
SQLPrepare(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
1108 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
);
1109 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
)
1110 (StatementHandle
, StatementText
, TextLength
);
1114 /*************************************************************************
1115 * SQLPutData [ODBC32.049]
1117 SQLRETURN WINAPI
SQLPutData(SQLHSTMT StatementHandle
, SQLPOINTER Data
, SQLINTEGER StrLen_or_Ind
)
1123 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
);
1124 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
)
1125 (StatementHandle
, Data
, StrLen_or_Ind
);
1129 /*************************************************************************
1130 * SQLRowCount [ODBC32.020]
1132 SQLRETURN WINAPI
SQLRowCount(SQLHSTMT StatementHandle
, SQLINTEGER
*RowCount
)
1138 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
);
1139 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
)
1140 (StatementHandle
, RowCount
);
1144 /*************************************************************************
1145 * SQLSetConnectAttr [ODBC32.039]
1147 SQLRETURN WINAPI
SQLSetConnectAttr(SQLHDBC ConnectionHandle
, SQLINTEGER Attribute
,
1148 SQLPOINTER Value
, SQLINTEGER StringLength
)
1154 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
);
1155 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
)
1156 (ConnectionHandle
, Attribute
, Value
, StringLength
);
1160 /*************************************************************************
1161 * SQLSetConnectOption [ODBC32.050]
1163 SQLRETURN WINAPI
SQLSetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1169 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
);
1170 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
)
1171 (ConnectionHandle
, Option
, Value
);
1175 /*************************************************************************
1176 * SQLSetCursorName [ODBC32.021]
1178 SQLRETURN WINAPI
SQLSetCursorName(SQLHSTMT StatementHandle
, SQLCHAR
*CursorName
, SQLSMALLINT NameLength
)
1184 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
);
1185 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
)
1186 (StatementHandle
, CursorName
, NameLength
);
1190 /*************************************************************************
1191 * SQLSetDescField [ODBC32.073]
1193 SQLRETURN WINAPI
SQLSetDescField(SQLHDESC DescriptorHandle
,
1194 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
1195 SQLPOINTER Value
, SQLINTEGER BufferLength
)
1201 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
);
1202 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
)
1203 (DescriptorHandle
, RecNumber
, FieldIdentifier
, Value
, BufferLength
);
1207 /*************************************************************************
1208 * SQLSetDescRec [ODBC32.074]
1210 SQLRETURN WINAPI
SQLSetDescRec(SQLHDESC DescriptorHandle
,
1211 SQLSMALLINT RecNumber
, SQLSMALLINT Type
,
1212 SQLSMALLINT SubType
, SQLINTEGER Length
,
1213 SQLSMALLINT Precision
, SQLSMALLINT Scale
,
1214 SQLPOINTER Data
, SQLINTEGER
*StringLength
,
1215 SQLINTEGER
*Indicator
)
1221 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
);
1222 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
)
1223 (DescriptorHandle
, RecNumber
, Type
, SubType
, Length
,
1224 Precision
, Scale
, Data
, StringLength
, Indicator
);
1228 /*************************************************************************
1229 * SQLSetEnvAttr [ODBC32.075]
1231 SQLRETURN WINAPI
SQLSetEnvAttr(SQLHENV EnvironmentHandle
,
1232 SQLINTEGER Attribute
, SQLPOINTER Value
,
1233 SQLINTEGER StringLength
)
1239 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
);
1240 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
)
1241 (EnvironmentHandle
, Attribute
, Value
, StringLength
);
1245 /*************************************************************************
1246 * SQLSetParam [ODBC32.022]
1248 SQLRETURN WINAPI
SQLSetParam(SQLHSTMT StatementHandle
,
1249 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
1250 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
1251 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
1252 SQLINTEGER
*StrLen_or_Ind
)
1258 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
);
1259 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
)
1260 (StatementHandle
, ParameterNumber
, ValueType
, ParameterType
, LengthPrecision
,
1261 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
1265 /*************************************************************************
1266 * SQLSetStmtAttr [ODBC32.076]
1268 SQLRETURN WINAPI
SQLSetStmtAttr(SQLHSTMT StatementHandle
,
1269 SQLINTEGER Attribute
, SQLPOINTER Value
,
1270 SQLINTEGER StringLength
)
1276 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTATTR
].func
);
1277 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTATTR
].func
)
1278 (StatementHandle
, Attribute
, Value
, StringLength
);
1282 /*************************************************************************
1283 * SQLSetStmtOption [ODBC32.051]
1285 SQLRETURN WINAPI
SQLSetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1291 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
);
1292 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
)
1293 (StatementHandle
, Option
, Value
);
1297 /*************************************************************************
1298 * SQLSpecialColumns [ODBC32.052]
1300 SQLRETURN WINAPI
SQLSpecialColumns(SQLHSTMT StatementHandle
,
1301 SQLUSMALLINT IdentifierType
, SQLCHAR
*CatalogName
,
1302 SQLSMALLINT NameLength1
, SQLCHAR
*SchemaName
,
1303 SQLSMALLINT NameLength2
, SQLCHAR
*TableName
,
1304 SQLSMALLINT NameLength3
, SQLUSMALLINT Scope
,
1305 SQLUSMALLINT Nullable
)
1310 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
);
1311 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
)
1312 (StatementHandle
, IdentifierType
, CatalogName
, NameLength1
, SchemaName
,
1313 NameLength2
, TableName
, NameLength3
, Scope
, Nullable
);
1317 /*************************************************************************
1318 * SQLStatistics [ODBC32.053]
1320 SQLRETURN WINAPI
SQLStatistics(SQLHSTMT StatementHandle
,
1321 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1322 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1323 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1324 SQLUSMALLINT Unique
, SQLUSMALLINT Reserved
)
1330 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
);
1331 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
)
1332 (StatementHandle
, CatalogName
, NameLength1
, SchemaName
, NameLength2
,
1333 TableName
, NameLength3
, Unique
, Reserved
);
1337 /*************************************************************************
1338 * SQLTables [ODBC32.054]
1340 SQLRETURN WINAPI
SQLTables(SQLHSTMT StatementHandle
,
1341 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1342 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1343 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1344 SQLCHAR
*TableType
, SQLSMALLINT NameLength4
)
1350 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLES
].func
);
1351 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLES
].func
)
1352 (StatementHandle
, CatalogName
, NameLength1
,
1353 SchemaName
, NameLength2
, TableName
, NameLength3
, TableType
, NameLength4
);
1357 /*************************************************************************
1358 * SQLTransact [ODBC32.023]
1360 SQLRETURN WINAPI
SQLTransact(SQLHENV EnvironmentHandle
, SQLHDBC ConnectionHandle
,
1361 SQLUSMALLINT CompletionType
)
1367 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
);
1368 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
)
1369 (EnvironmentHandle
, ConnectionHandle
, CompletionType
);
1373 /*************************************************************************
1374 * SQLBrowseConnect [ODBC32.055]
1376 SQLRETURN WINAPI
SQLBrowseConnect(
1378 SQLCHAR
*szConnStrIn
,
1379 SQLSMALLINT cbConnStrIn
,
1380 SQLCHAR
*szConnStrOut
,
1381 SQLSMALLINT cbConnStrOutMax
,
1382 SQLSMALLINT
*pcbConnStrOut
)
1388 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
);
1389 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
)
1390 (hdbc
, szConnStrIn
, cbConnStrIn
, szConnStrOut
, cbConnStrOutMax
, pcbConnStrOut
);
1394 /*************************************************************************
1395 * SQLBulkOperations [ODBC32.078]
1397 SQLRETURN WINAPI
SQLBulkOperations(
1398 SQLHSTMT StatementHandle
,
1399 SQLSMALLINT Operation
)
1405 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
);
1406 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
)
1407 (StatementHandle
, Operation
);
1411 /*************************************************************************
1412 * SQLColAttributes [ODBC32.006]
1414 SQLRETURN WINAPI
SQLColAttributes(
1417 SQLUSMALLINT fDescType
,
1419 SQLSMALLINT cbDescMax
,
1420 SQLSMALLINT
*pcbDesc
,
1427 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
);
1428 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
)
1429 (hstmt
, icol
, fDescType
, rgbDesc
, cbDescMax
, pcbDesc
, pfDesc
);
1433 /*************************************************************************
1434 * SQLColumnPrivileges [ODBC32.056]
1436 SQLRETURN WINAPI
SQLColumnPrivileges(
1438 SQLCHAR
*szCatalogName
,
1439 SQLSMALLINT cbCatalogName
,
1440 SQLCHAR
*szSchemaName
,
1441 SQLSMALLINT cbSchemaName
,
1442 SQLCHAR
*szTableName
,
1443 SQLSMALLINT cbTableName
,
1444 SQLCHAR
*szColumnName
,
1445 SQLSMALLINT cbColumnName
)
1451 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
);
1452 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
)
1453 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1454 szTableName
, cbTableName
, szColumnName
, cbColumnName
);
1458 /*************************************************************************
1459 * SQLDescribeParam [ODBC32.058]
1461 SQLRETURN WINAPI
SQLDescribeParam(
1464 SQLSMALLINT
*pfSqlType
,
1465 SQLUINTEGER
*pcbParamDef
,
1466 SQLSMALLINT
*pibScale
,
1467 SQLSMALLINT
*pfNullable
)
1473 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
);
1474 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
)
1475 (hstmt
, ipar
, pfSqlType
, pcbParamDef
, pibScale
, pfNullable
);
1479 /*************************************************************************
1480 * SQLExtendedFetch [ODBC32.059]
1482 SQLRETURN WINAPI
SQLExtendedFetch(
1484 SQLUSMALLINT fFetchType
,
1487 SQLUSMALLINT
*rgfRowStatus
)
1493 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
);
1494 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
)
1495 (hstmt
, fFetchType
, irow
, pcrow
, rgfRowStatus
);
1499 /*************************************************************************
1500 * SQLForeignKeys [ODBC32.060]
1502 SQLRETURN WINAPI
SQLForeignKeys(
1504 SQLCHAR
*szPkCatalogName
,
1505 SQLSMALLINT cbPkCatalogName
,
1506 SQLCHAR
*szPkSchemaName
,
1507 SQLSMALLINT cbPkSchemaName
,
1508 SQLCHAR
*szPkTableName
,
1509 SQLSMALLINT cbPkTableName
,
1510 SQLCHAR
*szFkCatalogName
,
1511 SQLSMALLINT cbFkCatalogName
,
1512 SQLCHAR
*szFkSchemaName
,
1513 SQLSMALLINT cbFkSchemaName
,
1514 SQLCHAR
*szFkTableName
,
1515 SQLSMALLINT cbFkTableName
)
1521 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
);
1522 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
)
1523 (hstmt
, szPkCatalogName
, cbPkCatalogName
, szPkSchemaName
, cbPkSchemaName
,
1524 szPkTableName
, cbPkTableName
, szFkCatalogName
, cbFkCatalogName
, szFkSchemaName
,
1525 cbFkSchemaName
, szFkTableName
, cbFkTableName
);
1529 /*************************************************************************
1530 * SQLMoreResults [ODBC32.061]
1532 SQLRETURN WINAPI
SQLMoreResults(SQLHSTMT hstmt
)
1538 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
);
1539 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
) (hstmt
);
1543 /*************************************************************************
1544 * SQLNativeSql [ODBC32.062]
1546 SQLRETURN WINAPI
SQLNativeSql(
1548 SQLCHAR
*szSqlStrIn
,
1549 SQLINTEGER cbSqlStrIn
,
1551 SQLINTEGER cbSqlStrMax
,
1552 SQLINTEGER
*pcbSqlStr
)
1558 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
);
1559 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
)
1560 (hdbc
, szSqlStrIn
, cbSqlStrIn
, szSqlStr
, cbSqlStrMax
, pcbSqlStr
);
1564 /*************************************************************************
1565 * SQLNumParams [ODBC32.063]
1567 SQLRETURN WINAPI
SQLNumParams(
1575 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
);
1576 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
) (hstmt
, pcpar
);
1580 /*************************************************************************
1581 * SQLParamOptions [ODBC32.064]
1583 SQLRETURN WINAPI
SQLParamOptions(
1592 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
);
1593 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
) (hstmt
, crow
, pirow
);
1597 /*************************************************************************
1598 * SQLPrimaryKeys [ODBC32.065]
1600 SQLRETURN WINAPI
SQLPrimaryKeys(
1602 SQLCHAR
*szCatalogName
,
1603 SQLSMALLINT cbCatalogName
,
1604 SQLCHAR
*szSchemaName
,
1605 SQLSMALLINT cbSchemaName
,
1606 SQLCHAR
*szTableName
,
1607 SQLSMALLINT cbTableName
)
1613 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
);
1614 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
)
1615 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1616 szTableName
, cbTableName
);
1620 /*************************************************************************
1621 * SQLProcedureColumns [ODBC32.066]
1623 SQLRETURN WINAPI
SQLProcedureColumns(
1625 SQLCHAR
*szCatalogName
,
1626 SQLSMALLINT cbCatalogName
,
1627 SQLCHAR
*szSchemaName
,
1628 SQLSMALLINT cbSchemaName
,
1629 SQLCHAR
*szProcName
,
1630 SQLSMALLINT cbProcName
,
1631 SQLCHAR
*szColumnName
,
1632 SQLSMALLINT cbColumnName
)
1638 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
);
1639 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
)
1640 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1641 szProcName
, cbProcName
, szColumnName
, cbColumnName
);
1645 /*************************************************************************
1646 * SQLProcedures [ODBC32.067]
1648 SQLRETURN WINAPI
SQLProcedures(
1650 SQLCHAR
*szCatalogName
,
1651 SQLSMALLINT cbCatalogName
,
1652 SQLCHAR
*szSchemaName
,
1653 SQLSMALLINT cbSchemaName
,
1654 SQLCHAR
*szProcName
,
1655 SQLSMALLINT cbProcName
)
1661 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
);
1662 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
)
1663 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1664 szProcName
, cbProcName
);
1668 /*************************************************************************
1669 * SQLSetPos [ODBC32.068]
1671 SQLRETURN WINAPI
SQLSetPos(
1674 SQLUSMALLINT fOption
,
1681 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
);
1682 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
)
1683 (hstmt
, irow
, fOption
, fLock
);
1687 /*************************************************************************
1688 * SQLTablePrivileges [ODBC32.070]
1690 SQLRETURN WINAPI
SQLTablePrivileges(
1692 SQLCHAR
*szCatalogName
,
1693 SQLSMALLINT cbCatalogName
,
1694 SQLCHAR
*szSchemaName
,
1695 SQLSMALLINT cbSchemaName
,
1696 SQLCHAR
*szTableName
,
1697 SQLSMALLINT cbTableName
)
1703 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
);
1704 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
)
1705 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1706 szTableName
, cbTableName
);
1710 /*************************************************************************
1711 * SQLDrivers [ODBC32.071]
1713 SQLRETURN WINAPI
SQLDrivers(
1715 SQLUSMALLINT fDirection
,
1716 SQLCHAR
*szDriverDesc
,
1717 SQLSMALLINT cbDriverDescMax
,
1718 SQLSMALLINT
*pcbDriverDesc
,
1719 SQLCHAR
*szDriverAttributes
,
1720 SQLSMALLINT cbDriverAttrMax
,
1721 SQLSMALLINT
*pcbDriverAttr
)
1727 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
);
1728 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
)
1729 (henv
, fDirection
, szDriverDesc
, cbDriverDescMax
, pcbDriverDesc
,
1730 szDriverAttributes
, cbDriverAttrMax
, pcbDriverAttr
);
1734 /*************************************************************************
1735 * SQLBindParameter [ODBC32.072]
1737 SQLRETURN WINAPI
SQLBindParameter(
1740 SQLSMALLINT fParamType
,
1742 SQLSMALLINT fSqlType
,
1743 SQLUINTEGER cbColDef
,
1744 SQLSMALLINT ibScale
,
1745 SQLPOINTER rgbValue
,
1746 SQLINTEGER cbValueMax
,
1747 SQLINTEGER
*pcbValue
)
1753 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
);
1754 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
)
1755 (hstmt
, ipar
, fParamType
, fCType
, fSqlType
, cbColDef
, ibScale
,
1756 rgbValue
, cbValueMax
, pcbValue
);
1760 /*************************************************************************
1761 * SQLDriverConnect [ODBC32.041]
1763 SQLRETURN WINAPI
SQLDriverConnect(
1766 SQLCHAR
*conn_str_in
,
1767 SQLSMALLINT len_conn_str_in
,
1768 SQLCHAR
*conn_str_out
,
1769 SQLSMALLINT conn_str_out_max
,
1770 SQLSMALLINT
*ptr_conn_str_out
,
1771 SQLUSMALLINT driver_completion
)
1777 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
);
1778 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
)
1779 (hdbc
, hwnd
, conn_str_in
, len_conn_str_in
, conn_str_out
,
1780 conn_str_out_max
, ptr_conn_str_out
, driver_completion
);
1784 /*************************************************************************
1785 * SQLSetScrollOptions [ODBC32.069]
1787 SQLRETURN WINAPI
SQLSetScrollOptions(
1788 SQLHSTMT statement_handle
,
1789 SQLUSMALLINT f_concurrency
,
1790 SQLINTEGER crow_keyset
,
1791 SQLUSMALLINT crow_rowset
)
1797 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
);
1798 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
)
1799 (statement_handle
, f_concurrency
, crow_keyset
, crow_rowset
);