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 /*#define SQLRETURNTYPE SQLRETURN SQL_API*/
33 #define SQLRETURNTYPE SQLRETURN WINAPI
35 DEFAULT_DEBUG_CHANNEL(odbc
);
37 static DM_FUNC template_func
[] =
39 /* 00 */ { SQL_API_SQLALLOCCONNECT
, "SQLAllocConnect", SQLAllocConnect
},
40 /* 01 */ { SQL_API_SQLALLOCENV
, "SQLAllocEnv", SQLAllocEnv
},
41 /* 02 */ { SQL_API_SQLALLOCHANDLE
, "SQLAllocHandle", SQLAllocHandle
},
42 /* 03 */ { SQL_API_SQLALLOCSTMT
, "SQLAllocStmt", SQLAllocStmt
},
43 /* 04 */ { SQL_API_SQLALLOCHANDLESTD
, "SQLAllocHandleStd", SQLAllocHandleStd
},
44 /* 05 */ { SQL_API_SQLBINDCOL
, "SQLBindCol", SQLBindCol
},
45 /* 06 */ { SQL_API_SQLBINDPARAM
, "SQLBindParam", SQLBindParam
},
46 /* 07 */ { SQL_API_SQLBINDPARAMETER
, "SQLBindParameter", SQLBindParameter
},
47 /* 08 */ { SQL_API_SQLBROWSECONNECT
, "SQLBrowseConnect", SQLBrowseConnect
},
48 /* 09 */ { SQL_API_SQLBULKOPERATIONS
, "SQLBulkOperations", SQLBulkOperations
},
49 /* 10 */ { SQL_API_SQLCANCEL
, "SQLCancel", SQLCancel
},
50 /* 11 */ { SQL_API_SQLCLOSECURSOR
, "SQLCloseCursor", SQLCloseCursor
},
51 /* 12 */ { SQL_API_SQLCOLATTRIBUTE
, "SQLColAttribute", SQLColAttribute
},
52 /* 13 */ { SQL_API_SQLCOLATTRIBUTES
, "SQLColAttributes", SQLColAttributes
},
53 /* 14 */ { SQL_API_SQLCOLUMNPRIVILEGES
, "SQLColumnPrivileges", SQLColumnPrivileges
},
54 /* 15 */ { SQL_API_SQLCOLUMNS
, "SQLColumns", SQLColumns
},
55 /* 16 */ { SQL_API_SQLCONNECT
, "SQLConnect", SQLConnect
},
56 /* 17 */ { SQL_API_SQLCOPYDESC
, "SQLCopyDesc", SQLCopyDesc
},
57 /* 18 */ { SQL_API_SQLDATASOURCES
, "SQLDataSources", SQLDataSources
},
58 /* 19 */ { SQL_API_SQLDESCRIBECOL
, "SQLDescribeCol", SQLDescribeCol
},
59 /* 20 */ { SQL_API_SQLDESCRIBEPARAM
, "SQLDescribeParam", SQLDescribeParam
},
60 /* 21 */ { SQL_API_SQLDISCONNECT
, "SQLDisconnect", SQLDisconnect
},
61 /* 22 */ { SQL_API_SQLDRIVERCONNECT
, "SQLDriverConnect", SQLDriverConnect
},
62 /* 23 */ { SQL_API_SQLDRIVERS
, "SQLDrivers", SQLDrivers
},
63 /* 24 */ { SQL_API_SQLENDTRAN
, "SQLEndTran", SQLEndTran
},
64 /* 25 */ { SQL_API_SQLERROR
, "SQLError", SQLError
},
65 /* 26 */ { SQL_API_SQLEXECDIRECT
, "SQLExecDirect", SQLExecDirect
},
66 /* 27 */ { SQL_API_SQLEXECUTE
, "SQLExecute", SQLExecute
},
67 /* 28 */ { SQL_API_SQLEXTENDEDFETCH
, "SQLExtendedFetch", SQLExtendedFetch
},
68 /* 29 */ { SQL_API_SQLFETCH
, "SQLFetch", SQLFetch
},
69 /* 30 */ { SQL_API_SQLFETCHSCROLL
, "SQLFetchScroll", SQLFetchScroll
},
70 /* 31 */ { SQL_API_SQLFOREIGNKEYS
, "SQLForeignKeys", SQLForeignKeys
},
71 /* 32 */ { SQL_API_SQLFREEENV
, "SQLFreeEnv", SQLFreeEnv
},
72 /* 33 */ { SQL_API_SQLFREEHANDLE
, "SQLFreeHandle", SQLFreeHandle
},
73 /* 34 */ { SQL_API_SQLFREESTMT
, "SQLFreeStmt", SQLFreeStmt
},
74 /* 35 */ { SQL_API_SQLFREECONNECT
, "SQLFreeConnect", SQLFreeConnect
},
75 /* 36 */ { SQL_API_SQLGETCONNECTATTR
, "SQLGetConnectAttr", SQLGetConnectAttr
},
76 /* 37 */ { SQL_API_SQLGETCONNECTOPTION
, "SQLGetConnectOption", SQLGetConnectOption
},
77 /* 38 */ { SQL_API_SQLGETCURSORNAME
, "SQLGetCursorName", SQLGetCursorName
},
78 /* 39 */ { SQL_API_SQLGETDATA
, "SQLGetData", SQLGetData
},
79 /* 40 */ { SQL_API_SQLGETDESCFIELD
, "SQLGetDescField", SQLGetDescField
},
80 /* 41 */ { SQL_API_SQLGETDESCREC
, "SQLGetDescRec", SQLGetDescRec
},
81 /* 42 */ { SQL_API_SQLGETDIAGFIELD
, "SQLGetDiagField", SQLGetDiagField
},
82 /* 43 */ { SQL_API_SQLGETENVATTR
, "SQLGetEnvAttr", SQLGetEnvAttr
},
83 /* 44 */ { SQL_API_SQLGETFUNCTIONS
, "SQLGetFunctions", SQLGetFunctions
},
84 /* 45 */ { SQL_API_SQLGETINFO
, "SQLGetInfo", SQLGetInfo
},
85 /* 46 */ { SQL_API_SQLGETSTMTATTR
, "SQLGetStmtAttr", SQLGetStmtAttr
},
86 /* 47 */ { SQL_API_SQLGETSTMTOPTION
, "SQLGetStmtOption", SQLGetStmtOption
},
87 /* 48 */ { SQL_API_SQLGETTYPEINFO
, "SQLGetTypeInfo", SQLGetTypeInfo
},
88 /* 49 */ { SQL_API_SQLMORERESULTS
, "SQLMoreResults", SQLMoreResults
},
89 /* 50 */ { SQL_API_SQLNATIVESQL
, "SQLNativeSql", SQLNativeSql
},
90 /* 51 */ { SQL_API_SQLNUMPARAMS
, "SQLNumParams", SQLNumParams
},
91 /* 52 */ { SQL_API_SQLNUMRESULTCOLS
, "SQLNumResultCols", SQLNumResultCols
},
92 /* 53 */ { SQL_API_SQLPARAMDATA
, "SQLParamData", SQLParamData
},
93 /* 54 */ { SQL_API_SQLPARAMOPTIONS
, "SQLParamOptions", SQLParamOptions
},
94 /* 55 */ { SQL_API_SQLPREPARE
, "SQLPrepare", SQLPrepare
},
95 /* 56 */ { SQL_API_SQLPRIMARYKEYS
, "SQLPrimaryKeys", SQLPrimaryKeys
},
96 /* 57 */ { SQL_API_SQLPROCEDURECOLUMNS
, "SQLProcedureColumns", SQLProcedureColumns
},
97 /* 58 */ { SQL_API_SQLPROCEDURES
, "SQLProcedures", SQLProcedures
},
98 /* 59 */ { SQL_API_SQLPUTDATA
, "SQLPutData", SQLPutData
},
99 /* 60 */ { SQL_API_SQLROWCOUNT
, "SQLRowCount", SQLRowCount
},
100 /* 61 */ { SQL_API_SQLSETCONNECTATTR
, "SQLSetConnectAttr", SQLSetConnectAttr
},
101 /* 62 */ { SQL_API_SQLSETCONNECTOPTION
, "SQLSetConnectOption", SQLSetConnectOption
},
102 /* 63 */ { SQL_API_SQLSETCURSORNAME
, "SQLSetCursorName", SQLSetCursorName
},
103 /* 64 */ { SQL_API_SQLSETDESCFIELD
, "SQLSetDescField", SQLSetDescField
},
104 /* 65 */ { SQL_API_SQLSETDESCREC
, "SQLSetDescRec", SQLSetDescRec
},
105 /* 66 */ { SQL_API_SQLSETENVATTR
, "SQLSetEnvAttr", SQLSetEnvAttr
},
106 /* 67 */ { SQL_API_SQLSETPARAM
, "SQLSetParam", SQLSetParam
},
107 /* 68 */ { SQL_API_SQLSETPOS
, "SQLSetPos", SQLSetPos
},
108 /* 69 */ { SQL_API_SQLSETSCROLLOPTIONS
, "SQLSetScrollOptions", SQLSetScrollOptions
},
109 /* 70 */ { SQL_API_SQLSETSTMTATTR
, "SQLSetStmtAttr", SQLSetStmtAttr
},
110 /* 71 */ { SQL_API_SQLSETSTMTOPTION
, "SQLSetStmtOption", SQLSetStmtOption
},
111 /* 72 */ { SQL_API_SQLSPECIALCOLUMNS
, "SQLSpecialColumns", SQLSpecialColumns
},
112 /* 73 */ { SQL_API_SQLSTATISTICS
, "SQLStatistics", SQLStatistics
},
113 /* 74 */ { SQL_API_SQLTABLEPRIVILEGES
, "SQLTablePrivileges", SQLTablePrivileges
},
114 /* 75 */ { SQL_API_SQLTABLES
, "SQLTables", SQLTables
},
115 /* 76 */ { SQL_API_SQLTRANSACT
, "SQLTransact", SQLTransact
},
116 /* 77 */ { SQL_API_SQLGETDIAGREC
, "SQLGetDiagRec", SQLGetDiagRec
},
119 static PROXYHANDLE gProxyHandle
= {NULL
, FALSE
, FALSE
, FALSE
, ERROR_LIBRARY_NOT_FOUND
};
121 SQLRETURN
SQLDummyFunc()
123 TRACE("SQLDummyFunc: \n");
127 /***********************************************************************
128 * MAIN_OdbcInit [Internal] Initializes the internal 'ODBC32.DLL'.
131 * hinstDLL [I] handle to the 'dlls' instance
133 * lpvReserved [I] reserverd, must be NULL
141 MAIN_OdbcInit(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
144 TRACE("Initializing proxy ODBC: %x,%lx,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
146 if (fdwReason
== DLL_PROCESS_ATTACH
)
148 TRACE("Loading ODBC...\n");
149 if (ODBC_LoadDriverManager())
150 ODBC_LoadDMFunctions();
152 else if (fdwReason
== DLL_PROCESS_DETACH
)
154 TRACE("Unloading ODBC...\n");
155 if (gProxyHandle
.bFunctionReady
)
157 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
159 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
163 if (gProxyHandle
.dmHandle
)
165 dlclose(gProxyHandle
.dmHandle
);
166 gProxyHandle
.dmHandle
= NULL
;
174 /***********************************************************************
175 * ODBC_LoadDriverManager [Internal] Load ODBC library.
184 BOOL
ODBC_LoadDriverManager()
186 char *s
= getenv("LIB_ODBC_DRIVER_MANAGER");
190 gProxyHandle
.bFunctionReady
= FALSE
;
192 if (s
!= NULL
&& strlen(s
) > 0)
193 strcpy(gProxyHandle
.dmLibName
, s
);
195 strcpy(gProxyHandle
.dmLibName
, "libodbc.so");
197 gProxyHandle
.dmHandle
= dlopen(gProxyHandle
.dmLibName
, RTLD_LAZY
);
199 if (gProxyHandle
.dmHandle
== NULL
) /* fail to load unixODBC driver manager */
201 WARN("failed to open library %s\n", gProxyHandle
.dmLibName
);
202 gProxyHandle
.dmLibName
[0] = '\0';
203 gProxyHandle
.nErrorType
= ERROR_LIBRARY_NOT_FOUND
;
208 gProxyHandle
.nErrorType
= ERROR_FREE
;
214 /***********************************************************************
215 * ODBC_LoadDMFunctions [Internal] Populate function table.
224 BOOL
ODBC_LoadDMFunctions()
228 if (gProxyHandle
.dmHandle
== NULL
)
231 for ( i
= 0; i
< NUM_SQLFUNC
; i
++ )
233 gProxyHandle
.functions
[i
] = template_func
[i
];
234 gProxyHandle
.functions
[i
].func
= dlsym(gProxyHandle
.dmHandle
,
235 gProxyHandle
.functions
[i
].name
);
239 ERR("Failed to load function %s",gProxyHandle
.functions
[i
].name
);
240 gProxyHandle
.functions
[i
].func
= SQLDummyFunc
;
244 gProxyHandle
.bFunctionReady
= TRUE
;
250 /*************************************************************************
251 * SQLAllocConnect [ODBC32.001]
253 SQLRETURNTYPE
SQLAllocConnect(SQLHENV EnvironmentHandle
, SQLHDBC
*ConnectionHandle
)
257 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
259 *ConnectionHandle
= SQL_NULL_HDBC
;
263 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCCONNECT
].func
)
264 (EnvironmentHandle
, ConnectionHandle
);
268 /*************************************************************************
269 * SQLAllocEnv [ODBC32.002]
271 SQLRETURNTYPE
SQLAllocEnv(SQLHENV
*EnvironmentHandle
)
275 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
277 *EnvironmentHandle
= SQL_NULL_HENV
;
281 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCENV
].func
) (EnvironmentHandle
);
285 /*************************************************************************
286 * SQLAllocHandle [ODBC32.024]
288 SQLRETURNTYPE
SQLAllocHandle(SQLSMALLINT HandleType
, SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
292 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
294 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
295 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
297 if (HandleType
== SQL_HANDLE_ENV
)
298 *OutputHandle
= SQL_NULL_HENV
;
299 else if (HandleType
== SQL_HANDLE_DBC
)
300 *OutputHandle
= SQL_NULL_HDBC
;
301 else if (HandleType
== SQL_HANDLE_STMT
)
302 *OutputHandle
= SQL_NULL_HSTMT
;
303 else if (HandleType
== SQL_HANDLE_DESC
)
304 *OutputHandle
= SQL_NULL_HDESC
;
309 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLE
].func
)
310 (HandleType
, InputHandle
, OutputHandle
);
314 /*************************************************************************
315 * SQLAllocStmt [ODBC32.003]
317 SQLRETURNTYPE
SQLAllocStmt(SQLHDBC ConnectionHandle
, SQLHSTMT
*StatementHandle
)
322 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
324 *StatementHandle
= SQL_NULL_HSTMT
;
328 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCSTMT
].func
)
329 (ConnectionHandle
, StatementHandle
);
333 /*************************************************************************
334 * SQLAllocHandleStd [ODBC32.077]
336 SQLRETURNTYPE
SQLAllocHandleStd( SQLSMALLINT HandleType
,
337 SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
)
339 TRACE("ProxyODBC: SQLAllocHandelStd.\n");
341 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
343 if (gProxyHandle
.nErrorType
== ERROR_LIBRARY_NOT_FOUND
)
344 WARN("ProxyODBC: Can not load ODBC driver manager library.\n");
346 if (HandleType
== SQL_HANDLE_ENV
)
347 *OutputHandle
= SQL_NULL_HENV
;
348 else if (HandleType
== SQL_HANDLE_DBC
)
349 *OutputHandle
= SQL_NULL_HDBC
;
350 else if (HandleType
== SQL_HANDLE_STMT
)
351 *OutputHandle
= SQL_NULL_HSTMT
;
352 else if (HandleType
== SQL_HANDLE_DESC
)
353 *OutputHandle
= SQL_NULL_HDESC
;
358 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLALLOCHANDLESTD
].func
)
359 (HandleType
, InputHandle
, OutputHandle
);
363 /*************************************************************************
364 * SQLBindCol [ODBC32.004]
366 SQLRETURNTYPE
SQLBindCol(SQLHSTMT StatementHandle
,
367 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
368 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
369 SQLINTEGER
*StrLen_or_Ind
)
373 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
378 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDCOL
].func
)
379 (StatementHandle
, ColumnNumber
, TargetType
,
380 TargetValue
, BufferLength
, StrLen_or_Ind
);
384 /*************************************************************************
385 * SQLBindParam [ODBC32.025]
387 SQLRETURNTYPE
SQLBindParam(SQLHSTMT StatementHandle
,
388 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
389 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
390 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
391 SQLINTEGER
*StrLen_or_Ind
)
395 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
400 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAM
].func
)
401 (StatementHandle
, ParameterNumber
, ValueType
,
402 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
406 /*************************************************************************
407 * SQLCancel [ODBC32.005]
409 SQLRETURNTYPE
SQLCancel(SQLHSTMT StatementHandle
)
413 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
418 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCANCEL
].func
) (StatementHandle
);
422 /*************************************************************************
423 * SQLCloseCursor [ODBC32.026]
425 SQLRETURNTYPE
SQLCloseCursor(SQLHSTMT StatementHandle
)
429 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
434 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCLOSECURSOR
].func
) (StatementHandle
);
438 /*************************************************************************
439 * SQLColAttribute [ODBC32.027]
441 SQLRETURNTYPE
SQLColAttribute (SQLHSTMT StatementHandle
,
442 SQLUSMALLINT ColumnNumber
, SQLUSMALLINT FieldIdentifier
,
443 SQLPOINTER CharacterAttribute
, SQLSMALLINT BufferLength
,
444 SQLSMALLINT
*StringLength
, SQLPOINTER NumericAttribute
)
448 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
453 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTE
].func
)
454 (StatementHandle
, ColumnNumber
, FieldIdentifier
,
455 CharacterAttribute
, BufferLength
, StringLength
, NumericAttribute
);
459 /*************************************************************************
460 * SQLColumns [ODBC32.040]
462 SQLRETURNTYPE
SQLColumns(SQLHSTMT StatementHandle
,
463 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
464 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
465 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
466 SQLCHAR
*ColumnName
, SQLSMALLINT NameLength4
)
470 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
475 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNS
].func
)
476 (StatementHandle
, CatalogName
, NameLength1
,
477 SchemaName
, NameLength2
, TableName
, NameLength3
, ColumnName
, NameLength4
);
481 /*************************************************************************
482 * SQLConnect [ODBC32.007]
484 SQLRETURNTYPE
SQLConnect(SQLHDBC ConnectionHandle
,
485 SQLCHAR
*ServerName
, SQLSMALLINT NameLength1
,
486 SQLCHAR
*UserName
, SQLSMALLINT NameLength2
,
487 SQLCHAR
*Authentication
, SQLSMALLINT NameLength3
)
491 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
496 strcpy(gProxyHandle
.ServerName
, ServerName
);
497 strcpy(gProxyHandle
.UserName
, UserName
);
499 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCONNECT
].func
)
500 (ConnectionHandle
, ServerName
, NameLength1
,
501 UserName
, NameLength2
, Authentication
, NameLength3
);
505 /*************************************************************************
506 * SQLCopyDesc [ODBC32.028]
508 SQLRETURNTYPE
SQLCopyDesc(SQLHDESC SourceDescHandle
, SQLHDESC TargetDescHandle
)
512 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
517 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOPYDESC
].func
)
518 (SourceDescHandle
, TargetDescHandle
);
522 /*************************************************************************
523 * SQLDataSources [ODBC32.057]
525 SQLRETURNTYPE
SQLDataSources(SQLHENV EnvironmentHandle
,
526 SQLUSMALLINT Direction
, SQLCHAR
*ServerName
,
527 SQLSMALLINT BufferLength1
, SQLSMALLINT
*NameLength1
,
528 SQLCHAR
*Description
, SQLSMALLINT BufferLength2
,
529 SQLSMALLINT
*NameLength2
)
533 TRACE("EnvironmentHandle = %p\n", (LPVOID
)EnvironmentHandle
);
535 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
537 ERR("Error: empty dm handle (gProxyHandle.dmHandle == NULL)\n");
541 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDATASOURCES
].func
)
542 (EnvironmentHandle
, Direction
, ServerName
,
543 BufferLength1
, NameLength1
, Description
, BufferLength2
, NameLength2
);
547 TRACE("returns: %d \t", ret
);
548 if (*NameLength1
> 0)
549 TRACE("DataSource = %s,", ServerName
);
550 if (*NameLength2
> 0)
551 TRACE(" Description = %s\n", Description
);
558 /*************************************************************************
559 * SQLDescribeCol [ODBC32.008]
561 SQLRETURNTYPE
SQLDescribeCol(SQLHSTMT StatementHandle
,
562 SQLUSMALLINT ColumnNumber
, SQLCHAR
*ColumnName
,
563 SQLSMALLINT BufferLength
, SQLSMALLINT
*NameLength
,
564 SQLSMALLINT
*DataType
, SQLUINTEGER
*ColumnSize
,
565 SQLSMALLINT
*DecimalDigits
, SQLSMALLINT
*Nullable
)
569 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
574 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBECOL
].func
)
575 (StatementHandle
, ColumnNumber
, ColumnName
,
576 BufferLength
, NameLength
, DataType
, ColumnSize
, DecimalDigits
, Nullable
);
580 /*************************************************************************
581 * SQLDisconnect [ODBC32.009]
583 SQLRETURNTYPE
SQLDisconnect(SQLHDBC ConnectionHandle
)
587 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
592 gProxyHandle
.ServerName
[0] = '\0';
593 gProxyHandle
.UserName
[0] = '\0';
595 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDISCONNECT
].func
) (ConnectionHandle
);
599 /*************************************************************************
600 * SQLEndTran [ODBC32.029]
602 SQLRETURNTYPE
SQLEndTran(SQLSMALLINT HandleType
, SQLHANDLE Handle
, SQLSMALLINT CompletionType
)
606 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
611 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLENDTRAN
].func
) (HandleType
, Handle
, CompletionType
);
615 /*************************************************************************
616 * SQLError [ODBC32.010]
618 SQLRETURNTYPE
SQLError(SQLHENV EnvironmentHandle
,
619 SQLHDBC ConnectionHandle
, SQLHSTMT StatementHandle
,
620 SQLCHAR
*Sqlstate
, SQLINTEGER
*NativeError
,
621 SQLCHAR
*MessageText
, SQLSMALLINT BufferLength
,
622 SQLSMALLINT
*TextLength
)
626 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
631 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLERROR
].func
)
632 (EnvironmentHandle
, ConnectionHandle
, StatementHandle
,
633 Sqlstate
, NativeError
, MessageText
, BufferLength
, TextLength
);
637 /*************************************************************************
638 * SQLExecDirect [ODBC32.011]
640 SQLRETURNTYPE
SQLExecDirect(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
644 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
649 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECDIRECT
].func
)
650 (StatementHandle
, StatementText
, TextLength
);
654 /*************************************************************************
655 * SQLExecute [ODBC32.012]
657 SQLRETURNTYPE
SQLExecute(SQLHSTMT StatementHandle
)
661 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
666 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXECUTE
].func
) (StatementHandle
);
670 /*************************************************************************
671 * SQLFetch [ODBC32.013]
673 SQLRETURNTYPE
SQLFetch(SQLHSTMT StatementHandle
)
677 if (!gProxyHandle
.bFunctionReady
|| gProxyHandle
.dmHandle
== NULL
)
682 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCH
].func
) (StatementHandle
);
686 /*************************************************************************
687 * SQLFetchScroll [ODBC32.030]
689 SQLRETURNTYPE
SQLFetchScroll(SQLHSTMT StatementHandle
, SQLSMALLINT FetchOrientation
, SQLINTEGER FetchOffset
)
693 if (gProxyHandle
.dmHandle
== NULL
)
698 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFETCHSCROLL
].func
)
699 (StatementHandle
, FetchOrientation
, FetchOffset
);
703 /*************************************************************************
704 * SQLFreeConnect [ODBC32.014]
706 SQLRETURNTYPE
SQLFreeConnect(SQLHDBC ConnectionHandle
)
710 if (gProxyHandle
.dmHandle
== NULL
)
715 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREECONNECT
].func
) (ConnectionHandle
);
719 /*************************************************************************
720 * SQLFreeEnv [ODBC32.015]
722 SQLRETURNTYPE
SQLFreeEnv(SQLHENV EnvironmentHandle
)
728 if (gProxyHandle
.dmHandle
== NULL
)
733 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEENV
].func
) (EnvironmentHandle
);
735 if (gProxyHandle.dmHandle)
737 dlclose(gProxyHandle.dmHandle);
738 gProxyHandle.dmHandle = NULL;
746 /*************************************************************************
747 * SQLFreeHandle [ODBC32.031]
749 SQLRETURNTYPE
SQLFreeHandle(SQLSMALLINT HandleType
, SQLHANDLE Handle
)
755 if (gProxyHandle
.dmHandle
== NULL
)
760 ret
= (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREEHANDLE
].func
)
761 (HandleType
, Handle
);
763 if (HandleType
== SQL_HANDLE_ENV
) /* it is time to close the loaded library */
765 if (gProxyHandle
.dmHandle
)
767 dlclose(gProxyHandle
.dmHandle
);
768 gProxyHandle
.dmHandle
= NULL
;
776 /*************************************************************************
777 * SQLFreeStmt [ODBC32.016]
779 SQLRETURNTYPE
SQLFreeStmt(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
)
784 if (gProxyHandle
.dmHandle
== NULL
)
789 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFREESTMT
].func
)
790 (StatementHandle
, Option
);
794 /*************************************************************************
795 * SQLGetConnectAttr [ODBC32.032]
797 SQLRETURNTYPE
SQLGetConnectAttr(SQLHDBC ConnectionHandle
,
798 SQLINTEGER Attribute
, SQLPOINTER Value
,
799 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
803 if (gProxyHandle
.dmHandle
== NULL
)
808 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTATTR
].func
)
809 (ConnectionHandle
, Attribute
, Value
,
810 BufferLength
, StringLength
);
814 /*************************************************************************
815 * SQLGetConnectOption [ODBC32.042]
817 SQLRETURNTYPE
SQLGetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
821 if (gProxyHandle
.dmHandle
== NULL
)
826 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCONNECTOPTION
].func
)
827 (ConnectionHandle
, Option
, Value
);
831 /*************************************************************************
832 * SQLGetCursorName [ODBC32.017]
834 SQLRETURNTYPE
SQLGetCursorName(SQLHSTMT StatementHandle
,
835 SQLCHAR
*CursorName
, SQLSMALLINT BufferLength
,
836 SQLSMALLINT
*NameLength
)
840 if (gProxyHandle
.dmHandle
== NULL
)
845 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETCURSORNAME
].func
)
846 (StatementHandle
, CursorName
, BufferLength
, NameLength
);
850 /*************************************************************************
851 * SQLGetData [ODBC32.043]
853 SQLRETURNTYPE
SQLGetData(SQLHSTMT StatementHandle
,
854 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
855 SQLPOINTER TargetValue
, SQLINTEGER BufferLength
,
856 SQLINTEGER
*StrLen_or_Ind
)
859 if (gProxyHandle
.dmHandle
== NULL
)
864 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDATA
].func
)
865 (StatementHandle
, ColumnNumber
, TargetType
,
866 TargetValue
, BufferLength
, StrLen_or_Ind
);
870 /*************************************************************************
871 * SQLGetDescField [ODBC32.033]
873 SQLRETURNTYPE
SQLGetDescField(SQLHDESC DescriptorHandle
,
874 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
875 SQLPOINTER Value
, SQLINTEGER BufferLength
,
876 SQLINTEGER
*StringLength
)
879 if (gProxyHandle
.dmHandle
== NULL
)
884 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCFIELD
].func
)
885 (DescriptorHandle
, RecNumber
, FieldIdentifier
,
886 Value
, BufferLength
, StringLength
);
890 /*************************************************************************
891 * SQLGetDescRec [ODBC32.034]
893 SQLRETURNTYPE
SQLGetDescRec(SQLHDESC DescriptorHandle
,
894 SQLSMALLINT RecNumber
, SQLCHAR
*Name
,
895 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
,
896 SQLSMALLINT
*Type
, SQLSMALLINT
*SubType
,
897 SQLINTEGER
*Length
, SQLSMALLINT
*Precision
,
898 SQLSMALLINT
*Scale
, SQLSMALLINT
*Nullable
)
901 if (gProxyHandle
.dmHandle
== NULL
)
906 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDESCREC
].func
)
907 (DescriptorHandle
, RecNumber
, Name
, BufferLength
,
908 StringLength
, Type
, SubType
, Length
, Precision
, Scale
, Nullable
);
912 /*************************************************************************
913 * SQLGetDiagField [ODBC32.035]
915 SQLRETURNTYPE
SQLGetDiagField(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
916 SQLSMALLINT RecNumber
, SQLSMALLINT DiagIdentifier
,
917 SQLPOINTER DiagInfo
, SQLSMALLINT BufferLength
,
918 SQLSMALLINT
*StringLength
)
921 if (gProxyHandle
.dmHandle
== NULL
)
926 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGFIELD
].func
)
927 (HandleType
, Handle
, RecNumber
, DiagIdentifier
,
928 DiagInfo
, BufferLength
, StringLength
);
932 /*************************************************************************
933 * SQLGetDiagRec [ODBC32.036]
935 SQLRETURNTYPE
SQLGetDiagRec(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
936 SQLSMALLINT RecNumber
, SQLCHAR
*Sqlstate
,
937 SQLINTEGER
*NativeError
, SQLCHAR
*MessageText
,
938 SQLSMALLINT BufferLength
, SQLSMALLINT
*TextLength
)
941 if (gProxyHandle
.dmHandle
== NULL
)
946 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETDIAGREC
].func
)
947 (HandleType
, Handle
, RecNumber
, Sqlstate
, NativeError
,
948 MessageText
, BufferLength
, TextLength
);
952 /*************************************************************************
953 * SQLGetEnvAttr [ODBC32.037]
955 SQLRETURNTYPE
SQLGetEnvAttr(SQLHENV EnvironmentHandle
,
956 SQLINTEGER Attribute
, SQLPOINTER Value
,
957 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
960 if (gProxyHandle
.dmHandle
== NULL
)
965 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETENVATTR
].func
)
966 (EnvironmentHandle
, Attribute
, Value
, BufferLength
, StringLength
);
970 /*************************************************************************
971 * SQLGetFunctions [ODBC32.044]
973 SQLRETURNTYPE
SQLGetFunctions(SQLHDBC ConnectionHandle
, SQLUSMALLINT FunctionId
, SQLUSMALLINT
*Supported
)
976 if (gProxyHandle
.dmHandle
== NULL
)
981 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETFUNCTIONS
].func
)
982 (ConnectionHandle
, FunctionId
, Supported
);
986 /*************************************************************************
987 * SQLGetInfo [ODBC32.045]
989 SQLRETURNTYPE
SQLGetInfo(SQLHDBC ConnectionHandle
,
990 SQLUSMALLINT InfoType
, SQLPOINTER InfoValue
,
991 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
)
994 if (gProxyHandle
.dmHandle
== NULL
)
999 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETINFO
].func
)
1000 (ConnectionHandle
, InfoType
, InfoValue
, BufferLength
, StringLength
);
1004 /*************************************************************************
1005 * SQLGetStmtAttr [ODBC32.038]
1007 SQLRETURNTYPE
SQLGetStmtAttr(SQLHSTMT StatementHandle
,
1008 SQLINTEGER Attribute
, SQLPOINTER Value
,
1009 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
)
1012 if (gProxyHandle
.dmHandle
== NULL
)
1017 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTATTR
].func
)
1018 (StatementHandle
, Attribute
, Value
, BufferLength
, StringLength
);
1022 /*************************************************************************
1023 * SQLGetStmtOption [ODBC32.046]
1025 SQLRETURNTYPE
SQLGetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLPOINTER Value
)
1028 if (gProxyHandle
.dmHandle
== NULL
)
1033 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETSTMTOPTION
].func
)
1034 (StatementHandle
, Option
, Value
);
1038 /*************************************************************************
1039 * SQLGetTypeInfo [ODBC32.047]
1041 SQLRETURNTYPE
SQLGetTypeInfo(SQLHSTMT StatementHandle
, SQLSMALLINT DataType
)
1044 if (gProxyHandle
.dmHandle
== NULL
)
1049 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLGETTYPEINFO
].func
)
1050 (StatementHandle
, DataType
);
1054 /*************************************************************************
1055 * SQLNumResultCols [ODBC32.018]
1057 SQLRETURNTYPE
SQLNumResultCols(SQLHSTMT StatementHandle
, SQLSMALLINT
*ColumnCount
)
1060 if (gProxyHandle
.dmHandle
== NULL
)
1065 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMRESULTCOLS
].func
)
1066 (StatementHandle
, ColumnCount
);
1070 /*************************************************************************
1071 * SQLParamData [ODBC32.048]
1073 SQLRETURNTYPE
SQLParamData(SQLHSTMT StatementHandle
, SQLPOINTER
*Value
)
1076 if (gProxyHandle
.dmHandle
== NULL
)
1081 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMDATA
].func
)
1082 (StatementHandle
, Value
);
1086 /*************************************************************************
1087 * SQLPrepare [ODBC32.019]
1089 SQLRETURNTYPE
SQLPrepare(SQLHSTMT StatementHandle
, SQLCHAR
*StatementText
, SQLINTEGER TextLength
)
1092 if (gProxyHandle
.dmHandle
== NULL
)
1097 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPREPARE
].func
)
1098 (StatementHandle
, StatementText
, TextLength
);
1102 /*************************************************************************
1103 * SQLPutData [ODBC32.049]
1105 SQLRETURNTYPE
SQLPutData(SQLHSTMT StatementHandle
, SQLPOINTER Data
, SQLINTEGER StrLen_or_Ind
)
1108 if (gProxyHandle
.dmHandle
== NULL
)
1113 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPUTDATA
].func
)
1114 (StatementHandle
, Data
, StrLen_or_Ind
);
1118 /*************************************************************************
1119 * SQLRowCount [ODBC32.020]
1121 SQLRETURNTYPE
SQLRowCount(SQLHSTMT StatementHandle
, SQLINTEGER
*RowCount
)
1124 if (gProxyHandle
.dmHandle
== NULL
)
1129 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLROWCOUNT
].func
)
1130 (StatementHandle
, RowCount
);
1134 /*************************************************************************
1135 * SQLSetConnectAttr [ODBC32.039]
1137 SQLRETURNTYPE
SQLSetConnectAttr(SQLHDBC ConnectionHandle
, SQLINTEGER Attribute
,
1138 SQLPOINTER Value
, SQLINTEGER StringLength
)
1141 if (gProxyHandle
.dmHandle
== NULL
)
1146 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTATTR
].func
)
1147 (ConnectionHandle
, Attribute
, Value
, StringLength
);
1151 /*************************************************************************
1152 * SQLSetConnectOption [ODBC32.050]
1154 SQLRETURNTYPE
SQLSetConnectOption(SQLHDBC ConnectionHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1157 if (gProxyHandle
.dmHandle
== NULL
)
1162 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCONNECTOPTION
].func
)
1163 (ConnectionHandle
, Option
, Value
);
1167 /*************************************************************************
1168 * SQLSetCursorName [ODBC32.021]
1170 SQLRETURNTYPE
SQLSetCursorName(SQLHSTMT StatementHandle
, SQLCHAR
*CursorName
, SQLSMALLINT NameLength
)
1173 if (gProxyHandle
.dmHandle
== NULL
)
1178 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETCURSORNAME
].func
)
1179 (StatementHandle
, CursorName
, NameLength
);
1183 /*************************************************************************
1184 * SQLSetDescField [ODBC32.073]
1186 SQLRETURNTYPE
SQLSetDescField(SQLHDESC DescriptorHandle
,
1187 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
1188 SQLPOINTER Value
, SQLINTEGER BufferLength
)
1191 if (gProxyHandle
.dmHandle
== NULL
)
1196 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCFIELD
].func
)
1197 (DescriptorHandle
, RecNumber
, FieldIdentifier
, Value
, BufferLength
);
1201 /*************************************************************************
1202 * SQLSetDescRec [ODBC32.074]
1204 SQLRETURNTYPE
SQLSetDescRec(SQLHDESC DescriptorHandle
,
1205 SQLSMALLINT RecNumber
, SQLSMALLINT Type
,
1206 SQLSMALLINT SubType
, SQLINTEGER Length
,
1207 SQLSMALLINT Precision
, SQLSMALLINT Scale
,
1208 SQLPOINTER Data
, SQLINTEGER
*StringLength
,
1209 SQLINTEGER
*Indicator
)
1212 if (gProxyHandle
.dmHandle
== NULL
)
1217 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETDESCREC
].func
)
1218 (DescriptorHandle
, RecNumber
, Type
, SubType
, Length
,
1219 Precision
, Scale
, Data
, StringLength
, Indicator
);
1223 /*************************************************************************
1224 * SQLSetEnvAttr [ODBC32.075]
1226 SQLRETURNTYPE
SQLSetEnvAttr(SQLHENV EnvironmentHandle
,
1227 SQLINTEGER Attribute
, SQLPOINTER Value
,
1228 SQLINTEGER StringLength
)
1231 if (gProxyHandle
.dmHandle
== NULL
)
1236 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETENVATTR
].func
)
1237 (EnvironmentHandle
, Attribute
, Value
, StringLength
);
1241 /*************************************************************************
1242 * SQLSetParam [ODBC32.022]
1244 SQLRETURNTYPE
SQLSetParam(SQLHSTMT StatementHandle
,
1245 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
1246 SQLSMALLINT ParameterType
, SQLUINTEGER LengthPrecision
,
1247 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
1248 SQLINTEGER
*StrLen_or_Ind
)
1251 if (gProxyHandle
.dmHandle
== NULL
)
1256 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPARAM
].func
)
1257 (StatementHandle
, ParameterNumber
, ValueType
, ParameterType
, LengthPrecision
,
1258 ParameterScale
, ParameterValue
, StrLen_or_Ind
);
1262 /*************************************************************************
1263 * SQLSetStmtAttr [ODBC32.076]
1265 SQLRETURNTYPE
SQLSetStmtAttr(SQLHSTMT StatementHandle
,
1266 SQLINTEGER Attribute
, SQLPOINTER Value
,
1267 SQLINTEGER StringLength
)
1270 if (gProxyHandle
.dmHandle
== NULL
)
1275 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTATTR
].func
)
1276 (StatementHandle
, Attribute
, Value
, StringLength
);
1280 /*************************************************************************
1281 * SQLSetStmtOption [ODBC32.051]
1283 SQLRETURNTYPE
SQLSetStmtOption(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
, SQLUINTEGER Value
)
1286 if (gProxyHandle
.dmHandle
== NULL
)
1291 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSTMTOPTION
].func
)
1292 (StatementHandle
, Option
, Value
);
1296 /*************************************************************************
1297 * SQLSpecialColumns [ODBC32.052]
1299 SQLRETURNTYPE
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
)
1306 if (gProxyHandle
.dmHandle
== NULL
)
1311 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSPECIALCOLUMNS
].func
)
1312 (StatementHandle
, IdentifierType
, CatalogName
, NameLength1
, SchemaName
,
1313 NameLength2
, TableName
, NameLength3
, Scope
, Nullable
);
1317 /*************************************************************************
1318 * SQLStatistics [ODBC32.053]
1320 SQLRETURNTYPE
SQLStatistics(SQLHSTMT StatementHandle
,
1321 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1322 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1323 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1324 SQLUSMALLINT Unique
, SQLUSMALLINT Reserved
)
1327 if (gProxyHandle
.dmHandle
== NULL
)
1332 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSTATISTICS
].func
)
1333 (StatementHandle
, CatalogName
, NameLength1
, SchemaName
, NameLength2
,
1334 TableName
, NameLength3
, Unique
, Reserved
);
1338 /*************************************************************************
1339 * SQLTables [ODBC32.054]
1341 SQLRETURNTYPE
SQLTables(SQLHSTMT StatementHandle
,
1342 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
1343 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
1344 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
1345 SQLCHAR
*TableType
, SQLSMALLINT NameLength4
)
1348 if (gProxyHandle
.dmHandle
== NULL
)
1353 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLES
].func
)
1354 (StatementHandle
, CatalogName
, NameLength1
,
1355 SchemaName
, NameLength2
, TableName
, NameLength3
, TableType
, NameLength4
);
1359 /*************************************************************************
1360 * SQLTransact [ODBC32.023]
1362 SQLRETURNTYPE
SQLTransact(SQLHENV EnvironmentHandle
, SQLHDBC ConnectionHandle
,
1363 SQLUSMALLINT CompletionType
)
1366 if (gProxyHandle
.dmHandle
== NULL
)
1371 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTRANSACT
].func
)
1372 (EnvironmentHandle
, ConnectionHandle
, CompletionType
);
1376 /*************************************************************************
1377 * SQLBrowseConnect [ODBC32.055]
1379 SQLRETURNTYPE
SQLBrowseConnect(
1381 SQLCHAR
*szConnStrIn
,
1382 SQLSMALLINT cbConnStrIn
,
1383 SQLCHAR
*szConnStrOut
,
1384 SQLSMALLINT cbConnStrOutMax
,
1385 SQLSMALLINT
*pcbConnStrOut
)
1388 if (gProxyHandle
.dmHandle
== NULL
)
1393 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBROWSECONNECT
].func
)
1394 (hdbc
, szConnStrIn
, cbConnStrIn
, szConnStrOut
, cbConnStrOutMax
, pcbConnStrOut
);
1398 /*************************************************************************
1399 * SQLBulkOperations [ODBC32.078]
1401 SQLRETURNTYPE
SQLBulkOperations(
1402 SQLHSTMT StatementHandle
,
1403 SQLSMALLINT Operation
)
1406 if (gProxyHandle
.dmHandle
== NULL
)
1411 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBULKOPERATIONS
].func
)
1412 (StatementHandle
, Operation
);
1416 /*************************************************************************
1417 * SQLColAttributes [ODBC32.006]
1419 SQLRETURNTYPE
SQLColAttributes(
1422 SQLUSMALLINT fDescType
,
1424 SQLSMALLINT cbDescMax
,
1425 SQLSMALLINT
*pcbDesc
,
1429 if (gProxyHandle
.dmHandle
== NULL
)
1434 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLATTRIBUTES
].func
)
1435 (hstmt
, icol
, fDescType
, rgbDesc
, cbDescMax
, pcbDesc
, pfDesc
);
1439 /*************************************************************************
1440 * SQLColumnPrivileges [ODBC32.056]
1442 SQLRETURNTYPE
SQLColumnPrivileges(
1444 SQLCHAR
*szCatalogName
,
1445 SQLSMALLINT cbCatalogName
,
1446 SQLCHAR
*szSchemaName
,
1447 SQLSMALLINT cbSchemaName
,
1448 SQLCHAR
*szTableName
,
1449 SQLSMALLINT cbTableName
,
1450 SQLCHAR
*szColumnName
,
1451 SQLSMALLINT cbColumnName
)
1454 if (gProxyHandle
.dmHandle
== NULL
)
1459 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLCOLUMNPRIVILEGES
].func
)
1460 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1461 szTableName
, cbTableName
, szColumnName
, cbColumnName
);
1465 /*************************************************************************
1466 * SQLDescribeParam [ODBC32.058]
1468 SQLRETURNTYPE
SQLDescribeParam(
1471 SQLSMALLINT
*pfSqlType
,
1472 SQLUINTEGER
*pcbParamDef
,
1473 SQLSMALLINT
*pibScale
,
1474 SQLSMALLINT
*pfNullable
)
1477 if (gProxyHandle
.dmHandle
== NULL
)
1482 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDESCRIBEPARAM
].func
)
1483 (hstmt
, ipar
, pfSqlType
, pcbParamDef
, pibScale
, pfNullable
);
1487 /*************************************************************************
1488 * SQLExtendedFetch [ODBC32.059]
1490 SQLRETURNTYPE
SQLExtendedFetch(
1492 SQLUSMALLINT fFetchType
,
1495 SQLUSMALLINT
*rgfRowStatus
)
1498 if (gProxyHandle
.dmHandle
== NULL
)
1503 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLEXTENDEDFETCH
].func
)
1504 (hstmt
, fFetchType
, irow
, pcrow
, rgfRowStatus
);
1508 /*************************************************************************
1509 * SQLForeignKeys [ODBC32.060]
1511 SQLRETURNTYPE
SQLForeignKeys(
1513 SQLCHAR
*szPkCatalogName
,
1514 SQLSMALLINT cbPkCatalogName
,
1515 SQLCHAR
*szPkSchemaName
,
1516 SQLSMALLINT cbPkSchemaName
,
1517 SQLCHAR
*szPkTableName
,
1518 SQLSMALLINT cbPkTableName
,
1519 SQLCHAR
*szFkCatalogName
,
1520 SQLSMALLINT cbFkCatalogName
,
1521 SQLCHAR
*szFkSchemaName
,
1522 SQLSMALLINT cbFkSchemaName
,
1523 SQLCHAR
*szFkTableName
,
1524 SQLSMALLINT cbFkTableName
)
1527 if (gProxyHandle
.dmHandle
== NULL
)
1532 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLFOREIGNKEYS
].func
)
1533 (hstmt
, szPkCatalogName
, cbPkCatalogName
, szPkSchemaName
, cbPkSchemaName
,
1534 szPkTableName
, cbPkTableName
, szFkCatalogName
, cbFkCatalogName
, szFkSchemaName
,
1535 cbFkSchemaName
, szFkTableName
, cbFkTableName
);
1539 /*************************************************************************
1540 * SQLMoreResults [ODBC32.061]
1542 SQLRETURNTYPE
SQLMoreResults(SQLHSTMT hstmt
)
1545 if (gProxyHandle
.dmHandle
== NULL
)
1550 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLMORERESULTS
].func
) (hstmt
);
1554 /*************************************************************************
1555 * SQLNativeSql [ODBC32.062]
1557 SQLRETURNTYPE
SQLNativeSql(
1559 SQLCHAR
*szSqlStrIn
,
1560 SQLINTEGER cbSqlStrIn
,
1562 SQLINTEGER cbSqlStrMax
,
1563 SQLINTEGER
*pcbSqlStr
)
1566 if (gProxyHandle
.dmHandle
== NULL
)
1571 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNATIVESQL
].func
)
1572 (hdbc
, szSqlStrIn
, cbSqlStrIn
, szSqlStr
, cbSqlStrMax
, pcbSqlStr
);
1576 /*************************************************************************
1577 * SQLNumParams [ODBC32.063]
1579 SQLRETURNTYPE
SQLNumParams(
1584 if (gProxyHandle
.dmHandle
== NULL
)
1589 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLNUMPARAMS
].func
) (hstmt
, pcpar
);
1593 /*************************************************************************
1594 * SQLParamOptions [ODBC32.064]
1596 SQLRETURNTYPE
SQLParamOptions(
1602 if (gProxyHandle
.dmHandle
== NULL
)
1607 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPARAMOPTIONS
].func
) (hstmt
, crow
, pirow
);
1611 /*************************************************************************
1612 * SQLPrimaryKeys [ODBC32.065]
1614 SQLRETURNTYPE
SQLPrimaryKeys(
1616 SQLCHAR
*szCatalogName
,
1617 SQLSMALLINT cbCatalogName
,
1618 SQLCHAR
*szSchemaName
,
1619 SQLSMALLINT cbSchemaName
,
1620 SQLCHAR
*szTableName
,
1621 SQLSMALLINT cbTableName
)
1624 if (gProxyHandle
.dmHandle
== NULL
)
1629 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPRIMARYKEYS
].func
)
1630 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1631 szTableName
, cbTableName
);
1635 /*************************************************************************
1636 * SQLProcedureColumns [ODBC32.066]
1638 SQLRETURNTYPE
SQLProcedureColumns(
1640 SQLCHAR
*szCatalogName
,
1641 SQLSMALLINT cbCatalogName
,
1642 SQLCHAR
*szSchemaName
,
1643 SQLSMALLINT cbSchemaName
,
1644 SQLCHAR
*szProcName
,
1645 SQLSMALLINT cbProcName
,
1646 SQLCHAR
*szColumnName
,
1647 SQLSMALLINT cbColumnName
)
1650 if (gProxyHandle
.dmHandle
== NULL
)
1655 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURECOLUMNS
].func
)
1656 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1657 szProcName
, cbProcName
, szColumnName
, cbColumnName
);
1661 /*************************************************************************
1662 * SQLProcedures [ODBC32.067]
1664 SQLRETURNTYPE
SQLProcedures(
1666 SQLCHAR
*szCatalogName
,
1667 SQLSMALLINT cbCatalogName
,
1668 SQLCHAR
*szSchemaName
,
1669 SQLSMALLINT cbSchemaName
,
1670 SQLCHAR
*szProcName
,
1671 SQLSMALLINT cbProcName
)
1674 if (gProxyHandle
.dmHandle
== NULL
)
1679 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLPROCEDURES
].func
)
1680 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1681 szProcName
, cbProcName
);
1685 /*************************************************************************
1686 * SQLSetPos [ODBC32.068]
1688 SQLRETURNTYPE
SQLSetPos(
1691 SQLUSMALLINT fOption
,
1695 if (gProxyHandle
.dmHandle
== NULL
)
1700 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETPOS
].func
)
1701 (hstmt
, irow
, fOption
, fLock
);
1705 /*************************************************************************
1706 * SQLTablePrivileges [ODBC32.070]
1708 SQLRETURNTYPE
SQLTablePrivileges(
1710 SQLCHAR
*szCatalogName
,
1711 SQLSMALLINT cbCatalogName
,
1712 SQLCHAR
*szSchemaName
,
1713 SQLSMALLINT cbSchemaName
,
1714 SQLCHAR
*szTableName
,
1715 SQLSMALLINT cbTableName
)
1718 if (gProxyHandle
.dmHandle
== NULL
)
1723 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLTABLEPRIVILEGES
].func
)
1724 (hstmt
, szCatalogName
, cbCatalogName
, szSchemaName
, cbSchemaName
,
1725 szTableName
, cbTableName
);
1729 /*************************************************************************
1730 * SQLDrivers [ODBC32.071]
1732 SQLRETURNTYPE
SQLDrivers(
1734 SQLUSMALLINT fDirection
,
1735 SQLCHAR
*szDriverDesc
,
1736 SQLSMALLINT cbDriverDescMax
,
1737 SQLSMALLINT
*pcbDriverDesc
,
1738 SQLCHAR
*szDriverAttributes
,
1739 SQLSMALLINT cbDriverAttrMax
,
1740 SQLSMALLINT
*pcbDriverAttr
)
1743 if (gProxyHandle
.dmHandle
== NULL
)
1748 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERS
].func
)
1749 (henv
, fDirection
, szDriverDesc
, cbDriverDescMax
, pcbDriverDesc
,
1750 szDriverAttributes
, cbDriverAttrMax
, pcbDriverAttr
);
1754 /*************************************************************************
1755 * SQLBindParameter [ODBC32.072]
1757 SQLRETURNTYPE
SQLBindParameter(
1760 SQLSMALLINT fParamType
,
1762 SQLSMALLINT fSqlType
,
1763 SQLUINTEGER cbColDef
,
1764 SQLSMALLINT ibScale
,
1765 SQLPOINTER rgbValue
,
1766 SQLINTEGER cbValueMax
,
1767 SQLINTEGER
*pcbValue
)
1770 if (gProxyHandle
.dmHandle
== NULL
)
1775 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLBINDPARAMETER
].func
)
1776 (hstmt
, ipar
, fParamType
, fCType
, fSqlType
, cbColDef
, ibScale
,
1777 rgbValue
, cbValueMax
, pcbValue
);
1781 /*************************************************************************
1782 * SQLDriverConnect [ODBC32.041]
1784 SQLRETURNTYPE
SQLDriverConnect(
1787 SQLCHAR
*conn_str_in
,
1788 SQLSMALLINT len_conn_str_in
,
1789 SQLCHAR
*conn_str_out
,
1790 SQLSMALLINT conn_str_out_max
,
1791 SQLSMALLINT
*ptr_conn_str_out
,
1792 SQLUSMALLINT driver_completion
)
1795 if (gProxyHandle
.dmHandle
== NULL
)
1800 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLDRIVERCONNECT
].func
)
1801 (hdbc
, hwnd
, conn_str_in
, len_conn_str_in
, conn_str_out
,
1802 conn_str_out_max
, ptr_conn_str_out
, driver_completion
);
1806 /*************************************************************************
1807 * SQLSetScrollOptions [ODBC32.069]
1809 SQLRETURNTYPE
SQLSetScrollOptions(
1810 SQLHSTMT statement_handle
,
1811 SQLUSMALLINT f_concurrency
,
1812 SQLINTEGER crow_keyset
,
1813 SQLUSMALLINT crow_rowset
)
1816 if (gProxyHandle
.dmHandle
== NULL
)
1821 return (gProxyHandle
.functions
[SQLAPI_INDEX_SQLSETSCROLLOPTIONS
].func
)
1822 (statement_handle
, f_concurrency
, crow_keyset
, crow_rowset
);