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"
40 #include "proxyodbc.h"
42 static BOOL
ODBC_LoadDriverManager(void);
43 static BOOL
ODBC_LoadDMFunctions(void);
45 WINE_DEFAULT_DEBUG_CHANNEL(odbc
);
47 static const DM_FUNC template_func
[] =
49 /* 00 */ { SQL_API_SQLALLOCCONNECT
, "SQLAllocConnect", SQLAllocConnect
, NULL
},
50 /* 01 */ { SQL_API_SQLALLOCENV
, "SQLAllocEnv", SQLAllocEnv
, NULL
},
51 /* 02 */ { SQL_API_SQLALLOCHANDLE
, "SQLAllocHandle", SQLAllocHandle
, NULL
},
52 /* 03 */ { SQL_API_SQLALLOCSTMT
, "SQLAllocStmt", SQLAllocStmt
, NULL
},
53 /* 04 */ { SQL_API_SQLALLOCHANDLESTD
, "SQLAllocHandleStd", SQLAllocHandleStd
, NULL
},
54 /* 05 */ { SQL_API_SQLBINDCOL
, "SQLBindCol", SQLBindCol
, NULL
},
55 /* 06 */ { SQL_API_SQLBINDPARAM
, "SQLBindParam", SQLBindParam
, NULL
},
56 /* 07 */ { SQL_API_SQLBINDPARAMETER
, "SQLBindParameter", SQLBindParameter
, NULL
},
57 /* 08 */ { SQL_API_SQLBROWSECONNECT
, "SQLBrowseConnect", SQLBrowseConnect
, NULL
},
58 /* 09 */ { SQL_API_SQLBULKOPERATIONS
, "SQLBulkOperations", SQLBulkOperations
, NULL
},
59 /* 10 */ { SQL_API_SQLCANCEL
, "SQLCancel", SQLCancel
, NULL
},
60 /* 11 */ { SQL_API_SQLCLOSECURSOR
, "SQLCloseCursor", SQLCloseCursor
, NULL
},
61 /* 12 */ { SQL_API_SQLCOLATTRIBUTE
, "SQLColAttribute", SQLColAttribute
, NULL
},
62 /* 13 */ { SQL_API_SQLCOLATTRIBUTES
, "SQLColAttributes", SQLColAttributes
, NULL
},
63 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES
, "SQLColumnPrivileges", SQLColumnPrivileges
, NULL
},
64 /* 15 */ { SQL_API_SQLCOLUMNS
, "SQLColumns", SQLColumns
, NULL
},
65 /* 16 */ { SQL_API_SQLCONNECT
, "SQLConnect", SQLConnect
, NULL
},
66 /* 17 */ { SQL_API_SQLCOPYDESC
, "SQLCopyDesc", SQLCopyDesc
, NULL
},
67 /* 18 */ { SQL_API_SQLDATASOURCES
, "SQLDataSources", SQLDataSources
, NULL
},
68 /* 19 */ { SQL_API_SQLDESCRIBECOL
, "SQLDescribeCol", SQLDescribeCol
, NULL
},
69 /* 20 */ { SQL_API_SQLDESCRIBEPARAM
, "SQLDescribeParam", SQLDescribeParam
, NULL
},
70 /* 21 */ { SQL_API_SQLDISCONNECT
, "SQLDisconnect", SQLDisconnect
, NULL
},
71 /* 22 */ { SQL_API_SQLDRIVERCONNECT
, "SQLDriverConnect", SQLDriverConnect
, NULL
},
72 /* 23 */ { SQL_API_SQLDRIVERS
, "SQLDrivers", SQLDrivers
, NULL
},
73 /* 24 */ { SQL_API_SQLENDTRAN
, "SQLEndTran", SQLEndTran
, NULL
},
74 /* 25 */ { SQL_API_SQLERROR
, "SQLError", SQLError
, NULL
},
75 /* 26 */ { SQL_API_SQLEXECDIRECT
, "SQLExecDirect", SQLExecDirect
, NULL
},
76 /* 27 */ { SQL_API_SQLEXECUTE
, "SQLExecute", SQLExecute
, NULL
},
77 /* 28 */ { SQL_API_SQLEXTENDEDFETCH
, "SQLExtendedFetch", SQLExtendedFetch
, NULL
},
78 /* 29 */ { SQL_API_SQLFETCH
, "SQLFetch", SQLFetch
, NULL
},
79 /* 30 */ { SQL_API_SQLFETCHSCROLL
, "SQLFetchScroll", SQLFetchScroll
, NULL
},
80 /* 31 */ { SQL_API_SQLFOREIGNKEYS
, "SQLForeignKeys", SQLForeignKeys
, NULL
},
81 /* 32 */ { SQL_API_SQLFREEENV
, "SQLFreeEnv", SQLFreeEnv
, NULL
},
82 /* 33 */ { SQL_API_SQLFREEHANDLE
, "SQLFreeHandle", SQLFreeHandle
, NULL
},
83 /* 34 */ { SQL_API_SQLFREESTMT
, "SQLFreeStmt", SQLFreeStmt
, NULL
},
84 /* 35 */ { SQL_API_SQLFREECONNECT
, "SQLFreeConnect", SQLFreeConnect
, NULL
},
85 /* 36 */ { SQL_API_SQLGETCONNECTATTR
, "SQLGetConnectAttr", SQLGetConnectAttr
, NULL
},
86 /* 37 */ { SQL_API_SQLGETCONNECTOPTION
, "SQLGetConnectOption", SQLGetConnectOption
, NULL
},
87 /* 38 */ { SQL_API_SQLGETCURSORNAME
, "SQLGetCursorName", SQLGetCursorName
, NULL
},
88 /* 39 */ { SQL_API_SQLGETDATA
, "SQLGetData", SQLGetData
, NULL
},
89 /* 40 */ { SQL_API_SQLGETDESCFIELD
, "SQLGetDescField", SQLGetDescField
, NULL
},
90 /* 41 */ { SQL_API_SQLGETDESCREC
, "SQLGetDescRec", SQLGetDescRec
, NULL
},
91 /* 42 */ { SQL_API_SQLGETDIAGFIELD
, "SQLGetDiagField", SQLGetDiagField
, NULL
},
92 /* 43 */ { SQL_API_SQLGETENVATTR
, "SQLGetEnvAttr", SQLGetEnvAttr
, NULL
},
93 /* 44 */ { SQL_API_SQLGETFUNCTIONS
, "SQLGetFunctions", SQLGetFunctions
, NULL
},
94 /* 45 */ { SQL_API_SQLGETINFO
, "SQLGetInfo", SQLGetInfo
, NULL
},
95 /* 46 */ { SQL_API_SQLGETSTMTATTR
, "SQLGetStmtAttr", SQLGetStmtAttr
, NULL
},
96 /* 47 */ { SQL_API_SQLGETSTMTOPTION
, "SQLGetStmtOption", SQLGetStmtOption
, NULL
},
97 /* 48 */ { SQL_API_SQLGETTYPEINFO
, "SQLGetTypeInfo", SQLGetTypeInfo
, NULL
},
98 /* 49 */ { SQL_API_SQLMORERESULTS
, "SQLMoreResults", SQLMoreResults
, NULL
},
99 /* 50 */ { SQL_API_SQLNATIVESQL
, "SQLNativeSql", SQLNativeSql
, NULL
},
100 /* 51 */ { SQL_API_SQLNUMPARAMS
, "SQLNumParams", SQLNumParams
, NULL
},
101 /* 52 */ { SQL_API_SQLNUMRESULTCOLS
, "SQLNumResultCols", SQLNumResultCols
, NULL
},
102 /* 53 */ { SQL_API_SQLPARAMDATA
, "SQLParamData", SQLParamData
, NULL
},
103 /* 54 */ { SQL_API_SQLPARAMOPTIONS
, "SQLParamOptions", SQLParamOptions
, NULL
},
104 /* 55 */ { SQL_API_SQLPREPARE
, "SQLPrepare", SQLPrepare
, NULL
},
105 /* 56 */ { SQL_API_SQLPRIMARYKEYS
, "SQLPrimaryKeys", SQLPrimaryKeys
, NULL
},
106 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS
, "SQLProcedureColumns", SQLProcedureColumns
, NULL
},
107 /* 58 */ { SQL_API_SQLPROCEDURES
, "SQLProcedures", SQLProcedures
, NULL
},
108 /* 59 */ { SQL_API_SQLPUTDATA
, "SQLPutData", SQLPutData
, NULL
},
109 /* 60 */ { SQL_API_SQLROWCOUNT
, "SQLRowCount", SQLRowCount
, NULL
},
110 /* 61 */ { SQL_API_SQLSETCONNECTATTR
, "SQLSetConnectAttr", SQLSetConnectAttr
, NULL
},
111 /* 62 */ { SQL_API_SQLSETCONNECTOPTION
, "SQLSetConnectOption", SQLSetConnectOption
, NULL
},
112 /* 63 */ { SQL_API_SQLSETCURSORNAME
, "SQLSetCursorName", SQLSetCursorName
, NULL
},
113 /* 64 */ { SQL_API_SQLSETDESCFIELD
, "SQLSetDescField", SQLSetDescField
, NULL
},
114 /* 65 */ { SQL_API_SQLSETDESCREC
, "SQLSetDescRec", SQLSetDescRec
, NULL
},
115 /* 66 */ { SQL_API_SQLSETENVATTR
, "SQLSetEnvAttr", SQLSetEnvAttr
, NULL
},
116 /* 67 */ { SQL_API_SQLSETPARAM
, "SQLSetParam", SQLSetParam
, NULL
},
117 /* 68 */ { SQL_API_SQLSETPOS
, "SQLSetPos", SQLSetPos
, NULL
},
118 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS
, "SQLSetScrollOptions", SQLSetScrollOptions
, NULL
},
119 /* 70 */ { SQL_API_SQLSETSTMTATTR
, "SQLSetStmtAttr", SQLSetStmtAttr
, NULL
},
120 /* 71 */ { SQL_API_SQLSETSTMTOPTION
, "SQLSetStmtOption", SQLSetStmtOption
, NULL
},
121 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS
, "SQLSpecialColumns", SQLSpecialColumns
, NULL
},
122 /* 73 */ { SQL_API_SQLSTATISTICS
, "SQLStatistics", SQLStatistics
, NULL
},
123 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES
, "SQLTablePrivileges", SQLTablePrivileges
, NULL
},
124 /* 75 */ { SQL_API_SQLTABLES
, "SQLTables", SQLTables
, NULL
},
125 /* 76 */ { SQL_API_SQLTRANSACT
, "SQLTransact", SQLTransact
, NULL
},
126 /* 77 */ { SQL_API_SQLGETDIAGREC
, "SQLGetDiagRec", SQLGetDiagRec
, NULL
},
129 static PROXYHANDLE gProxyHandle
= {
134 ERROR_LIBRARY_NOT_FOUND
,
142 /* What is the difference between these two (dmHandle cf READY_AND_dmHandle)? When does one use one and when the other? */
144 #define CHECK_dmHandle() \
146 if (gProxyHandle.dmHandle == NULL) \
148 TRACE ("Not ready\n"); \
153 #define CHECK_READY_AND_dmHandle() \
155 if (!gProxyHandle.bFunctionReady || gProxyHandle.dmHandle == NULL) \
157 TRACE ("Not ready\n"); \
162 SQLRETURN
SQLDummyFunc()
164 TRACE("SQLDummyFunc: \n");
168 /***********************************************************************
169 * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'.
172 * hinstDLL [I] handle to the DLL's instance
174 * lpvReserved [I] reserved, must be NULL
182 MAIN_OdbcInit(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
185 TRACE("Initializing or Finalizing proxy ODBC: %x,%lx,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
187 if (fdwReason
== DLL_PROCESS_ATTACH
)
189 TRACE("Loading ODBC...\n");
190 if (ODBC_LoadDriverManager())
191 ODBC_LoadDMFunctions();
193 else if (fdwReason
== DLL_PROCESS_DETACH
)
195 TRACE("Unloading ODBC...\n");
196 if (gProxyHandle
.bFunctionReady
)
198 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
200 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
204 if (gProxyHandle
.dmHandle
)
206 wine_dlclose(gProxyHandle
.dmHandle
,NULL
,0);
207 gProxyHandle
.dmHandle
= NULL
;
215 /***********************************************************************
216 * ODBC_LoadDriverManager [Internal] Load ODBC library.
225 static BOOL
ODBC_LoadDriverManager(void)
227 const char *s
= getenv("LIB_ODBC_DRIVER_MANAGER");
232 gProxyHandle
.bFunctionReady
= FALSE
;
234 if (s
!= NULL
&& strlen (s
) >= sizeof(gProxyHandle
.dmLibName
))
236 ERR("Driver name too long (%s)\n",s
);
239 if (s
== NULL
|| strlen(s
) == 0)
241 strcpy(gProxyHandle
.dmLibName
, s
);
243 gProxyHandle
.dmHandle
= wine_dlopen(gProxyHandle
.dmLibName
, RTLD_LAZY
, error
, sizeof(error
));
245 if (gProxyHandle
.dmHandle
== NULL
) /* fail to load unixODBC driver manager */
247 WARN("failed to open library %s: %s\n", gProxyHandle
.dmLibName
, error
);
248 gProxyHandle
.dmLibName
[0] = '\0';
249 gProxyHandle
.nErrorType
= ERROR_LIBRARY_NOT_FOUND
;
254 gProxyHandle
.nErrorType
= ERROR_FREE
;
260 /***********************************************************************
261 * ODBC_LoadDMFunctions [Internal] Populate function table.
270 static BOOL
ODBC_LoadDMFunctions(void)
275 if (gProxyHandle
.dmHandle
== NULL
)
278 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
280 gProxyHandle
.functions
[i
] = template_func
[i
];
281 gProxyHandle
.functions
[i
].func
= wine_dlsym(gProxyHandle
.dmHandle
,
282 gProxyHandle
.functions
[i
].name
, error
, sizeof(error
));
286 ERR("Failed to load function %s\n",gProxyHandle
.functions
[i
].name
);
287 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
291 gProxyHandle
.bFunctionReady
= TRUE
;
297 /*************************************************************************
298 * SQLAllocConnect [ODBC32.001]
300 SQLRETURN WINAPI
SQLAllocConnect(SQLHENV EnvironmentHandle
, SQLHDBC
*ConnectionHandle
)
303 TRACE("Env=%lx\n",EnvironmentHandle
);
305 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
307 *ConnectionHandle
= SQL_NULL_HDBC
;
308 TRACE("Not ready\n");
312 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
);
313 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
)
314 (EnvironmentHandle
, ConnectionHandle
);
315 TRACE("Returns ret=%d, Handle %lx\n",ret
, *ConnectionHandle
);
320 /*************************************************************************
321 * SQLAllocEnv [ODBC32.002]
323 SQLRETURN WINAPI
SQLAllocEnv(SQLHENV
*EnvironmentHandle
)
328 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
330 *EnvironmentHandle
= SQL_NULL_HENV
;
331 TRACE("Not ready\n");
335 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
);
336 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
) (EnvironmentHandle
);
337 TRACE("Returns ret=%d, Env=%lx\n",ret
, *EnvironmentHandle
);
342 /*************************************************************************
343 * SQLAllocHandle [ODBC32.024]
345 SQLRETURN WINAPI
SQLAllocHandle(SQLSMALLINT HandleType
, SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
348 TRACE("(Type=%d, Handle=%lx)\n",HandleType
,InputHandle
);
350 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
352 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
353 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
355 if (HandleType
== SQL_HANDLE_ENV
)
356 *OutputHandle
= SQL_NULL_HENV
;
357 else if (HandleType
== SQL_HANDLE_DBC
)
358 *OutputHandle
= SQL_NULL_HDBC
;
359 else if (HandleType
== SQL_HANDLE_STMT
)
360 *OutputHandle
= SQL_NULL_HSTMT
;
361 else if (HandleType
== SQL_HANDLE_DESC
)
362 *OutputHandle
= SQL_NULL_HDESC
;
364 TRACE ("Not ready\n");
368 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
);
369 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
)
370 (HandleType
, InputHandle
, OutputHandle
);
371 TRACE("Returns ret=%d, Handle=%lx\n",ret
, *OutputHandle
);
376 /*************************************************************************
377 * SQLAllocStmt [ODBC32.003]
379 SQLRETURN WINAPI
SQLAllocStmt(SQLHDBC ConnectionHandle
, SQLHSTMT
*StatementHandle
)
383 TRACE("(Connection=%lx)\n",ConnectionHandle
);
385 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
387 *StatementHandle
= SQL_NULL_HSTMT
;
388 TRACE ("Not ready\n");
392 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
);
393 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
)
394 (ConnectionHandle
, StatementHandle
);
395 TRACE ("Returns ret=%d, Handle=%lx\n", ret
, *StatementHandle
);
400 /*************************************************************************
401 * SQLAllocHandleStd [ODBC32.077]
403 SQLRETURN WINAPI
SQLAllocHandleStd( SQLSMALLINT HandleType
,
404 SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
406 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
408 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
410 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
411 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
413 if (HandleType
== SQL_HANDLE_ENV
)
414 *OutputHandle
= SQL_NULL_HENV
;
415 else if (HandleType
== SQL_HANDLE_DBC
)
416 *OutputHandle
= SQL_NULL_HDBC
;
417 else if (HandleType
== SQL_HANDLE_STMT
)
418 *OutputHandle
= SQL_NULL_HSTMT
;
419 else if (HandleType
== SQL_HANDLE_DESC
)
420 *OutputHandle
= SQL_NULL_HDESC
;
425 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
);
426 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
)
427 (HandleType
, InputHandle
, OutputHandle
);
431 /*************************************************************************
432 * SQLBindCol [ODBC32.004]
434 SQLRETURN WINAPI
SQLBindCol(SQLHSTMT StatementHandle
,
435 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
436 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
437 SQLINTEGER
*StrLen_or_Ind
)
441 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
443 TRACE ("Not ready\n");
447 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
);
448 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
)
449 (StatementHandle
, ColumnNumber
, TargetType
,
450 TargetValue
, BufferLength
, StrLen_or_Ind
);
454 /*************************************************************************
455 * SQLBindParam [ODBC32.025]
457 SQLRETURN WINAPI
SQLBindParam(SQLHSTMT StatementHandle
,
458 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
459 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
460 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
461 SQLINTEGER
*StrLen_or_Ind
)
465 CHECK_READY_AND_dmHandle();
467 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
);
468 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
)
469 (StatementHandle
, ParameterNumber
, ValueType
,
470 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
474 /*************************************************************************
475 * SQLCancel [ODBC32.005]
477 SQLRETURN WINAPI
SQLCancel(SQLHSTMT StatementHandle
)
481 CHECK_READY_AND_dmHandle();
483 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
);
484 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
) (StatementHandle
);
488 /*************************************************************************
489 * SQLCloseCursor [ODBC32.026]
491 SQLRETURN WINAPI
SQLCloseCursor(SQLHSTMT StatementHandle
)
494 TRACE("(Handle=%lx)\n",StatementHandle
);
496 CHECK_READY_AND_dmHandle();
498 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
);
499 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
) (StatementHandle
);
500 TRACE("returns %d\n",ret
);
505 /*************************************************************************
506 * SQLColAttribute [ODBC32.027]
508 SQLRETURN WINAPI
SQLColAttribute (SQLHSTMT StatementHandle
,
509 SQLUSMALLINT ColumnNumber
, SQLUSMALLINT FieldIdentifier
,
510 SQLPOINTER CharacterAttribute
, SQLSMALLINT BufferLength
,
511 SQLSMALLINT
*StringLength
, SQLPOINTER NumericAttribute
)
515 CHECK_READY_AND_dmHandle();
517 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
);
518 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
)
519 (StatementHandle
, ColumnNumber
, FieldIdentifier
,
520 CharacterAttribute
, BufferLength
, StringLength
, NumericAttribute
);
524 /*************************************************************************
525 * SQLColumns [ODBC32.040]
527 SQLRETURN WINAPI
SQLColumns(SQLHSTMT StatementHandle
,
528 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
529 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
530 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
531 SQLCHAR
*ColumnName
, SQLSMALLINT NameLength4
)
535 CHECK_READY_AND_dmHandle();
537 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
);
538 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
)
539 (StatementHandle
, CatalogName
, NameLength1
,
540 SchemaName
, NameLength2
, TableName
, NameLength3
, ColumnName
, NameLength4
);
544 /*************************************************************************
545 * SQLConnect [ODBC32.007]
547 SQLRETURN WINAPI
SQLConnect(SQLHDBC ConnectionHandle
,
548 SQLCHAR
*ServerName
, SQLSMALLINT NameLength1
,
549 SQLCHAR
*UserName
, SQLSMALLINT NameLength2
,
550 SQLCHAR
*Authentication
, SQLSMALLINT NameLength3
)
553 TRACE("(Server=%.*s)\n",NameLength1
, ServerName
);
555 CHECK_READY_AND_dmHandle();
557 strcpy(gProxyHandle
.ServerName
, ServerName
);
558 strcpy(gProxyHandle
.UserName
, UserName
);
560 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
);
561 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
)
562 (ConnectionHandle
, ServerName
, NameLength1
,
563 UserName
, NameLength2
, Authentication
, NameLength3
);
565 TRACE("returns %d\n",ret
);
570 /*************************************************************************
571 * SQLCopyDesc [ODBC32.028]
573 SQLRETURN WINAPI
SQLCopyDesc(SQLHDESC SourceDescHandle
, SQLHDESC TargetDescHandle
)
577 CHECK_READY_AND_dmHandle();
579 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
);
580 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
)
581 (SourceDescHandle
, TargetDescHandle
);
585 /*************************************************************************
586 * SQLDataSources [ODBC32.057]
588 SQLRETURN WINAPI
SQLDataSources(SQLHENV EnvironmentHandle
,
589 SQLUSMALLINT Direction
, SQLCHAR
*ServerName
,
590 SQLSMALLINT BufferLength1
, SQLSMALLINT
*NameLength1
,
591 SQLCHAR
*Description
, SQLSMALLINT BufferLength2
,
592 SQLSMALLINT
*NameLength2
)
596 TRACE("EnvironmentHandle = %p\n", (LPVOID
)EnvironmentHandle
);
598 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
600 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
604 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
);
605 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
)
606 (EnvironmentHandle
, Direction
, ServerName
,
607 BufferLength1
, NameLength1
, Description
, BufferLength2
, NameLength2
);
611 TRACE("returns: %d \t", ret
);
612 if (*NameLength1
> 0)
613 DPRINTF("DataSource = %s,", ServerName
);
614 if (*NameLength2
> 0)
615 DPRINTF(" Description = %s", Description
);
623 /*************************************************************************
624 * SQLDescribeCol [ODBC32.008]
626 SQLRETURN WINAPI
SQLDescribeCol(SQLHSTMT StatementHandle
,
627 SQLUSMALLINT ColumnNumber
, SQLCHAR
*ColumnName
,
628 SQLSMALLINT BufferLength
, SQLSMALLINT
*NameLength
,
629 SQLSMALLINT
*DataType
, SQLUINTEGER
*ColumnSize
,
630 SQLSMALLINT
*DecimalDigits
, SQLSMALLINT
*Nullable
)
634 CHECK_READY_AND_dmHandle();
636 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
);
637 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
)
638 (StatementHandle
, ColumnNumber
, ColumnName
,
639 BufferLength
, NameLength
, DataType
, ColumnSize
, DecimalDigits
, Nullable
);
643 /*************************************************************************
644 * SQLDisconnect [ODBC32.009]
646 SQLRETURN WINAPI
SQLDisconnect(SQLHDBC ConnectionHandle
)
649 TRACE("(Handle=%lx)\n", ConnectionHandle
);
651 CHECK_READY_AND_dmHandle();
653 gProxyHandle
.ServerName
[0] = '\0';
654 gProxyHandle
.UserName
[0] = '\0';
656 assert(gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
);
657 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
) (ConnectionHandle
);
658 TRACE("returns %d\n",ret
);
663 /*************************************************************************
664 * SQLEndTran [ODBC32.029]
666 SQLRETURN WINAPI
SQLEndTran(SQLSMALLINT HandleType
, SQLHANDLE Handle
, SQLSMALLINT CompletionType
)
670 CHECK_READY_AND_dmHandle();
672 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
);
673 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
) (HandleType
, Handle
, CompletionType
);
677 /*************************************************************************
678 * SQLError [ODBC32.010]
680 SQLRETURN WINAPI
SQLError(SQLHENV EnvironmentHandle
,
681 SQLHDBC ConnectionHandle
, SQLHSTMT StatementHandle
,
682 SQLCHAR
*Sqlstate
, SQLINTEGER
*NativeError
,
683 SQLCHAR
*MessageText
, SQLSMALLINT BufferLength
,
684 SQLSMALLINT
*TextLength
)
688 CHECK_READY_AND_dmHandle();
690 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
);
691 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
)
692 (EnvironmentHandle
, ConnectionHandle
, StatementHandle
,
693 Sqlstate
, NativeError
, MessageText
, BufferLength
, TextLength
);
697 /*************************************************************************
698 * SQLExecDirect [ODBC32.011]
700 SQLRETURN WINAPI
SQLExecDirect(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
704 CHECK_READY_AND_dmHandle();
706 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
);
707 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
)
708 (StatementHandle
, StatementText
, TextLength
);
712 /*************************************************************************
713 * SQLExecute [ODBC32.012]
715 SQLRETURN WINAPI
SQLExecute(SQLHSTMT StatementHandle
)
719 CHECK_READY_AND_dmHandle();
721 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
);
722 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
) (StatementHandle
);
726 /*************************************************************************
727 * SQLFetch [ODBC32.013]
729 SQLRETURN WINAPI
SQLFetch(SQLHSTMT StatementHandle
)
733 CHECK_READY_AND_dmHandle();
735 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
);
736 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
) (StatementHandle
);
740 /*************************************************************************
741 * SQLFetchScroll [ODBC32.030]
743 SQLRETURN WINAPI
SQLFetchScroll(SQLHSTMT StatementHandle
, SQLSMALLINT FetchOrientation
, SQLINTEGER FetchOffset
)
749 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
);
750 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
)
751 (StatementHandle
, FetchOrientation
, FetchOffset
);
755 /*************************************************************************
756 * SQLFreeConnect [ODBC32.014]
758 SQLRETURN WINAPI
SQLFreeConnect(SQLHDBC ConnectionHandle
)
761 TRACE("(Handle=%lx)\n",ConnectionHandle
);
765 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
);
766 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
) (ConnectionHandle
);
767 TRACE("Returns %d\n",ret
);
772 /*************************************************************************
773 * SQLFreeEnv [ODBC32.015]
775 SQLRETURN WINAPI
SQLFreeEnv(SQLHENV EnvironmentHandle
)
778 TRACE("(Env=%lx)\n",EnvironmentHandle
);
782 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
);
783 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
) (EnvironmentHandle
);
784 TRACE("Returns %d\n",ret
);
789 /*************************************************************************
790 * SQLFreeHandle [ODBC32.031]
792 SQLRETURN WINAPI
SQLFreeHandle(SQLSMALLINT HandleType
, SQLHANDLE Handle
)
795 TRACE("(Type=%d, Handle=%lx)\n",HandleType
,Handle
);
799 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
);
800 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
)
801 (HandleType
, Handle
);
802 TRACE ("Returns %d\n",ret
);
807 /*************************************************************************
808 * SQLFreeStmt [ODBC32.016]
810 SQLRETURN WINAPI
SQLFreeStmt(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
)
813 TRACE("(Handle %lx, Option=%d)\n",StatementHandle
, Option
);
817 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
);
818 ret
=(gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
)
819 (StatementHandle
, Option
);
820 TRACE("Returns %d\n",ret
);
825 /*************************************************************************
826 * SQLGetConnectAttr [ODBC32.032]
828 SQLRETURN WINAPI
SQLGetConnectAttr(SQLHDBC ConnectionHandle
,
829 SQLINTEGER Attribute
, SQLPOINTER Value
,
830 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
836 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
);
837 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
)
838 (ConnectionHandle
, Attribute
, Value
,
839 BufferLength
, StringLength
);
843 /*************************************************************************
844 * SQLGetConnectOption [ODBC32.042]
846 SQLRETURN WINAPI
SQLGetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
852 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
);
853 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
)
854 (ConnectionHandle
, Option
, Value
);
858 /*************************************************************************
859 * SQLGetCursorName [ODBC32.017]
861 SQLRETURN WINAPI
SQLGetCursorName(SQLHSTMT StatementHandle
,
862 SQLCHAR
*CursorName
, SQLSMALLINT BufferLength
,
863 SQLSMALLINT
*NameLength
)
869 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
);
870 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
)
871 (StatementHandle
, CursorName
, BufferLength
, NameLength
);
875 /*************************************************************************
876 * SQLGetData [ODBC32.043]
878 SQLRETURN WINAPI
SQLGetData(SQLHSTMT StatementHandle
,
879 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
880 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
881 SQLINTEGER
*StrLen_or_Ind
)
887 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
);
888 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
)
889 (StatementHandle
, ColumnNumber
, TargetType
,
890 TargetValue
, BufferLength
, StrLen_or_Ind
);
894 /*************************************************************************
895 * SQLGetDescField [ODBC32.033]
897 SQLRETURN WINAPI
SQLGetDescField(SQLHDESC DescriptorHandle
,
898 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
899 SQLPOINTER Value
, SQLINTEGER BufferLength
,
900 SQLINTEGER
*StringLength
)
906 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
);
907 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
)
908 (DescriptorHandle
, RecNumber
, FieldIdentifier
,
909 Value
, BufferLength
, StringLength
);
913 /*************************************************************************
914 * SQLGetDescRec [ODBC32.034]
916 SQLRETURN WINAPI
SQLGetDescRec(SQLHDESC DescriptorHandle
,
917 SQLSMALLINT RecNumber
, SQLCHAR
*Name
,
918 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
,
919 SQLSMALLINT
*Type
, SQLSMALLINT
*SubType
,
920 SQLINTEGER
*Length
, SQLSMALLINT
*Precision
,
921 SQLSMALLINT
*Scale
, SQLSMALLINT
*Nullable
)
927 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
);
928 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
)
929 (DescriptorHandle
, RecNumber
, Name
, BufferLength
,
930 StringLength
, Type
, SubType
, Length
, Precision
, Scale
, Nullable
);
934 /*************************************************************************
935 * SQLGetDiagField [ODBC32.035]
937 SQLRETURN WINAPI
SQLGetDiagField(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
938 SQLSMALLINT RecNumber
, SQLSMALLINT DiagIdentifier
,
939 SQLPOINTER DiagInfo
, SQLSMALLINT BufferLength
,
940 SQLSMALLINT
*StringLength
)
946 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
);
947 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
)
948 (HandleType
, Handle
, RecNumber
, DiagIdentifier
,
949 DiagInfo
, BufferLength
, StringLength
);
953 /*************************************************************************
954 * SQLGetDiagRec [ODBC32.036]
956 SQLRETURN WINAPI
SQLGetDiagRec(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
957 SQLSMALLINT RecNumber
, SQLCHAR
*Sqlstate
,
958 SQLINTEGER
*NativeError
, SQLCHAR
*MessageText
,
959 SQLSMALLINT BufferLength
, SQLSMALLINT
*TextLength
)
965 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
);
966 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
)
967 (HandleType
, Handle
, RecNumber
, Sqlstate
, NativeError
,
968 MessageText
, BufferLength
, TextLength
);
972 /*************************************************************************
973 * SQLGetEnvAttr [ODBC32.037]
975 SQLRETURN WINAPI
SQLGetEnvAttr(SQLHENV EnvironmentHandle
,
976 SQLINTEGER Attribute
, SQLPOINTER Value
,
977 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
983 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
);
984 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
)
985 (EnvironmentHandle
, Attribute
, Value
, BufferLength
, StringLength
);
989 /*************************************************************************
990 * SQLGetFunctions [ODBC32.044]
992 SQLRETURN WINAPI
SQLGetFunctions(SQLHDBC ConnectionHandle
, SQLUSMALLINT FunctionId
, SQLUSMALLINT
*Supported
)
998 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
);
999 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
)
1000 (ConnectionHandle
, FunctionId
, Supported
);
1004 /*************************************************************************
1005 * SQLGetInfo [ODBC32.045]
1007 SQLRETURN WINAPI
SQLGetInfo(SQLHDBC ConnectionHandle
,
1008 SQLUSMALLINT InfoType
, SQLPOINTER InfoValue
,
1009 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
)
1015 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
);
1016 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
)
1017 (ConnectionHandle
, InfoType
, InfoValue
, BufferLength
, StringLength
);
1021 /*************************************************************************
1022 * SQLGetStmtAttr [ODBC32.038]
1024 SQLRETURN WINAPI
SQLGetStmtAttr(SQLHSTMT StatementHandle
,
1025 SQLINTEGER Attribute
, SQLPOINTER Value
,
1026 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
1032 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
);
1033 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
)
1034 (StatementHandle
, Attribute
, Value
, BufferLength
, StringLength
);
1038 /*************************************************************************
1039 * SQLGetStmtOption [ODBC32.046]
1041 SQLRETURN WINAPI
SQLGetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
1047 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
);
1048 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
)
1049 (StatementHandle
, Option
, Value
);
1053 /*************************************************************************
1054 * SQLGetTypeInfo [ODBC32.047]
1056 SQLRETURN WINAPI
SQLGetTypeInfo(SQLHSTMT StatementHandle
, SQLSMALLINT DataType
)
1062 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
);
1063 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
)
1064 (StatementHandle
, DataType
);
1068 /*************************************************************************
1069 * SQLNumResultCols [ODBC32.018]
1071 SQLRETURN WINAPI
SQLNumResultCols(SQLHSTMT StatementHandle
, SQLSMALLINT
*ColumnCount
)
1077 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
);
1078 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
)
1079 (StatementHandle
, ColumnCount
);
1083 /*************************************************************************
1084 * SQLParamData [ODBC32.048]
1086 SQLRETURN WINAPI
SQLParamData(SQLHSTMT StatementHandle
, SQLPOINTER
*Value
)
1092 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
);
1093 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
)
1094 (StatementHandle
, Value
);
1098 /*************************************************************************
1099 * SQLPrepare [ODBC32.019]
1101 SQLRETURN WINAPI
SQLPrepare(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
1107 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
);
1108 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
)
1109 (StatementHandle
, StatementText
, TextLength
);
1113 /*************************************************************************
1114 * SQLPutData [ODBC32.049]
1116 SQLRETURN WINAPI
SQLPutData(SQLHSTMT StatementHandle
, SQLPOINTER Data
, SQLINTEGER StrLen_or_Ind
)
1122 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
);
1123 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
)
1124 (StatementHandle
, Data
, StrLen_or_Ind
);
1128 /*************************************************************************
1129 * SQLRowCount [ODBC32.020]
1131 SQLRETURN WINAPI
SQLRowCount(SQLHSTMT StatementHandle
, SQLINTEGER
*RowCount
)
1137 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
);
1138 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
)
1139 (StatementHandle
, RowCount
);
1143 /*************************************************************************
1144 * SQLSetConnectAttr [ODBC32.039]
1146 SQLRETURN WINAPI
SQLSetConnectAttr(SQLHDBC ConnectionHandle
, SQLINTEGER Attribute
,
1147 SQLPOINTER Value
, SQLINTEGER StringLength
)
1153 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
);
1154 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
)
1155 (ConnectionHandle
, Attribute
, Value
, StringLength
);
1159 /*************************************************************************
1160 * SQLSetConnectOption [ODBC32.050]
1162 SQLRETURN WINAPI
SQLSetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1168 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
);
1169 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
)
1170 (ConnectionHandle
, Option
, Value
);
1174 /*************************************************************************
1175 * SQLSetCursorName [ODBC32.021]
1177 SQLRETURN WINAPI
SQLSetCursorName(SQLHSTMT StatementHandle
, SQLCHAR
*CursorName
, SQLSMALLINT NameLength
)
1183 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
);
1184 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
)
1185 (StatementHandle
, CursorName
, NameLength
);
1189 /*************************************************************************
1190 * SQLSetDescField [ODBC32.073]
1192 SQLRETURN WINAPI
SQLSetDescField(SQLHDESC DescriptorHandle
,
1193 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
1194 SQLPOINTER Value
, SQLINTEGER BufferLength
)
1200 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
);
1201 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
)
1202 (DescriptorHandle
, RecNumber
, FieldIdentifier
, Value
, BufferLength
);
1206 /*************************************************************************
1207 * SQLSetDescRec [ODBC32.074]
1209 SQLRETURN WINAPI
SQLSetDescRec(SQLHDESC DescriptorHandle
,
1210 SQLSMALLINT RecNumber
, SQLSMALLINT Type
,
1211 SQLSMALLINT SubType
, SQLINTEGER Length
,
1212 SQLSMALLINT Precision
, SQLSMALLINT Scale
,
1213 SQLPOINTER Data
, SQLINTEGER
*StringLength
,
1214 SQLINTEGER
*Indicator
)
1220 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
);
1221 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
)
1222 (DescriptorHandle
, RecNumber
, Type
, SubType
, Length
,
1223 Precision
, Scale
, Data
, StringLength
, Indicator
);
1227 /*************************************************************************
1228 * SQLSetEnvAttr [ODBC32.075]
1230 SQLRETURN WINAPI
SQLSetEnvAttr(SQLHENV EnvironmentHandle
,
1231 SQLINTEGER Attribute
, SQLPOINTER Value
,
1232 SQLINTEGER StringLength
)
1238 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
);
1239 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
)
1240 (EnvironmentHandle
, Attribute
, Value
, StringLength
);
1244 /*************************************************************************
1245 * SQLSetParam [ODBC32.022]
1247 SQLRETURN WINAPI
SQLSetParam(SQLHSTMT StatementHandle
,
1248 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
1249 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
1250 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
1251 SQLINTEGER
*StrLen_or_Ind
)
1257 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
);
1258 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
)
1259 (StatementHandle
, ParameterNumber
, ValueType
, ParameterType
, LengthPrecision
,
1260 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
1264 /*************************************************************************
1265 * SQLSetStmtAttr [ODBC32.076]
1267 SQLRETURN WINAPI
SQLSetStmtAttr(SQLHSTMT StatementHandle
,
1268 SQLINTEGER Attribute
, SQLPOINTER Value
,
1269 SQLINTEGER StringLength
)
1275 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTATTR
].func
);
1276 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTATTR
].func
)
1277 (StatementHandle
, Attribute
, Value
, StringLength
);
1281 /*************************************************************************
1282 * SQLSetStmtOption [ODBC32.051]
1284 SQLRETURN WINAPI
SQLSetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1290 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
);
1291 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
)
1292 (StatementHandle
, Option
, Value
);
1296 /*************************************************************************
1297 * SQLSpecialColumns [ODBC32.052]
1299 SQLRETURN WINAPI
SQLSpecialColumns(SQLHSTMT StatementHandle
,
1300 SQLUSMALLINT IdentifierType
, SQLCHAR
*CatalogName
,
1301 SQLSMALLINT NameLength1
, SQLCHAR
*SchemaName
,
1302 SQLSMALLINT NameLength2
, SQLCHAR
*TableName
,
1303 SQLSMALLINT NameLength3
, SQLUSMALLINT Scope
,
1304 SQLUSMALLINT Nullable
)
1309 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
);
1310 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
)
1311 (StatementHandle
, IdentifierType
, CatalogName
, NameLength1
, SchemaName
,
1312 NameLength2
, TableName
, NameLength3
, Scope
, Nullable
);
1316 /*************************************************************************
1317 * SQLStatistics [ODBC32.053]
1319 SQLRETURN WINAPI
SQLStatistics(SQLHSTMT StatementHandle
,
1320 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1321 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1322 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1323 SQLUSMALLINT Unique
, SQLUSMALLINT Reserved
)
1329 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
);
1330 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
)
1331 (StatementHandle
, CatalogName
, NameLength1
, SchemaName
, NameLength2
,
1332 TableName
, NameLength3
, Unique
, Reserved
);
1336 /*************************************************************************
1337 * SQLTables [ODBC32.054]
1339 SQLRETURN WINAPI
SQLTables(SQLHSTMT StatementHandle
,
1340 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1341 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1342 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1343 SQLCHAR
*TableType
, SQLSMALLINT NameLength4
)
1349 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLES
].func
);
1350 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLES
].func
)
1351 (StatementHandle
, CatalogName
, NameLength1
,
1352 SchemaName
, NameLength2
, TableName
, NameLength3
, TableType
, NameLength4
);
1356 /*************************************************************************
1357 * SQLTransact [ODBC32.023]
1359 SQLRETURN WINAPI
SQLTransact(SQLHENV EnvironmentHandle
, SQLHDBC ConnectionHandle
,
1360 SQLUSMALLINT CompletionType
)
1366 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
);
1367 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
)
1368 (EnvironmentHandle
, ConnectionHandle
, CompletionType
);
1372 /*************************************************************************
1373 * SQLBrowseConnect [ODBC32.055]
1375 SQLRETURN WINAPI
SQLBrowseConnect(
1377 SQLCHAR
*szConnStrIn
,
1378 SQLSMALLINT cbConnStrIn
,
1379 SQLCHAR
*szConnStrOut
,
1380 SQLSMALLINT cbConnStrOutMax
,
1381 SQLSMALLINT
*pcbConnStrOut
)
1387 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
);
1388 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
)
1389 (hdbc
, szConnStrIn
, cbConnStrIn
, szConnStrOut
, cbConnStrOutMax
, pcbConnStrOut
);
1393 /*************************************************************************
1394 * SQLBulkOperations [ODBC32.078]
1396 SQLRETURN WINAPI
SQLBulkOperations(
1397 SQLHSTMT StatementHandle
,
1398 SQLSMALLINT Operation
)
1404 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
);
1405 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
)
1406 (StatementHandle
, Operation
);
1410 /*************************************************************************
1411 * SQLColAttributes [ODBC32.006]
1413 SQLRETURN WINAPI
SQLColAttributes(
1416 SQLUSMALLINT fDescType
,
1418 SQLSMALLINT cbDescMax
,
1419 SQLSMALLINT
*pcbDesc
,
1426 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
);
1427 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
)
1428 (hstmt
, icol
, fDescType
, rgbDesc
, cbDescMax
, pcbDesc
, pfDesc
);
1432 /*************************************************************************
1433 * SQLColumnPrivileges [ODBC32.056]
1435 SQLRETURN WINAPI
SQLColumnPrivileges(
1437 SQLCHAR
*szCatalogName
,
1438 SQLSMALLINT cbCatalogName
,
1439 SQLCHAR
*szSchemaName
,
1440 SQLSMALLINT cbSchemaName
,
1441 SQLCHAR
*szTableName
,
1442 SQLSMALLINT cbTableName
,
1443 SQLCHAR
*szColumnName
,
1444 SQLSMALLINT cbColumnName
)
1450 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
);
1451 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
)
1452 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1453 szTableName
, cbTableName
, szColumnName
, cbColumnName
);
1457 /*************************************************************************
1458 * SQLDescribeParam [ODBC32.058]
1460 SQLRETURN WINAPI
SQLDescribeParam(
1463 SQLSMALLINT
*pfSqlType
,
1464 SQLUINTEGER
*pcbParamDef
,
1465 SQLSMALLINT
*pibScale
,
1466 SQLSMALLINT
*pfNullable
)
1472 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
);
1473 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
)
1474 (hstmt
, ipar
, pfSqlType
, pcbParamDef
, pibScale
, pfNullable
);
1478 /*************************************************************************
1479 * SQLExtendedFetch [ODBC32.059]
1481 SQLRETURN WINAPI
SQLExtendedFetch(
1483 SQLUSMALLINT fFetchType
,
1486 SQLUSMALLINT
*rgfRowStatus
)
1492 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
);
1493 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
)
1494 (hstmt
, fFetchType
, irow
, pcrow
, rgfRowStatus
);
1498 /*************************************************************************
1499 * SQLForeignKeys [ODBC32.060]
1501 SQLRETURN WINAPI
SQLForeignKeys(
1503 SQLCHAR
*szPkCatalogName
,
1504 SQLSMALLINT cbPkCatalogName
,
1505 SQLCHAR
*szPkSchemaName
,
1506 SQLSMALLINT cbPkSchemaName
,
1507 SQLCHAR
*szPkTableName
,
1508 SQLSMALLINT cbPkTableName
,
1509 SQLCHAR
*szFkCatalogName
,
1510 SQLSMALLINT cbFkCatalogName
,
1511 SQLCHAR
*szFkSchemaName
,
1512 SQLSMALLINT cbFkSchemaName
,
1513 SQLCHAR
*szFkTableName
,
1514 SQLSMALLINT cbFkTableName
)
1520 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
);
1521 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
)
1522 (hstmt
, szPkCatalogName
, cbPkCatalogName
, szPkSchemaName
, cbPkSchemaName
,
1523 szPkTableName
, cbPkTableName
, szFkCatalogName
, cbFkCatalogName
, szFkSchemaName
,
1524 cbFkSchemaName
, szFkTableName
, cbFkTableName
);
1528 /*************************************************************************
1529 * SQLMoreResults [ODBC32.061]
1531 SQLRETURN WINAPI
SQLMoreResults(SQLHSTMT hstmt
)
1537 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
);
1538 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
) (hstmt
);
1542 /*************************************************************************
1543 * SQLNativeSql [ODBC32.062]
1545 SQLRETURN WINAPI
SQLNativeSql(
1547 SQLCHAR
*szSqlStrIn
,
1548 SQLINTEGER cbSqlStrIn
,
1550 SQLINTEGER cbSqlStrMax
,
1551 SQLINTEGER
*pcbSqlStr
)
1557 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
);
1558 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
)
1559 (hdbc
, szSqlStrIn
, cbSqlStrIn
, szSqlStr
, cbSqlStrMax
, pcbSqlStr
);
1563 /*************************************************************************
1564 * SQLNumParams [ODBC32.063]
1566 SQLRETURN WINAPI
SQLNumParams(
1574 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
);
1575 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
) (hstmt
, pcpar
);
1579 /*************************************************************************
1580 * SQLParamOptions [ODBC32.064]
1582 SQLRETURN WINAPI
SQLParamOptions(
1591 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
);
1592 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
) (hstmt
, crow
, pirow
);
1596 /*************************************************************************
1597 * SQLPrimaryKeys [ODBC32.065]
1599 SQLRETURN WINAPI
SQLPrimaryKeys(
1601 SQLCHAR
*szCatalogName
,
1602 SQLSMALLINT cbCatalogName
,
1603 SQLCHAR
*szSchemaName
,
1604 SQLSMALLINT cbSchemaName
,
1605 SQLCHAR
*szTableName
,
1606 SQLSMALLINT cbTableName
)
1612 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
);
1613 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
)
1614 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1615 szTableName
, cbTableName
);
1619 /*************************************************************************
1620 * SQLProcedureColumns [ODBC32.066]
1622 SQLRETURN WINAPI
SQLProcedureColumns(
1624 SQLCHAR
*szCatalogName
,
1625 SQLSMALLINT cbCatalogName
,
1626 SQLCHAR
*szSchemaName
,
1627 SQLSMALLINT cbSchemaName
,
1628 SQLCHAR
*szProcName
,
1629 SQLSMALLINT cbProcName
,
1630 SQLCHAR
*szColumnName
,
1631 SQLSMALLINT cbColumnName
)
1637 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
);
1638 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
)
1639 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1640 szProcName
, cbProcName
, szColumnName
, cbColumnName
);
1644 /*************************************************************************
1645 * SQLProcedures [ODBC32.067]
1647 SQLRETURN WINAPI
SQLProcedures(
1649 SQLCHAR
*szCatalogName
,
1650 SQLSMALLINT cbCatalogName
,
1651 SQLCHAR
*szSchemaName
,
1652 SQLSMALLINT cbSchemaName
,
1653 SQLCHAR
*szProcName
,
1654 SQLSMALLINT cbProcName
)
1660 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
);
1661 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
)
1662 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1663 szProcName
, cbProcName
);
1667 /*************************************************************************
1668 * SQLSetPos [ODBC32.068]
1670 SQLRETURN WINAPI
SQLSetPos(
1673 SQLUSMALLINT fOption
,
1680 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
);
1681 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
)
1682 (hstmt
, irow
, fOption
, fLock
);
1686 /*************************************************************************
1687 * SQLTablePrivileges [ODBC32.070]
1689 SQLRETURN WINAPI
SQLTablePrivileges(
1691 SQLCHAR
*szCatalogName
,
1692 SQLSMALLINT cbCatalogName
,
1693 SQLCHAR
*szSchemaName
,
1694 SQLSMALLINT cbSchemaName
,
1695 SQLCHAR
*szTableName
,
1696 SQLSMALLINT cbTableName
)
1702 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
);
1703 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
)
1704 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1705 szTableName
, cbTableName
);
1709 /*************************************************************************
1710 * SQLDrivers [ODBC32.071]
1712 SQLRETURN WINAPI
SQLDrivers(
1714 SQLUSMALLINT fDirection
,
1715 SQLCHAR
*szDriverDesc
,
1716 SQLSMALLINT cbDriverDescMax
,
1717 SQLSMALLINT
*pcbDriverDesc
,
1718 SQLCHAR
*szDriverAttributes
,
1719 SQLSMALLINT cbDriverAttrMax
,
1720 SQLSMALLINT
*pcbDriverAttr
)
1726 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
);
1727 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
)
1728 (henv
, fDirection
, szDriverDesc
, cbDriverDescMax
, pcbDriverDesc
,
1729 szDriverAttributes
, cbDriverAttrMax
, pcbDriverAttr
);
1733 /*************************************************************************
1734 * SQLBindParameter [ODBC32.072]
1736 SQLRETURN WINAPI
SQLBindParameter(
1739 SQLSMALLINT fParamType
,
1741 SQLSMALLINT fSqlType
,
1742 SQLUINTEGER cbColDef
,
1743 SQLSMALLINT ibScale
,
1744 SQLPOINTER rgbValue
,
1745 SQLINTEGER cbValueMax
,
1746 SQLINTEGER
*pcbValue
)
1752 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
);
1753 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
)
1754 (hstmt
, ipar
, fParamType
, fCType
, fSqlType
, cbColDef
, ibScale
,
1755 rgbValue
, cbValueMax
, pcbValue
);
1759 /*************************************************************************
1760 * SQLDriverConnect [ODBC32.041]
1762 SQLRETURN WINAPI
SQLDriverConnect(
1765 SQLCHAR
*conn_str_in
,
1766 SQLSMALLINT len_conn_str_in
,
1767 SQLCHAR
*conn_str_out
,
1768 SQLSMALLINT conn_str_out_max
,
1769 SQLSMALLINT
*ptr_conn_str_out
,
1770 SQLUSMALLINT driver_completion
)
1776 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
);
1777 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
)
1778 (hdbc
, hwnd
, conn_str_in
, len_conn_str_in
, conn_str_out
,
1779 conn_str_out_max
, ptr_conn_str_out
, driver_completion
);
1783 /*************************************************************************
1784 * SQLSetScrollOptions [ODBC32.069]
1786 SQLRETURN WINAPI
SQLSetScrollOptions(
1787 SQLHSTMT statement_handle
,
1788 SQLUSMALLINT f_concurrency
,
1789 SQLINTEGER crow_keyset
,
1790 SQLUSMALLINT crow_rowset
)
1796 assert (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
);
1797 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
)
1798 (statement_handle
, f_concurrency
, crow_keyset
, crow_rowset
);