4 * Copyright 1999 Xiang Li, Corel Corporation
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * Proxy ODBC driver manager. This manager delegates all ODBC
22 * calls to a real ODBC driver manager named by the environment
23 * variable LIB_ODBC_DRIVER_MANAGER, or to libodbc.so if the
24 * variable is not set.
35 #include <sys/types.h>
39 #define WIN32_NO_STATUS
43 #include "wine/debug.h"
49 #include "wine/debug.h"
51 WINE_DECLARE_DEBUG_CHANNEL(winediag
);
55 static SQLRETURN (*pSQLAllocConnect
)(SQLHENV
,SQLHDBC
*);
56 static SQLRETURN (*pSQLAllocEnv
)(SQLHENV
*);
57 static SQLRETURN (*pSQLAllocHandle
)(SQLSMALLINT
,SQLHANDLE
,SQLHANDLE
*);
58 static SQLRETURN (*pSQLAllocHandleStd
)(SQLSMALLINT
,SQLHANDLE
,SQLHANDLE
*);
59 static SQLRETURN (*pSQLAllocStmt
)(SQLHDBC
,SQLHSTMT
*);
60 static SQLRETURN (*pSQLBindCol
)(SQLHSTMT
,SQLUSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLLEN
,SQLLEN
*);
61 static SQLRETURN (*pSQLBindParam
)(SQLHSTMT
,SQLUSMALLINT
,SQLSMALLINT
,SQLSMALLINT
,SQLULEN
,SQLSMALLINT
,SQLPOINTER
,SQLLEN
*);
62 static SQLRETURN (*pSQLBindParameter
)(SQLHSTMT
,SQLUSMALLINT
,SQLSMALLINT
,SQLSMALLINT
,SQLSMALLINT
,SQLULEN
,SQLSMALLINT
,SQLPOINTER
,SQLLEN
,SQLLEN
*);
63 static SQLRETURN (*pSQLBrowseConnect
)(SQLHDBC
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
64 static SQLRETURN (*pSQLBrowseConnectW
)(SQLHDBC
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
65 static SQLRETURN (*pSQLBulkOperations
)(SQLHSTMT
,SQLSMALLINT
);
66 static SQLRETURN (*pSQLCancel
)(SQLHSTMT
);
67 static SQLRETURN (*pSQLCloseCursor
)(SQLHSTMT
);
68 static SQLRETURN (*pSQLColAttribute
)(SQLHSTMT
,SQLUSMALLINT
,SQLUSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*,SQLLEN
*);
69 static SQLRETURN (*pSQLColAttributeW
)(SQLHSTMT
,SQLUSMALLINT
,SQLUSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*,SQLLEN
*);
70 static SQLRETURN (*pSQLColAttributes
)(SQLHSTMT
,SQLUSMALLINT
,SQLUSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*,SQLLEN
*);
71 static SQLRETURN (*pSQLColAttributesW
)(SQLHSTMT
,SQLUSMALLINT
,SQLUSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*,SQLLEN
*);
72 static SQLRETURN (*pSQLColumnPrivileges
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
73 static SQLRETURN (*pSQLColumnPrivilegesW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
74 static SQLRETURN (*pSQLColumns
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
75 static SQLRETURN (*pSQLColumnsW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
76 static SQLRETURN (*pSQLConnect
)(SQLHDBC
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
77 static SQLRETURN (*pSQLConnectW
)(SQLHDBC
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
78 static SQLRETURN (*pSQLCopyDesc
)(SQLHDESC
,SQLHDESC
);
79 static SQLRETURN (*pSQLDataSources
)(SQLHENV
,SQLUSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
80 static SQLRETURN (*pSQLDataSourcesA
)(SQLHENV
,SQLUSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
81 static SQLRETURN (*pSQLDataSourcesW
)(SQLHENV
,SQLUSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
82 static SQLRETURN (*pSQLDescribeCol
)(SQLHSTMT
,SQLUSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLSMALLINT
*,SQLULEN
*,SQLSMALLINT
*,SQLSMALLINT
*);
83 static SQLRETURN (*pSQLDescribeColW
)(SQLHSTMT
,SQLUSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLSMALLINT
*,SQLULEN
*,SQLSMALLINT
*,SQLSMALLINT
*);
84 static SQLRETURN (*pSQLDescribeParam
)(SQLHSTMT
,SQLUSMALLINT
,SQLSMALLINT
*,SQLULEN
*,SQLSMALLINT
*,SQLSMALLINT
*);
85 static SQLRETURN (*pSQLDisconnect
)(SQLHDBC
);
86 static SQLRETURN (*pSQLDriverConnect
)(SQLHDBC
,SQLHWND
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLUSMALLINT
);
87 static SQLRETURN (*pSQLDriverConnectW
)(SQLHDBC
,SQLHWND
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLUSMALLINT
);
88 static SQLRETURN (*pSQLDrivers
)(SQLHENV
,SQLUSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
89 static SQLRETURN (*pSQLDriversW
)(SQLHENV
,SQLUSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
90 static SQLRETURN (*pSQLEndTran
)(SQLSMALLINT
,SQLHANDLE
,SQLSMALLINT
);
91 static SQLRETURN (*pSQLError
)(SQLHENV
,SQLHDBC
,SQLHSTMT
,SQLCHAR
*,SQLINTEGER
*,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
92 static SQLRETURN (*pSQLErrorW
)(SQLHENV
,SQLHDBC
,SQLHSTMT
,SQLWCHAR
*,SQLINTEGER
*,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
93 static SQLRETURN (*pSQLExecDirect
)(SQLHSTMT
,SQLCHAR
*,SQLINTEGER
);
94 static SQLRETURN (*pSQLExecDirectW
)(SQLHSTMT
,SQLWCHAR
*,SQLINTEGER
);
95 static SQLRETURN (*pSQLExecute
)(SQLHSTMT
);
96 static SQLRETURN (*pSQLExtendedFetch
)(SQLHSTMT
,SQLUSMALLINT
,SQLLEN
,SQLULEN
*,SQLUSMALLINT
*);
97 static SQLRETURN (*pSQLFetch
)(SQLHSTMT
);
98 static SQLRETURN (*pSQLFetchScroll
)(SQLHSTMT
,SQLSMALLINT
,SQLLEN
);
99 static SQLRETURN (*pSQLForeignKeys
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
100 static SQLRETURN (*pSQLForeignKeysW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
101 static SQLRETURN (*pSQLFreeConnect
)(SQLHDBC
);
102 static SQLRETURN (*pSQLFreeEnv
)(SQLHENV
);
103 static SQLRETURN (*pSQLFreeHandle
)(SQLSMALLINT
,SQLHANDLE
);
104 static SQLRETURN (*pSQLFreeStmt
)(SQLHSTMT
,SQLUSMALLINT
);
105 static SQLRETURN (*pSQLGetConnectAttr
)(SQLHDBC
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
,SQLINTEGER
*);
106 static SQLRETURN (*pSQLGetConnectAttrW
)(SQLHDBC
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
,SQLINTEGER
*);
107 static SQLRETURN (*pSQLGetConnectOption
)(SQLHDBC
,SQLUSMALLINT
,SQLPOINTER
);
108 static SQLRETURN (*pSQLGetConnectOptionW
)(SQLHDBC
,SQLUSMALLINT
,SQLPOINTER
);
109 static SQLRETURN (*pSQLGetCursorName
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
110 static SQLRETURN (*pSQLGetCursorNameW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
111 static SQLRETURN (*pSQLGetData
)(SQLHSTMT
,SQLUSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLLEN
,SQLLEN
*);
112 static SQLRETURN (*pSQLGetDescField
)(SQLHDESC
,SQLSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLINTEGER
,SQLINTEGER
*);
113 static SQLRETURN (*pSQLGetDescFieldW
)(SQLHDESC
,SQLSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLINTEGER
,SQLINTEGER
*);
114 static SQLRETURN (*pSQLGetDescRec
)(SQLHDESC
,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLSMALLINT
*,SQLSMALLINT
*,SQLLEN
*,SQLSMALLINT
*,SQLSMALLINT
*,SQLSMALLINT
*);
115 static SQLRETURN (*pSQLGetDescRecW
)(SQLHDESC
,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*,SQLSMALLINT
*,SQLSMALLINT
*,SQLLEN
*,SQLSMALLINT
*,SQLSMALLINT
*,SQLSMALLINT
*);
116 static SQLRETURN (*pSQLGetDiagField
)(SQLSMALLINT
,SQLHANDLE
,SQLSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*);
117 static SQLRETURN (*pSQLGetDiagFieldW
)(SQLSMALLINT
,SQLHANDLE
,SQLSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*);
118 static SQLRETURN (*pSQLGetDiagRec
)(SQLSMALLINT
,SQLHANDLE
,SQLSMALLINT
,SQLCHAR
*,SQLINTEGER
*,SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
119 static SQLRETURN (*pSQLGetDiagRecA
)(SQLSMALLINT
,SQLHANDLE
,SQLSMALLINT
,SQLCHAR
*,SQLINTEGER
*, SQLCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
120 static SQLRETURN (*pSQLGetDiagRecW
)(SQLSMALLINT
,SQLHANDLE
,SQLSMALLINT
,SQLWCHAR
*,SQLINTEGER
*,SQLWCHAR
*,SQLSMALLINT
,SQLSMALLINT
*);
121 static SQLRETURN (*pSQLGetEnvAttr
)(SQLHENV
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
,SQLINTEGER
*);
122 static SQLRETURN (*pSQLGetFunctions
)(SQLHDBC
,SQLUSMALLINT
,SQLUSMALLINT
*);
123 static SQLRETURN (*pSQLGetInfo
)(SQLHDBC
,SQLUSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*);
124 static SQLRETURN (*pSQLGetInfoW
)(SQLHDBC
,SQLUSMALLINT
,SQLPOINTER
,SQLSMALLINT
,SQLSMALLINT
*);
125 static SQLRETURN (*pSQLGetStmtAttr
)(SQLHSTMT
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
,SQLINTEGER
*);
126 static SQLRETURN (*pSQLGetStmtAttrW
)(SQLHSTMT
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
,SQLINTEGER
*);
127 static SQLRETURN (*pSQLGetStmtOption
)(SQLHSTMT
,SQLUSMALLINT
,SQLPOINTER
);
128 static SQLRETURN (*pSQLGetTypeInfo
)(SQLHSTMT
,SQLSMALLINT
);
129 static SQLRETURN (*pSQLGetTypeInfoW
)(SQLHSTMT
,SQLSMALLINT
);
130 static SQLRETURN (*pSQLMoreResults
)(SQLHSTMT
);
131 static SQLRETURN (*pSQLNativeSql
)(SQLHDBC
,SQLCHAR
*,SQLINTEGER
,SQLCHAR
*,SQLINTEGER
,SQLINTEGER
*);
132 static SQLRETURN (*pSQLNativeSqlW
)(SQLHDBC
,SQLWCHAR
*,SQLINTEGER
,SQLWCHAR
*,SQLINTEGER
,SQLINTEGER
*);
133 static SQLRETURN (*pSQLNumParams
)(SQLHSTMT
,SQLSMALLINT
*);
134 static SQLRETURN (*pSQLNumResultCols
)(SQLHSTMT
,SQLSMALLINT
*);
135 static SQLRETURN (*pSQLParamData
)(SQLHSTMT
,SQLPOINTER
*);
136 static SQLRETURN (*pSQLParamOptions
)(SQLHSTMT
,SQLULEN
,SQLULEN
*);
137 static SQLRETURN (*pSQLPrepare
)(SQLHSTMT
,SQLCHAR
*,SQLINTEGER
);
138 static SQLRETURN (*pSQLPrepareW
)(SQLHSTMT
,SQLWCHAR
*,SQLINTEGER
);
139 static SQLRETURN (*pSQLPrimaryKeys
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
140 static SQLRETURN (*pSQLPrimaryKeysW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
141 static SQLRETURN (*pSQLProcedureColumns
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
142 static SQLRETURN (*pSQLProcedureColumnsW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
143 static SQLRETURN (*pSQLProcedures
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
144 static SQLRETURN (*pSQLProceduresW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
145 static SQLRETURN (*pSQLPutData
)(SQLHSTMT
,SQLPOINTER
,SQLLEN
);
146 static SQLRETURN (*pSQLRowCount
)(SQLHSTMT
,SQLLEN
*);
147 static SQLRETURN (*pSQLSetConnectAttr
)(SQLHDBC
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
);
148 static SQLRETURN (*pSQLSetConnectAttrW
)(SQLHDBC
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
);
149 static SQLRETURN (*pSQLSetConnectOption
)(SQLHDBC
,SQLUSMALLINT
,SQLULEN
);
150 static SQLRETURN (*pSQLSetConnectOptionW
)(SQLHDBC
,SQLUSMALLINT
,SQLULEN
);
151 static SQLRETURN (*pSQLSetCursorName
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
);
152 static SQLRETURN (*pSQLSetCursorNameW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
);
153 static SQLRETURN (*pSQLSetDescField
)(SQLHDESC
,SQLSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLINTEGER
);
154 static SQLRETURN (*pSQLSetDescFieldW
)(SQLHDESC
,SQLSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLINTEGER
);
155 static SQLRETURN (*pSQLSetDescRec
)(SQLHDESC
,SQLSMALLINT
,SQLSMALLINT
,SQLSMALLINT
,SQLLEN
,SQLSMALLINT
,SQLSMALLINT
,SQLPOINTER
,SQLLEN
*,SQLLEN
*);
156 static SQLRETURN (*pSQLSetEnvAttr
)(SQLHENV
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
);
157 static SQLRETURN (*pSQLSetParam
)(SQLHSTMT
,SQLUSMALLINT
,SQLSMALLINT
,SQLSMALLINT
,SQLULEN
,SQLSMALLINT
,SQLPOINTER
,SQLLEN
*);
158 static SQLRETURN (*pSQLSetPos
)(SQLHSTMT
,SQLSETPOSIROW
,SQLUSMALLINT
,SQLUSMALLINT
);
159 static SQLRETURN (*pSQLSetScrollOptions
)(SQLHSTMT
,SQLUSMALLINT
,SQLLEN
,SQLUSMALLINT
);
160 static SQLRETURN (*pSQLSetStmtAttr
)(SQLHSTMT
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
);
161 static SQLRETURN (*pSQLSetStmtAttrW
)(SQLHSTMT
,SQLINTEGER
,SQLPOINTER
,SQLINTEGER
);
162 static SQLRETURN (*pSQLSetStmtOption
)(SQLHSTMT
,SQLUSMALLINT
,SQLULEN
);
163 static SQLRETURN (*pSQLSpecialColumns
)(SQLHSTMT
,SQLUSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLUSMALLINT
,SQLUSMALLINT
);
164 static SQLRETURN (*pSQLSpecialColumnsW
)(SQLHSTMT
,SQLUSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLUSMALLINT
,SQLUSMALLINT
);
165 static SQLRETURN (*pSQLStatistics
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLUSMALLINT
,SQLUSMALLINT
);
166 static SQLRETURN (*pSQLStatisticsW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLUSMALLINT
,SQLUSMALLINT
);
167 static SQLRETURN (*pSQLTablePrivileges
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
168 static SQLRETURN (*pSQLTablePrivilegesW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
169 static SQLRETURN (*pSQLTables
)(SQLHSTMT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
,SQLCHAR
*,SQLSMALLINT
);
170 static SQLRETURN (*pSQLTablesW
)(SQLHSTMT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
,SQLWCHAR
*,SQLSMALLINT
);
171 static SQLRETURN (*pSQLTransact
)(SQLHENV
,SQLHDBC
,SQLUSMALLINT
);
174 static NTSTATUS
load_odbc(void);
176 static NTSTATUS
odbc_process_attach( void *args
)
178 if (!load_odbc()) return STATUS_DLL_NOT_FOUND
;
179 return STATUS_SUCCESS
;
182 static NTSTATUS
odbc_process_detach( void *args
)
184 if (libodbc
) dlclose( libodbc
);
186 return STATUS_SUCCESS
;
189 static NTSTATUS
wrap_SQLAllocConnect( void *args
)
191 struct SQLAllocConnect_params
*params
= args
;
193 return pSQLAllocConnect(params
->EnvironmentHandle
, params
->ConnectionHandle
);
196 static NTSTATUS
wrap_SQLAllocEnv( void *args
)
198 struct SQLAllocEnv_params
*params
= args
;
200 return pSQLAllocEnv(params
->EnvironmentHandle
);
203 static NTSTATUS
wrap_SQLAllocHandle( void *args
)
205 struct SQLAllocHandle_params
*params
= args
;
207 return pSQLAllocHandle(params
->HandleType
, params
->InputHandle
, params
->OutputHandle
);
210 static NTSTATUS
wrap_SQLAllocHandleStd( void *args
)
212 struct SQLAllocHandleStd_params
*params
= args
;
214 return pSQLAllocHandleStd(params
->HandleType
, params
->InputHandle
, params
->OutputHandle
);
217 static NTSTATUS
wrap_SQLAllocStmt( void *args
)
219 struct SQLAllocStmt_params
*params
= args
;
221 return pSQLAllocStmt(params
->ConnectionHandle
, params
->StatementHandle
);
224 static NTSTATUS
wrap_SQLBindCol( void *args
)
226 struct SQLBindCol_params
*params
= args
;
228 return pSQLBindCol(params
->StatementHandle
, params
->ColumnNumber
, params
->TargetType
,
229 params
->TargetValue
, params
->BufferLength
, params
->StrLen_or_Ind
);
232 static NTSTATUS
wrap_SQLBindParam( void *args
)
234 struct SQLBindParam_params
*params
= args
;
236 return pSQLBindParam(params
->StatementHandle
, params
->ParameterNumber
, params
->ValueType
,
237 params
->ParameterType
, params
->LengthPrecision
, params
->ParameterScale
,
238 params
->ParameterValue
, params
->StrLen_or_Ind
);
241 static NTSTATUS
wrap_SQLBindParameter( void *args
)
243 struct SQLBindParameter_params
*params
= args
;
245 return pSQLBindParameter(params
->hstmt
, params
->ipar
, params
->fParamType
, params
->fCType
,
246 params
->fSqlType
, params
->cbColDef
, params
->ibScale
, params
->rgbValue
,
247 params
->cbValueMax
, params
->pcbValue
);
250 static NTSTATUS
wrap_SQLBrowseConnect( void *args
)
252 struct SQLBrowseConnect_params
*params
= args
;
254 return pSQLBrowseConnect(params
->hdbc
, params
->szConnStrIn
, params
->cbConnStrIn
, params
->szConnStrOut
,
255 params
->cbConnStrOutMax
, params
->pcbConnStrOut
);
258 static NTSTATUS
wrap_SQLBrowseConnectW( void *args
)
260 struct SQLBrowseConnectW_params
*params
= args
;
262 return pSQLBrowseConnectW(params
->hdbc
, params
->szConnStrIn
, params
->cbConnStrIn
, params
->szConnStrOut
,
263 params
->cbConnStrOutMax
, params
->pcbConnStrOut
);
266 static NTSTATUS
wrap_SQLBulkOperations( void *args
)
268 struct SQLBulkOperations_params
*params
= args
;
270 return pSQLBulkOperations(params
->StatementHandle
, params
->Operation
);
273 static NTSTATUS
wrap_SQLCancel( void *args
)
275 struct SQLCancel_params
*params
= args
;
277 return pSQLCancel(params
->StatementHandle
);
280 static NTSTATUS
wrap_SQLCloseCursor( void *args
)
282 struct SQLCloseCursor_params
*params
= args
;
284 return pSQLCloseCursor(params
->StatementHandle
);
287 static NTSTATUS
wrap_SQLColAttribute( void *args
)
289 struct SQLColAttribute_params
*params
= args
;
291 return pSQLColAttribute(params
->StatementHandle
, params
->ColumnNumber
, params
->FieldIdentifier
,
292 params
->CharacterAttribute
, params
->BufferLength
, params
->StringLength
,
293 params
->NumericAttribute
);
296 static NTSTATUS
wrap_SQLColAttributeW( void *args
)
298 struct SQLColAttributeW_params
*params
= args
;
300 return pSQLColAttributeW(params
->StatementHandle
, params
->ColumnNumber
, params
->FieldIdentifier
,
301 params
->CharacterAttribute
, params
->BufferLength
, params
->StringLength
,
302 params
->NumericAttribute
);
305 static NTSTATUS
wrap_SQLColAttributes( void *args
)
307 struct SQLColAttributes_params
*params
= args
;
309 return pSQLColAttributes(params
->hstmt
, params
->icol
, params
->fDescType
, params
->rgbDesc
,
310 params
->cbDescMax
, params
->pcbDesc
, params
->pfDesc
);
313 static NTSTATUS
wrap_SQLColAttributesW( void *args
)
315 struct SQLColAttributesW_params
*params
= args
;
317 return pSQLColAttributesW(params
->hstmt
, params
->icol
, params
->fDescType
, params
->rgbDesc
,
318 params
->cbDescMax
, params
->pcbDesc
, params
->pfDesc
);
321 static NTSTATUS
wrap_SQLColumnPrivileges( void *args
)
323 struct SQLColumnPrivileges_params
*params
= args
;
325 return pSQLColumnPrivileges(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
326 params
->szSchemaName
, params
->cbSchemaName
, params
->szTableName
,
327 params
->cbTableName
, params
->szColumnName
, params
->cbColumnName
);
330 static NTSTATUS
wrap_SQLColumnPrivilegesW( void *args
)
332 struct SQLColumnPrivilegesW_params
*params
= args
;
334 return pSQLColumnPrivilegesW(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
335 params
->szSchemaName
, params
->cbSchemaName
, params
->szTableName
,
336 params
->cbTableName
, params
->szColumnName
, params
->cbColumnName
);
339 static NTSTATUS
wrap_SQLColumns( void *args
)
341 struct SQLColumns_params
*params
= args
;
343 return pSQLColumns(params
->StatementHandle
, params
->CatalogName
, params
->NameLength1
,
344 params
->SchemaName
, params
->NameLength2
, params
->TableName
, params
->NameLength3
,
345 params
->ColumnName
, params
->NameLength4
);
348 static NTSTATUS
wrap_SQLColumnsW( void *args
)
350 struct SQLColumnsW_params
*params
= args
;
352 return pSQLColumnsW(params
->StatementHandle
, params
->CatalogName
, params
->NameLength1
,
353 params
->SchemaName
, params
->NameLength2
, params
->TableName
, params
->NameLength3
,
354 params
->ColumnName
, params
->NameLength4
);
357 static NTSTATUS
wrap_SQLConnect( void *args
)
359 struct SQLConnect_params
*params
= args
;
361 return pSQLConnect(params
->ConnectionHandle
, params
->ServerName
, params
->NameLength1
, params
->UserName
,
362 params
->NameLength2
, params
->Authentication
, params
->NameLength3
);
365 static NTSTATUS
wrap_SQLConnectW( void *args
)
367 struct SQLConnectW_params
*params
= args
;
369 return pSQLConnectW(params
->ConnectionHandle
, params
->ServerName
, params
->NameLength1
,
370 params
->UserName
, params
->NameLength2
, params
->Authentication
, params
->NameLength3
);
373 static NTSTATUS
wrap_SQLCopyDesc( void *args
)
375 struct SQLCopyDesc_params
*params
= args
;
377 return pSQLCopyDesc(params
->SourceDescHandle
, params
->TargetDescHandle
);
380 static NTSTATUS
wrap_SQLDataSources( void *args
)
382 struct SQLDataSources_params
*params
= args
;
384 return pSQLDataSources(params
->EnvironmentHandle
, params
->Direction
, params
->ServerName
,
385 params
->BufferLength1
, params
->NameLength1
, params
->Description
,
386 params
->BufferLength2
, params
->NameLength2
);
389 static NTSTATUS
wrap_SQLDataSourcesA( void *args
)
391 struct SQLDataSourcesA_params
*params
= args
;
393 return pSQLDataSourcesA(params
->EnvironmentHandle
, params
->Direction
, params
->ServerName
,
394 params
->BufferLength1
, params
->NameLength1
, params
->Description
,
395 params
->BufferLength2
, params
->NameLength2
);
398 static NTSTATUS
wrap_SQLDataSourcesW( void *args
)
400 struct SQLDataSourcesW_params
*params
= args
;
402 return pSQLDataSourcesW(params
->EnvironmentHandle
, params
->Direction
, params
->ServerName
,
403 params
->BufferLength1
, params
->NameLength1
, params
->Description
,
404 params
->BufferLength2
, params
->NameLength2
);
407 static NTSTATUS
wrap_SQLDescribeCol( void *args
)
409 struct SQLDescribeCol_params
*params
= args
;
411 return pSQLDescribeCol(params
->StatementHandle
, params
->ColumnNumber
, params
->ColumnName
,
412 params
->BufferLength
, params
->NameLength
, params
->DataType
,
413 params
->ColumnSize
, params
->DecimalDigits
, params
->Nullable
);
416 static NTSTATUS
wrap_SQLDescribeColW( void *args
)
418 struct SQLDescribeColW_params
*params
= args
;
420 return pSQLDescribeColW(params
->StatementHandle
, params
->ColumnNumber
, params
->ColumnName
,
421 params
->BufferLength
, params
->NameLength
, params
->DataType
,
422 params
->ColumnSize
, params
->DecimalDigits
, params
->Nullable
);
425 static NTSTATUS
wrap_SQLDescribeParam( void *args
)
427 struct SQLDescribeParam_params
*params
= args
;
429 return pSQLDescribeParam(params
->hstmt
, params
->ipar
, params
->pfSqlType
, params
->pcbParamDef
,
430 params
->pibScale
, params
->pfNullable
);
433 static NTSTATUS
wrap_SQLDisconnect( void *args
)
435 struct SQLDisconnect_params
*params
= args
;
437 return pSQLDisconnect(params
->ConnectionHandle
);
440 static NTSTATUS
wrap_SQLDriverConnect( void *args
)
442 struct SQLDriverConnect_params
*params
= args
;
444 return pSQLDriverConnect(params
->hdbc
, params
->hwnd
, params
->ConnectionString
, params
->Length
,
445 params
->conn_str_out
, params
->conn_str_out_max
,
446 params
->ptr_conn_str_out
, params
->driver_completion
);
449 static NTSTATUS
wrap_SQLDriverConnectW( void *args
)
451 struct SQLDriverConnectW_params
*params
= args
;
453 return pSQLDriverConnectW(params
->ConnectionHandle
, params
->WindowHandle
, params
->InConnectionString
,
454 params
->Length
, params
->OutConnectionString
, params
->BufferLength
,
455 params
->Length2
, params
->DriverCompletion
);
458 static NTSTATUS
wrap_SQLDrivers( void *args
)
460 struct SQLDrivers_params
*params
= args
;
462 return pSQLDrivers(params
->EnvironmentHandle
, params
->fDirection
, params
->szDriverDesc
,
463 params
->cbDriverDescMax
, params
->pcbDriverDesc
, params
->szDriverAttributes
,
464 params
->cbDriverAttrMax
, params
->pcbDriverAttr
);
467 static NTSTATUS
wrap_SQLDriversW( void *args
)
469 struct SQLDriversW_params
*params
= args
;
471 return pSQLDriversW(params
->EnvironmentHandle
, params
->fDirection
, params
->szDriverDesc
,
472 params
->cbDriverDescMax
, params
->pcbDriverDesc
, params
->szDriverAttributes
,
473 params
->cbDriverAttrMax
, params
->pcbDriverAttr
);
476 static NTSTATUS
wrap_SQLEndTran( void *args
)
478 struct SQLEndTran_params
*params
= args
;
480 return pSQLEndTran(params
->HandleType
, params
->Handle
, params
->CompletionType
);
483 static NTSTATUS
wrap_SQLError( void *args
)
485 struct SQLError_params
*params
= args
;
487 return pSQLError(params
->EnvironmentHandle
, params
->ConnectionHandle
, params
->StatementHandle
,
488 params
->Sqlstate
, params
->NativeError
, params
->MessageText
,
489 params
->BufferLength
, params
->TextLength
);
492 static NTSTATUS
wrap_SQLErrorW( void *args
)
494 struct SQLErrorW_params
*params
= args
;
496 return pSQLErrorW(params
->EnvironmentHandle
, params
->ConnectionHandle
, params
->StatementHandle
,
497 params
->Sqlstate
, params
->NativeError
, params
->MessageText
,
498 params
->BufferLength
, params
->TextLength
);
501 static NTSTATUS
wrap_SQLExecDirect( void *args
)
503 struct SQLExecDirect_params
*params
= args
;
505 return pSQLExecDirect(params
->StatementHandle
, params
->StatementText
, params
->TextLength
);
508 static NTSTATUS
wrap_SQLExecDirectW( void *args
)
510 struct SQLExecDirectW_params
*params
= args
;
512 return pSQLExecDirectW(params
->StatementHandle
, params
->StatementText
, params
->TextLength
);
515 static NTSTATUS
wrap_SQLExecute( void *args
)
517 struct SQLExecute_params
*params
= args
;
519 return pSQLExecute(params
->StatementHandle
);
522 static NTSTATUS
wrap_SQLExtendedFetch( void *args
)
524 struct SQLExtendedFetch_params
*params
= args
;
526 return pSQLExtendedFetch(params
->hstmt
, params
->fFetchType
, params
->irow
,
527 params
->pcrow
, params
->rgfRowStatus
);
530 static NTSTATUS
wrap_SQLFetch( void *args
)
532 struct SQLFetch_params
*params
= args
;
534 return pSQLFetch(params
->StatementHandle
);
537 static NTSTATUS
wrap_SQLFetchScroll( void *args
)
539 struct SQLFetchScroll_params
*params
= args
;
541 return pSQLFetchScroll(params
->StatementHandle
, params
->FetchOrientation
, params
->FetchOffset
);
544 static NTSTATUS
wrap_SQLForeignKeys( void *args
)
546 struct SQLForeignKeys_params
*params
= args
;
548 return pSQLForeignKeys(params
->hstmt
, params
->szPkCatalogName
, params
->cbPkCatalogName
,
549 params
->szPkSchemaName
, params
->cbPkSchemaName
, params
->szPkTableName
,
550 params
->cbPkTableName
, params
->szFkCatalogName
, params
->cbFkCatalogName
,
551 params
->szFkSchemaName
, params
->cbFkSchemaName
, params
->szFkTableName
,
552 params
->cbFkTableName
);
555 static NTSTATUS
wrap_SQLForeignKeysW( void *args
)
557 struct SQLForeignKeysW_params
*params
= args
;
559 return pSQLForeignKeysW(params
->hstmt
, params
->szPkCatalogName
, params
->cbPkCatalogName
,
560 params
->szPkSchemaName
, params
->cbPkSchemaName
, params
->szPkTableName
,
561 params
->cbPkTableName
, params
->szFkCatalogName
, params
->cbFkCatalogName
,
562 params
->szFkSchemaName
, params
->cbFkSchemaName
, params
->szFkTableName
,
563 params
->cbFkTableName
);
566 static NTSTATUS
wrap_SQLFreeConnect( void *args
)
568 struct SQLFreeConnect_params
*params
= args
;
570 return pSQLFreeConnect(params
->ConnectionHandle
);
573 static NTSTATUS
wrap_SQLFreeEnv( void *args
)
575 struct SQLFreeEnv_params
*params
= args
;
577 return pSQLFreeEnv(params
->EnvironmentHandle
);
580 static NTSTATUS
wrap_SQLFreeHandle( void *args
)
582 struct SQLFreeHandle_params
*params
= args
;
584 return pSQLFreeHandle(params
->HandleType
, params
->Handle
);
587 static NTSTATUS
wrap_SQLFreeStmt( void *args
)
589 struct SQLFreeStmt_params
*params
= args
;
591 return pSQLFreeStmt(params
->StatementHandle
, params
->Option
);
594 static NTSTATUS
wrap_SQLGetConnectAttr( void *args
)
596 struct SQLGetConnectAttr_params
*params
= args
;
598 return pSQLGetConnectAttr(params
->ConnectionHandle
, params
->Attribute
, params
->Value
,
599 params
->BufferLength
, params
->StringLength
);
602 static NTSTATUS
wrap_SQLGetConnectAttrW( void *args
)
604 struct SQLGetConnectAttrW_params
*params
= args
;
606 return pSQLGetConnectAttrW(params
->ConnectionHandle
, params
->Attribute
, params
->Value
,
607 params
->BufferLength
, params
->StringLength
);
610 static NTSTATUS
wrap_SQLGetConnectOption( void *args
)
612 struct SQLGetConnectOption_params
*params
= args
;
614 return pSQLGetConnectOption(params
->ConnectionHandle
, params
->Option
, params
->Value
);
617 static NTSTATUS
wrap_SQLGetConnectOptionW( void *args
)
619 struct SQLGetConnectOptionW_params
*params
= args
;
621 return pSQLGetConnectOptionW(params
->ConnectionHandle
, params
->Option
, params
->Value
);
624 static NTSTATUS
wrap_SQLGetCursorName( void *args
)
626 struct SQLGetCursorName_params
*params
= args
;
628 return pSQLGetCursorName(params
->StatementHandle
, params
->CursorName
, params
->BufferLength
,
632 static NTSTATUS
wrap_SQLGetCursorNameW( void *args
)
634 struct SQLGetCursorNameW_params
*params
= args
;
636 return pSQLGetCursorNameW(params
->StatementHandle
, params
->CursorName
, params
->BufferLength
,
640 static NTSTATUS
wrap_SQLGetData( void *args
)
642 struct SQLGetData_params
*params
= args
;
644 return pSQLGetData(params
->StatementHandle
, params
->ColumnNumber
, params
->TargetType
,
645 params
->TargetValue
, params
->BufferLength
, params
->StrLen_or_Ind
);
648 static NTSTATUS
wrap_SQLGetDescField( void *args
)
650 struct SQLGetDescField_params
*params
= args
;
652 return pSQLGetDescField(params
->DescriptorHandle
, params
->RecNumber
, params
->FieldIdentifier
,
653 params
->Value
, params
->BufferLength
, params
->StringLength
);
656 static NTSTATUS
wrap_SQLGetDescFieldW( void *args
)
658 struct SQLGetDescFieldW_params
*params
= args
;
660 return pSQLGetDescFieldW(params
->DescriptorHandle
, params
->RecNumber
, params
->FieldIdentifier
,
661 params
->Value
, params
->BufferLength
, params
->StringLength
);
664 static NTSTATUS
wrap_SQLGetDescRec( void *args
)
666 struct SQLGetDescRec_params
*params
= args
;
668 return pSQLGetDescRec(params
->DescriptorHandle
, params
->RecNumber
, params
->Name
, params
->BufferLength
,
669 params
->StringLength
, params
->Type
, params
->SubType
, params
->Length
,
670 params
->Precision
, params
->Scale
, params
->Nullable
);
673 static NTSTATUS
wrap_SQLGetDescRecW( void *args
)
675 struct SQLGetDescRecW_params
*params
= args
;
677 return pSQLGetDescRecW(params
->DescriptorHandle
, params
->RecNumber
, params
->Name
, params
->BufferLength
,
678 params
->StringLength
, params
->Type
, params
->SubType
, params
->Length
,
679 params
->Precision
, params
->Scale
, params
->Nullable
);
682 static NTSTATUS
wrap_SQLGetDiagField( void *args
)
684 struct SQLGetDiagField_params
*params
= args
;
686 return pSQLGetDiagField(params
->HandleType
, params
->Handle
, params
->RecNumber
, params
->DiagIdentifier
,
687 params
->DiagInfo
, params
->BufferLength
, params
->StringLength
);
690 static NTSTATUS
wrap_SQLGetDiagFieldW( void *args
)
692 struct SQLGetDiagFieldW_params
*params
= args
;
694 return pSQLGetDiagFieldW(params
->HandleType
, params
->Handle
, params
->RecNumber
, params
->DiagIdentifier
,
695 params
->DiagInfo
, params
->BufferLength
, params
->StringLength
);
698 static NTSTATUS
wrap_SQLGetDiagRec( void *args
)
700 struct SQLGetDiagRec_params
*params
= args
;
702 return pSQLGetDiagRec(params
->HandleType
, params
->Handle
, params
->RecNumber
, params
->Sqlstate
,
703 params
->NativeError
, params
->MessageText
, params
->BufferLength
,
707 static NTSTATUS
wrap_SQLGetDiagRecA( void *args
)
709 struct SQLGetDiagRecA_params
*params
= args
;
711 return pSQLGetDiagRecA(params
->HandleType
, params
->Handle
, params
->RecNumber
, params
->Sqlstate
,
712 params
->NativeError
, params
->MessageText
, params
->BufferLength
,
716 static NTSTATUS
wrap_SQLGetDiagRecW( void *args
)
718 struct SQLGetDiagRecW_params
*params
= args
;
720 return pSQLGetDiagRecW(params
->HandleType
, params
->Handle
, params
->RecNumber
, params
->Sqlstate
,
721 params
->NativeError
, params
->MessageText
, params
->BufferLength
,
725 static NTSTATUS
wrap_SQLGetEnvAttr( void *args
)
727 struct SQLGetEnvAttr_params
*params
= args
;
729 return pSQLGetEnvAttr(params
->EnvironmentHandle
, params
->Attribute
, params
->Value
,
730 params
->BufferLength
, params
->StringLength
);
733 static NTSTATUS
wrap_SQLGetFunctions( void *args
)
735 struct SQLGetFunctions_params
*params
= args
;
737 return pSQLGetFunctions(params
->ConnectionHandle
, params
->FunctionId
, params
->Supported
);
740 static NTSTATUS
wrap_SQLGetInfo( void *args
)
742 struct SQLGetInfo_params
*params
= args
;
744 return pSQLGetInfo(params
->ConnectionHandle
, params
->InfoType
, params
->InfoValue
,
745 params
->BufferLength
, params
->StringLength
);
748 static NTSTATUS
wrap_SQLGetInfoW( void *args
)
750 struct SQLGetInfoW_params
*params
= args
;
752 return pSQLGetInfoW(params
->ConnectionHandle
, params
->InfoType
, params
->InfoValue
,
753 params
->BufferLength
, params
->StringLength
);
756 static NTSTATUS
wrap_SQLGetStmtAttr( void *args
)
758 struct SQLGetStmtAttr_params
*params
= args
;
760 return pSQLGetStmtAttr(params
->StatementHandle
, params
->Attribute
, params
->Value
,
761 params
->BufferLength
, params
->StringLength
);
764 static NTSTATUS
wrap_SQLGetStmtAttrW( void *args
)
766 struct SQLGetStmtAttrW_params
*params
= args
;
768 return pSQLGetStmtAttrW(params
->StatementHandle
, params
->Attribute
, params
->Value
,
769 params
->BufferLength
, params
->StringLength
);
772 static NTSTATUS
wrap_SQLGetStmtOption( void *args
)
774 struct SQLGetStmtOption_params
*params
= args
;
776 return pSQLGetStmtOption(params
->StatementHandle
, params
->Option
, params
->Value
);
779 static NTSTATUS
wrap_SQLGetTypeInfo( void *args
)
781 struct SQLGetTypeInfo_params
*params
= args
;
783 return pSQLGetTypeInfo(params
->StatementHandle
, params
->DataType
);
786 static NTSTATUS
wrap_SQLGetTypeInfoW( void *args
)
788 struct SQLGetTypeInfoW_params
*params
= args
;
790 return pSQLGetTypeInfoW(params
->StatementHandle
, params
->DataType
);
793 static NTSTATUS
wrap_SQLMoreResults( void *args
)
795 struct SQLMoreResults_params
*params
= args
;
797 return pSQLMoreResults(params
->StatementHandle
);
800 static NTSTATUS
wrap_SQLNativeSql( void *args
)
802 struct SQLNativeSql_params
*params
= args
;
804 return pSQLNativeSql(params
->hdbc
, params
->szSqlStrIn
, params
->cbSqlStrIn
, params
->szSqlStr
,
805 params
->cbSqlStrMax
, params
->pcbSqlStr
);
808 static NTSTATUS
wrap_SQLNativeSqlW( void *args
)
810 struct SQLNativeSqlW_params
*params
= args
;
812 return pSQLNativeSqlW(params
->hdbc
, params
->szSqlStrIn
, params
->cbSqlStrIn
, params
->szSqlStr
,
813 params
->cbSqlStrMax
, params
->pcbSqlStr
);
816 static NTSTATUS
wrap_SQLNumParams( void *args
)
818 struct SQLNumParams_params
*params
= args
;
820 return pSQLNumParams(params
->hstmt
, params
->pcpar
);
823 static NTSTATUS
wrap_SQLNumResultCols( void *args
)
825 struct SQLNumResultCols_params
*params
= args
;
827 return pSQLNumResultCols(params
->StatementHandle
, params
->ColumnCount
);
830 static NTSTATUS
wrap_SQLParamData( void *args
)
832 struct SQLParamData_params
*params
= args
;
834 return pSQLParamData(params
->StatementHandle
, params
->Value
);
837 static NTSTATUS
wrap_SQLParamOptions( void *args
)
839 struct SQLParamOptions_params
*params
= args
;
841 return pSQLParamOptions(params
->hstmt
, params
->crow
, params
->pirow
);
844 static NTSTATUS
wrap_SQLPrepare( void *args
)
846 struct SQLPrepare_params
*params
= args
;
848 return pSQLPrepare(params
->StatementHandle
, params
->StatementText
, params
->TextLength
);
851 static NTSTATUS
wrap_SQLPrepareW( void *args
)
853 struct SQLPrepareW_params
*params
= args
;
855 return pSQLPrepareW(params
->StatementHandle
, params
->StatementText
, params
->TextLength
);
858 static NTSTATUS
wrap_SQLPrimaryKeys( void *args
)
860 struct SQLPrimaryKeys_params
*params
= args
;
862 return pSQLPrimaryKeys(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
863 params
->szSchemaName
, params
->cbSchemaName
,
864 params
->szTableName
, params
->cbTableName
);
867 static NTSTATUS
wrap_SQLPrimaryKeysW( void *args
)
869 struct SQLPrimaryKeysW_params
*params
= args
;
871 return pSQLPrimaryKeysW(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
872 params
->szSchemaName
, params
->cbSchemaName
,
873 params
->szTableName
, params
->cbTableName
);
876 static NTSTATUS
wrap_SQLProcedureColumns( void *args
)
878 struct SQLProcedureColumns_params
*params
= args
;
880 return pSQLProcedureColumns(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
881 params
->szSchemaName
, params
->cbSchemaName
, params
->szProcName
,
882 params
->cbProcName
, params
->szColumnName
, params
->cbColumnName
);
885 static NTSTATUS
wrap_SQLProcedureColumnsW( void *args
)
887 struct SQLProcedureColumnsW_params
*params
= args
;
889 return pSQLProcedureColumnsW(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
890 params
->szSchemaName
, params
->cbSchemaName
, params
->szProcName
,
891 params
->cbProcName
, params
->szColumnName
, params
->cbColumnName
);
894 static NTSTATUS
wrap_SQLProcedures( void *args
)
896 struct SQLProcedures_params
*params
= args
;
898 return pSQLProcedures(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
899 params
->szSchemaName
, params
->cbSchemaName
, params
->szProcName
,
903 static NTSTATUS
wrap_SQLProceduresW( void *args
)
905 struct SQLProceduresW_params
*params
= args
;
907 return pSQLProceduresW(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
908 params
->szSchemaName
, params
->cbSchemaName
, params
->szProcName
,
912 static NTSTATUS
wrap_SQLPutData( void *args
)
914 struct SQLPutData_params
*params
= args
;
916 return pSQLPutData(params
->StatementHandle
, params
->Data
, params
->StrLen_or_Ind
);
919 static NTSTATUS
wrap_SQLRowCount( void *args
)
921 struct SQLRowCount_params
*params
= args
;
923 return pSQLRowCount(params
->StatementHandle
, params
->RowCount
);
926 static NTSTATUS
wrap_SQLSetConnectAttr( void *args
)
928 struct SQLSetConnectAttr_params
*params
= args
;
930 return pSQLSetConnectAttr(params
->ConnectionHandle
, params
->Attribute
, params
->Value
,
931 params
->StringLength
);
934 static NTSTATUS
wrap_SQLSetConnectAttrW( void *args
)
936 struct SQLSetConnectAttrW_params
*params
= args
;
938 return pSQLSetConnectAttrW(params
->ConnectionHandle
, params
->Attribute
, params
->Value
,
939 params
->StringLength
);
942 static NTSTATUS
wrap_SQLSetConnectOption( void *args
)
944 struct SQLSetConnectOption_params
*params
= args
;
946 return pSQLSetConnectOption(params
->ConnectionHandle
, params
->Option
, params
->Value
);
949 static NTSTATUS
wrap_SQLSetConnectOptionW( void *args
)
951 struct SQLSetConnectOptionW_params
*params
= args
;
953 return pSQLSetConnectOptionW(params
->ConnectionHandle
, params
->Option
, params
->Value
);
956 static NTSTATUS
wrap_SQLSetCursorName( void *args
)
958 struct SQLSetCursorName_params
*params
= args
;
960 return pSQLSetCursorName(params
->StatementHandle
, params
->CursorName
, params
->NameLength
);
963 static NTSTATUS
wrap_SQLSetCursorNameW( void *args
)
965 struct SQLSetCursorNameW_params
*params
= args
;
967 return pSQLSetCursorNameW(params
->StatementHandle
, params
->CursorName
, params
->NameLength
);
970 static NTSTATUS
wrap_SQLSetDescField( void *args
)
972 struct SQLSetDescField_params
*params
= args
;
974 return pSQLSetDescField(params
->DescriptorHandle
, params
->RecNumber
, params
->FieldIdentifier
,
975 params
->Value
, params
->BufferLength
);
978 static NTSTATUS
wrap_SQLSetDescFieldW( void *args
)
980 struct SQLSetDescFieldW_params
*params
= args
;
982 return pSQLSetDescFieldW(params
->DescriptorHandle
, params
->RecNumber
, params
->FieldIdentifier
,
983 params
->Value
, params
->BufferLength
);
986 static NTSTATUS
wrap_SQLSetDescRec( void *args
)
988 struct SQLSetDescRec_params
*params
= args
;
990 return pSQLSetDescRec(params
->DescriptorHandle
, params
->RecNumber
, params
->Type
, params
->SubType
,
991 params
->Length
, params
->Precision
, params
->Scale
, params
->Data
,
992 params
->StringLength
, params
->Indicator
);
995 static NTSTATUS
wrap_SQLSetEnvAttr( void *args
)
997 struct SQLSetEnvAttr_params
*params
= args
;
999 return pSQLSetEnvAttr(params
->EnvironmentHandle
, params
->Attribute
, params
->Value
, params
->StringLength
);
1002 static NTSTATUS
wrap_SQLSetParam( void *args
)
1004 struct SQLSetParam_params
*params
= args
;
1006 return pSQLSetParam(params
->StatementHandle
, params
->ParameterNumber
, params
->ValueType
,
1007 params
->ParameterType
, params
->LengthPrecision
, params
->ParameterScale
,
1008 params
->ParameterValue
, params
->StrLen_or_Ind
);
1011 static NTSTATUS
wrap_SQLSetPos( void *args
)
1013 struct SQLSetPos_params
*params
= args
;
1015 return pSQLSetPos(params
->hstmt
, params
->irow
, params
->fOption
, params
->fLock
);
1018 static NTSTATUS
wrap_SQLSetScrollOptions( void *args
)
1020 struct SQLSetScrollOptions_params
*params
= args
;
1022 return pSQLSetScrollOptions(params
->statement_handle
, params
->f_concurrency
,
1023 params
->crow_keyset
, params
->crow_rowset
);
1026 static NTSTATUS
wrap_SQLSetStmtAttr( void *args
)
1028 struct SQLSetStmtAttr_params
*params
= args
;
1030 return pSQLSetStmtAttr(params
->StatementHandle
, params
->Attribute
, params
->Value
, params
->StringLength
);
1033 static NTSTATUS
wrap_SQLSetStmtAttrW( void *args
)
1035 struct SQLSetStmtAttrW_params
*params
= args
;
1037 return pSQLSetStmtAttrW(params
->StatementHandle
, params
->Attribute
, params
->Value
, params
->StringLength
);
1040 static NTSTATUS
wrap_SQLSetStmtOption( void *args
)
1042 struct SQLSetStmtOption_params
*params
= args
;
1044 return pSQLSetStmtOption(params
->StatementHandle
, params
->Option
, params
->Value
);
1047 static NTSTATUS
wrap_SQLSpecialColumns( void *args
)
1049 struct SQLSpecialColumns_params
*params
= args
;
1051 return pSQLSpecialColumns(params
->StatementHandle
, params
->IdentifierType
, params
->CatalogName
,
1052 params
->NameLength1
, params
->SchemaName
, params
->NameLength2
,
1053 params
->TableName
, params
->NameLength3
, params
->Scope
, params
->Nullable
);
1056 static NTSTATUS
wrap_SQLSpecialColumnsW( void *args
)
1058 struct SQLSpecialColumnsW_params
*params
= args
;
1060 return pSQLSpecialColumnsW(params
->StatementHandle
, params
->IdentifierType
, params
->CatalogName
,
1061 params
->NameLength1
, params
->SchemaName
, params
->NameLength2
,
1062 params
->TableName
, params
->NameLength3
, params
->Scope
, params
->Nullable
);
1065 static NTSTATUS
wrap_SQLStatistics( void *args
)
1067 struct SQLStatistics_params
*params
= args
;
1069 return pSQLStatistics(params
->StatementHandle
, params
->CatalogName
, params
->NameLength1
,
1070 params
->SchemaName
, params
->NameLength2
, params
->TableName
,
1071 params
->NameLength3
, params
->Unique
, params
->Reserved
);
1074 static NTSTATUS
wrap_SQLStatisticsW( void *args
)
1076 struct SQLStatisticsW_params
*params
= args
;
1078 return pSQLStatisticsW(params
->StatementHandle
, params
->CatalogName
, params
->NameLength1
,
1079 params
->SchemaName
, params
->NameLength2
, params
->TableName
,
1080 params
->NameLength3
, params
->Unique
, params
->Reserved
);
1083 static NTSTATUS
wrap_SQLTablePrivileges( void *args
)
1085 struct SQLTablePrivileges_params
*params
= args
;
1087 return pSQLTablePrivileges(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
1088 params
->szSchemaName
, params
->cbSchemaName
, params
->szTableName
,
1089 params
->cbTableName
);
1092 static NTSTATUS
wrap_SQLTablePrivilegesW( void *args
)
1094 struct SQLTablePrivilegesW_params
*params
= args
;
1096 return pSQLTablePrivilegesW(params
->hstmt
, params
->szCatalogName
, params
->cbCatalogName
,
1097 params
->szSchemaName
, params
->cbSchemaName
, params
->szTableName
,
1098 params
->cbTableName
);
1101 static NTSTATUS
wrap_SQLTables( void *args
)
1103 struct SQLTables_params
*params
= args
;
1105 return pSQLTables(params
->StatementHandle
, params
->CatalogName
, params
->NameLength1
,
1106 params
->SchemaName
, params
->NameLength2
, params
->TableName
,
1107 params
->NameLength3
, params
->TableType
, params
->NameLength4
);
1110 static NTSTATUS
wrap_SQLTablesW( void *args
)
1112 struct SQLTablesW_params
*params
= args
;
1114 return pSQLTablesW(params
->StatementHandle
, params
->CatalogName
, params
->NameLength1
,
1115 params
->SchemaName
, params
->NameLength2
, params
->TableName
,
1116 params
->NameLength3
, params
->TableType
, params
->NameLength4
);
1119 static NTSTATUS
wrap_SQLTransact( void *args
)
1121 struct SQLTransact_params
*params
= args
;
1123 return pSQLTransact(params
->EnvironmentHandle
, params
->ConnectionHandle
, params
->CompletionType
);
1126 unixlib_entry_t __wine_unix_call_funcs
[NB_ODBC_FUNCS
] =
1128 odbc_process_attach
,
1129 odbc_process_detach
,
1132 static NTSTATUS
error_func( void *args
)
1137 static NTSTATUS
load_odbc(void)
1139 const char *s
= getenv("LIB_ODBC_DRIVER_MANAGER");
1141 #ifdef SONAME_LIBODBC
1142 if (!s
|| !s
[0]) s
= SONAME_LIBODBC
;
1144 if (!s
|| !s
[0] || !(libodbc
= dlopen( s
, RTLD_LAZY
| RTLD_GLOBAL
)))
1146 ERR_(winediag
)("failed to open library %s: %s\n", debugstr_a(s
), dlerror());
1147 return STATUS_DLL_NOT_FOUND
;
1150 #define LOAD_FUNC(name) \
1151 __wine_unix_call_funcs[unix_##name] = (p##name = dlsym( libodbc, #name )) ? wrap_##name : error_func
1153 LOAD_FUNC(SQLAllocConnect
);
1154 LOAD_FUNC(SQLAllocEnv
);
1155 LOAD_FUNC(SQLAllocHandle
);
1156 LOAD_FUNC(SQLAllocHandleStd
);
1157 LOAD_FUNC(SQLAllocStmt
);
1158 LOAD_FUNC(SQLBindCol
);
1159 LOAD_FUNC(SQLBindParam
);
1160 LOAD_FUNC(SQLBindParameter
);
1161 LOAD_FUNC(SQLBrowseConnect
);
1162 LOAD_FUNC(SQLBrowseConnectW
);
1163 LOAD_FUNC(SQLBulkOperations
);
1164 LOAD_FUNC(SQLCancel
);
1165 LOAD_FUNC(SQLCloseCursor
);
1166 LOAD_FUNC(SQLColAttribute
);
1167 LOAD_FUNC(SQLColAttributeW
);
1168 LOAD_FUNC(SQLColAttributes
);
1169 LOAD_FUNC(SQLColAttributesW
);
1170 LOAD_FUNC(SQLColumnPrivileges
);
1171 LOAD_FUNC(SQLColumnPrivilegesW
);
1172 LOAD_FUNC(SQLColumns
);
1173 LOAD_FUNC(SQLColumnsW
);
1174 LOAD_FUNC(SQLConnect
);
1175 LOAD_FUNC(SQLConnectW
);
1176 LOAD_FUNC(SQLCopyDesc
);
1177 LOAD_FUNC(SQLDataSources
);
1178 LOAD_FUNC(SQLDataSourcesA
);
1179 LOAD_FUNC(SQLDataSourcesW
);
1180 LOAD_FUNC(SQLDescribeCol
);
1181 LOAD_FUNC(SQLDescribeColW
);
1182 LOAD_FUNC(SQLDescribeParam
);
1183 LOAD_FUNC(SQLDisconnect
);
1184 LOAD_FUNC(SQLDriverConnect
);
1185 LOAD_FUNC(SQLDriverConnectW
);
1186 LOAD_FUNC(SQLDrivers
);
1187 LOAD_FUNC(SQLDriversW
);
1188 LOAD_FUNC(SQLEndTran
);
1189 LOAD_FUNC(SQLError
);
1190 LOAD_FUNC(SQLErrorW
);
1191 LOAD_FUNC(SQLExecDirect
);
1192 LOAD_FUNC(SQLExecDirectW
);
1193 LOAD_FUNC(SQLExecute
);
1194 LOAD_FUNC(SQLExtendedFetch
);
1195 LOAD_FUNC(SQLFetch
);
1196 LOAD_FUNC(SQLFetchScroll
);
1197 LOAD_FUNC(SQLForeignKeys
);
1198 LOAD_FUNC(SQLForeignKeysW
);
1199 LOAD_FUNC(SQLFreeConnect
);
1200 LOAD_FUNC(SQLFreeEnv
);
1201 LOAD_FUNC(SQLFreeHandle
);
1202 LOAD_FUNC(SQLFreeStmt
);
1203 LOAD_FUNC(SQLGetConnectAttr
);
1204 LOAD_FUNC(SQLGetConnectAttrW
);
1205 LOAD_FUNC(SQLGetConnectOption
);
1206 LOAD_FUNC(SQLGetConnectOptionW
);
1207 LOAD_FUNC(SQLGetCursorName
);
1208 LOAD_FUNC(SQLGetCursorNameW
);
1209 LOAD_FUNC(SQLGetData
);
1210 LOAD_FUNC(SQLGetDescField
);
1211 LOAD_FUNC(SQLGetDescFieldW
);
1212 LOAD_FUNC(SQLGetDescRec
);
1213 LOAD_FUNC(SQLGetDescRecW
);
1214 LOAD_FUNC(SQLGetDiagField
);
1215 LOAD_FUNC(SQLGetDiagFieldW
);
1216 LOAD_FUNC(SQLGetDiagRec
);
1217 LOAD_FUNC(SQLGetDiagRecA
);
1218 LOAD_FUNC(SQLGetDiagRecW
);
1219 LOAD_FUNC(SQLGetEnvAttr
);
1220 LOAD_FUNC(SQLGetFunctions
);
1221 LOAD_FUNC(SQLGetInfo
);
1222 LOAD_FUNC(SQLGetInfoW
);
1223 LOAD_FUNC(SQLGetStmtAttr
);
1224 LOAD_FUNC(SQLGetStmtAttrW
);
1225 LOAD_FUNC(SQLGetStmtOption
);
1226 LOAD_FUNC(SQLGetTypeInfo
);
1227 LOAD_FUNC(SQLGetTypeInfoW
);
1228 LOAD_FUNC(SQLMoreResults
);
1229 LOAD_FUNC(SQLNativeSql
);
1230 LOAD_FUNC(SQLNativeSqlW
);
1231 LOAD_FUNC(SQLNumParams
);
1232 LOAD_FUNC(SQLNumResultCols
);
1233 LOAD_FUNC(SQLParamData
);
1234 LOAD_FUNC(SQLParamOptions
);
1235 LOAD_FUNC(SQLPrepare
);
1236 LOAD_FUNC(SQLPrepareW
);
1237 LOAD_FUNC(SQLPrimaryKeys
);
1238 LOAD_FUNC(SQLPrimaryKeysW
);
1239 LOAD_FUNC(SQLProcedureColumns
);
1240 LOAD_FUNC(SQLProcedureColumnsW
);
1241 LOAD_FUNC(SQLProcedures
);
1242 LOAD_FUNC(SQLProceduresW
);
1243 LOAD_FUNC(SQLPutData
);
1244 LOAD_FUNC(SQLRowCount
);
1245 LOAD_FUNC(SQLSetConnectAttr
);
1246 LOAD_FUNC(SQLSetConnectAttrW
);
1247 LOAD_FUNC(SQLSetConnectOption
);
1248 LOAD_FUNC(SQLSetConnectOptionW
);
1249 LOAD_FUNC(SQLSetCursorName
);
1250 LOAD_FUNC(SQLSetCursorNameW
);
1251 LOAD_FUNC(SQLSetDescField
);
1252 LOAD_FUNC(SQLSetDescFieldW
);
1253 LOAD_FUNC(SQLSetDescRec
);
1254 LOAD_FUNC(SQLSetEnvAttr
);
1255 LOAD_FUNC(SQLSetParam
);
1256 LOAD_FUNC(SQLSetPos
);
1257 LOAD_FUNC(SQLSetScrollOptions
);
1258 LOAD_FUNC(SQLSetStmtAttr
);
1259 LOAD_FUNC(SQLSetStmtAttrW
);
1260 LOAD_FUNC(SQLSetStmtOption
);
1261 LOAD_FUNC(SQLSpecialColumns
);
1262 LOAD_FUNC(SQLSpecialColumnsW
);
1263 LOAD_FUNC(SQLStatistics
);
1264 LOAD_FUNC(SQLStatisticsW
);
1265 LOAD_FUNC(SQLTablePrivileges
);
1266 LOAD_FUNC(SQLTablePrivilegesW
);
1267 LOAD_FUNC(SQLTables
);
1268 LOAD_FUNC(SQLTablesW
);
1269 LOAD_FUNC(SQLTransact
);
1271 return STATUS_SUCCESS
;