4 * Copyright 1999 Xiang Li, Corel Corporation
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * Proxy ODBC driver manager. This manager delegates all ODBC
22 * calls to a real ODBC driver manager named by the environment
23 * variable LIB_ODBC_DRIVER_MANAGER, or to libodbc.so if the
24 * variable is not set.
29 #include "wine/port.h"
39 #include "wine/debug.h"
40 #include "wine/library.h"
46 #include "proxyodbc.h"
48 static BOOL
ODBC_LoadDriverManager(void);
49 static BOOL
ODBC_LoadDMFunctions(void);
51 WINE_DEFAULT_DEBUG_CHANNEL(odbc
);
53 static const DM_FUNC template_func
[] =
55 /* 00 */ { SQL_API_SQLALLOCCONNECT
, "SQLAllocConnect", SQLAllocConnect
, NULL
},
56 /* 01 */ { SQL_API_SQLALLOCENV
, "SQLAllocEnv", SQLAllocEnv
, NULL
},
57 /* 02 */ { SQL_API_SQLALLOCHANDLE
, "SQLAllocHandle", SQLAllocHandle
, NULL
},
58 /* 03 */ { SQL_API_SQLALLOCSTMT
, "SQLAllocStmt", SQLAllocStmt
, NULL
},
59 /* 04 */ { SQL_API_SQLALLOCHANDLESTD
, "SQLAllocHandleStd", SQLAllocHandleStd
, NULL
},
60 /* 05 */ { SQL_API_SQLBINDCOL
, "SQLBindCol", SQLBindCol
, NULL
},
61 /* 06 */ { SQL_API_SQLBINDPARAM
, "SQLBindParam", SQLBindParam
, NULL
},
62 /* 07 */ { SQL_API_SQLBINDPARAMETER
, "SQLBindParameter", SQLBindParameter
, NULL
},
63 /* 08 */ { SQL_API_SQLBROWSECONNECT
, "SQLBrowseConnect", SQLBrowseConnect
, NULL
},
64 /* 09 */ { SQL_API_SQLBULKOPERATIONS
, "SQLBulkOperations", SQLBulkOperations
, NULL
},
65 /* 10 */ { SQL_API_SQLCANCEL
, "SQLCancel", SQLCancel
, NULL
},
66 /* 11 */ { SQL_API_SQLCLOSECURSOR
, "SQLCloseCursor", SQLCloseCursor
, NULL
},
67 /* 12 */ { SQL_API_SQLCOLATTRIBUTE
, "SQLColAttribute", SQLColAttribute
, NULL
},
68 /* 13 */ { SQL_API_SQLCOLATTRIBUTES
, "SQLColAttributes", SQLColAttributes
, NULL
},
69 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES
, "SQLColumnPrivileges", SQLColumnPrivileges
, NULL
},
70 /* 15 */ { SQL_API_SQLCOLUMNS
, "SQLColumns", SQLColumns
, NULL
},
71 /* 16 */ { SQL_API_SQLCONNECT
, "SQLConnect", SQLConnect
, NULL
},
72 /* 17 */ { SQL_API_SQLCOPYDESC
, "SQLCopyDesc", SQLCopyDesc
, NULL
},
73 /* 18 */ { SQL_API_SQLDATASOURCES
, "SQLDataSources", SQLDataSources
, NULL
},
74 /* 19 */ { SQL_API_SQLDESCRIBECOL
, "SQLDescribeCol", SQLDescribeCol
, NULL
},
75 /* 20 */ { SQL_API_SQLDESCRIBEPARAM
, "SQLDescribeParam", SQLDescribeParam
, NULL
},
76 /* 21 */ { SQL_API_SQLDISCONNECT
, "SQLDisconnect", SQLDisconnect
, NULL
},
77 /* 22 */ { SQL_API_SQLDRIVERCONNECT
, "SQLDriverConnect", SQLDriverConnect
, NULL
},
78 /* 23 */ { SQL_API_SQLDRIVERS
, "SQLDrivers", SQLDrivers
, NULL
},
79 /* 24 */ { SQL_API_SQLENDTRAN
, "SQLEndTran", SQLEndTran
, NULL
},
80 /* 25 */ { SQL_API_SQLERROR
, "SQLError", SQLError
, NULL
},
81 /* 26 */ { SQL_API_SQLEXECDIRECT
, "SQLExecDirect", SQLExecDirect
, NULL
},
82 /* 27 */ { SQL_API_SQLEXECUTE
, "SQLExecute", SQLExecute
, NULL
},
83 /* 28 */ { SQL_API_SQLEXTENDEDFETCH
, "SQLExtendedFetch", SQLExtendedFetch
, NULL
},
84 /* 29 */ { SQL_API_SQLFETCH
, "SQLFetch", SQLFetch
, NULL
},
85 /* 30 */ { SQL_API_SQLFETCHSCROLL
, "SQLFetchScroll", SQLFetchScroll
, NULL
},
86 /* 31 */ { SQL_API_SQLFOREIGNKEYS
, "SQLForeignKeys", SQLForeignKeys
, NULL
},
87 /* 32 */ { SQL_API_SQLFREEENV
, "SQLFreeEnv", SQLFreeEnv
, NULL
},
88 /* 33 */ { SQL_API_SQLFREEHANDLE
, "SQLFreeHandle", SQLFreeHandle
, NULL
},
89 /* 34 */ { SQL_API_SQLFREESTMT
, "SQLFreeStmt", SQLFreeStmt
, NULL
},
90 /* 35 */ { SQL_API_SQLFREECONNECT
, "SQLFreeConnect", SQLFreeConnect
, NULL
},
91 /* 36 */ { SQL_API_SQLGETCONNECTATTR
, "SQLGetConnectAttr", SQLGetConnectAttr
, NULL
},
92 /* 37 */ { SQL_API_SQLGETCONNECTOPTION
, "SQLGetConnectOption", SQLGetConnectOption
, NULL
},
93 /* 38 */ { SQL_API_SQLGETCURSORNAME
, "SQLGetCursorName", SQLGetCursorName
, NULL
},
94 /* 39 */ { SQL_API_SQLGETDATA
, "SQLGetData", SQLGetData
, NULL
},
95 /* 40 */ { SQL_API_SQLGETDESCFIELD
, "SQLGetDescField", SQLGetDescField
, NULL
},
96 /* 41 */ { SQL_API_SQLGETDESCREC
, "SQLGetDescRec", SQLGetDescRec
, NULL
},
97 /* 42 */ { SQL_API_SQLGETDIAGFIELD
, "SQLGetDiagField", SQLGetDiagField
, NULL
},
98 /* 43 */ { SQL_API_SQLGETENVATTR
, "SQLGetEnvAttr", SQLGetEnvAttr
, NULL
},
99 /* 44 */ { SQL_API_SQLGETFUNCTIONS
, "SQLGetFunctions", SQLGetFunctions
, NULL
},
100 /* 45 */ { SQL_API_SQLGETINFO
, "SQLGetInfo", SQLGetInfo
, NULL
},
101 /* 46 */ { SQL_API_SQLGETSTMTATTR
, "SQLGetStmtAttr", SQLGetStmtAttr
, NULL
},
102 /* 47 */ { SQL_API_SQLGETSTMTOPTION
, "SQLGetStmtOption", SQLGetStmtOption
, NULL
},
103 /* 48 */ { SQL_API_SQLGETTYPEINFO
, "SQLGetTypeInfo", SQLGetTypeInfo
, NULL
},
104 /* 49 */ { SQL_API_SQLMORERESULTS
, "SQLMoreResults", SQLMoreResults
, NULL
},
105 /* 50 */ { SQL_API_SQLNATIVESQL
, "SQLNativeSql", SQLNativeSql
, NULL
},
106 /* 51 */ { SQL_API_SQLNUMPARAMS
, "SQLNumParams", SQLNumParams
, NULL
},
107 /* 52 */ { SQL_API_SQLNUMRESULTCOLS
, "SQLNumResultCols", SQLNumResultCols
, NULL
},
108 /* 53 */ { SQL_API_SQLPARAMDATA
, "SQLParamData", SQLParamData
, NULL
},
109 /* 54 */ { SQL_API_SQLPARAMOPTIONS
, "SQLParamOptions", SQLParamOptions
, NULL
},
110 /* 55 */ { SQL_API_SQLPREPARE
, "SQLPrepare", SQLPrepare
, NULL
},
111 /* 56 */ { SQL_API_SQLPRIMARYKEYS
, "SQLPrimaryKeys", SQLPrimaryKeys
, NULL
},
112 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS
, "SQLProcedureColumns", SQLProcedureColumns
, NULL
},
113 /* 58 */ { SQL_API_SQLPROCEDURES
, "SQLProcedures", SQLProcedures
, NULL
},
114 /* 59 */ { SQL_API_SQLPUTDATA
, "SQLPutData", SQLPutData
, NULL
},
115 /* 60 */ { SQL_API_SQLROWCOUNT
, "SQLRowCount", SQLRowCount
, NULL
},
116 /* 61 */ { SQL_API_SQLSETCONNECTATTR
, "SQLSetConnectAttr", SQLSetConnectAttr
, NULL
},
117 /* 62 */ { SQL_API_SQLSETCONNECTOPTION
, "SQLSetConnectOption", SQLSetConnectOption
, NULL
},
118 /* 63 */ { SQL_API_SQLSETCURSORNAME
, "SQLSetCursorName", SQLSetCursorName
, NULL
},
119 /* 64 */ { SQL_API_SQLSETDESCFIELD
, "SQLSetDescField", SQLSetDescField
, NULL
},
120 /* 65 */ { SQL_API_SQLSETDESCREC
, "SQLSetDescRec", SQLSetDescRec
, NULL
},
121 /* 66 */ { SQL_API_SQLSETENVATTR
, "SQLSetEnvAttr", SQLSetEnvAttr
, NULL
},
122 /* 67 */ { SQL_API_SQLSETPARAM
, "SQLSetParam", SQLSetParam
, NULL
},
123 /* 68 */ { SQL_API_SQLSETPOS
, "SQLSetPos", SQLSetPos
, NULL
},
124 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS
, "SQLSetScrollOptions", SQLSetScrollOptions
, NULL
},
125 /* 70 */ { SQL_API_SQLSETSTMTATTR
, "SQLSetStmtAttr", SQLSetStmtAttr
, NULL
},
126 /* 71 */ { SQL_API_SQLSETSTMTOPTION
, "SQLSetStmtOption", SQLSetStmtOption
, NULL
},
127 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS
, "SQLSpecialColumns", SQLSpecialColumns
, NULL
},
128 /* 73 */ { SQL_API_SQLSTATISTICS
, "SQLStatistics", SQLStatistics
, NULL
},
129 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES
, "SQLTablePrivileges", SQLTablePrivileges
, NULL
},
130 /* 75 */ { SQL_API_SQLTABLES
, "SQLTables", SQLTables
, NULL
},
131 /* 76 */ { SQL_API_SQLTRANSACT
, "SQLTransact", SQLTransact
, NULL
},
132 /* 77 */ { SQL_API_SQLGETDIAGREC
, "SQLGetDiagRec", SQLGetDiagRec
, NULL
},
135 static PROXYHANDLE gProxyHandle
;
137 /* What is the difference between these two (dmHandle cf READY_AND_dmHandle)? When does one use one and when the other? */
139 #define CHECK_dmHandle() \
141 if (gProxyHandle.dmHandle == NULL) \
143 TRACE ("Not ready\n"); \
148 #define CHECK_READY_AND_dmHandle() \
150 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) \
152 TRACE ("Not ready\n"); \
157 SQLRETURN
SQLDummyFunc()
159 TRACE("SQLDummyFunc: \n");
163 /***********************************************************************
164 * DllMain [Internal] Initializes the internal 'ODBC32.DLL'.
167 * hinstDLL [I] handle to the DLL's instance
169 * lpvReserved [I] reserved, must be NULL
176 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
179 TRACE("Initializing or Finalizing proxy ODBC: %p,%lx,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
181 if (fdwReason
== DLL_PROCESS_ATTACH
)
183 TRACE("Loading ODBC...\n");
184 DisableThreadLibraryCalls(hinstDLL
);
185 if (ODBC_LoadDriverManager())
186 ODBC_LoadDMFunctions();
188 else if (fdwReason
== DLL_PROCESS_DETACH
)
190 TRACE("Unloading ODBC...\n");
191 if (gProxyHandle
.bFunctionReady
)
193 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
195 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
199 if (gProxyHandle
.dmHandle
)
201 wine_dlclose(gProxyHandle
.dmHandle
,NULL
,0);
202 gProxyHandle
.dmHandle
= NULL
;
210 /***********************************************************************
211 * ODBC_LoadDriverManager [Internal] Load ODBC library.
220 static BOOL
ODBC_LoadDriverManager(void)
222 const char *s
= getenv("LIB_ODBC_DRIVER_MANAGER");
227 gProxyHandle
.bFunctionReady
= FALSE
;
228 gProxyHandle
.nErrorType
= ERROR_LIBRARY_NOT_FOUND
;
230 if (s
!= NULL
&& strlen (s
) >= sizeof(gProxyHandle
.dmLibName
))
232 ERR("Driver name too long (%s)\n",s
);
235 if (s
== NULL
|| strlen(s
) == 0)
237 strcpy(gProxyHandle
.dmLibName
, s
);
239 gProxyHandle
.dmHandle
= wine_dlopen(gProxyHandle
.dmLibName
, RTLD_LAZY
, error
, sizeof(error
));
241 if (gProxyHandle
.dmHandle
== NULL
) /* fail to load unixODBC driver manager */
243 WARN("failed to open library %s: %s\n", gProxyHandle
.dmLibName
, error
);
244 gProxyHandle
.dmLibName
[0] = '\0';
245 gProxyHandle
.nErrorType
= ERROR_LIBRARY_NOT_FOUND
;
250 gProxyHandle
.nErrorType
= ERROR_FREE
;
256 /***********************************************************************
257 * ODBC_LoadDMFunctions [Internal] Populate function table.
266 static BOOL
ODBC_LoadDMFunctions(void)
271 if (gProxyHandle
.dmHandle
== NULL
)
274 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
276 gProxyHandle
.functions
[i
] = template_func
[i
];
277 gProxyHandle
.functions
[i
].func
= wine_dlsym(gProxyHandle
.dmHandle
,
278 gProxyHandle
.functions
[i
].name
, error
, sizeof(error
));
282 ERR("Failed to load function %s\n",gProxyHandle
.functions
[i
].name
);
283 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
287 gProxyHandle
.bFunctionReady
= TRUE
;
293 /*************************************************************************
294 * SQLAllocConnect [ODBC32.001]
296 SQLRETURN WINAPI
SQLAllocConnect(SQLHENV EnvironmentHandle
, SQLHDBC
*ConnectionHandle
)
299 TRACE("Env=%lx\n",EnvironmentHandle
);
301 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
303 *ConnectionHandle
= SQL_NULL_HDBC
;
304 TRACE("Not ready\n");
308 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
);
309 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
)
310 (EnvironmentHandle
, ConnectionHandle
);
311 TRACE("Returns ret=%d, Handle %lx\n",ret
, *ConnectionHandle
);
316 /*************************************************************************
317 * SQLAllocEnv [ODBC32.002]
319 SQLRETURN WINAPI
SQLAllocEnv(SQLHENV
*EnvironmentHandle
)
324 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
326 *EnvironmentHandle
= SQL_NULL_HENV
;
327 TRACE("Not ready\n");
331 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
);
332 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
) (EnvironmentHandle
);
333 TRACE("Returns ret=%d, Env=%lx\n",ret
, *EnvironmentHandle
);
338 /*************************************************************************
339 * SQLAllocHandle [ODBC32.024]
341 SQLRETURN WINAPI
SQLAllocHandle(SQLSMALLINT HandleType
, SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
344 TRACE("(Type=%d, Handle=%lx)\n",HandleType
,InputHandle
);
346 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
348 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
349 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
351 if (HandleType
== SQL_HANDLE_ENV
)
352 *OutputHandle
= SQL_NULL_HENV
;
353 else if (HandleType
== SQL_HANDLE_DBC
)
354 *OutputHandle
= SQL_NULL_HDBC
;
355 else if (HandleType
== SQL_HANDLE_STMT
)
356 *OutputHandle
= SQL_NULL_HSTMT
;
357 else if (HandleType
== SQL_HANDLE_DESC
)
358 *OutputHandle
= SQL_NULL_HDESC
;
360 TRACE ("Not ready\n");
364 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
);
365 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
)
366 (HandleType
, InputHandle
, OutputHandle
);
367 TRACE("Returns ret=%d, Handle=%lx\n",ret
, *OutputHandle
);
372 /*************************************************************************
373 * SQLAllocStmt [ODBC32.003]
375 SQLRETURN WINAPI
SQLAllocStmt(SQLHDBC ConnectionHandle
, SQLHSTMT
*StatementHandle
)
379 TRACE("(Connection=%lx)\n",ConnectionHandle
);
381 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
383 *StatementHandle
= SQL_NULL_HSTMT
;
384 TRACE ("Not ready\n");
388 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
);
389 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
)
390 (ConnectionHandle
, StatementHandle
);
391 TRACE ("Returns ret=%d, Handle=%lx\n", ret
, *StatementHandle
);
396 /*************************************************************************
397 * SQLAllocHandleStd [ODBC32.077]
399 SQLRETURN WINAPI
SQLAllocHandleStd( SQLSMALLINT HandleType
,
400 SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
402 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
404 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
406 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
407 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
409 if (HandleType
== SQL_HANDLE_ENV
)
410 *OutputHandle
= SQL_NULL_HENV
;
411 else if (HandleType
== SQL_HANDLE_DBC
)
412 *OutputHandle
= SQL_NULL_HDBC
;
413 else if (HandleType
== SQL_HANDLE_STMT
)
414 *OutputHandle
= SQL_NULL_HSTMT
;
415 else if (HandleType
== SQL_HANDLE_DESC
)
416 *OutputHandle
= SQL_NULL_HDESC
;
421 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
);
422 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
)
423 (HandleType
, InputHandle
, OutputHandle
);
427 /*************************************************************************
428 * SQLBindCol [ODBC32.004]
430 SQLRETURN WINAPI
SQLBindCol(SQLHSTMT StatementHandle
,
431 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
432 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
433 SQLINTEGER
*StrLen_or_Ind
)
437 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
439 TRACE ("Not ready\n");
443 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
);
444 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
)
445 (StatementHandle
, ColumnNumber
, TargetType
,
446 TargetValue
, BufferLength
, StrLen_or_Ind
);
450 /*************************************************************************
451 * SQLBindParam [ODBC32.025]
453 SQLRETURN WINAPI
SQLBindParam(SQLHSTMT StatementHandle
,
454 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
455 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
456 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
457 SQLINTEGER
*StrLen_or_Ind
)
461 CHECK_READY_AND_dmHandle();
463 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
);
464 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
)
465 (StatementHandle
, ParameterNumber
, ValueType
,
466 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
470 /*************************************************************************
471 * SQLCancel [ODBC32.005]
473 SQLRETURN WINAPI
SQLCancel(SQLHSTMT StatementHandle
)
477 CHECK_READY_AND_dmHandle();
479 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
);
480 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
) (StatementHandle
);
484 /*************************************************************************
485 * SQLCloseCursor [ODBC32.026]
487 SQLRETURN WINAPI
SQLCloseCursor(SQLHSTMT StatementHandle
)
490 TRACE("(Handle=%lx)\n",StatementHandle
);
492 CHECK_READY_AND_dmHandle();
494 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
);
495 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
) (StatementHandle
);
496 TRACE("returns %d\n",ret
);
501 /*************************************************************************
502 * SQLColAttribute [ODBC32.027]
504 SQLRETURN WINAPI
SQLColAttribute (SQLHSTMT StatementHandle
,
505 SQLUSMALLINT ColumnNumber
, SQLUSMALLINT FieldIdentifier
,
506 SQLPOINTER CharacterAttribute
, SQLSMALLINT BufferLength
,
507 SQLSMALLINT
*StringLength
, SQLPOINTER NumericAttribute
)
511 CHECK_READY_AND_dmHandle();
513 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
);
514 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
)
515 (StatementHandle
, ColumnNumber
, FieldIdentifier
,
516 CharacterAttribute
, BufferLength
, StringLength
, NumericAttribute
);
520 /*************************************************************************
521 * SQLColumns [ODBC32.040]
523 SQLRETURN WINAPI
SQLColumns(SQLHSTMT StatementHandle
,
524 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
525 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
526 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
527 SQLCHAR
*ColumnName
, SQLSMALLINT NameLength4
)
531 CHECK_READY_AND_dmHandle();
533 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
);
534 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
)
535 (StatementHandle
, CatalogName
, NameLength1
,
536 SchemaName
, NameLength2
, TableName
, NameLength3
, ColumnName
, NameLength4
);
540 /*************************************************************************
541 * SQLConnect [ODBC32.007]
543 SQLRETURN WINAPI
SQLConnect(SQLHDBC ConnectionHandle
,
544 SQLCHAR
*ServerName
, SQLSMALLINT NameLength1
,
545 SQLCHAR
*UserName
, SQLSMALLINT NameLength2
,
546 SQLCHAR
*Authentication
, SQLSMALLINT NameLength3
)
549 TRACE("(Server=%.*s)\n",NameLength1
, ServerName
);
551 CHECK_READY_AND_dmHandle();
553 strcpy(gProxyHandle
.ServerName
, ServerName
);
554 strcpy(gProxyHandle
.UserName
, UserName
);
556 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
);
557 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
)
558 (ConnectionHandle
, ServerName
, NameLength1
,
559 UserName
, NameLength2
, Authentication
, NameLength3
);
561 TRACE("returns %d\n",ret
);
566 /*************************************************************************
567 * SQLCopyDesc [ODBC32.028]
569 SQLRETURN WINAPI
SQLCopyDesc(SQLHDESC SourceDescHandle
, SQLHDESC TargetDescHandle
)
573 CHECK_READY_AND_dmHandle();
575 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
);
576 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
)
577 (SourceDescHandle
, TargetDescHandle
);
581 /*************************************************************************
582 * SQLDataSources [ODBC32.057]
584 SQLRETURN WINAPI
SQLDataSources(SQLHENV EnvironmentHandle
,
585 SQLUSMALLINT Direction
, SQLCHAR
*ServerName
,
586 SQLSMALLINT BufferLength1
, SQLSMALLINT
*NameLength1
,
587 SQLCHAR
*Description
, SQLSMALLINT BufferLength2
,
588 SQLSMALLINT
*NameLength2
)
592 TRACE("EnvironmentHandle = %p\n", (LPVOID
)EnvironmentHandle
);
594 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
596 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
600 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
);
601 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
)
602 (EnvironmentHandle
, Direction
, ServerName
,
603 BufferLength1
, NameLength1
, Description
, BufferLength2
, NameLength2
);
607 TRACE("returns: %d \t", ret
);
608 if (*NameLength1
> 0)
609 TRACE("DataSource = %s,", ServerName
);
610 if (*NameLength2
> 0)
611 TRACE(" Description = %s", Description
);
619 /*************************************************************************
620 * SQLDescribeCol [ODBC32.008]
622 SQLRETURN WINAPI
SQLDescribeCol(SQLHSTMT StatementHandle
,
623 SQLUSMALLINT ColumnNumber
, SQLCHAR
*ColumnName
,
624 SQLSMALLINT BufferLength
, SQLSMALLINT
*NameLength
,
625 SQLSMALLINT
*DataType
, SQLUINTEGER
*ColumnSize
,
626 SQLSMALLINT
*DecimalDigits
, SQLSMALLINT
*Nullable
)
630 CHECK_READY_AND_dmHandle();
632 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
);
633 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
)
634 (StatementHandle
, ColumnNumber
, ColumnName
,
635 BufferLength
, NameLength
, DataType
, ColumnSize
, DecimalDigits
, Nullable
);
639 /*************************************************************************
640 * SQLDisconnect [ODBC32.009]
642 SQLRETURN WINAPI
SQLDisconnect(SQLHDBC ConnectionHandle
)
645 TRACE("(Handle=%lx)\n", ConnectionHandle
);
647 CHECK_READY_AND_dmHandle();
649 gProxyHandle
.ServerName
[0] = '\0';
650 gProxyHandle
.UserName
[0] = '\0';
652 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
);
653 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
) (ConnectionHandle
);
654 TRACE("returns %d\n",ret
);
659 /*************************************************************************
660 * SQLEndTran [ODBC32.029]
662 SQLRETURN WINAPI
SQLEndTran(SQLSMALLINT HandleType
, SQLHANDLE Handle
, SQLSMALLINT CompletionType
)
666 CHECK_READY_AND_dmHandle();
668 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
);
669 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
) (HandleType
, Handle
, CompletionType
);
673 /*************************************************************************
674 * SQLError [ODBC32.010]
676 SQLRETURN WINAPI
SQLError(SQLHENV EnvironmentHandle
,
677 SQLHDBC ConnectionHandle
, SQLHSTMT StatementHandle
,
678 SQLCHAR
*Sqlstate
, SQLINTEGER
*NativeError
,
679 SQLCHAR
*MessageText
, SQLSMALLINT BufferLength
,
680 SQLSMALLINT
*TextLength
)
684 CHECK_READY_AND_dmHandle();
686 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
);
687 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
)
688 (EnvironmentHandle
, ConnectionHandle
, StatementHandle
,
689 Sqlstate
, NativeError
, MessageText
, BufferLength
, TextLength
);
693 /*************************************************************************
694 * SQLExecDirect [ODBC32.011]
696 SQLRETURN WINAPI
SQLExecDirect(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
700 CHECK_READY_AND_dmHandle();
702 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
);
703 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
)
704 (StatementHandle
, StatementText
, TextLength
);
708 /*************************************************************************
709 * SQLExecute [ODBC32.012]
711 SQLRETURN WINAPI
SQLExecute(SQLHSTMT StatementHandle
)
715 CHECK_READY_AND_dmHandle();
717 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
);
718 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
) (StatementHandle
);
722 /*************************************************************************
723 * SQLFetch [ODBC32.013]
725 SQLRETURN WINAPI
SQLFetch(SQLHSTMT StatementHandle
)
729 CHECK_READY_AND_dmHandle();
731 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
);
732 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
) (StatementHandle
);
736 /*************************************************************************
737 * SQLFetchScroll [ODBC32.030]
739 SQLRETURN WINAPI
SQLFetchScroll(SQLHSTMT StatementHandle
, SQLSMALLINT FetchOrientation
, SQLINTEGER FetchOffset
)
745 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
);
746 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
)
747 (StatementHandle
, FetchOrientation
, FetchOffset
);
751 /*************************************************************************
752 * SQLFreeConnect [ODBC32.014]
754 SQLRETURN WINAPI
SQLFreeConnect(SQLHDBC ConnectionHandle
)
757 TRACE("(Handle=%lx)\n",ConnectionHandle
);
761 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
);
762 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
) (ConnectionHandle
);
763 TRACE("Returns %d\n",ret
);
768 /*************************************************************************
769 * SQLFreeEnv [ODBC32.015]
771 SQLRETURN WINAPI
SQLFreeEnv(SQLHENV EnvironmentHandle
)
774 TRACE("(Env=%lx)\n",EnvironmentHandle
);
778 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
);
779 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
) (EnvironmentHandle
);
780 TRACE("Returns %d\n",ret
);
785 /*************************************************************************
786 * SQLFreeHandle [ODBC32.031]
788 SQLRETURN WINAPI
SQLFreeHandle(SQLSMALLINT HandleType
, SQLHANDLE Handle
)
791 TRACE("(Type=%d, Handle=%lx)\n",HandleType
,Handle
);
795 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
);
796 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
)
797 (HandleType
, Handle
);
798 TRACE ("Returns %d\n",ret
);
803 /*************************************************************************
804 * SQLFreeStmt [ODBC32.016]
806 SQLRETURN WINAPI
SQLFreeStmt(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
)
809 TRACE("(Handle %lx, Option=%d)\n",StatementHandle
, Option
);
813 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
);
814 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
)
815 (StatementHandle
, Option
);
816 TRACE("Returns %d\n",ret
);
821 /*************************************************************************
822 * SQLGetConnectAttr [ODBC32.032]
824 SQLRETURN WINAPI
SQLGetConnectAttr(SQLHDBC ConnectionHandle
,
825 SQLINTEGER Attribute
, SQLPOINTER Value
,
826 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
832 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
);
833 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
)
834 (ConnectionHandle
, Attribute
, Value
,
835 BufferLength
, StringLength
);
839 /*************************************************************************
840 * SQLGetConnectOption [ODBC32.042]
842 SQLRETURN WINAPI
SQLGetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
848 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
);
849 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
)
850 (ConnectionHandle
, Option
, Value
);
854 /*************************************************************************
855 * SQLGetCursorName [ODBC32.017]
857 SQLRETURN WINAPI
SQLGetCursorName(SQLHSTMT StatementHandle
,
858 SQLCHAR
*CursorName
, SQLSMALLINT BufferLength
,
859 SQLSMALLINT
*NameLength
)
865 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
);
866 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
)
867 (StatementHandle
, CursorName
, BufferLength
, NameLength
);
871 /*************************************************************************
872 * SQLGetData [ODBC32.043]
874 SQLRETURN WINAPI
SQLGetData(SQLHSTMT StatementHandle
,
875 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
876 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
877 SQLINTEGER
*StrLen_or_Ind
)
883 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
);
884 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
)
885 (StatementHandle
, ColumnNumber
, TargetType
,
886 TargetValue
, BufferLength
, StrLen_or_Ind
);
890 /*************************************************************************
891 * SQLGetDescField [ODBC32.033]
893 SQLRETURN WINAPI
SQLGetDescField(SQLHDESC DescriptorHandle
,
894 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
895 SQLPOINTER Value
, SQLINTEGER BufferLength
,
896 SQLINTEGER
*StringLength
)
902 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
);
903 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
)
904 (DescriptorHandle
, RecNumber
, FieldIdentifier
,
905 Value
, BufferLength
, StringLength
);
909 /*************************************************************************
910 * SQLGetDescRec [ODBC32.034]
912 SQLRETURN WINAPI
SQLGetDescRec(SQLHDESC DescriptorHandle
,
913 SQLSMALLINT RecNumber
, SQLCHAR
*Name
,
914 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
,
915 SQLSMALLINT
*Type
, SQLSMALLINT
*SubType
,
916 SQLINTEGER
*Length
, SQLSMALLINT
*Precision
,
917 SQLSMALLINT
*Scale
, SQLSMALLINT
*Nullable
)
923 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
);
924 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
)
925 (DescriptorHandle
, RecNumber
, Name
, BufferLength
,
926 StringLength
, Type
, SubType
, Length
, Precision
, Scale
, Nullable
);
930 /*************************************************************************
931 * SQLGetDiagField [ODBC32.035]
933 SQLRETURN WINAPI
SQLGetDiagField(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
934 SQLSMALLINT RecNumber
, SQLSMALLINT DiagIdentifier
,
935 SQLPOINTER DiagInfo
, SQLSMALLINT BufferLength
,
936 SQLSMALLINT
*StringLength
)
942 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
);
943 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
)
944 (HandleType
, Handle
, RecNumber
, DiagIdentifier
,
945 DiagInfo
, BufferLength
, StringLength
);
949 /*************************************************************************
950 * SQLGetDiagRec [ODBC32.036]
952 SQLRETURN WINAPI
SQLGetDiagRec(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
953 SQLSMALLINT RecNumber
, SQLCHAR
*Sqlstate
,
954 SQLINTEGER
*NativeError
, SQLCHAR
*MessageText
,
955 SQLSMALLINT BufferLength
, SQLSMALLINT
*TextLength
)
961 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
);
962 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
)
963 (HandleType
, Handle
, RecNumber
, Sqlstate
, NativeError
,
964 MessageText
, BufferLength
, TextLength
);
968 /*************************************************************************
969 * SQLGetEnvAttr [ODBC32.037]
971 SQLRETURN WINAPI
SQLGetEnvAttr(SQLHENV EnvironmentHandle
,
972 SQLINTEGER Attribute
, SQLPOINTER Value
,
973 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
979 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
);
980 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
)
981 (EnvironmentHandle
, Attribute
, Value
, BufferLength
, StringLength
);
985 /*************************************************************************
986 * SQLGetFunctions [ODBC32.044]
988 SQLRETURN WINAPI
SQLGetFunctions(SQLHDBC ConnectionHandle
, SQLUSMALLINT FunctionId
, SQLUSMALLINT
*Supported
)
994 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
);
995 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
)
996 (ConnectionHandle
, FunctionId
, Supported
);
1000 /*************************************************************************
1001 * SQLGetInfo [ODBC32.045]
1003 SQLRETURN WINAPI
SQLGetInfo(SQLHDBC ConnectionHandle
,
1004 SQLUSMALLINT InfoType
, SQLPOINTER InfoValue
,
1005 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
)
1011 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
);
1012 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
)
1013 (ConnectionHandle
, InfoType
, InfoValue
, BufferLength
, StringLength
);
1017 /*************************************************************************
1018 * SQLGetStmtAttr [ODBC32.038]
1020 SQLRETURN WINAPI
SQLGetStmtAttr(SQLHSTMT StatementHandle
,
1021 SQLINTEGER Attribute
, SQLPOINTER Value
,
1022 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
1028 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
);
1029 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
)
1030 (StatementHandle
, Attribute
, Value
, BufferLength
, StringLength
);
1034 /*************************************************************************
1035 * SQLGetStmtOption [ODBC32.046]
1037 SQLRETURN WINAPI
SQLGetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
1043 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
);
1044 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
)
1045 (StatementHandle
, Option
, Value
);
1049 /*************************************************************************
1050 * SQLGetTypeInfo [ODBC32.047]
1052 SQLRETURN WINAPI
SQLGetTypeInfo(SQLHSTMT StatementHandle
, SQLSMALLINT DataType
)
1058 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
);
1059 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
)
1060 (StatementHandle
, DataType
);
1064 /*************************************************************************
1065 * SQLNumResultCols [ODBC32.018]
1067 SQLRETURN WINAPI
SQLNumResultCols(SQLHSTMT StatementHandle
, SQLSMALLINT
*ColumnCount
)
1073 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
);
1074 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
)
1075 (StatementHandle
, ColumnCount
);
1079 /*************************************************************************
1080 * SQLParamData [ODBC32.048]
1082 SQLRETURN WINAPI
SQLParamData(SQLHSTMT StatementHandle
, SQLPOINTER
*Value
)
1088 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
);
1089 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
)
1090 (StatementHandle
, Value
);
1094 /*************************************************************************
1095 * SQLPrepare [ODBC32.019]
1097 SQLRETURN WINAPI
SQLPrepare(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
1103 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
);
1104 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
)
1105 (StatementHandle
, StatementText
, TextLength
);
1109 /*************************************************************************
1110 * SQLPutData [ODBC32.049]
1112 SQLRETURN WINAPI
SQLPutData(SQLHSTMT StatementHandle
, SQLPOINTER Data
, SQLINTEGER StrLen_or_Ind
)
1118 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
);
1119 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
)
1120 (StatementHandle
, Data
, StrLen_or_Ind
);
1124 /*************************************************************************
1125 * SQLRowCount [ODBC32.020]
1127 SQLRETURN WINAPI
SQLRowCount(SQLHSTMT StatementHandle
, SQLINTEGER
*RowCount
)
1133 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
);
1134 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
)
1135 (StatementHandle
, RowCount
);
1139 /*************************************************************************
1140 * SQLSetConnectAttr [ODBC32.039]
1142 SQLRETURN WINAPI
SQLSetConnectAttr(SQLHDBC ConnectionHandle
, SQLINTEGER Attribute
,
1143 SQLPOINTER Value
, SQLINTEGER StringLength
)
1149 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
);
1150 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
)
1151 (ConnectionHandle
, Attribute
, Value
, StringLength
);
1155 /*************************************************************************
1156 * SQLSetConnectOption [ODBC32.050]
1158 SQLRETURN WINAPI
SQLSetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1164 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
);
1165 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
)
1166 (ConnectionHandle
, Option
, Value
);
1170 /*************************************************************************
1171 * SQLSetCursorName [ODBC32.021]
1173 SQLRETURN WINAPI
SQLSetCursorName(SQLHSTMT StatementHandle
, SQLCHAR
*CursorName
, SQLSMALLINT NameLength
)
1179 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
);
1180 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
)
1181 (StatementHandle
, CursorName
, NameLength
);
1185 /*************************************************************************
1186 * SQLSetDescField [ODBC32.073]
1188 SQLRETURN WINAPI
SQLSetDescField(SQLHDESC DescriptorHandle
,
1189 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
1190 SQLPOINTER Value
, SQLINTEGER BufferLength
)
1196 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
);
1197 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
)
1198 (DescriptorHandle
, RecNumber
, FieldIdentifier
, Value
, BufferLength
);
1202 /*************************************************************************
1203 * SQLSetDescRec [ODBC32.074]
1205 SQLRETURN WINAPI
SQLSetDescRec(SQLHDESC DescriptorHandle
,
1206 SQLSMALLINT RecNumber
, SQLSMALLINT Type
,
1207 SQLSMALLINT SubType
, SQLINTEGER Length
,
1208 SQLSMALLINT Precision
, SQLSMALLINT Scale
,
1209 SQLPOINTER Data
, SQLINTEGER
*StringLength
,
1210 SQLINTEGER
*Indicator
)
1216 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
);
1217 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
)
1218 (DescriptorHandle
, RecNumber
, Type
, SubType
, Length
,
1219 Precision
, Scale
, Data
, StringLength
, Indicator
);
1223 /*************************************************************************
1224 * SQLSetEnvAttr [ODBC32.075]
1226 SQLRETURN WINAPI
SQLSetEnvAttr(SQLHENV EnvironmentHandle
,
1227 SQLINTEGER Attribute
, SQLPOINTER Value
,
1228 SQLINTEGER StringLength
)
1234 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
);
1235 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
)
1236 (EnvironmentHandle
, Attribute
, Value
, StringLength
);
1240 /*************************************************************************
1241 * SQLSetParam [ODBC32.022]
1243 SQLRETURN WINAPI
SQLSetParam(SQLHSTMT StatementHandle
,
1244 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
1245 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
1246 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
1247 SQLINTEGER
*StrLen_or_Ind
)
1253 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
);
1254 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
)
1255 (StatementHandle
, ParameterNumber
, ValueType
, ParameterType
, LengthPrecision
,
1256 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
1260 /*************************************************************************
1261 * SQLSetStmtAttr [ODBC32.076]
1263 SQLRETURN WINAPI
SQLSetStmtAttr(SQLHSTMT StatementHandle
,
1264 SQLINTEGER Attribute
, SQLPOINTER Value
,
1265 SQLINTEGER StringLength
)
1271 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTATTR
].func
);
1272 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTATTR
].func
)
1273 (StatementHandle
, Attribute
, Value
, StringLength
);
1277 /*************************************************************************
1278 * SQLSetStmtOption [ODBC32.051]
1280 SQLRETURN WINAPI
SQLSetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1286 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
);
1287 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
)
1288 (StatementHandle
, Option
, Value
);
1292 /*************************************************************************
1293 * SQLSpecialColumns [ODBC32.052]
1295 SQLRETURN WINAPI
SQLSpecialColumns(SQLHSTMT StatementHandle
,
1296 SQLUSMALLINT IdentifierType
, SQLCHAR
*CatalogName
,
1297 SQLSMALLINT NameLength1
, SQLCHAR
*SchemaName
,
1298 SQLSMALLINT NameLength2
, SQLCHAR
*TableName
,
1299 SQLSMALLINT NameLength3
, SQLUSMALLINT Scope
,
1300 SQLUSMALLINT Nullable
)
1305 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
);
1306 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
)
1307 (StatementHandle
, IdentifierType
, CatalogName
, NameLength1
, SchemaName
,
1308 NameLength2
, TableName
, NameLength3
, Scope
, Nullable
);
1312 /*************************************************************************
1313 * SQLStatistics [ODBC32.053]
1315 SQLRETURN WINAPI
SQLStatistics(SQLHSTMT StatementHandle
,
1316 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1317 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1318 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1319 SQLUSMALLINT Unique
, SQLUSMALLINT Reserved
)
1325 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
);
1326 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
)
1327 (StatementHandle
, CatalogName
, NameLength1
, SchemaName
, NameLength2
,
1328 TableName
, NameLength3
, Unique
, Reserved
);
1332 /*************************************************************************
1333 * SQLTables [ODBC32.054]
1335 SQLRETURN WINAPI
SQLTables(SQLHSTMT StatementHandle
,
1336 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1337 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1338 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1339 SQLCHAR
*TableType
, SQLSMALLINT NameLength4
)
1345 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLES
].func
);
1346 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLES
].func
)
1347 (StatementHandle
, CatalogName
, NameLength1
,
1348 SchemaName
, NameLength2
, TableName
, NameLength3
, TableType
, NameLength4
);
1352 /*************************************************************************
1353 * SQLTransact [ODBC32.023]
1355 SQLRETURN WINAPI
SQLTransact(SQLHENV EnvironmentHandle
, SQLHDBC ConnectionHandle
,
1356 SQLUSMALLINT CompletionType
)
1362 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
);
1363 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
)
1364 (EnvironmentHandle
, ConnectionHandle
, CompletionType
);
1368 /*************************************************************************
1369 * SQLBrowseConnect [ODBC32.055]
1371 SQLRETURN WINAPI
SQLBrowseConnect(
1373 SQLCHAR
*szConnStrIn
,
1374 SQLSMALLINT cbConnStrIn
,
1375 SQLCHAR
*szConnStrOut
,
1376 SQLSMALLINT cbConnStrOutMax
,
1377 SQLSMALLINT
*pcbConnStrOut
)
1383 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
);
1384 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
)
1385 (hdbc
, szConnStrIn
, cbConnStrIn
, szConnStrOut
, cbConnStrOutMax
, pcbConnStrOut
);
1389 /*************************************************************************
1390 * SQLBulkOperations [ODBC32.078]
1392 SQLRETURN WINAPI
SQLBulkOperations(
1393 SQLHSTMT StatementHandle
,
1394 SQLSMALLINT Operation
)
1400 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
);
1401 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
)
1402 (StatementHandle
, Operation
);
1406 /*************************************************************************
1407 * SQLColAttributes [ODBC32.006]
1409 SQLRETURN WINAPI
SQLColAttributes(
1412 SQLUSMALLINT fDescType
,
1414 SQLSMALLINT cbDescMax
,
1415 SQLSMALLINT
*pcbDesc
,
1422 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
);
1423 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
)
1424 (hstmt
, icol
, fDescType
, rgbDesc
, cbDescMax
, pcbDesc
, pfDesc
);
1428 /*************************************************************************
1429 * SQLColumnPrivileges [ODBC32.056]
1431 SQLRETURN WINAPI
SQLColumnPrivileges(
1433 SQLCHAR
*szCatalogName
,
1434 SQLSMALLINT cbCatalogName
,
1435 SQLCHAR
*szSchemaName
,
1436 SQLSMALLINT cbSchemaName
,
1437 SQLCHAR
*szTableName
,
1438 SQLSMALLINT cbTableName
,
1439 SQLCHAR
*szColumnName
,
1440 SQLSMALLINT cbColumnName
)
1446 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
);
1447 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
)
1448 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1449 szTableName
, cbTableName
, szColumnName
, cbColumnName
);
1453 /*************************************************************************
1454 * SQLDescribeParam [ODBC32.058]
1456 SQLRETURN WINAPI
SQLDescribeParam(
1459 SQLSMALLINT
*pfSqlType
,
1460 SQLUINTEGER
*pcbParamDef
,
1461 SQLSMALLINT
*pibScale
,
1462 SQLSMALLINT
*pfNullable
)
1468 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
);
1469 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
)
1470 (hstmt
, ipar
, pfSqlType
, pcbParamDef
, pibScale
, pfNullable
);
1474 /*************************************************************************
1475 * SQLExtendedFetch [ODBC32.059]
1477 SQLRETURN WINAPI
SQLExtendedFetch(
1479 SQLUSMALLINT fFetchType
,
1482 SQLUSMALLINT
*rgfRowStatus
)
1488 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
);
1489 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
)
1490 (hstmt
, fFetchType
, irow
, pcrow
, rgfRowStatus
);
1494 /*************************************************************************
1495 * SQLForeignKeys [ODBC32.060]
1497 SQLRETURN WINAPI
SQLForeignKeys(
1499 SQLCHAR
*szPkCatalogName
,
1500 SQLSMALLINT cbPkCatalogName
,
1501 SQLCHAR
*szPkSchemaName
,
1502 SQLSMALLINT cbPkSchemaName
,
1503 SQLCHAR
*szPkTableName
,
1504 SQLSMALLINT cbPkTableName
,
1505 SQLCHAR
*szFkCatalogName
,
1506 SQLSMALLINT cbFkCatalogName
,
1507 SQLCHAR
*szFkSchemaName
,
1508 SQLSMALLINT cbFkSchemaName
,
1509 SQLCHAR
*szFkTableName
,
1510 SQLSMALLINT cbFkTableName
)
1516 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
);
1517 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
)
1518 (hstmt
, szPkCatalogName
, cbPkCatalogName
, szPkSchemaName
, cbPkSchemaName
,
1519 szPkTableName
, cbPkTableName
, szFkCatalogName
, cbFkCatalogName
, szFkSchemaName
,
1520 cbFkSchemaName
, szFkTableName
, cbFkTableName
);
1524 /*************************************************************************
1525 * SQLMoreResults [ODBC32.061]
1527 SQLRETURN WINAPI
SQLMoreResults(SQLHSTMT hstmt
)
1533 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
);
1534 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
) (hstmt
);
1538 /*************************************************************************
1539 * SQLNativeSql [ODBC32.062]
1541 SQLRETURN WINAPI
SQLNativeSql(
1543 SQLCHAR
*szSqlStrIn
,
1544 SQLINTEGER cbSqlStrIn
,
1546 SQLINTEGER cbSqlStrMax
,
1547 SQLINTEGER
*pcbSqlStr
)
1553 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
);
1554 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
)
1555 (hdbc
, szSqlStrIn
, cbSqlStrIn
, szSqlStr
, cbSqlStrMax
, pcbSqlStr
);
1559 /*************************************************************************
1560 * SQLNumParams [ODBC32.063]
1562 SQLRETURN WINAPI
SQLNumParams(
1570 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
);
1571 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
) (hstmt
, pcpar
);
1575 /*************************************************************************
1576 * SQLParamOptions [ODBC32.064]
1578 SQLRETURN WINAPI
SQLParamOptions(
1587 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
);
1588 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
) (hstmt
, crow
, pirow
);
1592 /*************************************************************************
1593 * SQLPrimaryKeys [ODBC32.065]
1595 SQLRETURN WINAPI
SQLPrimaryKeys(
1597 SQLCHAR
*szCatalogName
,
1598 SQLSMALLINT cbCatalogName
,
1599 SQLCHAR
*szSchemaName
,
1600 SQLSMALLINT cbSchemaName
,
1601 SQLCHAR
*szTableName
,
1602 SQLSMALLINT cbTableName
)
1608 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
);
1609 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
)
1610 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1611 szTableName
, cbTableName
);
1615 /*************************************************************************
1616 * SQLProcedureColumns [ODBC32.066]
1618 SQLRETURN WINAPI
SQLProcedureColumns(
1620 SQLCHAR
*szCatalogName
,
1621 SQLSMALLINT cbCatalogName
,
1622 SQLCHAR
*szSchemaName
,
1623 SQLSMALLINT cbSchemaName
,
1624 SQLCHAR
*szProcName
,
1625 SQLSMALLINT cbProcName
,
1626 SQLCHAR
*szColumnName
,
1627 SQLSMALLINT cbColumnName
)
1633 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
);
1634 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
)
1635 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1636 szProcName
, cbProcName
, szColumnName
, cbColumnName
);
1640 /*************************************************************************
1641 * SQLProcedures [ODBC32.067]
1643 SQLRETURN WINAPI
SQLProcedures(
1645 SQLCHAR
*szCatalogName
,
1646 SQLSMALLINT cbCatalogName
,
1647 SQLCHAR
*szSchemaName
,
1648 SQLSMALLINT cbSchemaName
,
1649 SQLCHAR
*szProcName
,
1650 SQLSMALLINT cbProcName
)
1656 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
);
1657 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
)
1658 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1659 szProcName
, cbProcName
);
1663 /*************************************************************************
1664 * SQLSetPos [ODBC32.068]
1666 SQLRETURN WINAPI
SQLSetPos(
1669 SQLUSMALLINT fOption
,
1676 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
);
1677 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
)
1678 (hstmt
, irow
, fOption
, fLock
);
1682 /*************************************************************************
1683 * SQLTablePrivileges [ODBC32.070]
1685 SQLRETURN WINAPI
SQLTablePrivileges(
1687 SQLCHAR
*szCatalogName
,
1688 SQLSMALLINT cbCatalogName
,
1689 SQLCHAR
*szSchemaName
,
1690 SQLSMALLINT cbSchemaName
,
1691 SQLCHAR
*szTableName
,
1692 SQLSMALLINT cbTableName
)
1698 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
);
1699 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
)
1700 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1701 szTableName
, cbTableName
);
1705 /*************************************************************************
1706 * SQLDrivers [ODBC32.071]
1708 SQLRETURN WINAPI
SQLDrivers(
1710 SQLUSMALLINT fDirection
,
1711 SQLCHAR
*szDriverDesc
,
1712 SQLSMALLINT cbDriverDescMax
,
1713 SQLSMALLINT
*pcbDriverDesc
,
1714 SQLCHAR
*szDriverAttributes
,
1715 SQLSMALLINT cbDriverAttrMax
,
1716 SQLSMALLINT
*pcbDriverAttr
)
1722 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
);
1723 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
)
1724 (henv
, fDirection
, szDriverDesc
, cbDriverDescMax
, pcbDriverDesc
,
1725 szDriverAttributes
, cbDriverAttrMax
, pcbDriverAttr
);
1729 /*************************************************************************
1730 * SQLBindParameter [ODBC32.072]
1732 SQLRETURN WINAPI
SQLBindParameter(
1735 SQLSMALLINT fParamType
,
1737 SQLSMALLINT fSqlType
,
1738 SQLUINTEGER cbColDef
,
1739 SQLSMALLINT ibScale
,
1740 SQLPOINTER rgbValue
,
1741 SQLINTEGER cbValueMax
,
1742 SQLINTEGER
*pcbValue
)
1748 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
);
1749 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
)
1750 (hstmt
, ipar
, fParamType
, fCType
, fSqlType
, cbColDef
, ibScale
,
1751 rgbValue
, cbValueMax
, pcbValue
);
1755 /*************************************************************************
1756 * SQLDriverConnect [ODBC32.041]
1758 SQLRETURN WINAPI
SQLDriverConnect(
1761 SQLCHAR
*conn_str_in
,
1762 SQLSMALLINT len_conn_str_in
,
1763 SQLCHAR
*conn_str_out
,
1764 SQLSMALLINT conn_str_out_max
,
1765 SQLSMALLINT
*ptr_conn_str_out
,
1766 SQLUSMALLINT driver_completion
)
1772 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
);
1773 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
)
1774 (hdbc
, hwnd
, conn_str_in
, len_conn_str_in
, conn_str_out
,
1775 conn_str_out_max
, ptr_conn_str_out
, driver_completion
);
1779 /*************************************************************************
1780 * SQLSetScrollOptions [ODBC32.069]
1782 SQLRETURN WINAPI
SQLSetScrollOptions(
1783 SQLHSTMT statement_handle
,
1784 SQLUSMALLINT f_concurrency
,
1785 SQLINTEGER crow_keyset
,
1786 SQLUSMALLINT crow_rowset
)
1792 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
);
1793 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
)
1794 (statement_handle
, f_concurrency
, crow_keyset
, crow_rowset
);