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 * Xiang Li, Corel Corporation, Nov. 12, 1999
18 #include "debugtools.h"
24 typedef char* GUID
; /* This definition is in sqltypes.h, but if _WINDOWS is defined, this is skipped. */
30 #include "proxyodbc.h"
32 DEFAULT_DEBUG_CHANNEL(odbc
);
34 static DM_FUNC template_func
[] =
36 /* 00 */ { SQL_API_SQLALLOCCONNECT
, "SQLAllocConnect", SQLAllocConnect
},
37 /* 01 */ { SQL_API_SQLALLOCENV
, "SQLAllocEnv", SQLAllocEnv
},
38 /* 02 */ { SQL_API_SQLALLOCHANDLE
, "SQLAllocHandle", SQLAllocHandle
},
39 /* 03 */ { SQL_API_SQLALLOCSTMT
, "SQLAllocStmt", SQLAllocStmt
},
40 /* 04 */ { SQL_API_SQLALLOCHANDLESTD
, "SQLAllocHandleStd", SQLAllocHandleStd
},
41 /* 05 */ { SQL_API_SQLBINDCOL
, "SQLBindCol", SQLBindCol
},
42 /* 06 */ { SQL_API_SQLBINDPARAM
, "SQLBindParam", SQLBindParam
},
43 /* 07 */ { SQL_API_SQLBINDPARAMETER
, "SQLBindParameter", SQLBindParameter
},
44 /* 08 */ { SQL_API_SQLBROWSECONNECT
, "SQLBrowseConnect", SQLBrowseConnect
},
45 /* 09 */ { SQL_API_SQLBULKOPERATIONS
, "SQLBulkOperations", SQLBulkOperations
},
46 /* 10 */ { SQL_API_SQLCANCEL
, "SQLCancel", SQLCancel
},
47 /* 11 */ { SQL_API_SQLCLOSECURSOR
, "SQLCloseCursor", SQLCloseCursor
},
48 /* 12 */ { SQL_API_SQLCOLATTRIBUTE
, "SQLColAttribute", SQLColAttribute
},
49 /* 13 */ { SQL_API_SQLCOLATTRIBUTES
, "SQLColAttributes", SQLColAttributes
},
50 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES
, "SQLColumnPrivileges", SQLColumnPrivileges
},
51 /* 15 */ { SQL_API_SQLCOLUMNS
, "SQLColumns", SQLColumns
},
52 /* 16 */ { SQL_API_SQLCONNECT
, "SQLConnect", SQLConnect
},
53 /* 17 */ { SQL_API_SQLCOPYDESC
, "SQLCopyDesc", SQLCopyDesc
},
54 /* 18 */ { SQL_API_SQLDATASOURCES
, "SQLDataSources", SQLDataSources
},
55 /* 19 */ { SQL_API_SQLDESCRIBECOL
, "SQLDescribeCol", SQLDescribeCol
},
56 /* 20 */ { SQL_API_SQLDESCRIBEPARAM
, "SQLDescribeParam", SQLDescribeParam
},
57 /* 21 */ { SQL_API_SQLDISCONNECT
, "SQLDisconnect", SQLDisconnect
},
58 /* 22 */ { SQL_API_SQLDRIVERCONNECT
, "SQLDriverConnect", SQLDriverConnect
},
59 /* 23 */ { SQL_API_SQLDRIVERS
, "SQLDrivers", SQLDrivers
},
60 /* 24 */ { SQL_API_SQLENDTRAN
, "SQLEndTran", SQLEndTran
},
61 /* 25 */ { SQL_API_SQLERROR
, "SQLError", SQLError
},
62 /* 26 */ { SQL_API_SQLEXECDIRECT
, "SQLExecDirect", SQLExecDirect
},
63 /* 27 */ { SQL_API_SQLEXECUTE
, "SQLExecute", SQLExecute
},
64 /* 28 */ { SQL_API_SQLEXTENDEDFETCH
, "SQLExtendedFetch", SQLExtendedFetch
},
65 /* 29 */ { SQL_API_SQLFETCH
, "SQLFetch", SQLFetch
},
66 /* 30 */ { SQL_API_SQLFETCHSCROLL
, "SQLFetchScroll", SQLFetchScroll
},
67 /* 31 */ { SQL_API_SQLFOREIGNKEYS
, "SQLForeignKeys", SQLForeignKeys
},
68 /* 32 */ { SQL_API_SQLFREEENV
, "SQLFreeEnv", SQLFreeEnv
},
69 /* 33 */ { SQL_API_SQLFREEHANDLE
, "SQLFreeHandle", SQLFreeHandle
},
70 /* 34 */ { SQL_API_SQLFREESTMT
, "SQLFreeStmt", SQLFreeStmt
},
71 /* 35 */ { SQL_API_SQLFREECONNECT
, "SQLFreeConnect", SQLFreeConnect
},
72 /* 36 */ { SQL_API_SQLGETCONNECTATTR
, "SQLGetConnectAttr", SQLGetConnectAttr
},
73 /* 37 */ { SQL_API_SQLGETCONNECTOPTION
, "SQLGetConnectOption", SQLGetConnectOption
},
74 /* 38 */ { SQL_API_SQLGETCURSORNAME
, "SQLGetCursorName", SQLGetCursorName
},
75 /* 39 */ { SQL_API_SQLGETDATA
, "SQLGetData", SQLGetData
},
76 /* 40 */ { SQL_API_SQLGETDESCFIELD
, "SQLGetDescField", SQLGetDescField
},
77 /* 41 */ { SQL_API_SQLGETDESCREC
, "SQLGetDescRec", SQLGetDescRec
},
78 /* 42 */ { SQL_API_SQLGETDIAGFIELD
, "SQLGetDiagField", SQLGetDiagField
},
79 /* 43 */ { SQL_API_SQLGETENVATTR
, "SQLGetEnvAttr", SQLGetEnvAttr
},
80 /* 44 */ { SQL_API_SQLGETFUNCTIONS
, "SQLGetFunctions", SQLGetFunctions
},
81 /* 45 */ { SQL_API_SQLGETINFO
, "SQLGetInfo", SQLGetInfo
},
82 /* 46 */ { SQL_API_SQLGETSTMTATTR
, "SQLGetStmtAttr", SQLGetStmtAttr
},
83 /* 47 */ { SQL_API_SQLGETSTMTOPTION
, "SQLGetStmtOption", SQLGetStmtOption
},
84 /* 48 */ { SQL_API_SQLGETTYPEINFO
, "SQLGetTypeInfo", SQLGetTypeInfo
},
85 /* 49 */ { SQL_API_SQLMORERESULTS
, "SQLMoreResults", SQLMoreResults
},
86 /* 50 */ { SQL_API_SQLNATIVESQL
, "SQLNativeSql", SQLNativeSql
},
87 /* 51 */ { SQL_API_SQLNUMPARAMS
, "SQLNumParams", SQLNumParams
},
88 /* 52 */ { SQL_API_SQLNUMRESULTCOLS
, "SQLNumResultCols", SQLNumResultCols
},
89 /* 53 */ { SQL_API_SQLPARAMDATA
, "SQLParamData", SQLParamData
},
90 /* 54 */ { SQL_API_SQLPARAMOPTIONS
, "SQLParamOptions", SQLParamOptions
},
91 /* 55 */ { SQL_API_SQLPREPARE
, "SQLPrepare", SQLPrepare
},
92 /* 56 */ { SQL_API_SQLPRIMARYKEYS
, "SQLPrimaryKeys", SQLPrimaryKeys
},
93 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS
, "SQLProcedureColumns", SQLProcedureColumns
},
94 /* 58 */ { SQL_API_SQLPROCEDURES
, "SQLProcedures", SQLProcedures
},
95 /* 59 */ { SQL_API_SQLPUTDATA
, "SQLPutData", SQLPutData
},
96 /* 60 */ { SQL_API_SQLROWCOUNT
, "SQLRowCount", SQLRowCount
},
97 /* 61 */ { SQL_API_SQLSETCONNECTATTR
, "SQLSetConnectAttr", SQLSetConnectAttr
},
98 /* 62 */ { SQL_API_SQLSETCONNECTOPTION
, "SQLSetConnectOption", SQLSetConnectOption
},
99 /* 63 */ { SQL_API_SQLSETCURSORNAME
, "SQLSetCursorName", SQLSetCursorName
},
100 /* 64 */ { SQL_API_SQLSETDESCFIELD
, "SQLSetDescField", SQLSetDescField
},
101 /* 65 */ { SQL_API_SQLSETDESCREC
, "SQLSetDescRec", SQLSetDescRec
},
102 /* 66 */ { SQL_API_SQLSETENVATTR
, "SQLSetEnvAttr", SQLSetEnvAttr
},
103 /* 67 */ { SQL_API_SQLSETPARAM
, "SQLSetParam", SQLSetParam
},
104 /* 68 */ { SQL_API_SQLSETPOS
, "SQLSetPos", SQLSetPos
},
105 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS
, "SQLSetScrollOptions", SQLSetScrollOptions
},
106 /* 70 */ { SQL_API_SQLSETSTMTATTR
, "SQLSetStmtAttr", SQLSetStmtAttr
},
107 /* 71 */ { SQL_API_SQLSETSTMTOPTION
, "SQLSetStmtOption", SQLSetStmtOption
},
108 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS
, "SQLSpecialColumns", SQLSpecialColumns
},
109 /* 73 */ { SQL_API_SQLSTATISTICS
, "SQLStatistics", SQLStatistics
},
110 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES
, "SQLTablePrivileges", SQLTablePrivileges
},
111 /* 75 */ { SQL_API_SQLTABLES
, "SQLTables", SQLTables
},
112 /* 76 */ { SQL_API_SQLTRANSACT
, "SQLTransact", SQLTransact
},
113 /* 77 */ { SQL_API_SQLGETDIAGREC
, "SQLGetDiagRec", SQLGetDiagRec
},
116 static PROXYHANDLE gProxyHandle
= {NULL
, FALSE
, FALSE
, FALSE
, ERROR_LIBRARY_NOT_FOUND
};
118 SQLRETURN
SQLDummyFunc()
120 TRACE("SQLDummyFunc: \n");
124 /***********************************************************************
125 * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'.
128 * hinstDLL [I] handle to the DLL's instance
130 * lpvReserved [I] reserved, must be NULL
138 MAIN_OdbcInit(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
141 TRACE("Initializing proxy ODBC: %x,%lx,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
143 if (fdwReason
== DLL_PROCESS_ATTACH
)
145 TRACE("Loading ODBC...\n");
146 if (ODBC_LoadDriverManager())
147 ODBC_LoadDMFunctions();
149 else if (fdwReason
== DLL_PROCESS_DETACH
)
151 TRACE("Unloading ODBC...\n");
152 if (gProxyHandle
.bFunctionReady
)
154 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
156 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
160 if (gProxyHandle
.dmHandle
)
162 dlclose(gProxyHandle
.dmHandle
);
163 gProxyHandle
.dmHandle
= NULL
;
171 /***********************************************************************
172 * ODBC_LoadDriverManager [Internal] Load ODBC library.
181 BOOL
ODBC_LoadDriverManager()
183 char *s
= getenv("LIB_ODBC_DRIVER_MANAGER");
187 gProxyHandle
.bFunctionReady
= FALSE
;
189 if (s
!= NULL
&& strlen(s
) > 0)
190 strcpy(gProxyHandle
.dmLibName
, s
);
192 strcpy(gProxyHandle
.dmLibName
, "libodbc.so");
194 gProxyHandle
.dmHandle
= dlopen(gProxyHandle
.dmLibName
, RTLD_LAZY
);
196 if (gProxyHandle
.dmHandle
== NULL
) /* fail to load unixODBC driver manager */
198 WARN("failed to open library %s\n", gProxyHandle
.dmLibName
);
199 gProxyHandle
.dmLibName
[0] = '\0';
200 gProxyHandle
.nErrorType
= ERROR_LIBRARY_NOT_FOUND
;
205 gProxyHandle
.nErrorType
= ERROR_FREE
;
211 /***********************************************************************
212 * ODBC_LoadDMFunctions [Internal] Populate function table.
221 BOOL
ODBC_LoadDMFunctions()
225 if (gProxyHandle
.dmHandle
== NULL
)
228 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
230 gProxyHandle
.functions
[i
] = template_func
[i
];
231 gProxyHandle
.functions
[i
].func
= dlsym(gProxyHandle
.dmHandle
,
232 gProxyHandle
.functions
[i
].name
);
236 ERR("Failed to load function %s",gProxyHandle
.functions
[i
].name
);
237 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
241 gProxyHandle
.bFunctionReady
= TRUE
;
247 /*************************************************************************
248 * SQLAllocConnect [ODBC32.001]
250 SQLRETURN WINAPI
SQLAllocConnect(SQLHENV EnvironmentHandle
, SQLHDBC
*ConnectionHandle
)
254 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
256 *ConnectionHandle
= SQL_NULL_HDBC
;
260 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
)
261 (EnvironmentHandle
, ConnectionHandle
);
265 /*************************************************************************
266 * SQLAllocEnv [ODBC32.002]
268 SQLRETURN WINAPI
SQLAllocEnv(SQLHENV
*EnvironmentHandle
)
272 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
274 *EnvironmentHandle
= SQL_NULL_HENV
;
278 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
) (EnvironmentHandle
);
282 /*************************************************************************
283 * SQLAllocHandle [ODBC32.024]
285 SQLRETURN WINAPI
SQLAllocHandle(SQLSMALLINT HandleType
, SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
289 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
291 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
292 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
294 if (HandleType
== SQL_HANDLE_ENV
)
295 *OutputHandle
= SQL_NULL_HENV
;
296 else if (HandleType
== SQL_HANDLE_DBC
)
297 *OutputHandle
= SQL_NULL_HDBC
;
298 else if (HandleType
== SQL_HANDLE_STMT
)
299 *OutputHandle
= SQL_NULL_HSTMT
;
300 else if (HandleType
== SQL_HANDLE_DESC
)
301 *OutputHandle
= SQL_NULL_HDESC
;
306 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
)
307 (HandleType
, InputHandle
, OutputHandle
);
311 /*************************************************************************
312 * SQLAllocStmt [ODBC32.003]
314 SQLRETURN WINAPI
SQLAllocStmt(SQLHDBC ConnectionHandle
, SQLHSTMT
*StatementHandle
)
319 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
321 *StatementHandle
= SQL_NULL_HSTMT
;
325 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
)
326 (ConnectionHandle
, StatementHandle
);
330 /*************************************************************************
331 * SQLAllocHandleStd [ODBC32.077]
333 SQLRETURN WINAPI
SQLAllocHandleStd( SQLSMALLINT HandleType
,
334 SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
336 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
338 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
340 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
341 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
343 if (HandleType
== SQL_HANDLE_ENV
)
344 *OutputHandle
= SQL_NULL_HENV
;
345 else if (HandleType
== SQL_HANDLE_DBC
)
346 *OutputHandle
= SQL_NULL_HDBC
;
347 else if (HandleType
== SQL_HANDLE_STMT
)
348 *OutputHandle
= SQL_NULL_HSTMT
;
349 else if (HandleType
== SQL_HANDLE_DESC
)
350 *OutputHandle
= SQL_NULL_HDESC
;
355 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
)
356 (HandleType
, InputHandle
, OutputHandle
);
360 /*************************************************************************
361 * SQLBindCol [ODBC32.004]
363 SQLRETURN WINAPI
SQLBindCol(SQLHSTMT StatementHandle
,
364 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
365 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
366 SQLINTEGER
*StrLen_or_Ind
)
370 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
375 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
)
376 (StatementHandle
, ColumnNumber
, TargetType
,
377 TargetValue
, BufferLength
, StrLen_or_Ind
);
381 /*************************************************************************
382 * SQLBindParam [ODBC32.025]
384 SQLRETURN WINAPI
SQLBindParam(SQLHSTMT StatementHandle
,
385 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
386 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
387 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
388 SQLINTEGER
*StrLen_or_Ind
)
392 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
397 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
)
398 (StatementHandle
, ParameterNumber
, ValueType
,
399 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
403 /*************************************************************************
404 * SQLCancel [ODBC32.005]
406 SQLRETURN WINAPI
SQLCancel(SQLHSTMT StatementHandle
)
410 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
415 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
) (StatementHandle
);
419 /*************************************************************************
420 * SQLCloseCursor [ODBC32.026]
422 SQLRETURN WINAPI
SQLCloseCursor(SQLHSTMT StatementHandle
)
426 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
431 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
) (StatementHandle
);
435 /*************************************************************************
436 * SQLColAttribute [ODBC32.027]
438 SQLRETURN WINAPI
SQLColAttribute (SQLHSTMT StatementHandle
,
439 SQLUSMALLINT ColumnNumber
, SQLUSMALLINT FieldIdentifier
,
440 SQLPOINTER CharacterAttribute
, SQLSMALLINT BufferLength
,
441 SQLSMALLINT
*StringLength
, SQLPOINTER NumericAttribute
)
445 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
450 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
)
451 (StatementHandle
, ColumnNumber
, FieldIdentifier
,
452 CharacterAttribute
, BufferLength
, StringLength
, NumericAttribute
);
456 /*************************************************************************
457 * SQLColumns [ODBC32.040]
459 SQLRETURN WINAPI
SQLColumns(SQLHSTMT StatementHandle
,
460 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
461 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
462 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
463 SQLCHAR
*ColumnName
, SQLSMALLINT NameLength4
)
467 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
472 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
)
473 (StatementHandle
, CatalogName
, NameLength1
,
474 SchemaName
, NameLength2
, TableName
, NameLength3
, ColumnName
, NameLength4
);
478 /*************************************************************************
479 * SQLConnect [ODBC32.007]
481 SQLRETURN WINAPI
SQLConnect(SQLHDBC ConnectionHandle
,
482 SQLCHAR
*ServerName
, SQLSMALLINT NameLength1
,
483 SQLCHAR
*UserName
, SQLSMALLINT NameLength2
,
484 SQLCHAR
*Authentication
, SQLSMALLINT NameLength3
)
488 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
493 strcpy(gProxyHandle
.ServerName
, ServerName
);
494 strcpy(gProxyHandle
.UserName
, UserName
);
496 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
)
497 (ConnectionHandle
, ServerName
, NameLength1
,
498 UserName
, NameLength2
, Authentication
, NameLength3
);
502 /*************************************************************************
503 * SQLCopyDesc [ODBC32.028]
505 SQLRETURN WINAPI
SQLCopyDesc(SQLHDESC SourceDescHandle
, SQLHDESC TargetDescHandle
)
509 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
514 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
)
515 (SourceDescHandle
, TargetDescHandle
);
519 /*************************************************************************
520 * SQLDataSources [ODBC32.057]
522 SQLRETURN WINAPI
SQLDataSources(SQLHENV EnvironmentHandle
,
523 SQLUSMALLINT Direction
, SQLCHAR
*ServerName
,
524 SQLSMALLINT BufferLength1
, SQLSMALLINT
*NameLength1
,
525 SQLCHAR
*Description
, SQLSMALLINT BufferLength2
,
526 SQLSMALLINT
*NameLength2
)
530 TRACE("EnvironmentHandle = %p\n", (LPVOID
)EnvironmentHandle
);
532 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
534 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
538 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
)
539 (EnvironmentHandle
, Direction
, ServerName
,
540 BufferLength1
, NameLength1
, Description
, BufferLength2
, NameLength2
);
544 TRACE("returns: %d \t", ret
);
545 if (*NameLength1
> 0)
546 TRACE("DataSource = %s,", ServerName
);
547 if (*NameLength2
> 0)
548 TRACE(" Description = %s\n", Description
);
555 /*************************************************************************
556 * SQLDescribeCol [ODBC32.008]
558 SQLRETURN WINAPI
SQLDescribeCol(SQLHSTMT StatementHandle
,
559 SQLUSMALLINT ColumnNumber
, SQLCHAR
*ColumnName
,
560 SQLSMALLINT BufferLength
, SQLSMALLINT
*NameLength
,
561 SQLSMALLINT
*DataType
, SQLUINTEGER
*ColumnSize
,
562 SQLSMALLINT
*DecimalDigits
, SQLSMALLINT
*Nullable
)
566 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
571 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
)
572 (StatementHandle
, ColumnNumber
, ColumnName
,
573 BufferLength
, NameLength
, DataType
, ColumnSize
, DecimalDigits
, Nullable
);
577 /*************************************************************************
578 * SQLDisconnect [ODBC32.009]
580 SQLRETURN WINAPI
SQLDisconnect(SQLHDBC ConnectionHandle
)
584 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
589 gProxyHandle
.ServerName
[0] = '\0';
590 gProxyHandle
.UserName
[0] = '\0';
592 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
) (ConnectionHandle
);
596 /*************************************************************************
597 * SQLEndTran [ODBC32.029]
599 SQLRETURN WINAPI
SQLEndTran(SQLSMALLINT HandleType
, SQLHANDLE Handle
, SQLSMALLINT CompletionType
)
603 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
608 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
) (HandleType
, Handle
, CompletionType
);
612 /*************************************************************************
613 * SQLError [ODBC32.010]
615 SQLRETURN WINAPI
SQLError(SQLHENV EnvironmentHandle
,
616 SQLHDBC ConnectionHandle
, SQLHSTMT StatementHandle
,
617 SQLCHAR
*Sqlstate
, SQLINTEGER
*NativeError
,
618 SQLCHAR
*MessageText
, SQLSMALLINT BufferLength
,
619 SQLSMALLINT
*TextLength
)
623 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
628 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
)
629 (EnvironmentHandle
, ConnectionHandle
, StatementHandle
,
630 Sqlstate
, NativeError
, MessageText
, BufferLength
, TextLength
);
634 /*************************************************************************
635 * SQLExecDirect [ODBC32.011]
637 SQLRETURN WINAPI
SQLExecDirect(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
641 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
646 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
)
647 (StatementHandle
, StatementText
, TextLength
);
651 /*************************************************************************
652 * SQLExecute [ODBC32.012]
654 SQLRETURN WINAPI
SQLExecute(SQLHSTMT StatementHandle
)
658 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
663 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
) (StatementHandle
);
667 /*************************************************************************
668 * SQLFetch [ODBC32.013]
670 SQLRETURN WINAPI
SQLFetch(SQLHSTMT StatementHandle
)
674 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
679 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
) (StatementHandle
);
683 /*************************************************************************
684 * SQLFetchScroll [ODBC32.030]
686 SQLRETURN WINAPI
SQLFetchScroll(SQLHSTMT StatementHandle
, SQLSMALLINT FetchOrientation
, SQLINTEGER FetchOffset
)
690 if (gProxyHandle
.dmHandle
== NULL
)
695 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
)
696 (StatementHandle
, FetchOrientation
, FetchOffset
);
700 /*************************************************************************
701 * SQLFreeConnect [ODBC32.014]
703 SQLRETURN WINAPI
SQLFreeConnect(SQLHDBC ConnectionHandle
)
707 if (gProxyHandle
.dmHandle
== NULL
)
712 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
) (ConnectionHandle
);
716 /*************************************************************************
717 * SQLFreeEnv [ODBC32.015]
719 SQLRETURN WINAPI
SQLFreeEnv(SQLHENV EnvironmentHandle
)
725 if (gProxyHandle
.dmHandle
== NULL
)
730 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
) (EnvironmentHandle
);
732 if (gProxyHandle.dmHandle)
734 dlclose(gProxyHandle.dmHandle);
735 gProxyHandle.dmHandle = NULL;
743 /*************************************************************************
744 * SQLFreeHandle [ODBC32.031]
746 SQLRETURN WINAPI
SQLFreeHandle(SQLSMALLINT HandleType
, SQLHANDLE Handle
)
752 if (gProxyHandle
.dmHandle
== NULL
)
757 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
)
758 (HandleType
, Handle
);
760 if (HandleType
== SQL_HANDLE_ENV
) /* it is time to close the loaded library */
762 if (gProxyHandle
.dmHandle
)
764 dlclose(gProxyHandle
.dmHandle
);
765 gProxyHandle
.dmHandle
= NULL
;
773 /*************************************************************************
774 * SQLFreeStmt [ODBC32.016]
776 SQLRETURN WINAPI
SQLFreeStmt(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
)
781 if (gProxyHandle
.dmHandle
== NULL
)
786 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
)
787 (StatementHandle
, Option
);
791 /*************************************************************************
792 * SQLGetConnectAttr [ODBC32.032]
794 SQLRETURN WINAPI
SQLGetConnectAttr(SQLHDBC ConnectionHandle
,
795 SQLINTEGER Attribute
, SQLPOINTER Value
,
796 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
800 if (gProxyHandle
.dmHandle
== NULL
)
805 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
)
806 (ConnectionHandle
, Attribute
, Value
,
807 BufferLength
, StringLength
);
811 /*************************************************************************
812 * SQLGetConnectOption [ODBC32.042]
814 SQLRETURN WINAPI
SQLGetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
818 if (gProxyHandle
.dmHandle
== NULL
)
823 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
)
824 (ConnectionHandle
, Option
, Value
);
828 /*************************************************************************
829 * SQLGetCursorName [ODBC32.017]
831 SQLRETURN WINAPI
SQLGetCursorName(SQLHSTMT StatementHandle
,
832 SQLCHAR
*CursorName
, SQLSMALLINT BufferLength
,
833 SQLSMALLINT
*NameLength
)
837 if (gProxyHandle
.dmHandle
== NULL
)
842 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
)
843 (StatementHandle
, CursorName
, BufferLength
, NameLength
);
847 /*************************************************************************
848 * SQLGetData [ODBC32.043]
850 SQLRETURN WINAPI
SQLGetData(SQLHSTMT StatementHandle
,
851 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
852 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
853 SQLINTEGER
*StrLen_or_Ind
)
856 if (gProxyHandle
.dmHandle
== NULL
)
861 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
)
862 (StatementHandle
, ColumnNumber
, TargetType
,
863 TargetValue
, BufferLength
, StrLen_or_Ind
);
867 /*************************************************************************
868 * SQLGetDescField [ODBC32.033]
870 SQLRETURN WINAPI
SQLGetDescField(SQLHDESC DescriptorHandle
,
871 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
872 SQLPOINTER Value
, SQLINTEGER BufferLength
,
873 SQLINTEGER
*StringLength
)
876 if (gProxyHandle
.dmHandle
== NULL
)
881 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
)
882 (DescriptorHandle
, RecNumber
, FieldIdentifier
,
883 Value
, BufferLength
, StringLength
);
887 /*************************************************************************
888 * SQLGetDescRec [ODBC32.034]
890 SQLRETURN WINAPI
SQLGetDescRec(SQLHDESC DescriptorHandle
,
891 SQLSMALLINT RecNumber
, SQLCHAR
*Name
,
892 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
,
893 SQLSMALLINT
*Type
, SQLSMALLINT
*SubType
,
894 SQLINTEGER
*Length
, SQLSMALLINT
*Precision
,
895 SQLSMALLINT
*Scale
, SQLSMALLINT
*Nullable
)
898 if (gProxyHandle
.dmHandle
== NULL
)
903 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
)
904 (DescriptorHandle
, RecNumber
, Name
, BufferLength
,
905 StringLength
, Type
, SubType
, Length
, Precision
, Scale
, Nullable
);
909 /*************************************************************************
910 * SQLGetDiagField [ODBC32.035]
912 SQLRETURN WINAPI
SQLGetDiagField(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
913 SQLSMALLINT RecNumber
, SQLSMALLINT DiagIdentifier
,
914 SQLPOINTER DiagInfo
, SQLSMALLINT BufferLength
,
915 SQLSMALLINT
*StringLength
)
918 if (gProxyHandle
.dmHandle
== NULL
)
923 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
)
924 (HandleType
, Handle
, RecNumber
, DiagIdentifier
,
925 DiagInfo
, BufferLength
, StringLength
);
929 /*************************************************************************
930 * SQLGetDiagRec [ODBC32.036]
932 SQLRETURN WINAPI
SQLGetDiagRec(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
933 SQLSMALLINT RecNumber
, SQLCHAR
*Sqlstate
,
934 SQLINTEGER
*NativeError
, SQLCHAR
*MessageText
,
935 SQLSMALLINT BufferLength
, SQLSMALLINT
*TextLength
)
938 if (gProxyHandle
.dmHandle
== NULL
)
943 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
)
944 (HandleType
, Handle
, RecNumber
, Sqlstate
, NativeError
,
945 MessageText
, BufferLength
, TextLength
);
949 /*************************************************************************
950 * SQLGetEnvAttr [ODBC32.037]
952 SQLRETURN WINAPI
SQLGetEnvAttr(SQLHENV EnvironmentHandle
,
953 SQLINTEGER Attribute
, SQLPOINTER Value
,
954 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
957 if (gProxyHandle
.dmHandle
== NULL
)
962 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
)
963 (EnvironmentHandle
, Attribute
, Value
, BufferLength
, StringLength
);
967 /*************************************************************************
968 * SQLGetFunctions [ODBC32.044]
970 SQLRETURN WINAPI
SQLGetFunctions(SQLHDBC ConnectionHandle
, SQLUSMALLINT FunctionId
, SQLUSMALLINT
*Supported
)
973 if (gProxyHandle
.dmHandle
== NULL
)
978 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
)
979 (ConnectionHandle
, FunctionId
, Supported
);
983 /*************************************************************************
984 * SQLGetInfo [ODBC32.045]
986 SQLRETURN WINAPI
SQLGetInfo(SQLHDBC ConnectionHandle
,
987 SQLUSMALLINT InfoType
, SQLPOINTER InfoValue
,
988 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
)
991 if (gProxyHandle
.dmHandle
== NULL
)
996 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
)
997 (ConnectionHandle
, InfoType
, InfoValue
, BufferLength
, StringLength
);
1001 /*************************************************************************
1002 * SQLGetStmtAttr [ODBC32.038]
1004 SQLRETURN WINAPI
SQLGetStmtAttr(SQLHSTMT StatementHandle
,
1005 SQLINTEGER Attribute
, SQLPOINTER Value
,
1006 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
1009 if (gProxyHandle
.dmHandle
== NULL
)
1014 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
)
1015 (StatementHandle
, Attribute
, Value
, BufferLength
, StringLength
);
1019 /*************************************************************************
1020 * SQLGetStmtOption [ODBC32.046]
1022 SQLRETURN WINAPI
SQLGetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
1025 if (gProxyHandle
.dmHandle
== NULL
)
1030 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
)
1031 (StatementHandle
, Option
, Value
);
1035 /*************************************************************************
1036 * SQLGetTypeInfo [ODBC32.047]
1038 SQLRETURN WINAPI
SQLGetTypeInfo(SQLHSTMT StatementHandle
, SQLSMALLINT DataType
)
1041 if (gProxyHandle
.dmHandle
== NULL
)
1046 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
)
1047 (StatementHandle
, DataType
);
1051 /*************************************************************************
1052 * SQLNumResultCols [ODBC32.018]
1054 SQLRETURN WINAPI
SQLNumResultCols(SQLHSTMT StatementHandle
, SQLSMALLINT
*ColumnCount
)
1057 if (gProxyHandle
.dmHandle
== NULL
)
1062 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
)
1063 (StatementHandle
, ColumnCount
);
1067 /*************************************************************************
1068 * SQLParamData [ODBC32.048]
1070 SQLRETURN WINAPI
SQLParamData(SQLHSTMT StatementHandle
, SQLPOINTER
*Value
)
1073 if (gProxyHandle
.dmHandle
== NULL
)
1078 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
)
1079 (StatementHandle
, Value
);
1083 /*************************************************************************
1084 * SQLPrepare [ODBC32.019]
1086 SQLRETURN WINAPI
SQLPrepare(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
1089 if (gProxyHandle
.dmHandle
== NULL
)
1094 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
)
1095 (StatementHandle
, StatementText
, TextLength
);
1099 /*************************************************************************
1100 * SQLPutData [ODBC32.049]
1102 SQLRETURN WINAPI
SQLPutData(SQLHSTMT StatementHandle
, SQLPOINTER Data
, SQLINTEGER StrLen_or_Ind
)
1105 if (gProxyHandle
.dmHandle
== NULL
)
1110 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
)
1111 (StatementHandle
, Data
, StrLen_or_Ind
);
1115 /*************************************************************************
1116 * SQLRowCount [ODBC32.020]
1118 SQLRETURN WINAPI
SQLRowCount(SQLHSTMT StatementHandle
, SQLINTEGER
*RowCount
)
1121 if (gProxyHandle
.dmHandle
== NULL
)
1126 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
)
1127 (StatementHandle
, RowCount
);
1131 /*************************************************************************
1132 * SQLSetConnectAttr [ODBC32.039]
1134 SQLRETURN WINAPI
SQLSetConnectAttr(SQLHDBC ConnectionHandle
, SQLINTEGER Attribute
,
1135 SQLPOINTER Value
, SQLINTEGER StringLength
)
1138 if (gProxyHandle
.dmHandle
== NULL
)
1143 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
)
1144 (ConnectionHandle
, Attribute
, Value
, StringLength
);
1148 /*************************************************************************
1149 * SQLSetConnectOption [ODBC32.050]
1151 SQLRETURN WINAPI
SQLSetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1154 if (gProxyHandle
.dmHandle
== NULL
)
1159 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
)
1160 (ConnectionHandle
, Option
, Value
);
1164 /*************************************************************************
1165 * SQLSetCursorName [ODBC32.021]
1167 SQLRETURN WINAPI
SQLSetCursorName(SQLHSTMT StatementHandle
, SQLCHAR
*CursorName
, SQLSMALLINT NameLength
)
1170 if (gProxyHandle
.dmHandle
== NULL
)
1175 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
)
1176 (StatementHandle
, CursorName
, NameLength
);
1180 /*************************************************************************
1181 * SQLSetDescField [ODBC32.073]
1183 SQLRETURN WINAPI
SQLSetDescField(SQLHDESC DescriptorHandle
,
1184 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
1185 SQLPOINTER Value
, SQLINTEGER BufferLength
)
1188 if (gProxyHandle
.dmHandle
== NULL
)
1193 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
)
1194 (DescriptorHandle
, RecNumber
, FieldIdentifier
, Value
, BufferLength
);
1198 /*************************************************************************
1199 * SQLSetDescRec [ODBC32.074]
1201 SQLRETURN WINAPI
SQLSetDescRec(SQLHDESC DescriptorHandle
,
1202 SQLSMALLINT RecNumber
, SQLSMALLINT Type
,
1203 SQLSMALLINT SubType
, SQLINTEGER Length
,
1204 SQLSMALLINT Precision
, SQLSMALLINT Scale
,
1205 SQLPOINTER Data
, SQLINTEGER
*StringLength
,
1206 SQLINTEGER
*Indicator
)
1209 if (gProxyHandle
.dmHandle
== NULL
)
1214 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
)
1215 (DescriptorHandle
, RecNumber
, Type
, SubType
, Length
,
1216 Precision
, Scale
, Data
, StringLength
, Indicator
);
1220 /*************************************************************************
1221 * SQLSetEnvAttr [ODBC32.075]
1223 SQLRETURN WINAPI
SQLSetEnvAttr(SQLHENV EnvironmentHandle
,
1224 SQLINTEGER Attribute
, SQLPOINTER Value
,
1225 SQLINTEGER StringLength
)
1228 if (gProxyHandle
.dmHandle
== NULL
)
1233 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
)
1234 (EnvironmentHandle
, Attribute
, Value
, StringLength
);
1238 /*************************************************************************
1239 * SQLSetParam [ODBC32.022]
1241 SQLRETURN WINAPI
SQLSetParam(SQLHSTMT StatementHandle
,
1242 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
1243 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
1244 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
1245 SQLINTEGER
*StrLen_or_Ind
)
1248 if (gProxyHandle
.dmHandle
== NULL
)
1253 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
)
1254 (StatementHandle
, ParameterNumber
, ValueType
, ParameterType
, LengthPrecision
,
1255 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
1259 /*************************************************************************
1260 * SQLSetStmtAttr [ODBC32.076]
1262 SQLRETURN WINAPI
SQLSetStmtAttr(SQLHSTMT StatementHandle
,
1263 SQLINTEGER Attribute
, SQLPOINTER Value
,
1264 SQLINTEGER StringLength
)
1267 if (gProxyHandle
.dmHandle
== NULL
)
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
)
1283 if (gProxyHandle
.dmHandle
== NULL
)
1288 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
)
1289 (StatementHandle
, Option
, Value
);
1293 /*************************************************************************
1294 * SQLSpecialColumns [ODBC32.052]
1296 SQLRETURN WINAPI
SQLSpecialColumns(SQLHSTMT StatementHandle
,
1297 SQLUSMALLINT IdentifierType
, SQLCHAR
*CatalogName
,
1298 SQLSMALLINT NameLength1
, SQLCHAR
*SchemaName
,
1299 SQLSMALLINT NameLength2
, SQLCHAR
*TableName
,
1300 SQLSMALLINT NameLength3
, SQLUSMALLINT Scope
,
1301 SQLUSMALLINT Nullable
)
1303 if (gProxyHandle
.dmHandle
== NULL
)
1308 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
)
1309 (StatementHandle
, IdentifierType
, CatalogName
, NameLength1
, SchemaName
,
1310 NameLength2
, TableName
, NameLength3
, Scope
, Nullable
);
1314 /*************************************************************************
1315 * SQLStatistics [ODBC32.053]
1317 SQLRETURN WINAPI
SQLStatistics(SQLHSTMT StatementHandle
,
1318 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1319 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1320 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1321 SQLUSMALLINT Unique
, SQLUSMALLINT Reserved
)
1324 if (gProxyHandle
.dmHandle
== NULL
)
1329 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
)
1330 (StatementHandle
, CatalogName
, NameLength1
, SchemaName
, NameLength2
,
1331 TableName
, NameLength3
, Unique
, Reserved
);
1335 /*************************************************************************
1336 * SQLTables [ODBC32.054]
1338 SQLRETURN WINAPI
SQLTables(SQLHSTMT StatementHandle
,
1339 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1340 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1341 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1342 SQLCHAR
*TableType
, SQLSMALLINT NameLength4
)
1345 if (gProxyHandle
.dmHandle
== NULL
)
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
)
1363 if (gProxyHandle
.dmHandle
== NULL
)
1368 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
)
1369 (EnvironmentHandle
, ConnectionHandle
, CompletionType
);
1373 /*************************************************************************
1374 * SQLBrowseConnect [ODBC32.055]
1376 SQLRETURN WINAPI
SQLBrowseConnect(
1378 SQLCHAR
*szConnStrIn
,
1379 SQLSMALLINT cbConnStrIn
,
1380 SQLCHAR
*szConnStrOut
,
1381 SQLSMALLINT cbConnStrOutMax
,
1382 SQLSMALLINT
*pcbConnStrOut
)
1385 if (gProxyHandle
.dmHandle
== NULL
)
1390 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
)
1391 (hdbc
, szConnStrIn
, cbConnStrIn
, szConnStrOut
, cbConnStrOutMax
, pcbConnStrOut
);
1395 /*************************************************************************
1396 * SQLBulkOperations [ODBC32.078]
1398 SQLRETURN WINAPI
SQLBulkOperations(
1399 SQLHSTMT StatementHandle
,
1400 SQLSMALLINT Operation
)
1403 if (gProxyHandle
.dmHandle
== NULL
)
1408 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
)
1409 (StatementHandle
, Operation
);
1413 /*************************************************************************
1414 * SQLColAttributes [ODBC32.006]
1416 SQLRETURN WINAPI
SQLColAttributes(
1419 SQLUSMALLINT fDescType
,
1421 SQLSMALLINT cbDescMax
,
1422 SQLSMALLINT
*pcbDesc
,
1426 if (gProxyHandle
.dmHandle
== NULL
)
1431 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
)
1432 (hstmt
, icol
, fDescType
, rgbDesc
, cbDescMax
, pcbDesc
, pfDesc
);
1436 /*************************************************************************
1437 * SQLColumnPrivileges [ODBC32.056]
1439 SQLRETURN WINAPI
SQLColumnPrivileges(
1441 SQLCHAR
*szCatalogName
,
1442 SQLSMALLINT cbCatalogName
,
1443 SQLCHAR
*szSchemaName
,
1444 SQLSMALLINT cbSchemaName
,
1445 SQLCHAR
*szTableName
,
1446 SQLSMALLINT cbTableName
,
1447 SQLCHAR
*szColumnName
,
1448 SQLSMALLINT cbColumnName
)
1451 if (gProxyHandle
.dmHandle
== NULL
)
1456 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
)
1457 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1458 szTableName
, cbTableName
, szColumnName
, cbColumnName
);
1462 /*************************************************************************
1463 * SQLDescribeParam [ODBC32.058]
1465 SQLRETURN WINAPI
SQLDescribeParam(
1468 SQLSMALLINT
*pfSqlType
,
1469 SQLUINTEGER
*pcbParamDef
,
1470 SQLSMALLINT
*pibScale
,
1471 SQLSMALLINT
*pfNullable
)
1474 if (gProxyHandle
.dmHandle
== NULL
)
1479 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
)
1480 (hstmt
, ipar
, pfSqlType
, pcbParamDef
, pibScale
, pfNullable
);
1484 /*************************************************************************
1485 * SQLExtendedFetch [ODBC32.059]
1487 SQLRETURN WINAPI
SQLExtendedFetch(
1489 SQLUSMALLINT fFetchType
,
1492 SQLUSMALLINT
*rgfRowStatus
)
1495 if (gProxyHandle
.dmHandle
== NULL
)
1500 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
)
1501 (hstmt
, fFetchType
, irow
, pcrow
, rgfRowStatus
);
1505 /*************************************************************************
1506 * SQLForeignKeys [ODBC32.060]
1508 SQLRETURN WINAPI
SQLForeignKeys(
1510 SQLCHAR
*szPkCatalogName
,
1511 SQLSMALLINT cbPkCatalogName
,
1512 SQLCHAR
*szPkSchemaName
,
1513 SQLSMALLINT cbPkSchemaName
,
1514 SQLCHAR
*szPkTableName
,
1515 SQLSMALLINT cbPkTableName
,
1516 SQLCHAR
*szFkCatalogName
,
1517 SQLSMALLINT cbFkCatalogName
,
1518 SQLCHAR
*szFkSchemaName
,
1519 SQLSMALLINT cbFkSchemaName
,
1520 SQLCHAR
*szFkTableName
,
1521 SQLSMALLINT cbFkTableName
)
1524 if (gProxyHandle
.dmHandle
== NULL
)
1529 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
)
1530 (hstmt
, szPkCatalogName
, cbPkCatalogName
, szPkSchemaName
, cbPkSchemaName
,
1531 szPkTableName
, cbPkTableName
, szFkCatalogName
, cbFkCatalogName
, szFkSchemaName
,
1532 cbFkSchemaName
, szFkTableName
, cbFkTableName
);
1536 /*************************************************************************
1537 * SQLMoreResults [ODBC32.061]
1539 SQLRETURN WINAPI
SQLMoreResults(SQLHSTMT hstmt
)
1542 if (gProxyHandle
.dmHandle
== NULL
)
1547 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
) (hstmt
);
1551 /*************************************************************************
1552 * SQLNativeSql [ODBC32.062]
1554 SQLRETURN WINAPI
SQLNativeSql(
1556 SQLCHAR
*szSqlStrIn
,
1557 SQLINTEGER cbSqlStrIn
,
1559 SQLINTEGER cbSqlStrMax
,
1560 SQLINTEGER
*pcbSqlStr
)
1563 if (gProxyHandle
.dmHandle
== NULL
)
1568 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
)
1569 (hdbc
, szSqlStrIn
, cbSqlStrIn
, szSqlStr
, cbSqlStrMax
, pcbSqlStr
);
1573 /*************************************************************************
1574 * SQLNumParams [ODBC32.063]
1576 SQLRETURN WINAPI
SQLNumParams(
1581 if (gProxyHandle
.dmHandle
== NULL
)
1586 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
) (hstmt
, pcpar
);
1590 /*************************************************************************
1591 * SQLParamOptions [ODBC32.064]
1593 SQLRETURN WINAPI
SQLParamOptions(
1599 if (gProxyHandle
.dmHandle
== NULL
)
1604 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
) (hstmt
, crow
, pirow
);
1608 /*************************************************************************
1609 * SQLPrimaryKeys [ODBC32.065]
1611 SQLRETURN WINAPI
SQLPrimaryKeys(
1613 SQLCHAR
*szCatalogName
,
1614 SQLSMALLINT cbCatalogName
,
1615 SQLCHAR
*szSchemaName
,
1616 SQLSMALLINT cbSchemaName
,
1617 SQLCHAR
*szTableName
,
1618 SQLSMALLINT cbTableName
)
1621 if (gProxyHandle
.dmHandle
== NULL
)
1626 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
)
1627 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1628 szTableName
, cbTableName
);
1632 /*************************************************************************
1633 * SQLProcedureColumns [ODBC32.066]
1635 SQLRETURN WINAPI
SQLProcedureColumns(
1637 SQLCHAR
*szCatalogName
,
1638 SQLSMALLINT cbCatalogName
,
1639 SQLCHAR
*szSchemaName
,
1640 SQLSMALLINT cbSchemaName
,
1641 SQLCHAR
*szProcName
,
1642 SQLSMALLINT cbProcName
,
1643 SQLCHAR
*szColumnName
,
1644 SQLSMALLINT cbColumnName
)
1647 if (gProxyHandle
.dmHandle
== NULL
)
1652 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
)
1653 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1654 szProcName
, cbProcName
, szColumnName
, cbColumnName
);
1658 /*************************************************************************
1659 * SQLProcedures [ODBC32.067]
1661 SQLRETURN WINAPI
SQLProcedures(
1663 SQLCHAR
*szCatalogName
,
1664 SQLSMALLINT cbCatalogName
,
1665 SQLCHAR
*szSchemaName
,
1666 SQLSMALLINT cbSchemaName
,
1667 SQLCHAR
*szProcName
,
1668 SQLSMALLINT cbProcName
)
1671 if (gProxyHandle
.dmHandle
== NULL
)
1676 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
)
1677 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1678 szProcName
, cbProcName
);
1682 /*************************************************************************
1683 * SQLSetPos [ODBC32.068]
1685 SQLRETURN WINAPI
SQLSetPos(
1688 SQLUSMALLINT fOption
,
1692 if (gProxyHandle
.dmHandle
== NULL
)
1697 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
)
1698 (hstmt
, irow
, fOption
, fLock
);
1702 /*************************************************************************
1703 * SQLTablePrivileges [ODBC32.070]
1705 SQLRETURN WINAPI
SQLTablePrivileges(
1707 SQLCHAR
*szCatalogName
,
1708 SQLSMALLINT cbCatalogName
,
1709 SQLCHAR
*szSchemaName
,
1710 SQLSMALLINT cbSchemaName
,
1711 SQLCHAR
*szTableName
,
1712 SQLSMALLINT cbTableName
)
1715 if (gProxyHandle
.dmHandle
== NULL
)
1720 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
)
1721 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1722 szTableName
, cbTableName
);
1726 /*************************************************************************
1727 * SQLDrivers [ODBC32.071]
1729 SQLRETURN WINAPI
SQLDrivers(
1731 SQLUSMALLINT fDirection
,
1732 SQLCHAR
*szDriverDesc
,
1733 SQLSMALLINT cbDriverDescMax
,
1734 SQLSMALLINT
*pcbDriverDesc
,
1735 SQLCHAR
*szDriverAttributes
,
1736 SQLSMALLINT cbDriverAttrMax
,
1737 SQLSMALLINT
*pcbDriverAttr
)
1740 if (gProxyHandle
.dmHandle
== NULL
)
1745 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
)
1746 (henv
, fDirection
, szDriverDesc
, cbDriverDescMax
, pcbDriverDesc
,
1747 szDriverAttributes
, cbDriverAttrMax
, pcbDriverAttr
);
1751 /*************************************************************************
1752 * SQLBindParameter [ODBC32.072]
1754 SQLRETURN WINAPI
SQLBindParameter(
1757 SQLSMALLINT fParamType
,
1759 SQLSMALLINT fSqlType
,
1760 SQLUINTEGER cbColDef
,
1761 SQLSMALLINT ibScale
,
1762 SQLPOINTER rgbValue
,
1763 SQLINTEGER cbValueMax
,
1764 SQLINTEGER
*pcbValue
)
1767 if (gProxyHandle
.dmHandle
== NULL
)
1772 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
)
1773 (hstmt
, ipar
, fParamType
, fCType
, fSqlType
, cbColDef
, ibScale
,
1774 rgbValue
, cbValueMax
, pcbValue
);
1778 /*************************************************************************
1779 * SQLDriverConnect [ODBC32.041]
1781 SQLRETURN WINAPI
SQLDriverConnect(
1784 SQLCHAR
*conn_str_in
,
1785 SQLSMALLINT len_conn_str_in
,
1786 SQLCHAR
*conn_str_out
,
1787 SQLSMALLINT conn_str_out_max
,
1788 SQLSMALLINT
*ptr_conn_str_out
,
1789 SQLUSMALLINT driver_completion
)
1792 if (gProxyHandle
.dmHandle
== NULL
)
1797 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
)
1798 (hdbc
, hwnd
, conn_str_in
, len_conn_str_in
, conn_str_out
,
1799 conn_str_out_max
, ptr_conn_str_out
, driver_completion
);
1803 /*************************************************************************
1804 * SQLSetScrollOptions [ODBC32.069]
1806 SQLRETURN WINAPI
SQLSetScrollOptions(
1807 SQLHSTMT statement_handle
,
1808 SQLUSMALLINT f_concurrency
,
1809 SQLINTEGER crow_keyset
,
1810 SQLUSMALLINT crow_rowset
)
1813 if (gProxyHandle
.dmHandle
== NULL
)
1818 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
)
1819 (statement_handle
, f_concurrency
, crow_keyset
, crow_rowset
);