xref: /reactos/dll/win32/odbc32/proxyodbc.c (revision 4658658f)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Win32 ODBC functions
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Copyright 1999 Xiang Li, Corel Corporation
5c2c66affSColin Finck  *
6c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
7c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
8c2c66affSColin Finck  * License as published by the Free Software Foundation; either
9c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
12c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14c2c66affSColin Finck  * Lesser General Public License for more details.
15c2c66affSColin Finck  *
16c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
17c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
18c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19c2c66affSColin Finck  *
20c2c66affSColin Finck  * NOTES:
21c2c66affSColin Finck  *   Proxy ODBC driver manager.  This manager delegates all ODBC
22c2c66affSColin Finck  *   calls to a real ODBC driver manager named by the environment
23c2c66affSColin Finck  *   variable LIB_ODBC_DRIVER_MANAGER, or to libodbc.so if the
24c2c66affSColin Finck  *   variable is not set.
25c2c66affSColin Finck  *
26c2c66affSColin Finck  */
27c2c66affSColin Finck 
28f47d676dSAmine Khaldi #include "config.h"
29f47d676dSAmine Khaldi #include "wine/port.h"
30c2c66affSColin Finck 
31f47d676dSAmine Khaldi #include <stdarg.h>
32f47d676dSAmine Khaldi #include <stdio.h>
33f47d676dSAmine Khaldi #include <stdlib.h>
34f47d676dSAmine Khaldi #include <string.h>
35c2c66affSColin Finck #include <assert.h>
36c2c66affSColin Finck 
37f47d676dSAmine Khaldi #include "windef.h"
38f47d676dSAmine Khaldi #include "winbase.h"
39f47d676dSAmine Khaldi #include "winreg.h"
40f47d676dSAmine Khaldi #ifndef __REACTOS__
41f47d676dSAmine Khaldi #include "wine/debug.h"
42f47d676dSAmine Khaldi #endif
43f47d676dSAmine Khaldi #include "wine/library.h"
44f47d676dSAmine Khaldi #include "wine/unicode.h"
45c2c66affSColin Finck 
46f47d676dSAmine Khaldi #include "sql.h"
47f47d676dSAmine Khaldi #include "sqltypes.h"
48f47d676dSAmine Khaldi #include "sqlext.h"
49c2c66affSColin Finck 
50f47d676dSAmine Khaldi #ifdef __REACTOS__
51c2c66affSColin Finck #undef TRACE_ON
52c2c66affSColin Finck #include <wine/debug.h>
53f47d676dSAmine Khaldi #endif
54c2c66affSColin Finck 
55c2c66affSColin Finck static BOOL ODBC_LoadDriverManager(void);
56c2c66affSColin Finck static BOOL ODBC_LoadDMFunctions(void);
57c2c66affSColin Finck 
58c2c66affSColin Finck WINE_DEFAULT_DEBUG_CHANNEL(odbc);
59c2c66affSColin Finck WINE_DECLARE_DEBUG_CHANNEL(winediag);
60c2c66affSColin Finck 
61c2c66affSColin Finck static SQLRETURN (*pSQLAllocConnect)(SQLHENV,SQLHDBC*);
62c2c66affSColin Finck static SQLRETURN (*pSQLAllocEnv)(SQLHENV*);
63c2c66affSColin Finck static SQLRETURN (*pSQLAllocHandle)(SQLSMALLINT,SQLHANDLE,SQLHANDLE*);
64c2c66affSColin Finck static SQLRETURN (*pSQLAllocHandleStd)(SQLSMALLINT,SQLHANDLE,SQLHANDLE*);
65c2c66affSColin Finck static SQLRETURN (*pSQLAllocStmt)(SQLHDBC,SQLHSTMT*);
66c2c66affSColin Finck static SQLRETURN (*pSQLBindCol)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
67c2c66affSColin Finck static SQLRETURN (*pSQLBindParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN*);
68c2c66affSColin Finck static SQLRETURN (*pSQLBindParameter)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
69c2c66affSColin Finck static SQLRETURN (*pSQLBrowseConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
70c2c66affSColin Finck static SQLRETURN (*pSQLBrowseConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
71c2c66affSColin Finck static SQLRETURN (*pSQLBulkOperations)(SQLHSTMT,SQLSMALLINT);
72c2c66affSColin Finck static SQLRETURN (*pSQLCancel)(SQLHSTMT);
73c2c66affSColin Finck static SQLRETURN (*pSQLCloseCursor)(SQLHSTMT);
74c2c66affSColin Finck static SQLRETURN (*pSQLColAttribute)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
75c2c66affSColin Finck static SQLRETURN (*pSQLColAttributeW)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
76c2c66affSColin Finck static SQLRETURN (*pSQLColAttributes)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
77c2c66affSColin Finck static SQLRETURN (*pSQLColAttributesW)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*);
78c2c66affSColin Finck static SQLRETURN (*pSQLColumnPrivileges)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
79c2c66affSColin Finck static SQLRETURN (*pSQLColumnPrivilegesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
80c2c66affSColin Finck static SQLRETURN (*pSQLColumns)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
81c2c66affSColin Finck static SQLRETURN (*pSQLColumnsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
82c2c66affSColin Finck static SQLRETURN (*pSQLConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
83c2c66affSColin Finck static SQLRETURN (*pSQLConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
84c2c66affSColin Finck static SQLRETURN (*pSQLCopyDesc)(SQLHDESC,SQLHDESC);
85c2c66affSColin Finck static SQLRETURN (*pSQLDataSources)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
86c2c66affSColin Finck static SQLRETURN (*pSQLDataSourcesA)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
87c2c66affSColin Finck static SQLRETURN (*pSQLDataSourcesW)(SQLHENV,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
88c2c66affSColin Finck static SQLRETURN (*pSQLDescribeCol)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*);
89c2c66affSColin Finck static SQLRETURN (*pSQLDescribeColW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*);
90c2c66affSColin Finck static SQLRETURN (*pSQLDescribeParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*);
91c2c66affSColin Finck static SQLRETURN (*pSQLDisconnect)(SQLHDBC);
92c2c66affSColin Finck static SQLRETURN (*pSQLDriverConnect)(SQLHDBC,SQLHWND,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT);
93c2c66affSColin Finck static SQLRETURN (*pSQLDriverConnectW)(SQLHDBC,SQLHWND,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT);
94c2c66affSColin Finck static SQLRETURN (*pSQLDrivers)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
95c2c66affSColin Finck static SQLRETURN (*pSQLDriversW)(SQLHENV,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
96c2c66affSColin Finck static SQLRETURN (*pSQLEndTran)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT);
97c2c66affSColin Finck static SQLRETURN (*pSQLError)(SQLHENV,SQLHDBC,SQLHSTMT,SQLCHAR*,SQLINTEGER*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
98c2c66affSColin Finck static SQLRETURN (*pSQLErrorW)(SQLHENV,SQLHDBC,SQLHSTMT,SQLWCHAR*,SQLINTEGER*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
99c2c66affSColin Finck static SQLRETURN (*pSQLExecDirect)(SQLHSTMT,SQLCHAR*,SQLINTEGER);
100c2c66affSColin Finck static SQLRETURN (*pSQLExecDirectW)(SQLHSTMT,SQLWCHAR*,SQLINTEGER);
101c2c66affSColin Finck static SQLRETURN (*pSQLExecute)(SQLHSTMT);
102c2c66affSColin Finck static SQLRETURN (*pSQLExtendedFetch)(SQLHSTMT,SQLUSMALLINT,SQLLEN,SQLULEN*,SQLUSMALLINT*);
103c2c66affSColin Finck static SQLRETURN (*pSQLFetch)(SQLHSTMT);
104c2c66affSColin Finck static SQLRETURN (*pSQLFetchScroll)(SQLHSTMT,SQLSMALLINT,SQLLEN);
105c2c66affSColin Finck static SQLRETURN (*pSQLForeignKeys)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
106c2c66affSColin Finck static SQLRETURN (*pSQLForeignKeysW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
107c2c66affSColin Finck static SQLRETURN (*pSQLFreeConnect)(SQLHDBC);
108c2c66affSColin Finck static SQLRETURN (*pSQLFreeEnv)(SQLHENV);
109c2c66affSColin Finck static SQLRETURN (*pSQLFreeHandle)(SQLSMALLINT,SQLHANDLE);
110c2c66affSColin Finck static SQLRETURN (*pSQLFreeStmt)(SQLHSTMT,SQLUSMALLINT);
111c2c66affSColin Finck static SQLRETURN (*pSQLGetConnectAttr)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
112c2c66affSColin Finck static SQLRETURN (*pSQLGetConnectAttrW)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
113c2c66affSColin Finck static SQLRETURN (*pSQLGetConnectOption)(SQLHDBC,SQLUSMALLINT,SQLPOINTER);
114c2c66affSColin Finck static SQLRETURN (*pSQLGetConnectOptionW)(SQLHDBC,SQLUSMALLINT,SQLPOINTER);
115c2c66affSColin Finck static SQLRETURN (*pSQLGetCursorName)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
116c2c66affSColin Finck static SQLRETURN (*pSQLGetCursorNameW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
117c2c66affSColin Finck static SQLRETURN (*pSQLGetData)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*);
118c2c66affSColin Finck static SQLRETURN (*pSQLGetDescField)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
119c2c66affSColin Finck static SQLRETURN (*pSQLGetDescFieldW)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
120c2c66affSColin Finck static SQLRETURN (*pSQLGetDescRec)(SQLHDESC,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*,SQLLEN*,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*);
121c2c66affSColin Finck static SQLRETURN (*pSQLGetDescRecW)(SQLHDESC,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*,SQLLEN*,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*);
122c2c66affSColin Finck static SQLRETURN (*pSQLGetDiagField)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
123c2c66affSColin Finck static SQLRETURN (*pSQLGetDiagFieldW)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
124c2c66affSColin Finck static SQLRETURN (*pSQLGetDiagRec)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLCHAR*,SQLINTEGER*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
125c2c66affSColin Finck static SQLRETURN (*pSQLGetDiagRecW)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLWCHAR*,SQLINTEGER*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*);
126c2c66affSColin Finck static SQLRETURN (*pSQLGetEnvAttr)(SQLHENV,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
127c2c66affSColin Finck static SQLRETURN (*pSQLGetFunctions)(SQLHDBC,SQLUSMALLINT,SQLUSMALLINT*);
128c2c66affSColin Finck static SQLRETURN (*pSQLGetInfo)(SQLHDBC,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
129c2c66affSColin Finck static SQLRETURN (*pSQLGetInfoW)(SQLHDBC,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*);
130c2c66affSColin Finck static SQLRETURN (*pSQLGetStmtAttr)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
131c2c66affSColin Finck static SQLRETURN (*pSQLGetStmtAttrW)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*);
132c2c66affSColin Finck static SQLRETURN (*pSQLGetStmtOption)(SQLHSTMT,SQLUSMALLINT,SQLPOINTER);
133c2c66affSColin Finck static SQLRETURN (*pSQLGetTypeInfo)(SQLHSTMT,SQLSMALLINT);
134c2c66affSColin Finck static SQLRETURN (*pSQLGetTypeInfoW)(SQLHSTMT,SQLSMALLINT);
135c2c66affSColin Finck static SQLRETURN (*pSQLMoreResults)(SQLHSTMT);
136c2c66affSColin Finck static SQLRETURN (*pSQLNativeSql)(SQLHDBC,SQLCHAR*,SQLINTEGER,SQLCHAR*,SQLINTEGER,SQLINTEGER*);
137c2c66affSColin Finck static SQLRETURN (*pSQLNativeSqlW)(SQLHDBC,SQLWCHAR*,SQLINTEGER,SQLWCHAR*,SQLINTEGER,SQLINTEGER*);
138c2c66affSColin Finck static SQLRETURN (*pSQLNumParams)(SQLHSTMT,SQLSMALLINT*);
139c2c66affSColin Finck static SQLRETURN (*pSQLNumResultCols)(SQLHSTMT,SQLSMALLINT*);
140c2c66affSColin Finck static SQLRETURN (*pSQLParamData)(SQLHSTMT,SQLPOINTER*);
141c2c66affSColin Finck static SQLRETURN (*pSQLParamOptions)(SQLHSTMT,SQLULEN,SQLULEN*);
142c2c66affSColin Finck static SQLRETURN (*pSQLPrepare)(SQLHSTMT,SQLCHAR*,SQLINTEGER);
143c2c66affSColin Finck static SQLRETURN (*pSQLPrepareW)(SQLHSTMT,SQLWCHAR*,SQLINTEGER);
144c2c66affSColin Finck static SQLRETURN (*pSQLPrimaryKeys)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
145c2c66affSColin Finck static SQLRETURN (*pSQLPrimaryKeysW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
146c2c66affSColin Finck static SQLRETURN (*pSQLProcedureColumns)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
147c2c66affSColin Finck static SQLRETURN (*pSQLProcedureColumnsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
148c2c66affSColin Finck static SQLRETURN (*pSQLProcedures)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
149c2c66affSColin Finck static SQLRETURN (*pSQLProceduresW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
150c2c66affSColin Finck static SQLRETURN (*pSQLPutData)(SQLHSTMT,SQLPOINTER,SQLLEN);
151c2c66affSColin Finck static SQLRETURN (*pSQLRowCount)(SQLHSTMT,SQLLEN*);
152c2c66affSColin Finck static SQLRETURN (*pSQLSetConnectAttr)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER);
153c2c66affSColin Finck static SQLRETURN (*pSQLSetConnectAttrW)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER);
154c2c66affSColin Finck static SQLRETURN (*pSQLSetConnectOption)(SQLHDBC,SQLUSMALLINT,SQLULEN);
155c2c66affSColin Finck static SQLRETURN (*pSQLSetConnectOptionW)(SQLHDBC,SQLUSMALLINT,SQLULEN);
156c2c66affSColin Finck static SQLRETURN (*pSQLSetCursorName)(SQLHSTMT,SQLCHAR*,SQLSMALLINT);
157c2c66affSColin Finck static SQLRETURN (*pSQLSetCursorNameW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT);
158c2c66affSColin Finck static SQLRETURN (*pSQLSetDescField)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER);
159c2c66affSColin Finck static SQLRETURN (*pSQLSetDescFieldW)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER);
160c2c66affSColin Finck static SQLRETURN (*pSQLSetDescRec)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLLEN,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN*,SQLLEN*);
161c2c66affSColin Finck static SQLRETURN (*pSQLSetEnvAttr)(SQLHENV,SQLINTEGER,SQLPOINTER,SQLINTEGER);
162c2c66affSColin Finck static SQLRETURN (*pSQLSetParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN*);
163c2c66affSColin Finck static SQLRETURN (*pSQLSetPos)(SQLHSTMT,SQLSETPOSIROW,SQLUSMALLINT,SQLUSMALLINT);
164c2c66affSColin Finck static SQLRETURN (*pSQLSetScrollOptions)(SQLHSTMT,SQLUSMALLINT,SQLLEN,SQLUSMALLINT);
165c2c66affSColin Finck static SQLRETURN (*pSQLSetStmtAttr)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER);
166c2c66affSColin Finck static SQLRETURN (*pSQLSetStmtAttrW)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER);
167c2c66affSColin Finck static SQLRETURN (*pSQLSetStmtOption)(SQLHSTMT,SQLUSMALLINT,SQLULEN);
168c2c66affSColin Finck static SQLRETURN (*pSQLSpecialColumns)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
169c2c66affSColin Finck static SQLRETURN (*pSQLSpecialColumnsW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
170c2c66affSColin Finck static SQLRETURN (*pSQLStatistics)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
171c2c66affSColin Finck static SQLRETURN (*pSQLStatisticsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
172c2c66affSColin Finck static SQLRETURN (*pSQLTablePrivileges)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
173c2c66affSColin Finck static SQLRETURN (*pSQLTablePrivilegesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
174c2c66affSColin Finck static SQLRETURN (*pSQLTables)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT);
175c2c66affSColin Finck static SQLRETURN (*pSQLTablesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT);
176c2c66affSColin Finck static SQLRETURN (*pSQLTransact)(SQLHENV,SQLHDBC,SQLUSMALLINT);
17704ef5f7aSAmine Khaldi static SQLRETURN (*pSQLGetDiagRecA)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLCHAR*,SQLINTEGER*,
17804ef5f7aSAmine Khaldi                                     SQLCHAR*,SQLSMALLINT,SQLSMALLINT*);
179c2c66affSColin Finck 
180c2c66affSColin Finck #define ERROR_FREE 0
181c2c66affSColin Finck #define ERROR_SQLERROR  1
182c2c66affSColin Finck #define ERROR_LIBRARY_NOT_FOUND 2
183c2c66affSColin Finck 
184c2c66affSColin Finck static void *dmHandle;
185c2c66affSColin Finck static int nErrorType;
186c2c66affSColin Finck 
18704ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLAllocEnv(SQLHENV *);
18804ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLFreeEnv(SQLHENV);
18904ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDataSources(SQLHENV, SQLUSMALLINT, SQLCHAR *, SQLSMALLINT,
19004ef5f7aSAmine Khaldi                                        SQLSMALLINT *, SQLCHAR *, SQLSMALLINT, SQLSMALLINT *);
19104ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDrivers(SQLHENV, SQLUSMALLINT, SQLCHAR *, SQLSMALLINT, SQLSMALLINT *,
19204ef5f7aSAmine Khaldi                                    SQLCHAR *, SQLSMALLINT, SQLSMALLINT *);
19304ef5f7aSAmine Khaldi 
194c2c66affSColin Finck /***********************************************************************
195c2c66affSColin Finck  * ODBC_ReplicateODBCInstToRegistry
196c2c66affSColin Finck  *
197c2c66affSColin Finck  * PARAMS
198c2c66affSColin Finck  *
199c2c66affSColin Finck  * RETURNS
200c2c66affSColin Finck  *
201c2c66affSColin Finck  * Utility to ODBC_ReplicateToRegistry to replicate the drivers of the
202c2c66affSColin Finck  * ODBCINST.INI settings
203c2c66affSColin Finck  *
204c2c66affSColin Finck  * The driver settings are not replicated to the registry.  If we were to
205c2c66affSColin Finck  * replicate them we would need to decide whether to replicate all settings
206c2c66affSColin Finck  * or to do some translation; whether to remove any entries present only in
207c2c66affSColin Finck  * the windows registry, etc.
208c2c66affSColin Finck  */
209c2c66affSColin Finck 
ODBC_ReplicateODBCInstToRegistry(SQLHENV hEnv)210c2c66affSColin Finck static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv)
211c2c66affSColin Finck {
212c2c66affSColin Finck     HKEY hODBCInst;
213c2c66affSColin Finck     LONG reg_ret;
214c2c66affSColin Finck     BOOL success;
215c2c66affSColin Finck 
216c2c66affSColin Finck     success = FALSE;
217c2c66affSColin Finck     TRACE ("Driver settings are not currently replicated to the registry\n");
218c2c66affSColin Finck     if ((reg_ret = RegCreateKeyExA (HKEY_LOCAL_MACHINE,
219c2c66affSColin Finck             "Software\\ODBC\\ODBCINST.INI", 0, NULL,
220c2c66affSColin Finck             REG_OPTION_NON_VOLATILE,
221c2c66affSColin Finck             KEY_ALL_ACCESS /* a couple more than we need */, NULL,
222c2c66affSColin Finck             &hODBCInst, NULL)) == ERROR_SUCCESS)
223c2c66affSColin Finck     {
224c2c66affSColin Finck         HKEY hDrivers;
225c2c66affSColin Finck         if ((reg_ret = RegCreateKeyExA (hODBCInst, "ODBC Drivers", 0,
226c2c66affSColin Finck                 NULL, REG_OPTION_NON_VOLATILE,
227c2c66affSColin Finck                 KEY_ALL_ACCESS /* overkill */, NULL, &hDrivers, NULL))
228c2c66affSColin Finck                 == ERROR_SUCCESS)
229c2c66affSColin Finck         {
230c2c66affSColin Finck             SQLRETURN sql_ret;
231c2c66affSColin Finck             SQLUSMALLINT dirn;
232c2c66affSColin Finck             CHAR desc [256];
233c2c66affSColin Finck             SQLSMALLINT sizedesc;
234c2c66affSColin Finck 
235c2c66affSColin Finck             success = TRUE;
236c2c66affSColin Finck             dirn = SQL_FETCH_FIRST;
23704ef5f7aSAmine Khaldi             while ((sql_ret = ODBC32_SQLDrivers (hEnv, dirn, (SQLCHAR*)desc, sizeof(desc),
238c2c66affSColin Finck                     &sizedesc, NULL, 0, NULL)) == SQL_SUCCESS ||
239c2c66affSColin Finck                     sql_ret == SQL_SUCCESS_WITH_INFO)
240c2c66affSColin Finck             {
241c2c66affSColin Finck                 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
242c2c66affSColin Finck                 dirn = SQL_FETCH_NEXT;
243c2c66affSColin Finck                 if (sizedesc == lstrlenA(desc))
244c2c66affSColin Finck                 {
245c2c66affSColin Finck                     HKEY hThis;
246c2c66affSColin Finck                     if ((reg_ret = RegQueryValueExA (hDrivers, desc, NULL,
247c2c66affSColin Finck                             NULL, NULL, NULL)) == ERROR_FILE_NOT_FOUND)
248c2c66affSColin Finck                     {
249c2c66affSColin Finck                         if ((reg_ret = RegSetValueExA (hDrivers, desc, 0,
250c2c66affSColin Finck                                 REG_SZ, (const BYTE *)"Installed", 10)) != ERROR_SUCCESS)
251c2c66affSColin Finck                         {
252c2c66affSColin Finck                             TRACE ("Error %d replicating driver %s\n",
253c2c66affSColin Finck                                     reg_ret, desc);
254c2c66affSColin Finck                             success = FALSE;
255c2c66affSColin Finck                         }
256c2c66affSColin Finck                     }
257c2c66affSColin Finck                     else if (reg_ret != ERROR_SUCCESS)
258c2c66affSColin Finck                     {
259c2c66affSColin Finck                         TRACE ("Error %d checking for %s in drivers\n",
260c2c66affSColin Finck                                 reg_ret, desc);
261c2c66affSColin Finck                         success = FALSE;
262c2c66affSColin Finck                     }
263c2c66affSColin Finck                     if ((reg_ret = RegCreateKeyExA (hODBCInst, desc, 0,
264c2c66affSColin Finck                             NULL, REG_OPTION_NON_VOLATILE,
265c2c66affSColin Finck                             KEY_ALL_ACCESS, NULL, &hThis, NULL))
266c2c66affSColin Finck                             == ERROR_SUCCESS)
267c2c66affSColin Finck                     {
268c2c66affSColin Finck                         /* FIXME This is where the settings go.
269c2c66affSColin Finck                          * I suggest that if the disposition says it
270c2c66affSColin Finck                          * exists then we leave it alone.  Alternatively
271c2c66affSColin Finck                          * include an extra value to flag that it is
272c2c66affSColin Finck                          * a replication of the unixODBC/iODBC/...
273c2c66affSColin Finck                          */
274c2c66affSColin Finck                         if ((reg_ret = RegCloseKey (hThis)) !=
275c2c66affSColin Finck                                 ERROR_SUCCESS)
276c2c66affSColin Finck                             TRACE ("Error %d closing %s key\n", reg_ret,
277c2c66affSColin Finck                                     desc);
278c2c66affSColin Finck                     }
279c2c66affSColin Finck                     else
280c2c66affSColin Finck                     {
281c2c66affSColin Finck                         TRACE ("Error %d ensuring driver key %s\n",
282c2c66affSColin Finck                                 reg_ret, desc);
283c2c66affSColin Finck                         success = FALSE;
284c2c66affSColin Finck                     }
285c2c66affSColin Finck                 }
286c2c66affSColin Finck                 else
287c2c66affSColin Finck                 {
288c2c66affSColin Finck                     WARN ("Unusually long driver name %s not replicated\n",
289c2c66affSColin Finck                             desc);
290c2c66affSColin Finck                     success = FALSE;
291c2c66affSColin Finck                 }
292c2c66affSColin Finck             }
293c2c66affSColin Finck             if (sql_ret != SQL_NO_DATA)
294c2c66affSColin Finck             {
295c2c66affSColin Finck                 TRACE ("Error %d enumerating drivers\n", (int)sql_ret);
296c2c66affSColin Finck                 success = FALSE;
297c2c66affSColin Finck             }
298c2c66affSColin Finck             if ((reg_ret = RegCloseKey (hDrivers)) != ERROR_SUCCESS)
299c2c66affSColin Finck             {
300c2c66affSColin Finck                 TRACE ("Error %d closing hDrivers\n", reg_ret);
301c2c66affSColin Finck             }
302c2c66affSColin Finck         }
303c2c66affSColin Finck         else
304c2c66affSColin Finck         {
305c2c66affSColin Finck             TRACE ("Error %d opening HKLM\\S\\O\\OI\\Drivers\n", reg_ret);
306c2c66affSColin Finck         }
307c2c66affSColin Finck         if ((reg_ret = RegCloseKey (hODBCInst)) != ERROR_SUCCESS)
308c2c66affSColin Finck         {
309c2c66affSColin Finck             TRACE ("Error %d closing HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
310c2c66affSColin Finck         }
311c2c66affSColin Finck     }
312c2c66affSColin Finck     else
313c2c66affSColin Finck     {
314c2c66affSColin Finck         TRACE ("Error %d opening HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
315c2c66affSColin Finck     }
316c2c66affSColin Finck     if (!success)
317c2c66affSColin Finck     {
318c2c66affSColin Finck         WARN ("May not have replicated all ODBC drivers to the registry\n");
319c2c66affSColin Finck     }
320c2c66affSColin Finck }
321c2c66affSColin Finck 
322c2c66affSColin Finck /***********************************************************************
323c2c66affSColin Finck  * ODBC_ReplicateODBCToRegistry
324c2c66affSColin Finck  *
325c2c66affSColin Finck  * PARAMS
326c2c66affSColin Finck  *
327c2c66affSColin Finck  * RETURNS
328c2c66affSColin Finck  *
329c2c66affSColin Finck  * Utility to ODBC_ReplicateToRegistry to replicate either the USER or
330c2c66affSColin Finck  * SYSTEM dsns
331c2c66affSColin Finck  *
332c2c66affSColin Finck  * For now simply place the "Driver description" (as returned by SQLDataSources)
333c2c66affSColin Finck  * into the registry as the driver.  This is enough to satisfy Crystal's
334c2c66affSColin Finck  * requirement that there be a driver entry.  (It doesn't seem to care what
335c2c66affSColin Finck  * the setting is).
336c2c66affSColin Finck  * A slightly more accurate setting would be to access the registry to find
337c2c66affSColin Finck  * the actual driver library for the given description (which appears to map
338c2c66affSColin Finck  * to one of the HKLM/Software/ODBC/ODBCINST.INI keys).  (If you do this note
339c2c66affSColin Finck  * that this will add a requirement that this function be called after
340c2c66affSColin Finck  * ODBC_ReplicateODBCInstToRegistry)
341c2c66affSColin Finck  */
ODBC_ReplicateODBCToRegistry(BOOL is_user,SQLHENV hEnv)342c2c66affSColin Finck static void ODBC_ReplicateODBCToRegistry (BOOL is_user, SQLHENV hEnv)
343c2c66affSColin Finck {
344c2c66affSColin Finck     HKEY hODBC;
345c2c66affSColin Finck     LONG reg_ret;
346c2c66affSColin Finck     SQLRETURN sql_ret;
347c2c66affSColin Finck     SQLUSMALLINT dirn;
348c2c66affSColin Finck     CHAR dsn [SQL_MAX_DSN_LENGTH + 1];
349c2c66affSColin Finck     SQLSMALLINT sizedsn;
350c2c66affSColin Finck     CHAR desc [256];
351c2c66affSColin Finck     SQLSMALLINT sizedesc;
352c2c66affSColin Finck     BOOL success;
353c2c66affSColin Finck     const char *which = is_user ? "user" : "system";
354c2c66affSColin Finck 
355c2c66affSColin Finck     success = FALSE;
356c2c66affSColin Finck     if ((reg_ret = RegCreateKeyExA (
357c2c66affSColin Finck             is_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
358c2c66affSColin Finck             "Software\\ODBC\\ODBC.INI", 0, NULL, REG_OPTION_NON_VOLATILE,
359c2c66affSColin Finck             KEY_ALL_ACCESS /* a couple more than we need */, NULL, &hODBC,
360c2c66affSColin Finck             NULL)) == ERROR_SUCCESS)
361c2c66affSColin Finck     {
362c2c66affSColin Finck         success = TRUE;
363c2c66affSColin Finck         dirn = is_user ? SQL_FETCH_FIRST_USER : SQL_FETCH_FIRST_SYSTEM;
36404ef5f7aSAmine Khaldi         while ((sql_ret = ODBC32_SQLDataSources (hEnv, dirn,
365c2c66affSColin Finck                 (SQLCHAR*)dsn, sizeof(dsn), &sizedsn,
366c2c66affSColin Finck                 (SQLCHAR*)desc, sizeof(desc), &sizedesc)) == SQL_SUCCESS
367c2c66affSColin Finck                 || sql_ret == SQL_SUCCESS_WITH_INFO)
368c2c66affSColin Finck         {
369c2c66affSColin Finck             /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
370c2c66affSColin Finck             dirn = SQL_FETCH_NEXT;
371c2c66affSColin Finck             if (sizedsn == lstrlenA(dsn) && sizedesc == lstrlenA(desc))
372c2c66affSColin Finck             {
373c2c66affSColin Finck                 HKEY hDSN;
374c2c66affSColin Finck                 if ((reg_ret = RegCreateKeyExA (hODBC, dsn, 0,
375c2c66affSColin Finck                         NULL, REG_OPTION_NON_VOLATILE,
376c2c66affSColin Finck                         KEY_ALL_ACCESS, NULL, &hDSN, NULL))
377c2c66affSColin Finck                         == ERROR_SUCCESS)
378c2c66affSColin Finck                 {
379c2c66affSColin Finck                     static const char DRIVERKEY[] = "Driver";
380c2c66affSColin Finck                     if ((reg_ret = RegQueryValueExA (hDSN, DRIVERKEY,
381c2c66affSColin Finck                             NULL, NULL, NULL, NULL))
382c2c66affSColin Finck                             == ERROR_FILE_NOT_FOUND)
383c2c66affSColin Finck                     {
384c2c66affSColin Finck                         if ((reg_ret = RegSetValueExA (hDSN, DRIVERKEY, 0,
385c2c66affSColin Finck                                 REG_SZ, (LPBYTE)desc, sizedesc)) != ERROR_SUCCESS)
386c2c66affSColin Finck                         {
387c2c66affSColin Finck                             TRACE ("Error %d replicating description of "
388c2c66affSColin Finck                                     "%s(%s)\n", reg_ret, dsn, desc);
389c2c66affSColin Finck                             success = FALSE;
390c2c66affSColin Finck                         }
391c2c66affSColin Finck                     }
392c2c66affSColin Finck                     else if (reg_ret != ERROR_SUCCESS)
393c2c66affSColin Finck                     {
394c2c66affSColin Finck                         TRACE ("Error %d checking for description of %s\n",
395c2c66affSColin Finck                                 reg_ret, dsn);
396c2c66affSColin Finck                         success = FALSE;
397c2c66affSColin Finck                     }
398c2c66affSColin Finck                     if ((reg_ret = RegCloseKey (hDSN)) != ERROR_SUCCESS)
399c2c66affSColin Finck                     {
400c2c66affSColin Finck                         TRACE ("Error %d closing %s DSN key %s\n",
401c2c66affSColin Finck                                 reg_ret, which, dsn);
402c2c66affSColin Finck                     }
403c2c66affSColin Finck                 }
404c2c66affSColin Finck                 else
405c2c66affSColin Finck                 {
406c2c66affSColin Finck                     TRACE ("Error %d opening %s DSN key %s\n",
407c2c66affSColin Finck                             reg_ret, which, dsn);
408c2c66affSColin Finck                     success = FALSE;
409c2c66affSColin Finck                 }
410c2c66affSColin Finck             }
411c2c66affSColin Finck             else
412c2c66affSColin Finck             {
413c2c66affSColin Finck                 WARN ("Unusually long %s data source name %s (%s) not "
414c2c66affSColin Finck                         "replicated\n", which, dsn, desc);
415c2c66affSColin Finck                 success = FALSE;
416c2c66affSColin Finck             }
417c2c66affSColin Finck         }
418c2c66affSColin Finck         if (sql_ret != SQL_NO_DATA)
419c2c66affSColin Finck         {
420c2c66affSColin Finck             TRACE ("Error %d enumerating %s datasources\n",
421c2c66affSColin Finck                     (int)sql_ret, which);
422c2c66affSColin Finck             success = FALSE;
423c2c66affSColin Finck         }
424c2c66affSColin Finck         if ((reg_ret = RegCloseKey (hODBC)) != ERROR_SUCCESS)
425c2c66affSColin Finck         {
426c2c66affSColin Finck             TRACE ("Error %d closing %s ODBC.INI registry key\n", reg_ret,
427c2c66affSColin Finck                     which);
428c2c66affSColin Finck         }
429c2c66affSColin Finck     }
430c2c66affSColin Finck     else
431c2c66affSColin Finck     {
432c2c66affSColin Finck         TRACE ("Error %d creating/opening %s ODBC.INI registry key\n",
433c2c66affSColin Finck                 reg_ret, which);
434c2c66affSColin Finck     }
435c2c66affSColin Finck     if (!success)
436c2c66affSColin Finck     {
437c2c66affSColin Finck         WARN ("May not have replicated all %s ODBC DSNs to the registry\n",
438c2c66affSColin Finck                 which);
439c2c66affSColin Finck     }
440c2c66affSColin Finck }
441c2c66affSColin Finck 
442c2c66affSColin Finck /***********************************************************************
443c2c66affSColin Finck  * ODBC_ReplicateToRegistry
444c2c66affSColin Finck  *
445c2c66affSColin Finck  * PARAMS
446c2c66affSColin Finck  *
447c2c66affSColin Finck  * RETURNS
448c2c66affSColin Finck  *
449c2c66affSColin Finck  * Unfortunately some of the functions that Windows documents as being part
450c2c66affSColin Finck  * of the ODBC API it implements directly during compilation or something
451c2c66affSColin Finck  * in terms of registry access functions.
452c2c66affSColin Finck  * e.g. SQLGetInstalledDrivers queries the list at
453c2c66affSColin Finck  * HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC Drivers
454c2c66affSColin Finck  *
455c2c66affSColin Finck  * This function is called when the driver manager is loaded and is used
456c2c66affSColin Finck  * to replicate the appropriate details into the Wine registry
457c2c66affSColin Finck  */
458c2c66affSColin Finck 
ODBC_ReplicateToRegistry(void)459c2c66affSColin Finck static void ODBC_ReplicateToRegistry (void)
460c2c66affSColin Finck {
461c2c66affSColin Finck     SQLRETURN sql_ret;
462c2c66affSColin Finck     SQLHENV hEnv;
463c2c66affSColin Finck 
46404ef5f7aSAmine Khaldi     if ((sql_ret = ODBC32_SQLAllocEnv (&hEnv)) == SQL_SUCCESS)
465c2c66affSColin Finck     {
466c2c66affSColin Finck         ODBC_ReplicateODBCInstToRegistry (hEnv);
467c2c66affSColin Finck         ODBC_ReplicateODBCToRegistry (FALSE /* system dsns */, hEnv);
468c2c66affSColin Finck         ODBC_ReplicateODBCToRegistry (TRUE /* user dsns */, hEnv);
469c2c66affSColin Finck 
47004ef5f7aSAmine Khaldi         if ((sql_ret = ODBC32_SQLFreeEnv (hEnv)) != SQL_SUCCESS)
471c2c66affSColin Finck         {
472c2c66affSColin Finck             TRACE ("Error %d freeing the SQL environment.\n", (int)sql_ret);
473c2c66affSColin Finck         }
474c2c66affSColin Finck     }
475c2c66affSColin Finck     else
476c2c66affSColin Finck     {
477c2c66affSColin Finck         TRACE ("Error %d opening an SQL environment.\n", (int)sql_ret);
478c2c66affSColin Finck         WARN ("The external ODBC settings have not been replicated to the"
479c2c66affSColin Finck                 " Wine registry\n");
480c2c66affSColin Finck     }
481c2c66affSColin Finck }
482c2c66affSColin Finck 
483c2c66affSColin Finck /***********************************************************************
484c2c66affSColin Finck  * DllMain [Internal] Initializes the internal 'ODBC32.DLL'.
485c2c66affSColin Finck  */
DllMain(HINSTANCE hinstDLL,DWORD reason,LPVOID reserved)486c2c66affSColin Finck BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
487c2c66affSColin Finck {
488c2c66affSColin Finck     TRACE("proxy ODBC: %p,%x,%p\n", hinstDLL, reason, reserved);
489c2c66affSColin Finck 
490c2c66affSColin Finck     switch (reason)
491c2c66affSColin Finck     {
492c2c66affSColin Finck     case DLL_PROCESS_ATTACH:
493c2c66affSColin Finck        DisableThreadLibraryCalls(hinstDLL);
494c2c66affSColin Finck        if (ODBC_LoadDriverManager())
495c2c66affSColin Finck        {
496c2c66affSColin Finck           ODBC_LoadDMFunctions();
497c2c66affSColin Finck           ODBC_ReplicateToRegistry();
498c2c66affSColin Finck        }
499c2c66affSColin Finck        break;
500c2c66affSColin Finck 
501c2c66affSColin Finck     case DLL_PROCESS_DETACH:
502c2c66affSColin Finck       if (reserved) break;
503c2c66affSColin Finck       if (dmHandle) wine_dlclose(dmHandle,NULL,0);
504c2c66affSColin Finck     }
505c2c66affSColin Finck 
506c2c66affSColin Finck     return TRUE;
507c2c66affSColin Finck }
508c2c66affSColin Finck 
509c2c66affSColin Finck /***********************************************************************
510c2c66affSColin Finck  * ODBC_LoadDriverManager [Internal] Load ODBC library.
511c2c66affSColin Finck  *
512c2c66affSColin Finck  * PARAMS
513c2c66affSColin Finck  *
514c2c66affSColin Finck  * RETURNS
515c2c66affSColin Finck  *     Success: TRUE
516c2c66affSColin Finck  *     Failure: FALSE
517c2c66affSColin Finck  */
518c2c66affSColin Finck 
ODBC_LoadDriverManager(void)519c2c66affSColin Finck static BOOL ODBC_LoadDriverManager(void)
520c2c66affSColin Finck {
521c2c66affSColin Finck    const char *s = getenv("LIB_ODBC_DRIVER_MANAGER");
522c2c66affSColin Finck    char error[256];
523c2c66affSColin Finck 
524c2c66affSColin Finck #ifdef SONAME_LIBODBC
525c2c66affSColin Finck    if (!s || !s[0]) s = SONAME_LIBODBC;
526c2c66affSColin Finck #endif
527c2c66affSColin Finck    if (!s || !s[0]) goto failed;
528c2c66affSColin Finck 
529c2c66affSColin Finck    dmHandle = wine_dlopen(s, RTLD_LAZY | RTLD_GLOBAL, error, sizeof(error));
530c2c66affSColin Finck 
531c2c66affSColin Finck    if (dmHandle != NULL)
532c2c66affSColin Finck    {
533c2c66affSColin Finck       TRACE("Opened library %s\n", s);
534c2c66affSColin Finck       nErrorType = ERROR_FREE;
535c2c66affSColin Finck       return TRUE;
536c2c66affSColin Finck    }
537c2c66affSColin Finck failed:
538c2c66affSColin Finck    ERR_(winediag)("failed to open library %s: %s\n", debugstr_a(s), error);
539c2c66affSColin Finck    nErrorType = ERROR_LIBRARY_NOT_FOUND;
540c2c66affSColin Finck    return FALSE;
541c2c66affSColin Finck }
542c2c66affSColin Finck 
543c2c66affSColin Finck 
544c2c66affSColin Finck /***********************************************************************
545c2c66affSColin Finck  * ODBC_LoadDMFunctions [Internal] Populate function table.
546c2c66affSColin Finck  *
547c2c66affSColin Finck  * PARAMS
548c2c66affSColin Finck  *
549c2c66affSColin Finck  * RETURNS
550c2c66affSColin Finck  *     Success: TRUE
551c2c66affSColin Finck  *     Failure: FALSE
552c2c66affSColin Finck  */
553c2c66affSColin Finck 
ODBC_LoadDMFunctions(void)554c2c66affSColin Finck static BOOL ODBC_LoadDMFunctions(void)
555c2c66affSColin Finck {
556c2c66affSColin Finck     char error[256];
557c2c66affSColin Finck 
558c2c66affSColin Finck     if (dmHandle == NULL)
559c2c66affSColin Finck         return FALSE;
560c2c66affSColin Finck 
561c2c66affSColin Finck #define LOAD_FUNC(name) \
562c2c66affSColin Finck     if ((p##name = wine_dlsym( dmHandle, #name, error, sizeof(error) ))); \
563c2c66affSColin Finck     else WARN( "Failed to load %s: %s\n", #name, error )
564c2c66affSColin Finck 
565c2c66affSColin Finck     LOAD_FUNC(SQLAllocConnect);
566c2c66affSColin Finck     LOAD_FUNC(SQLAllocEnv);
567c2c66affSColin Finck     LOAD_FUNC(SQLAllocHandle);
568c2c66affSColin Finck     LOAD_FUNC(SQLAllocHandleStd);
569c2c66affSColin Finck     LOAD_FUNC(SQLAllocStmt);
570c2c66affSColin Finck     LOAD_FUNC(SQLBindCol);
571c2c66affSColin Finck     LOAD_FUNC(SQLBindParam);
572c2c66affSColin Finck     LOAD_FUNC(SQLBindParameter);
573c2c66affSColin Finck     LOAD_FUNC(SQLBrowseConnect);
574c2c66affSColin Finck     LOAD_FUNC(SQLBrowseConnectW);
575c2c66affSColin Finck     LOAD_FUNC(SQLBulkOperations);
576c2c66affSColin Finck     LOAD_FUNC(SQLCancel);
577c2c66affSColin Finck     LOAD_FUNC(SQLCloseCursor);
578c2c66affSColin Finck     LOAD_FUNC(SQLColAttribute);
579c2c66affSColin Finck     LOAD_FUNC(SQLColAttributeW);
580c2c66affSColin Finck     LOAD_FUNC(SQLColAttributes);
581c2c66affSColin Finck     LOAD_FUNC(SQLColAttributesW);
582c2c66affSColin Finck     LOAD_FUNC(SQLColumnPrivileges);
583c2c66affSColin Finck     LOAD_FUNC(SQLColumnPrivilegesW);
584c2c66affSColin Finck     LOAD_FUNC(SQLColumns);
585c2c66affSColin Finck     LOAD_FUNC(SQLColumnsW);
586c2c66affSColin Finck     LOAD_FUNC(SQLConnect);
587c2c66affSColin Finck     LOAD_FUNC(SQLConnectW);
588c2c66affSColin Finck     LOAD_FUNC(SQLCopyDesc);
589c2c66affSColin Finck     LOAD_FUNC(SQLDataSources);
590c2c66affSColin Finck     LOAD_FUNC(SQLDataSourcesA);
591c2c66affSColin Finck     LOAD_FUNC(SQLDataSourcesW);
592c2c66affSColin Finck     LOAD_FUNC(SQLDescribeCol);
593c2c66affSColin Finck     LOAD_FUNC(SQLDescribeColW);
594c2c66affSColin Finck     LOAD_FUNC(SQLDescribeParam);
595c2c66affSColin Finck     LOAD_FUNC(SQLDisconnect);
596c2c66affSColin Finck     LOAD_FUNC(SQLDriverConnect);
597c2c66affSColin Finck     LOAD_FUNC(SQLDriverConnectW);
598c2c66affSColin Finck     LOAD_FUNC(SQLDrivers);
599c2c66affSColin Finck     LOAD_FUNC(SQLDriversW);
600c2c66affSColin Finck     LOAD_FUNC(SQLEndTran);
601c2c66affSColin Finck     LOAD_FUNC(SQLError);
602c2c66affSColin Finck     LOAD_FUNC(SQLErrorW);
603c2c66affSColin Finck     LOAD_FUNC(SQLExecDirect);
604c2c66affSColin Finck     LOAD_FUNC(SQLExecDirectW);
605c2c66affSColin Finck     LOAD_FUNC(SQLExecute);
606c2c66affSColin Finck     LOAD_FUNC(SQLExtendedFetch);
607c2c66affSColin Finck     LOAD_FUNC(SQLFetch);
608c2c66affSColin Finck     LOAD_FUNC(SQLFetchScroll);
609c2c66affSColin Finck     LOAD_FUNC(SQLForeignKeys);
610c2c66affSColin Finck     LOAD_FUNC(SQLForeignKeysW);
611c2c66affSColin Finck     LOAD_FUNC(SQLFreeConnect);
612c2c66affSColin Finck     LOAD_FUNC(SQLFreeEnv);
613c2c66affSColin Finck     LOAD_FUNC(SQLFreeHandle);
614c2c66affSColin Finck     LOAD_FUNC(SQLFreeStmt);
615c2c66affSColin Finck     LOAD_FUNC(SQLGetConnectAttr);
616c2c66affSColin Finck     LOAD_FUNC(SQLGetConnectAttrW);
617c2c66affSColin Finck     LOAD_FUNC(SQLGetConnectOption);
618c2c66affSColin Finck     LOAD_FUNC(SQLGetConnectOptionW);
619c2c66affSColin Finck     LOAD_FUNC(SQLGetCursorName);
620c2c66affSColin Finck     LOAD_FUNC(SQLGetCursorNameW);
621c2c66affSColin Finck     LOAD_FUNC(SQLGetData);
622c2c66affSColin Finck     LOAD_FUNC(SQLGetDescField);
623c2c66affSColin Finck     LOAD_FUNC(SQLGetDescFieldW);
624c2c66affSColin Finck     LOAD_FUNC(SQLGetDescRec);
625c2c66affSColin Finck     LOAD_FUNC(SQLGetDescRecW);
626c2c66affSColin Finck     LOAD_FUNC(SQLGetDiagField);
627c2c66affSColin Finck     LOAD_FUNC(SQLGetDiagFieldW);
628c2c66affSColin Finck     LOAD_FUNC(SQLGetDiagRec);
62904ef5f7aSAmine Khaldi     LOAD_FUNC(SQLGetDiagRecA);
630c2c66affSColin Finck     LOAD_FUNC(SQLGetDiagRecW);
631c2c66affSColin Finck     LOAD_FUNC(SQLGetEnvAttr);
632c2c66affSColin Finck     LOAD_FUNC(SQLGetFunctions);
633c2c66affSColin Finck     LOAD_FUNC(SQLGetInfo);
634c2c66affSColin Finck     LOAD_FUNC(SQLGetInfoW);
635c2c66affSColin Finck     LOAD_FUNC(SQLGetStmtAttr);
636c2c66affSColin Finck     LOAD_FUNC(SQLGetStmtAttrW);
637c2c66affSColin Finck     LOAD_FUNC(SQLGetStmtOption);
638c2c66affSColin Finck     LOAD_FUNC(SQLGetTypeInfo);
639c2c66affSColin Finck     LOAD_FUNC(SQLGetTypeInfoW);
640c2c66affSColin Finck     LOAD_FUNC(SQLMoreResults);
641c2c66affSColin Finck     LOAD_FUNC(SQLNativeSql);
642c2c66affSColin Finck     LOAD_FUNC(SQLNativeSqlW);
643c2c66affSColin Finck     LOAD_FUNC(SQLNumParams);
644c2c66affSColin Finck     LOAD_FUNC(SQLNumResultCols);
645c2c66affSColin Finck     LOAD_FUNC(SQLParamData);
646c2c66affSColin Finck     LOAD_FUNC(SQLParamOptions);
647c2c66affSColin Finck     LOAD_FUNC(SQLPrepare);
648c2c66affSColin Finck     LOAD_FUNC(SQLPrepareW);
649c2c66affSColin Finck     LOAD_FUNC(SQLPrimaryKeys);
650c2c66affSColin Finck     LOAD_FUNC(SQLPrimaryKeysW);
651c2c66affSColin Finck     LOAD_FUNC(SQLProcedureColumns);
652c2c66affSColin Finck     LOAD_FUNC(SQLProcedureColumnsW);
653c2c66affSColin Finck     LOAD_FUNC(SQLProcedures);
654c2c66affSColin Finck     LOAD_FUNC(SQLProceduresW);
655c2c66affSColin Finck     LOAD_FUNC(SQLPutData);
656c2c66affSColin Finck     LOAD_FUNC(SQLRowCount);
657c2c66affSColin Finck     LOAD_FUNC(SQLSetConnectAttr);
658c2c66affSColin Finck     LOAD_FUNC(SQLSetConnectAttrW);
659c2c66affSColin Finck     LOAD_FUNC(SQLSetConnectOption);
660c2c66affSColin Finck     LOAD_FUNC(SQLSetConnectOptionW);
661c2c66affSColin Finck     LOAD_FUNC(SQLSetCursorName);
662c2c66affSColin Finck     LOAD_FUNC(SQLSetCursorNameW);
663c2c66affSColin Finck     LOAD_FUNC(SQLSetDescField);
664c2c66affSColin Finck     LOAD_FUNC(SQLSetDescFieldW);
665c2c66affSColin Finck     LOAD_FUNC(SQLSetDescRec);
666c2c66affSColin Finck     LOAD_FUNC(SQLSetEnvAttr);
667c2c66affSColin Finck     LOAD_FUNC(SQLSetParam);
668c2c66affSColin Finck     LOAD_FUNC(SQLSetPos);
669c2c66affSColin Finck     LOAD_FUNC(SQLSetScrollOptions);
670c2c66affSColin Finck     LOAD_FUNC(SQLSetStmtAttr);
671c2c66affSColin Finck     LOAD_FUNC(SQLSetStmtAttrW);
672c2c66affSColin Finck     LOAD_FUNC(SQLSetStmtOption);
673c2c66affSColin Finck     LOAD_FUNC(SQLSpecialColumns);
674c2c66affSColin Finck     LOAD_FUNC(SQLSpecialColumnsW);
675c2c66affSColin Finck     LOAD_FUNC(SQLStatistics);
676c2c66affSColin Finck     LOAD_FUNC(SQLStatisticsW);
677c2c66affSColin Finck     LOAD_FUNC(SQLTablePrivileges);
678c2c66affSColin Finck     LOAD_FUNC(SQLTablePrivilegesW);
679c2c66affSColin Finck     LOAD_FUNC(SQLTables);
680c2c66affSColin Finck     LOAD_FUNC(SQLTablesW);
681c2c66affSColin Finck     LOAD_FUNC(SQLTransact);
682c2c66affSColin Finck #undef LOAD_FUNC
683c2c66affSColin Finck 
684c2c66affSColin Finck     return TRUE;
685c2c66affSColin Finck }
686c2c66affSColin Finck 
687c2c66affSColin Finck /*************************************************************************
688c2c66affSColin Finck  *				SQLAllocConnect           [ODBC32.001]
689c2c66affSColin Finck  */
ODBC32_SQLAllocConnect(SQLHENV EnvironmentHandle,SQLHDBC * ConnectionHandle)69004ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
691c2c66affSColin Finck {
692c2c66affSColin Finck     SQLRETURN ret;
693*4658658fSAmine Khaldi 
694*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle);
695c2c66affSColin Finck 
696c2c66affSColin Finck     if (!pSQLAllocConnect)
697c2c66affSColin Finck     {
698c2c66affSColin Finck         *ConnectionHandle = SQL_NULL_HDBC;
699c2c66affSColin Finck         TRACE("Not ready\n");
700c2c66affSColin Finck         return SQL_ERROR;
701c2c66affSColin Finck     }
702c2c66affSColin Finck 
703c2c66affSColin Finck     ret = pSQLAllocConnect(EnvironmentHandle, ConnectionHandle);
704*4658658fSAmine Khaldi     TRACE("Returning %d, ConnectionHandle %p\n", ret, *ConnectionHandle);
705c2c66affSColin Finck     return ret;
706c2c66affSColin Finck }
707c2c66affSColin Finck 
708c2c66affSColin Finck /*************************************************************************
709c2c66affSColin Finck  *				SQLAllocEnv           [ODBC32.002]
710c2c66affSColin Finck  */
ODBC32_SQLAllocEnv(SQLHENV * EnvironmentHandle)71104ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLAllocEnv(SQLHENV *EnvironmentHandle)
712c2c66affSColin Finck {
713c2c66affSColin Finck     SQLRETURN ret;
714*4658658fSAmine Khaldi 
715*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
716c2c66affSColin Finck 
717c2c66affSColin Finck     if (!pSQLAllocEnv)
718c2c66affSColin Finck     {
719c2c66affSColin Finck         *EnvironmentHandle = SQL_NULL_HENV;
720c2c66affSColin Finck         TRACE("Not ready\n");
721c2c66affSColin Finck         return SQL_ERROR;
722c2c66affSColin Finck     }
723c2c66affSColin Finck 
724c2c66affSColin Finck     ret = pSQLAllocEnv(EnvironmentHandle);
725*4658658fSAmine Khaldi     TRACE("Returning %d, EnvironmentHandle %p\n", ret, *EnvironmentHandle);
726c2c66affSColin Finck     return ret;
727c2c66affSColin Finck }
728c2c66affSColin Finck 
729c2c66affSColin Finck /*************************************************************************
730c2c66affSColin Finck  *				SQLAllocHandle           [ODBC32.024]
731c2c66affSColin Finck  */
ODBC32_SQLAllocHandle(SQLSMALLINT HandleType,SQLHANDLE InputHandle,SQLHANDLE * OutputHandle)73204ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
733c2c66affSColin Finck {
734c2c66affSColin Finck     SQLRETURN ret;
735*4658658fSAmine Khaldi 
736*4658658fSAmine Khaldi     TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
737c2c66affSColin Finck 
738c2c66affSColin Finck     if (!pSQLAllocHandle)
739c2c66affSColin Finck     {
740c2c66affSColin Finck         if (nErrorType == ERROR_LIBRARY_NOT_FOUND)
741c2c66affSColin Finck             WARN("ProxyODBC: Cannot load ODBC driver manager library.\n");
742c2c66affSColin Finck 
743c2c66affSColin Finck         if (HandleType == SQL_HANDLE_ENV)
744c2c66affSColin Finck             *OutputHandle = SQL_NULL_HENV;
745c2c66affSColin Finck         else if (HandleType == SQL_HANDLE_DBC)
746c2c66affSColin Finck             *OutputHandle = SQL_NULL_HDBC;
747c2c66affSColin Finck         else if (HandleType == SQL_HANDLE_STMT)
748c2c66affSColin Finck             *OutputHandle = SQL_NULL_HSTMT;
749c2c66affSColin Finck         else if (HandleType == SQL_HANDLE_DESC)
750c2c66affSColin Finck             *OutputHandle = SQL_NULL_HDESC;
751c2c66affSColin Finck 
752c2c66affSColin Finck         TRACE ("Not ready\n");
753c2c66affSColin Finck         return SQL_ERROR;
754c2c66affSColin Finck     }
755c2c66affSColin Finck 
756c2c66affSColin Finck     ret = pSQLAllocHandle(HandleType, InputHandle, OutputHandle);
757*4658658fSAmine Khaldi     TRACE("Returning %d, Handle %p\n", ret, *OutputHandle);
758c2c66affSColin Finck     return ret;
759c2c66affSColin Finck }
760c2c66affSColin Finck 
761c2c66affSColin Finck /*************************************************************************
762c2c66affSColin Finck  *				SQLAllocStmt           [ODBC32.003]
763c2c66affSColin Finck  */
ODBC32_SQLAllocStmt(SQLHDBC ConnectionHandle,SQLHSTMT * StatementHandle)76404ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
765c2c66affSColin Finck {
766c2c66affSColin Finck     SQLRETURN ret;
767c2c66affSColin Finck 
768*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
769c2c66affSColin Finck 
770c2c66affSColin Finck     if (!pSQLAllocStmt)
771c2c66affSColin Finck     {
772c2c66affSColin Finck         *StatementHandle = SQL_NULL_HSTMT;
773c2c66affSColin Finck         TRACE("Not ready\n");
774c2c66affSColin Finck         return SQL_ERROR;
775c2c66affSColin Finck     }
776c2c66affSColin Finck 
777c2c66affSColin Finck     ret = pSQLAllocStmt(ConnectionHandle, StatementHandle);
778*4658658fSAmine Khaldi     TRACE ("Returning %d, StatementHandle %p\n", ret, *StatementHandle);
779c2c66affSColin Finck     return ret;
780c2c66affSColin Finck }
781c2c66affSColin Finck 
782c2c66affSColin Finck /*************************************************************************
783c2c66affSColin Finck  *				SQLAllocHandleStd           [ODBC32.077]
784c2c66affSColin Finck  */
ODBC32_SQLAllocHandleStd(SQLSMALLINT HandleType,SQLHANDLE InputHandle,SQLHANDLE * OutputHandle)785*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
786c2c66affSColin Finck {
787*4658658fSAmine Khaldi     SQLRETURN ret;
788*4658658fSAmine Khaldi 
789*4658658fSAmine Khaldi     TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
790c2c66affSColin Finck 
791c2c66affSColin Finck     if (!pSQLAllocHandleStd)
792c2c66affSColin Finck     {
793c2c66affSColin Finck         if (nErrorType == ERROR_LIBRARY_NOT_FOUND)
794c2c66affSColin Finck             WARN("ProxyODBC: Cannot load ODBC driver manager library.\n");
795c2c66affSColin Finck 
796c2c66affSColin Finck         if (HandleType == SQL_HANDLE_ENV)
797c2c66affSColin Finck             *OutputHandle = SQL_NULL_HENV;
798c2c66affSColin Finck         else if (HandleType == SQL_HANDLE_DBC)
799c2c66affSColin Finck             *OutputHandle = SQL_NULL_HDBC;
800c2c66affSColin Finck         else if (HandleType == SQL_HANDLE_STMT)
801c2c66affSColin Finck             *OutputHandle = SQL_NULL_HSTMT;
802c2c66affSColin Finck         else if (HandleType == SQL_HANDLE_DESC)
803c2c66affSColin Finck             *OutputHandle = SQL_NULL_HDESC;
804c2c66affSColin Finck 
805c2c66affSColin Finck         return SQL_ERROR;
806c2c66affSColin Finck     }
807c2c66affSColin Finck 
808*4658658fSAmine Khaldi     ret = pSQLAllocHandleStd(HandleType, InputHandle, OutputHandle);
809*4658658fSAmine Khaldi     TRACE ("Returning %d, OutputHandle %p\n", ret, *OutputHandle);
810*4658658fSAmine Khaldi     return ret;
811c2c66affSColin Finck }
812c2c66affSColin Finck 
debugstr_sqllen(SQLLEN len)813*4658658fSAmine Khaldi static const char *debugstr_sqllen( SQLLEN len )
814*4658658fSAmine Khaldi {
815*4658658fSAmine Khaldi #ifdef _WIN64
816*4658658fSAmine Khaldi     return wine_dbg_sprintf( "%ld", len );
817*4658658fSAmine Khaldi #else
818*4658658fSAmine Khaldi     return wine_dbg_sprintf( "%d", len );
819*4658658fSAmine Khaldi #endif
820*4658658fSAmine Khaldi }
821c2c66affSColin Finck 
822c2c66affSColin Finck /*************************************************************************
823c2c66affSColin Finck  *				SQLBindCol           [ODBC32.004]
824c2c66affSColin Finck  */
ODBC32_SQLBindCol(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,SQLSMALLINT TargetType,SQLPOINTER TargetValue,SQLLEN BufferLength,SQLLEN * StrLen_or_Ind)825*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
826*4658658fSAmine Khaldi                                    SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
827c2c66affSColin Finck {
828*4658658fSAmine Khaldi     SQLRETURN ret;
829*4658658fSAmine Khaldi 
830*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
831*4658658fSAmine Khaldi           StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
832c2c66affSColin Finck 
833c2c66affSColin Finck     if (!pSQLBindCol)
834c2c66affSColin Finck     {
835c2c66affSColin Finck         TRACE("Not ready\n");
836c2c66affSColin Finck         return SQL_ERROR;
837c2c66affSColin Finck     }
838c2c66affSColin Finck 
839*4658658fSAmine Khaldi     ret = pSQLBindCol(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind);
840*4658658fSAmine Khaldi     TRACE ("Returning %d\n", ret);
841*4658658fSAmine Khaldi     return ret;
842c2c66affSColin Finck }
843c2c66affSColin Finck 
debugstr_sqlulen(SQLULEN len)844*4658658fSAmine Khaldi static const char *debugstr_sqlulen( SQLULEN len )
845*4658658fSAmine Khaldi {
846*4658658fSAmine Khaldi #ifdef _WIN64
847*4658658fSAmine Khaldi     return wine_dbg_sprintf( "%lu", len );
848*4658658fSAmine Khaldi #else
849*4658658fSAmine Khaldi     return wine_dbg_sprintf( "%u", len );
850*4658658fSAmine Khaldi #endif
851*4658658fSAmine Khaldi }
852c2c66affSColin Finck 
853c2c66affSColin Finck /*************************************************************************
854c2c66affSColin Finck  *				SQLBindParam           [ODBC32.025]
855c2c66affSColin Finck  */
ODBC32_SQLBindParam(SQLHSTMT StatementHandle,SQLUSMALLINT ParameterNumber,SQLSMALLINT ValueType,SQLSMALLINT ParameterType,SQLULEN LengthPrecision,SQLSMALLINT ParameterScale,SQLPOINTER ParameterValue,SQLLEN * StrLen_or_Ind)856*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
857*4658658fSAmine Khaldi                                      SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
858*4658658fSAmine Khaldi                                      SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
859c2c66affSColin Finck {
860*4658658fSAmine Khaldi     SQLRETURN ret;
861*4658658fSAmine Khaldi 
862*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
863*4658658fSAmine Khaldi           " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
864*4658658fSAmine Khaldi           ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
865c2c66affSColin Finck 
866c2c66affSColin Finck     if (!pSQLBindParam) return SQL_ERROR;
867c2c66affSColin Finck 
868*4658658fSAmine Khaldi     ret = pSQLBindParam(StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision, ParameterScale,
869*4658658fSAmine Khaldi                         ParameterValue, StrLen_or_Ind);
870*4658658fSAmine Khaldi     TRACE ("Returning %d\n", ret);
871*4658658fSAmine Khaldi     return ret;
872*4658658fSAmine Khaldi }
873c2c66affSColin Finck 
874c2c66affSColin Finck /*************************************************************************
875c2c66affSColin Finck  *				SQLCancel           [ODBC32.005]
876c2c66affSColin Finck  */
ODBC32_SQLCancel(SQLHSTMT StatementHandle)87704ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLCancel(SQLHSTMT StatementHandle)
878c2c66affSColin Finck {
879*4658658fSAmine Khaldi     SQLRETURN ret;
880*4658658fSAmine Khaldi 
881*4658658fSAmine Khaldi     TRACE("(StatementHandle %p)\n", StatementHandle);
882c2c66affSColin Finck 
883c2c66affSColin Finck     if (!pSQLCancel) return SQL_ERROR;
884c2c66affSColin Finck 
885*4658658fSAmine Khaldi     ret = pSQLCancel(StatementHandle);
886*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
887*4658658fSAmine Khaldi     return ret;
888*4658658fSAmine Khaldi }
889c2c66affSColin Finck 
890c2c66affSColin Finck /*************************************************************************
891c2c66affSColin Finck  *				SQLCloseCursor           [ODBC32.026]
892c2c66affSColin Finck  */
ODBC32_SQLCloseCursor(SQLHSTMT StatementHandle)89304ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLCloseCursor(SQLHSTMT StatementHandle)
894c2c66affSColin Finck {
895c2c66affSColin Finck     SQLRETURN ret;
896*4658658fSAmine Khaldi 
897*4658658fSAmine Khaldi     TRACE("(StatementHandle %p)\n", StatementHandle);
898c2c66affSColin Finck 
899c2c66affSColin Finck     if (!pSQLCloseCursor) return SQL_ERROR;
900c2c66affSColin Finck 
901c2c66affSColin Finck     ret = pSQLCloseCursor(StatementHandle);
902*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
903c2c66affSColin Finck     return ret;
904c2c66affSColin Finck }
905c2c66affSColin Finck 
906c2c66affSColin Finck /*************************************************************************
907c2c66affSColin Finck  *				SQLColAttribute           [ODBC32.027]
908c2c66affSColin Finck  */
ODBC32_SQLColAttribute(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,SQLUSMALLINT FieldIdentifier,SQLPOINTER CharacterAttribute,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength,SQLLEN * NumericAttribute)909*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
910*4658658fSAmine Khaldi                                         SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
911*4658658fSAmine Khaldi                                         SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
912*4658658fSAmine Khaldi                                         SQLLEN *NumericAttribute)
913c2c66affSColin Finck {
914*4658658fSAmine Khaldi     SQLRETURN ret;
915*4658658fSAmine Khaldi 
916*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d,"
917*4658658fSAmine Khaldi           " StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier,
918*4658658fSAmine Khaldi           CharacterAttribute, BufferLength, StringLength, NumericAttribute);
919c2c66affSColin Finck 
920c2c66affSColin Finck     if (!pSQLColAttribute) return SQL_ERROR;
921c2c66affSColin Finck 
922*4658658fSAmine Khaldi     ret = pSQLColAttribute(StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength,
923*4658658fSAmine Khaldi                            StringLength, NumericAttribute);
924*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
925*4658658fSAmine Khaldi     return ret;
926*4658658fSAmine Khaldi }
927c2c66affSColin Finck 
928c2c66affSColin Finck /*************************************************************************
929c2c66affSColin Finck  *				SQLColumns           [ODBC32.040]
930c2c66affSColin Finck  */
ODBC32_SQLColumns(SQLHSTMT StatementHandle,SQLCHAR * CatalogName,SQLSMALLINT NameLength1,SQLCHAR * SchemaName,SQLSMALLINT NameLength2,SQLCHAR * TableName,SQLSMALLINT NameLength3,SQLCHAR * ColumnName,SQLSMALLINT NameLength4)931*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
932*4658658fSAmine Khaldi                                    SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
933*4658658fSAmine Khaldi                                    SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
934c2c66affSColin Finck {
935*4658658fSAmine Khaldi     SQLRETURN ret;
936*4658658fSAmine Khaldi 
937*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
938*4658658fSAmine Khaldi           " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
939*4658658fSAmine Khaldi           debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
940*4658658fSAmine Khaldi           debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
941*4658658fSAmine Khaldi           debugstr_an((const char *)TableName, NameLength3), NameLength3,
942*4658658fSAmine Khaldi           debugstr_an((const char *)ColumnName, NameLength4), NameLength4);
943c2c66affSColin Finck 
944c2c66affSColin Finck     if (!pSQLColumns) return SQL_ERROR;
945c2c66affSColin Finck 
946*4658658fSAmine Khaldi     ret = pSQLColumns(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName,
947*4658658fSAmine Khaldi                       NameLength3, ColumnName, NameLength4);
948*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
949*4658658fSAmine Khaldi     return ret;
950*4658658fSAmine Khaldi }
951c2c66affSColin Finck 
952c2c66affSColin Finck /*************************************************************************
953c2c66affSColin Finck  *				SQLConnect           [ODBC32.007]
954c2c66affSColin Finck  */
ODBC32_SQLConnect(SQLHDBC ConnectionHandle,SQLCHAR * ServerName,SQLSMALLINT NameLength1,SQLCHAR * UserName,SQLSMALLINT NameLength2,SQLCHAR * Authentication,SQLSMALLINT NameLength3)955*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1,
956*4658658fSAmine Khaldi                                    SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication,
957*4658658fSAmine Khaldi                                    SQLSMALLINT NameLength3)
958c2c66affSColin Finck {
959c2c66affSColin Finck     SQLRETURN ret;
960*4658658fSAmine Khaldi 
961*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
962*4658658fSAmine Khaldi           " NameLength3 %d)\n", ConnectionHandle,
963*4658658fSAmine Khaldi           debugstr_an((const char *)ServerName, NameLength1), NameLength1,
964*4658658fSAmine Khaldi           debugstr_an((const char *)UserName, NameLength2), NameLength2,
965*4658658fSAmine Khaldi           debugstr_an((const char *)Authentication, NameLength3), NameLength3);
966c2c66affSColin Finck 
967c2c66affSColin Finck     if (!pSQLConnect) return SQL_ERROR;
968c2c66affSColin Finck 
969*4658658fSAmine Khaldi     ret = pSQLConnect(ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3);
970*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
971c2c66affSColin Finck     return ret;
972c2c66affSColin Finck }
973c2c66affSColin Finck 
974c2c66affSColin Finck /*************************************************************************
975c2c66affSColin Finck  *				SQLCopyDesc           [ODBC32.028]
976c2c66affSColin Finck  */
ODBC32_SQLCopyDesc(SQLHDESC SourceDescHandle,SQLHDESC TargetDescHandle)97704ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
978c2c66affSColin Finck {
979*4658658fSAmine Khaldi     SQLRETURN ret;
980*4658658fSAmine Khaldi 
981*4658658fSAmine Khaldi     TRACE("(SourceDescHandle %p, TargetDescHandle %p)\n", SourceDescHandle, TargetDescHandle);
982c2c66affSColin Finck 
983c2c66affSColin Finck     if (!pSQLCopyDesc) return SQL_ERROR;
984c2c66affSColin Finck 
985*4658658fSAmine Khaldi     ret = pSQLCopyDesc(SourceDescHandle, TargetDescHandle);
986*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
987*4658658fSAmine Khaldi     return ret;
988*4658658fSAmine Khaldi }
989c2c66affSColin Finck 
990c2c66affSColin Finck /*************************************************************************
991c2c66affSColin Finck  *				SQLDataSources           [ODBC32.057]
992c2c66affSColin Finck  */
ODBC32_SQLDataSources(SQLHENV EnvironmentHandle,SQLUSMALLINT Direction,SQLCHAR * ServerName,SQLSMALLINT BufferLength1,SQLSMALLINT * NameLength1,SQLCHAR * Description,SQLSMALLINT BufferLength2,SQLSMALLINT * NameLength2)993*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
994*4658658fSAmine Khaldi                                        SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
995*4658658fSAmine Khaldi                                        SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
996c2c66affSColin Finck {
997c2c66affSColin Finck     SQLRETURN ret;
998c2c66affSColin Finck 
999*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
1000*4658658fSAmine Khaldi           " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
1001*4658658fSAmine Khaldi           NameLength1, Description, BufferLength2, NameLength2);
1002c2c66affSColin Finck 
1003c2c66affSColin Finck     if (!pSQLDataSources) return SQL_ERROR;
1004c2c66affSColin Finck 
1005*4658658fSAmine Khaldi     ret = pSQLDataSources(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description,
1006*4658658fSAmine Khaldi                           BufferLength2, NameLength2);
1007*4658658fSAmine Khaldi     if (ret >= 0 && TRACE_ON(odbc))
1008c2c66affSColin Finck     {
1009*4658658fSAmine Khaldi         if (ServerName && NameLength1 && *NameLength1 > 0)
1010*4658658fSAmine Khaldi             TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
1011*4658658fSAmine Khaldi         if (Description && NameLength2 && *NameLength2 > 0)
1012*4658658fSAmine Khaldi             TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
1013c2c66affSColin Finck         TRACE("\n");
1014c2c66affSColin Finck     }
1015c2c66affSColin Finck 
1016*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1017c2c66affSColin Finck     return ret;
1018c2c66affSColin Finck }
1019c2c66affSColin Finck 
ODBC32_SQLDataSourcesA(SQLHENV EnvironmentHandle,SQLUSMALLINT Direction,SQLCHAR * ServerName,SQLSMALLINT BufferLength1,SQLSMALLINT * NameLength1,SQLCHAR * Description,SQLSMALLINT BufferLength2,SQLSMALLINT * NameLength2)1020*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDataSourcesA(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
1021*4658658fSAmine Khaldi                                         SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
1022*4658658fSAmine Khaldi                                         SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
1023c2c66affSColin Finck {
1024c2c66affSColin Finck     SQLRETURN ret;
1025c2c66affSColin Finck 
1026*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
1027*4658658fSAmine Khaldi           " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
1028*4658658fSAmine Khaldi           NameLength1, Description, BufferLength2, NameLength2);
1029c2c66affSColin Finck 
1030c2c66affSColin Finck     if (!pSQLDataSourcesA) return SQL_ERROR;
1031c2c66affSColin Finck 
1032*4658658fSAmine Khaldi     ret = pSQLDataSourcesA(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description,
1033*4658658fSAmine Khaldi                            BufferLength2, NameLength2);
1034c2c66affSColin Finck     if (TRACE_ON(odbc))
1035c2c66affSColin Finck     {
1036*4658658fSAmine Khaldi        if (ServerName && NameLength1 && *NameLength1 > 0)
1037*4658658fSAmine Khaldi             TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
1038*4658658fSAmine Khaldi        if (Description && NameLength2 && *NameLength2 > 0)
1039*4658658fSAmine Khaldi             TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
1040c2c66affSColin Finck        TRACE("\n");
1041c2c66affSColin Finck     }
1042c2c66affSColin Finck 
1043*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1044c2c66affSColin Finck     return ret;
1045c2c66affSColin Finck }
1046c2c66affSColin Finck 
1047c2c66affSColin Finck /*************************************************************************
1048c2c66affSColin Finck  *				SQLDescribeCol           [ODBC32.008]
1049c2c66affSColin Finck  */
ODBC32_SQLDescribeCol(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,SQLCHAR * ColumnName,SQLSMALLINT BufferLength,SQLSMALLINT * NameLength,SQLSMALLINT * DataType,SQLULEN * ColumnSize,SQLSMALLINT * DecimalDigits,SQLSMALLINT * Nullable)1050*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
1051*4658658fSAmine Khaldi                                        SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
1052*4658658fSAmine Khaldi                                        SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
1053c2c66affSColin Finck {
1054*4658658fSAmine Khaldi     SQLSMALLINT dummy;
1055*4658658fSAmine Khaldi     SQLRETURN ret;
1056*4658658fSAmine Khaldi 
1057*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
1058*4658658fSAmine Khaldi           " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
1059*4658658fSAmine Khaldi           BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
1060c2c66affSColin Finck 
1061c2c66affSColin Finck     if (!pSQLDescribeCol) return SQL_ERROR;
1062*4658658fSAmine Khaldi     if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
1063*4658658fSAmine Khaldi 
1064*4658658fSAmine Khaldi     ret = pSQLDescribeCol(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize,
1065*4658658fSAmine Khaldi                           DecimalDigits, Nullable);
1066*4658658fSAmine Khaldi     if (ret >= 0)
1067*4658658fSAmine Khaldi     {
1068*4658658fSAmine Khaldi         if (ColumnName && NameLength) TRACE(" ColumnName %s\n", debugstr_an((const char *)ColumnName, *NameLength));
1069*4658658fSAmine Khaldi         if (DataType) TRACE(" DataType %d\n", *DataType);
1070*4658658fSAmine Khaldi         if (ColumnSize) TRACE(" ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
1071*4658658fSAmine Khaldi         if (DecimalDigits) TRACE(" DecimalDigits %d\n", *DecimalDigits);
1072*4658658fSAmine Khaldi         if (Nullable) TRACE(" Nullable %d\n", *Nullable);
1073c2c66affSColin Finck     }
1074c2c66affSColin Finck 
1075*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1076*4658658fSAmine Khaldi     return ret;
1077*4658658fSAmine Khaldi }
1078c2c66affSColin Finck 
1079c2c66affSColin Finck /*************************************************************************
1080c2c66affSColin Finck  *				SQLDisconnect           [ODBC32.009]
1081c2c66affSColin Finck  */
ODBC32_SQLDisconnect(SQLHDBC ConnectionHandle)108204ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDisconnect(SQLHDBC ConnectionHandle)
1083c2c66affSColin Finck {
1084c2c66affSColin Finck     SQLRETURN ret;
1085*4658658fSAmine Khaldi 
1086*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
1087c2c66affSColin Finck 
1088c2c66affSColin Finck     if (!pSQLDisconnect) return SQL_ERROR;
1089c2c66affSColin Finck 
1090c2c66affSColin Finck     ret = pSQLDisconnect(ConnectionHandle);
1091*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1092c2c66affSColin Finck     return ret;
1093c2c66affSColin Finck }
1094c2c66affSColin Finck 
1095c2c66affSColin Finck /*************************************************************************
1096c2c66affSColin Finck  *				SQLEndTran           [ODBC32.029]
1097c2c66affSColin Finck  */
ODBC32_SQLEndTran(SQLSMALLINT HandleType,SQLHANDLE Handle,SQLSMALLINT CompletionType)109804ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
1099c2c66affSColin Finck {
1100*4658658fSAmine Khaldi     SQLRETURN ret;
1101*4658658fSAmine Khaldi 
1102*4658658fSAmine Khaldi     TRACE("(HandleType %d, Handle %p, CompletionType %d)\n", HandleType, Handle, CompletionType);
1103c2c66affSColin Finck 
1104c2c66affSColin Finck     if (!pSQLEndTran) return SQL_ERROR;
1105c2c66affSColin Finck 
1106*4658658fSAmine Khaldi     ret = pSQLEndTran(HandleType, Handle, CompletionType);
1107*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1108*4658658fSAmine Khaldi     return ret;
1109*4658658fSAmine Khaldi }
1110c2c66affSColin Finck 
1111c2c66affSColin Finck /*************************************************************************
1112c2c66affSColin Finck  *				SQLError           [ODBC32.010]
1113c2c66affSColin Finck  */
ODBC32_SQLError(SQLHENV EnvironmentHandle,SQLHDBC ConnectionHandle,SQLHSTMT StatementHandle,SQLCHAR * Sqlstate,SQLINTEGER * NativeError,SQLCHAR * MessageText,SQLSMALLINT BufferLength,SQLSMALLINT * TextLength)1114*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
1115*4658658fSAmine Khaldi                                  SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
1116*4658658fSAmine Khaldi                                  SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
1117c2c66affSColin Finck {
1118c2c66affSColin Finck     SQLRETURN ret;
1119c2c66affSColin Finck 
1120*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
1121*4658658fSAmine Khaldi           " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
1122*4658658fSAmine Khaldi           StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
1123c2c66affSColin Finck 
1124c2c66affSColin Finck     if (!pSQLError) return SQL_ERROR;
1125*4658658fSAmine Khaldi 
1126*4658658fSAmine Khaldi     ret = pSQLError(EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate, NativeError, MessageText,
1127*4658658fSAmine Khaldi                     BufferLength, TextLength);
1128*4658658fSAmine Khaldi 
1129c2c66affSColin Finck     if (ret == SQL_SUCCESS)
1130*4658658fSAmine Khaldi     {
1131*4658658fSAmine Khaldi         TRACE(" SQLState %s\n", debugstr_an((const char *)Sqlstate, 5));
1132*4658658fSAmine Khaldi         TRACE(" Error %d\n", *NativeError);
1133*4658658fSAmine Khaldi         TRACE(" MessageText %s\n", debugstr_an((const char *)MessageText, *TextLength));
1134c2c66affSColin Finck     }
1135c2c66affSColin Finck 
1136*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1137*4658658fSAmine Khaldi     return ret;
1138*4658658fSAmine Khaldi }
1139c2c66affSColin Finck 
1140c2c66affSColin Finck /*************************************************************************
1141c2c66affSColin Finck  *				SQLExecDirect           [ODBC32.011]
1142c2c66affSColin Finck  */
ODBC32_SQLExecDirect(SQLHSTMT StatementHandle,SQLCHAR * StatementText,SQLINTEGER TextLength)114304ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1144c2c66affSColin Finck {
1145*4658658fSAmine Khaldi     SQLRETURN ret;
1146*4658658fSAmine Khaldi 
1147*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1148*4658658fSAmine Khaldi           debugstr_an((const char *)StatementText, TextLength), TextLength);
1149c2c66affSColin Finck 
1150c2c66affSColin Finck     if (!pSQLExecDirect) return SQL_ERROR;
1151c2c66affSColin Finck 
1152*4658658fSAmine Khaldi     ret = pSQLExecDirect(StatementHandle, StatementText, TextLength);
1153*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1154*4658658fSAmine Khaldi     return ret;
1155*4658658fSAmine Khaldi }
1156c2c66affSColin Finck 
1157c2c66affSColin Finck /*************************************************************************
1158c2c66affSColin Finck  *				SQLExecute           [ODBC32.012]
1159c2c66affSColin Finck  */
ODBC32_SQLExecute(SQLHSTMT StatementHandle)116004ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLExecute(SQLHSTMT StatementHandle)
1161c2c66affSColin Finck {
1162*4658658fSAmine Khaldi     SQLRETURN ret;
1163*4658658fSAmine Khaldi 
1164*4658658fSAmine Khaldi     TRACE("(StatementHandle %p)\n", StatementHandle);
1165c2c66affSColin Finck 
1166c2c66affSColin Finck     if (!pSQLExecute) return SQL_ERROR;
1167c2c66affSColin Finck 
1168*4658658fSAmine Khaldi     ret = pSQLExecute(StatementHandle);
1169*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1170*4658658fSAmine Khaldi     return ret;
1171*4658658fSAmine Khaldi }
1172c2c66affSColin Finck 
1173c2c66affSColin Finck /*************************************************************************
1174c2c66affSColin Finck  *				SQLFetch           [ODBC32.013]
1175c2c66affSColin Finck  */
ODBC32_SQLFetch(SQLHSTMT StatementHandle)117604ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLFetch(SQLHSTMT StatementHandle)
1177c2c66affSColin Finck {
1178*4658658fSAmine Khaldi     SQLRETURN ret;
1179*4658658fSAmine Khaldi 
1180*4658658fSAmine Khaldi     TRACE("(StatementHandle %p)\n", StatementHandle);
1181c2c66affSColin Finck 
1182c2c66affSColin Finck     if (!pSQLFetch) return SQL_ERROR;
1183c2c66affSColin Finck 
1184*4658658fSAmine Khaldi     ret = pSQLFetch(StatementHandle);
1185*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1186*4658658fSAmine Khaldi     return ret;
1187*4658658fSAmine Khaldi }
1188c2c66affSColin Finck 
1189c2c66affSColin Finck /*************************************************************************
1190c2c66affSColin Finck  *				SQLFetchScroll          [ODBC32.030]
1191c2c66affSColin Finck  */
ODBC32_SQLFetchScroll(SQLHSTMT StatementHandle,SQLSMALLINT FetchOrientation,SQLLEN FetchOffset)119204ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset)
1193c2c66affSColin Finck {
1194*4658658fSAmine Khaldi     SQLRETURN ret;
1195*4658658fSAmine Khaldi 
1196*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s)\n", StatementHandle, FetchOrientation,
1197*4658658fSAmine Khaldi           debugstr_sqllen(FetchOffset));
1198c2c66affSColin Finck 
1199c2c66affSColin Finck     if (!pSQLFetchScroll) return SQL_ERROR;
1200c2c66affSColin Finck 
1201*4658658fSAmine Khaldi     ret = pSQLFetchScroll(StatementHandle, FetchOrientation, FetchOffset);
1202*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1203*4658658fSAmine Khaldi     return ret;
1204*4658658fSAmine Khaldi }
1205c2c66affSColin Finck 
1206c2c66affSColin Finck /*************************************************************************
1207c2c66affSColin Finck  *				SQLFreeConnect           [ODBC32.014]
1208c2c66affSColin Finck  */
ODBC32_SQLFreeConnect(SQLHDBC ConnectionHandle)120904ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLFreeConnect(SQLHDBC ConnectionHandle)
1210c2c66affSColin Finck {
1211c2c66affSColin Finck     SQLRETURN ret;
1212*4658658fSAmine Khaldi 
1213*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
1214c2c66affSColin Finck 
1215c2c66affSColin Finck     if (!pSQLFreeConnect) return SQL_ERROR;
1216c2c66affSColin Finck 
1217c2c66affSColin Finck     ret = pSQLFreeConnect(ConnectionHandle);
1218*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1219c2c66affSColin Finck     return ret;
1220c2c66affSColin Finck }
1221c2c66affSColin Finck 
1222c2c66affSColin Finck /*************************************************************************
1223c2c66affSColin Finck  *				SQLFreeEnv           [ODBC32.015]
1224c2c66affSColin Finck  */
ODBC32_SQLFreeEnv(SQLHENV EnvironmentHandle)122504ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLFreeEnv(SQLHENV EnvironmentHandle)
1226c2c66affSColin Finck {
1227c2c66affSColin Finck     SQLRETURN ret;
1228*4658658fSAmine Khaldi 
1229c2c66affSColin Finck     TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
1230c2c66affSColin Finck 
1231c2c66affSColin Finck     if (!pSQLFreeEnv) return SQL_ERROR;
1232c2c66affSColin Finck 
1233c2c66affSColin Finck     ret = pSQLFreeEnv(EnvironmentHandle);
1234*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1235c2c66affSColin Finck     return ret;
1236c2c66affSColin Finck }
1237c2c66affSColin Finck 
1238c2c66affSColin Finck /*************************************************************************
1239c2c66affSColin Finck  *				SQLFreeHandle           [ODBC32.031]
1240c2c66affSColin Finck  */
ODBC32_SQLFreeHandle(SQLSMALLINT HandleType,SQLHANDLE Handle)124104ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
1242c2c66affSColin Finck {
1243c2c66affSColin Finck     SQLRETURN ret;
1244*4658658fSAmine Khaldi 
1245*4658658fSAmine Khaldi     TRACE("(HandleType %d, Handle %p)\n", HandleType, Handle);
1246c2c66affSColin Finck 
1247c2c66affSColin Finck     if (!pSQLFreeHandle) return SQL_ERROR;
1248c2c66affSColin Finck 
1249c2c66affSColin Finck     ret = pSQLFreeHandle(HandleType, Handle);
1250*4658658fSAmine Khaldi     TRACE ("Returning %d\n", ret);
1251c2c66affSColin Finck     return ret;
1252c2c66affSColin Finck }
1253c2c66affSColin Finck 
1254c2c66affSColin Finck /*************************************************************************
1255c2c66affSColin Finck  *				SQLFreeStmt           [ODBC32.016]
1256c2c66affSColin Finck  */
ODBC32_SQLFreeStmt(SQLHSTMT StatementHandle,SQLUSMALLINT Option)125704ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
1258c2c66affSColin Finck {
1259c2c66affSColin Finck     SQLRETURN ret;
1260*4658658fSAmine Khaldi 
1261*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option);
1262c2c66affSColin Finck 
1263c2c66affSColin Finck     if (!pSQLFreeStmt) return SQL_ERROR;
1264c2c66affSColin Finck 
1265c2c66affSColin Finck     ret = pSQLFreeStmt(StatementHandle, Option);
1266*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1267c2c66affSColin Finck     return ret;
1268c2c66affSColin Finck }
1269c2c66affSColin Finck 
1270c2c66affSColin Finck /*************************************************************************
1271c2c66affSColin Finck  *				SQLGetConnectAttr           [ODBC32.032]
1272c2c66affSColin Finck  */
ODBC32_SQLGetConnectAttr(SQLHDBC ConnectionHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER BufferLength,SQLINTEGER * StringLength)1273*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1274c2c66affSColin Finck                                           SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1275c2c66affSColin Finck {
1276*4658658fSAmine Khaldi     SQLRETURN ret;
1277*4658658fSAmine Khaldi 
1278*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
1279*4658658fSAmine Khaldi           Attribute, Value, BufferLength, StringLength);
1280c2c66affSColin Finck 
1281c2c66affSColin Finck     if (!pSQLGetConnectAttr) return SQL_ERROR;
1282c2c66affSColin Finck 
1283*4658658fSAmine Khaldi     ret = pSQLGetConnectAttr(ConnectionHandle, Attribute, Value, BufferLength, StringLength);
1284*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1285*4658658fSAmine Khaldi     return ret;
1286*4658658fSAmine Khaldi }
1287c2c66affSColin Finck 
1288c2c66affSColin Finck /*************************************************************************
1289c2c66affSColin Finck  *				SQLGetConnectOption       [ODBC32.042]
1290c2c66affSColin Finck  */
ODBC32_SQLGetConnectOption(SQLHDBC ConnectionHandle,SQLUSMALLINT Option,SQLPOINTER Value)129104ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1292c2c66affSColin Finck {
1293*4658658fSAmine Khaldi     SQLRETURN ret;
1294*4658658fSAmine Khaldi 
1295*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
1296c2c66affSColin Finck 
1297c2c66affSColin Finck     if (!pSQLGetConnectOption) return SQL_ERROR;
1298c2c66affSColin Finck 
1299*4658658fSAmine Khaldi     ret = pSQLGetConnectOption(ConnectionHandle, Option, Value);
1300*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1301*4658658fSAmine Khaldi     return ret;
1302*4658658fSAmine Khaldi }
1303c2c66affSColin Finck 
1304c2c66affSColin Finck /*************************************************************************
1305c2c66affSColin Finck  *				SQLGetCursorName           [ODBC32.017]
1306c2c66affSColin Finck  */
ODBC32_SQLGetCursorName(SQLHSTMT StatementHandle,SQLCHAR * CursorName,SQLSMALLINT BufferLength,SQLSMALLINT * NameLength)1307*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength,
1308c2c66affSColin Finck                                          SQLSMALLINT *NameLength)
1309c2c66affSColin Finck {
1310*4658658fSAmine Khaldi     SQLRETURN ret;
1311*4658658fSAmine Khaldi 
1312*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
1313*4658658fSAmine Khaldi           BufferLength, NameLength);
1314c2c66affSColin Finck 
1315c2c66affSColin Finck     if (!pSQLGetCursorName) return SQL_ERROR;
1316c2c66affSColin Finck 
1317*4658658fSAmine Khaldi     ret = pSQLGetCursorName(StatementHandle, CursorName, BufferLength, NameLength);
1318*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1319*4658658fSAmine Khaldi     return ret;
1320*4658658fSAmine Khaldi }
1321c2c66affSColin Finck 
1322c2c66affSColin Finck /*************************************************************************
1323c2c66affSColin Finck  *				SQLGetData           [ODBC32.043]
1324c2c66affSColin Finck  */
ODBC32_SQLGetData(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,SQLSMALLINT TargetType,SQLPOINTER TargetValue,SQLLEN BufferLength,SQLLEN * StrLen_or_Ind)1325*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
1326*4658658fSAmine Khaldi                                    SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
1327c2c66affSColin Finck {
1328*4658658fSAmine Khaldi     SQLRETURN ret;
1329*4658658fSAmine Khaldi 
1330*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
1331*4658658fSAmine Khaldi           StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
1332c2c66affSColin Finck 
1333c2c66affSColin Finck     if (!pSQLGetData) return SQL_ERROR;
1334c2c66affSColin Finck 
1335*4658658fSAmine Khaldi     ret = pSQLGetData(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind);
1336*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1337*4658658fSAmine Khaldi     return ret;
1338*4658658fSAmine Khaldi }
1339c2c66affSColin Finck 
1340c2c66affSColin Finck /*************************************************************************
1341c2c66affSColin Finck  *				SQLGetDescField           [ODBC32.033]
1342c2c66affSColin Finck  */
ODBC32_SQLGetDescField(SQLHDESC DescriptorHandle,SQLSMALLINT RecNumber,SQLSMALLINT FieldIdentifier,SQLPOINTER Value,SQLINTEGER BufferLength,SQLINTEGER * StringLength)1343*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1344*4658658fSAmine Khaldi                                         SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1345c2c66affSColin Finck {
1346*4658658fSAmine Khaldi     SQLRETURN ret;
1347*4658658fSAmine Khaldi 
1348*4658658fSAmine Khaldi     TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
1349*4658658fSAmine Khaldi           DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
1350c2c66affSColin Finck 
1351c2c66affSColin Finck     if (!pSQLGetDescField) return SQL_ERROR;
1352c2c66affSColin Finck 
1353*4658658fSAmine Khaldi     ret = pSQLGetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
1354*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1355*4658658fSAmine Khaldi     return ret;
1356*4658658fSAmine Khaldi }
1357c2c66affSColin Finck 
1358c2c66affSColin Finck /*************************************************************************
1359c2c66affSColin Finck  *				SQLGetDescRec           [ODBC32.034]
1360c2c66affSColin Finck  */
ODBC32_SQLGetDescRec(SQLHDESC DescriptorHandle,SQLSMALLINT RecNumber,SQLCHAR * Name,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength,SQLSMALLINT * Type,SQLSMALLINT * SubType,SQLLEN * Length,SQLSMALLINT * Precision,SQLSMALLINT * Scale,SQLSMALLINT * Nullable)1361*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLCHAR *Name,
1362*4658658fSAmine Khaldi                                       SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
1363*4658658fSAmine Khaldi                                       SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
1364c2c66affSColin Finck                                       SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
1365c2c66affSColin Finck {
1366*4658658fSAmine Khaldi     SQLRETURN ret;
1367*4658658fSAmine Khaldi 
1368*4658658fSAmine Khaldi     TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
1369*4658658fSAmine Khaldi           " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
1370*4658658fSAmine Khaldi           StringLength, Type, SubType, Length, Precision, Scale, Nullable);
1371c2c66affSColin Finck 
1372c2c66affSColin Finck     if (!pSQLGetDescRec) return SQL_ERROR;
1373c2c66affSColin Finck 
1374*4658658fSAmine Khaldi     ret = pSQLGetDescRec(DescriptorHandle, RecNumber, Name, BufferLength, StringLength, Type, SubType, Length,
1375*4658658fSAmine Khaldi                          Precision, Scale, Nullable);
1376*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1377*4658658fSAmine Khaldi     return ret;
1378*4658658fSAmine Khaldi }
1379c2c66affSColin Finck 
1380c2c66affSColin Finck /*************************************************************************
1381c2c66affSColin Finck  *				SQLGetDiagField           [ODBC32.035]
1382c2c66affSColin Finck  */
ODBC32_SQLGetDiagField(SQLSMALLINT HandleType,SQLHANDLE Handle,SQLSMALLINT RecNumber,SQLSMALLINT DiagIdentifier,SQLPOINTER DiagInfo,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength)1383*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
1384*4658658fSAmine Khaldi                                         SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
1385c2c66affSColin Finck                                         SQLSMALLINT *StringLength)
1386c2c66affSColin Finck {
1387*4658658fSAmine Khaldi     SQLRETURN ret;
1388*4658658fSAmine Khaldi 
1389*4658658fSAmine Khaldi     TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
1390*4658658fSAmine Khaldi           " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
1391c2c66affSColin Finck 
1392c2c66affSColin Finck     if (!pSQLGetDiagField) return SQL_ERROR;
1393c2c66affSColin Finck 
1394*4658658fSAmine Khaldi     ret = pSQLGetDiagField(HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
1395*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1396*4658658fSAmine Khaldi     return ret;
1397*4658658fSAmine Khaldi }
1398c2c66affSColin Finck 
1399c2c66affSColin Finck /*************************************************************************
1400c2c66affSColin Finck  *				SQLGetDiagRec           [ODBC32.036]
1401c2c66affSColin Finck  */
ODBC32_SQLGetDiagRec(SQLSMALLINT HandleType,SQLHANDLE Handle,SQLSMALLINT RecNumber,SQLCHAR * Sqlstate,SQLINTEGER * NativeError,SQLCHAR * MessageText,SQLSMALLINT BufferLength,SQLSMALLINT * TextLength)1402*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
1403*4658658fSAmine Khaldi                                       SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
1404c2c66affSColin Finck                                       SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
1405c2c66affSColin Finck {
1406*4658658fSAmine Khaldi     SQLRETURN ret;
1407*4658658fSAmine Khaldi 
1408*4658658fSAmine Khaldi     TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
1409*4658658fSAmine Khaldi           " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
1410*4658658fSAmine Khaldi           TextLength);
1411c2c66affSColin Finck 
1412c2c66affSColin Finck     if (!pSQLGetDiagRec) return SQL_ERROR;
1413c2c66affSColin Finck 
1414*4658658fSAmine Khaldi     ret = pSQLGetDiagRec(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
1415*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1416*4658658fSAmine Khaldi     return ret;
1417*4658658fSAmine Khaldi }
1418c2c66affSColin Finck 
1419c2c66affSColin Finck /*************************************************************************
1420c2c66affSColin Finck  *				SQLGetEnvAttr           [ODBC32.037]
1421c2c66affSColin Finck  */
ODBC32_SQLGetEnvAttr(SQLHENV EnvironmentHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER BufferLength,SQLINTEGER * StringLength)1422*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1423c2c66affSColin Finck                                       SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1424c2c66affSColin Finck {
1425*4658658fSAmine Khaldi     SQLRETURN ret;
1426*4658658fSAmine Khaldi 
1427*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n",
1428*4658658fSAmine Khaldi           EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
1429c2c66affSColin Finck 
1430c2c66affSColin Finck     if (!pSQLGetEnvAttr) return SQL_ERROR;
1431c2c66affSColin Finck 
1432*4658658fSAmine Khaldi     ret = pSQLGetEnvAttr(EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
1433*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1434*4658658fSAmine Khaldi     return ret;
1435*4658658fSAmine Khaldi }
1436c2c66affSColin Finck 
1437c2c66affSColin Finck /*************************************************************************
1438c2c66affSColin Finck  *				SQLGetFunctions           [ODBC32.044]
1439c2c66affSColin Finck  */
ODBC32_SQLGetFunctions(SQLHDBC ConnectionHandle,SQLUSMALLINT FunctionId,SQLUSMALLINT * Supported)144004ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
1441c2c66affSColin Finck {
1442*4658658fSAmine Khaldi     SQLRETURN ret;
1443*4658658fSAmine Khaldi 
1444*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported);
1445c2c66affSColin Finck 
1446c2c66affSColin Finck     if (!pSQLGetFunctions) return SQL_ERROR;
1447c2c66affSColin Finck 
1448*4658658fSAmine Khaldi     ret = pSQLGetFunctions(ConnectionHandle, FunctionId, Supported);
1449*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1450*4658658fSAmine Khaldi     return ret;
1451*4658658fSAmine Khaldi }
1452c2c66affSColin Finck 
1453c2c66affSColin Finck /*************************************************************************
1454c2c66affSColin Finck  *				SQLGetInfo           [ODBC32.045]
1455c2c66affSColin Finck  */
ODBC32_SQLGetInfo(SQLHDBC ConnectionHandle,SQLUSMALLINT InfoType,SQLPOINTER InfoValue,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength)1456*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
1457c2c66affSColin Finck                                    SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
1458c2c66affSColin Finck {
1459*4658658fSAmine Khaldi     SQLRETURN ret;
1460c2c66affSColin Finck 
1461*4658658fSAmine Khaldi     TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
1462*4658658fSAmine Khaldi           InfoType, InfoValue, BufferLength, StringLength);
1463*4658658fSAmine Khaldi 
1464*4658658fSAmine Khaldi     if (!InfoValue)
1465*4658658fSAmine Khaldi     {
1466*4658658fSAmine Khaldi         WARN("Unexpected NULL InfoValue address\n");
1467*4658658fSAmine Khaldi         return SQL_ERROR;
1468c2c66affSColin Finck     }
1469c2c66affSColin Finck 
1470*4658658fSAmine Khaldi     if (!pSQLGetInfo) return SQL_ERROR;
1471*4658658fSAmine Khaldi 
1472*4658658fSAmine Khaldi     ret = pSQLGetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
1473*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1474*4658658fSAmine Khaldi     return ret;
1475*4658658fSAmine Khaldi }
1476c2c66affSColin Finck 
1477c2c66affSColin Finck /*************************************************************************
1478c2c66affSColin Finck  *				SQLGetStmtAttr           [ODBC32.038]
1479c2c66affSColin Finck  */
ODBC32_SQLGetStmtAttr(SQLHSTMT StatementHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER BufferLength,SQLINTEGER * StringLength)1480*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1481c2c66affSColin Finck                                        SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1482c2c66affSColin Finck {
1483*4658658fSAmine Khaldi     SQLRETURN ret;
1484c2c66affSColin Finck 
1485*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
1486*4658658fSAmine Khaldi           Attribute, Value, BufferLength, StringLength);
1487*4658658fSAmine Khaldi 
1488*4658658fSAmine Khaldi     if (!Value)
1489*4658658fSAmine Khaldi     {
1490*4658658fSAmine Khaldi         WARN("Unexpected NULL Value return address\n");
1491*4658658fSAmine Khaldi         return SQL_ERROR;
1492c2c66affSColin Finck     }
1493c2c66affSColin Finck 
1494*4658658fSAmine Khaldi     if (!pSQLGetStmtAttr) return SQL_ERROR;
1495*4658658fSAmine Khaldi 
1496*4658658fSAmine Khaldi     ret = pSQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength);
1497*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1498*4658658fSAmine Khaldi     return ret;
1499*4658658fSAmine Khaldi }
1500c2c66affSColin Finck 
1501c2c66affSColin Finck /*************************************************************************
1502c2c66affSColin Finck  *				SQLGetStmtOption           [ODBC32.046]
1503c2c66affSColin Finck  */
ODBC32_SQLGetStmtOption(SQLHSTMT StatementHandle,SQLUSMALLINT Option,SQLPOINTER Value)150404ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1505c2c66affSColin Finck {
1506*4658658fSAmine Khaldi     SQLRETURN ret;
1507*4658658fSAmine Khaldi 
1508*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Option %d, Value %p)\n", StatementHandle, Option, Value);
1509c2c66affSColin Finck 
1510c2c66affSColin Finck     if (!pSQLGetStmtOption) return SQL_ERROR;
1511c2c66affSColin Finck 
1512*4658658fSAmine Khaldi     ret = pSQLGetStmtOption(StatementHandle, Option, Value);
1513*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1514*4658658fSAmine Khaldi     return ret;
1515*4658658fSAmine Khaldi }
1516c2c66affSColin Finck 
1517c2c66affSColin Finck /*************************************************************************
1518c2c66affSColin Finck  *				SQLGetTypeInfo           [ODBC32.047]
1519c2c66affSColin Finck  */
ODBC32_SQLGetTypeInfo(SQLHSTMT StatementHandle,SQLSMALLINT DataType)152004ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1521c2c66affSColin Finck {
1522*4658658fSAmine Khaldi     SQLRETURN ret;
1523*4658658fSAmine Khaldi 
1524*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
1525c2c66affSColin Finck 
1526c2c66affSColin Finck     if (!pSQLGetTypeInfo) return SQL_ERROR;
1527c2c66affSColin Finck 
1528*4658658fSAmine Khaldi     ret = pSQLGetTypeInfo(StatementHandle, DataType);
1529*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1530*4658658fSAmine Khaldi     return ret;
1531*4658658fSAmine Khaldi }
1532c2c66affSColin Finck 
1533c2c66affSColin Finck /*************************************************************************
1534c2c66affSColin Finck  *				SQLNumResultCols           [ODBC32.018]
1535c2c66affSColin Finck  */
ODBC32_SQLNumResultCols(SQLHSTMT StatementHandle,SQLSMALLINT * ColumnCount)153604ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1537c2c66affSColin Finck {
1538*4658658fSAmine Khaldi     SQLRETURN ret;
1539*4658658fSAmine Khaldi 
1540*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount);
1541c2c66affSColin Finck 
1542c2c66affSColin Finck     if (!pSQLNumResultCols) return SQL_ERROR;
1543c2c66affSColin Finck 
1544*4658658fSAmine Khaldi     ret = pSQLNumResultCols(StatementHandle, ColumnCount);
1545*4658658fSAmine Khaldi     TRACE("Returning %d ColumnCount %d\n", ret, *ColumnCount);
1546*4658658fSAmine Khaldi     return ret;
1547*4658658fSAmine Khaldi }
1548c2c66affSColin Finck 
1549c2c66affSColin Finck /*************************************************************************
1550c2c66affSColin Finck  *				SQLParamData           [ODBC32.048]
1551c2c66affSColin Finck  */
ODBC32_SQLParamData(SQLHSTMT StatementHandle,SQLPOINTER * Value)155204ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1553c2c66affSColin Finck {
1554*4658658fSAmine Khaldi     SQLRETURN ret;
1555*4658658fSAmine Khaldi 
1556*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Value %p)\n", StatementHandle, Value);
1557c2c66affSColin Finck 
1558c2c66affSColin Finck     if (!pSQLParamData) return SQL_ERROR;
1559c2c66affSColin Finck 
1560*4658658fSAmine Khaldi     ret = pSQLParamData(StatementHandle, Value);
1561*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1562*4658658fSAmine Khaldi     return ret;
1563*4658658fSAmine Khaldi }
1564c2c66affSColin Finck 
1565c2c66affSColin Finck /*************************************************************************
1566c2c66affSColin Finck  *				SQLPrepare           [ODBC32.019]
1567c2c66affSColin Finck  */
ODBC32_SQLPrepare(SQLHSTMT StatementHandle,SQLCHAR * StatementText,SQLINTEGER TextLength)156804ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1569c2c66affSColin Finck {
1570*4658658fSAmine Khaldi     SQLRETURN ret;
1571*4658658fSAmine Khaldi 
1572*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1573*4658658fSAmine Khaldi           debugstr_an((const char *)StatementText, TextLength), TextLength);
1574c2c66affSColin Finck 
1575c2c66affSColin Finck     if (!pSQLPrepare) return SQL_ERROR;
1576c2c66affSColin Finck 
1577*4658658fSAmine Khaldi     ret = pSQLPrepare(StatementHandle, StatementText, TextLength);
1578*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1579*4658658fSAmine Khaldi     return ret;
1580*4658658fSAmine Khaldi }
1581c2c66affSColin Finck 
1582c2c66affSColin Finck /*************************************************************************
1583c2c66affSColin Finck  *				SQLPutData           [ODBC32.049]
1584c2c66affSColin Finck  */
ODBC32_SQLPutData(SQLHSTMT StatementHandle,SQLPOINTER Data,SQLLEN StrLen_or_Ind)158504ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind)
1586c2c66affSColin Finck {
1587*4658658fSAmine Khaldi     SQLRETURN ret;
1588*4658658fSAmine Khaldi 
1589*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Data %p, StrLen_or_Ind %s)\n", StatementHandle, Data, debugstr_sqllen(StrLen_or_Ind));
1590c2c66affSColin Finck 
1591c2c66affSColin Finck     if (!pSQLPutData) return SQL_ERROR;
1592c2c66affSColin Finck 
1593*4658658fSAmine Khaldi     ret = pSQLPutData(StatementHandle, Data, StrLen_or_Ind);
1594*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1595*4658658fSAmine Khaldi     return ret;
1596*4658658fSAmine Khaldi }
1597c2c66affSColin Finck 
1598c2c66affSColin Finck /*************************************************************************
1599c2c66affSColin Finck  *				SQLRowCount           [ODBC32.020]
1600c2c66affSColin Finck  */
ODBC32_SQLRowCount(SQLHSTMT StatementHandle,SQLLEN * RowCount)160104ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
1602c2c66affSColin Finck {
1603*4658658fSAmine Khaldi     SQLRETURN ret;
1604*4658658fSAmine Khaldi 
1605*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount);
1606c2c66affSColin Finck 
1607c2c66affSColin Finck     if (!pSQLRowCount) return SQL_ERROR;
1608c2c66affSColin Finck 
1609*4658658fSAmine Khaldi     ret = pSQLRowCount(StatementHandle, RowCount);
1610*4658658fSAmine Khaldi     if (ret == SQL_SUCCESS && RowCount) TRACE(" RowCount %s\n", debugstr_sqllen(*RowCount));
1611*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1612*4658658fSAmine Khaldi     return ret;
1613*4658658fSAmine Khaldi }
1614c2c66affSColin Finck 
1615c2c66affSColin Finck /*************************************************************************
1616c2c66affSColin Finck  *				SQLSetConnectAttr           [ODBC32.039]
1617c2c66affSColin Finck  */
ODBC32_SQLSetConnectAttr(SQLHDBC ConnectionHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER StringLength)1618*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1619*4658658fSAmine Khaldi                                           SQLINTEGER StringLength)
1620c2c66affSColin Finck {
1621*4658658fSAmine Khaldi     SQLRETURN ret;
1622*4658658fSAmine Khaldi 
1623*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
1624*4658658fSAmine Khaldi           StringLength);
1625c2c66affSColin Finck 
1626c2c66affSColin Finck     if (!pSQLSetConnectAttr) return SQL_ERROR;
1627c2c66affSColin Finck 
1628*4658658fSAmine Khaldi     ret = pSQLSetConnectAttr(ConnectionHandle, Attribute, Value, StringLength);
1629*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1630*4658658fSAmine Khaldi     return ret;
1631*4658658fSAmine Khaldi }
1632c2c66affSColin Finck 
1633c2c66affSColin Finck /*************************************************************************
1634c2c66affSColin Finck  *				SQLSetConnectOption           [ODBC32.050]
1635c2c66affSColin Finck  */
ODBC32_SQLSetConnectOption(SQLHDBC ConnectionHandle,SQLUSMALLINT Option,SQLULEN Value)163604ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value)
1637c2c66affSColin Finck {
1638*4658658fSAmine Khaldi     SQLRETURN ret;
1639*4658658fSAmine Khaldi 
1640*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqlulen(Value));
1641c2c66affSColin Finck 
1642c2c66affSColin Finck     if (!pSQLSetConnectOption) return SQL_ERROR;
1643c2c66affSColin Finck 
1644*4658658fSAmine Khaldi     ret = pSQLSetConnectOption(ConnectionHandle, Option, Value);
1645*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1646*4658658fSAmine Khaldi     return ret;
1647*4658658fSAmine Khaldi }
1648c2c66affSColin Finck 
1649c2c66affSColin Finck /*************************************************************************
1650c2c66affSColin Finck  *				SQLSetCursorName           [ODBC32.021]
1651c2c66affSColin Finck  */
ODBC32_SQLSetCursorName(SQLHSTMT StatementHandle,SQLCHAR * CursorName,SQLSMALLINT NameLength)165204ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
1653c2c66affSColin Finck {
1654*4658658fSAmine Khaldi     SQLRETURN ret;
1655*4658658fSAmine Khaldi 
1656*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
1657*4658658fSAmine Khaldi           debugstr_an((const char *)CursorName, NameLength), NameLength);
1658c2c66affSColin Finck 
1659c2c66affSColin Finck     if (!pSQLSetCursorName) return SQL_ERROR;
1660c2c66affSColin Finck 
1661*4658658fSAmine Khaldi     ret = pSQLSetCursorName(StatementHandle, CursorName, NameLength);
1662*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1663*4658658fSAmine Khaldi     return ret;
1664*4658658fSAmine Khaldi }
1665c2c66affSColin Finck 
1666c2c66affSColin Finck /*************************************************************************
1667c2c66affSColin Finck  *				SQLSetDescField           [ODBC32.073]
1668c2c66affSColin Finck  */
ODBC32_SQLSetDescField(SQLHDESC DescriptorHandle,SQLSMALLINT RecNumber,SQLSMALLINT FieldIdentifier,SQLPOINTER Value,SQLINTEGER BufferLength)1669*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1670c2c66affSColin Finck                                         SQLPOINTER Value, SQLINTEGER BufferLength)
1671c2c66affSColin Finck {
1672*4658658fSAmine Khaldi     SQLRETURN ret;
1673*4658658fSAmine Khaldi 
1674*4658658fSAmine Khaldi     TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
1675*4658658fSAmine Khaldi           RecNumber, FieldIdentifier, Value, BufferLength);
1676c2c66affSColin Finck 
1677c2c66affSColin Finck     if (!pSQLSetDescField) return SQL_ERROR;
1678c2c66affSColin Finck 
1679*4658658fSAmine Khaldi     ret = pSQLSetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
1680*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1681*4658658fSAmine Khaldi     return ret;
1682*4658658fSAmine Khaldi }
1683c2c66affSColin Finck 
1684c2c66affSColin Finck /*************************************************************************
1685c2c66affSColin Finck  *				SQLSetDescRec           [ODBC32.074]
1686c2c66affSColin Finck  */
ODBC32_SQLSetDescRec(SQLHDESC DescriptorHandle,SQLSMALLINT RecNumber,SQLSMALLINT Type,SQLSMALLINT SubType,SQLLEN Length,SQLSMALLINT Precision,SQLSMALLINT Scale,SQLPOINTER Data,SQLLEN * StringLength,SQLLEN * Indicator)1687*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type,
1688*4658658fSAmine Khaldi                                       SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale,
1689*4658658fSAmine Khaldi                                       SQLPOINTER Data, SQLLEN *StringLength, SQLLEN *Indicator)
1690c2c66affSColin Finck {
1691*4658658fSAmine Khaldi     SQLRETURN ret;
1692*4658658fSAmine Khaldi 
1693*4658658fSAmine Khaldi     TRACE("(DescriptorHandle %p, RecNumber %d, Type %d, SubType %d, Length %s, Precision %d, Scale %d, Data %p,"
1694*4658658fSAmine Khaldi           " StringLength %p, Indicator %p)\n", DescriptorHandle, RecNumber, Type, SubType, debugstr_sqllen(Length),
1695*4658658fSAmine Khaldi           Precision, Scale, Data, StringLength, Indicator);
1696c2c66affSColin Finck 
1697c2c66affSColin Finck     if (!pSQLSetDescRec) return SQL_ERROR;
1698c2c66affSColin Finck 
1699*4658658fSAmine Khaldi     ret = pSQLSetDescRec(DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data,
1700*4658658fSAmine Khaldi                          StringLength, Indicator);
1701*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1702*4658658fSAmine Khaldi     return ret;
1703*4658658fSAmine Khaldi }
1704c2c66affSColin Finck 
1705c2c66affSColin Finck /*************************************************************************
1706c2c66affSColin Finck  *				SQLSetEnvAttr           [ODBC32.075]
1707c2c66affSColin Finck  */
ODBC32_SQLSetEnvAttr(SQLHENV EnvironmentHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER StringLength)1708*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1709c2c66affSColin Finck                                       SQLINTEGER StringLength)
1710c2c66affSColin Finck {
1711*4658658fSAmine Khaldi     SQLRETURN ret;
1712*4658658fSAmine Khaldi 
1713*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value,
1714*4658658fSAmine Khaldi           StringLength);
1715c2c66affSColin Finck 
1716c2c66affSColin Finck     if (!pSQLSetEnvAttr) return SQL_ERROR;
1717c2c66affSColin Finck 
1718*4658658fSAmine Khaldi     ret = pSQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength);
1719*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1720*4658658fSAmine Khaldi     return ret;
1721*4658658fSAmine Khaldi }
1722c2c66affSColin Finck 
1723c2c66affSColin Finck /*************************************************************************
1724c2c66affSColin Finck  *				SQLSetParam           [ODBC32.022]
1725c2c66affSColin Finck  */
ODBC32_SQLSetParam(SQLHSTMT StatementHandle,SQLUSMALLINT ParameterNumber,SQLSMALLINT ValueType,SQLSMALLINT ParameterType,SQLULEN LengthPrecision,SQLSMALLINT ParameterScale,SQLPOINTER ParameterValue,SQLLEN * StrLen_or_Ind)1726*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1727*4658658fSAmine Khaldi                                     SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
1728*4658658fSAmine Khaldi                                     SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
1729c2c66affSColin Finck {
1730*4658658fSAmine Khaldi     SQLRETURN ret;
1731*4658658fSAmine Khaldi 
1732*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
1733*4658658fSAmine Khaldi           " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
1734*4658658fSAmine Khaldi           ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
1735c2c66affSColin Finck 
1736c2c66affSColin Finck     if (!pSQLSetParam) return SQL_ERROR;
1737c2c66affSColin Finck 
1738*4658658fSAmine Khaldi     ret = pSQLSetParam(StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision,
1739*4658658fSAmine Khaldi                        ParameterScale, ParameterValue, StrLen_or_Ind);
1740*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1741*4658658fSAmine Khaldi     return ret;
1742*4658658fSAmine Khaldi }
1743c2c66affSColin Finck 
1744c2c66affSColin Finck /*************************************************************************
1745c2c66affSColin Finck  *				SQLSetStmtAttr           [ODBC32.076]
1746c2c66affSColin Finck  */
ODBC32_SQLSetStmtAttr(SQLHSTMT StatementHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER StringLength)1747*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1748c2c66affSColin Finck                                        SQLINTEGER StringLength)
1749c2c66affSColin Finck {
1750*4658658fSAmine Khaldi     SQLRETURN ret;
1751*4658658fSAmine Khaldi 
1752*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
1753*4658658fSAmine Khaldi           StringLength);
1754c2c66affSColin Finck 
1755c2c66affSColin Finck     if (!pSQLSetStmtAttr) return SQL_ERROR;
1756c2c66affSColin Finck 
1757*4658658fSAmine Khaldi     ret = pSQLSetStmtAttr(StatementHandle, Attribute, Value, StringLength);
1758*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1759*4658658fSAmine Khaldi     return ret;
1760*4658658fSAmine Khaldi }
1761c2c66affSColin Finck 
1762c2c66affSColin Finck /*************************************************************************
1763c2c66affSColin Finck  *				SQLSetStmtOption           [ODBC32.051]
1764c2c66affSColin Finck  */
ODBC32_SQLSetStmtOption(SQLHSTMT StatementHandle,SQLUSMALLINT Option,SQLULEN Value)176504ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value)
1766c2c66affSColin Finck {
1767*4658658fSAmine Khaldi     SQLRETURN ret;
1768*4658658fSAmine Khaldi 
1769*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Option %d, Value %s)\n", StatementHandle, Option, debugstr_sqlulen(Value));
1770c2c66affSColin Finck 
1771c2c66affSColin Finck     if (!pSQLSetStmtOption) return SQL_ERROR;
1772c2c66affSColin Finck 
1773*4658658fSAmine Khaldi     ret = pSQLSetStmtOption(StatementHandle, Option, Value);
1774*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1775*4658658fSAmine Khaldi     return ret;
1776*4658658fSAmine Khaldi }
1777c2c66affSColin Finck 
1778c2c66affSColin Finck /*************************************************************************
1779c2c66affSColin Finck  *				SQLSpecialColumns           [ODBC32.052]
1780c2c66affSColin Finck  */
ODBC32_SQLSpecialColumns(SQLHSTMT StatementHandle,SQLUSMALLINT IdentifierType,SQLCHAR * CatalogName,SQLSMALLINT NameLength1,SQLCHAR * SchemaName,SQLSMALLINT NameLength2,SQLCHAR * TableName,SQLSMALLINT NameLength3,SQLUSMALLINT Scope,SQLUSMALLINT Nullable)1781*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
1782*4658658fSAmine Khaldi                                           SQLSMALLINT NameLength1, SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1783*4658658fSAmine Khaldi                                           SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
1784c2c66affSColin Finck                                           SQLUSMALLINT Nullable)
1785c2c66affSColin Finck {
1786*4658658fSAmine Khaldi     SQLRETURN ret;
1787*4658658fSAmine Khaldi 
1788*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
1789*4658658fSAmine Khaldi           " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
1790*4658658fSAmine Khaldi           debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1791*4658658fSAmine Khaldi           debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1792*4658658fSAmine Khaldi           debugstr_an((const char *)TableName, NameLength3), NameLength3, Scope, Nullable);
1793c2c66affSColin Finck 
1794c2c66affSColin Finck     if (!pSQLSpecialColumns) return SQL_ERROR;
1795c2c66affSColin Finck 
1796*4658658fSAmine Khaldi     ret = pSQLSpecialColumns(StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
1797*4658658fSAmine Khaldi                              NameLength2, TableName, NameLength3, Scope, Nullable);
1798*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1799*4658658fSAmine Khaldi     return ret;
1800*4658658fSAmine Khaldi }
1801c2c66affSColin Finck 
1802c2c66affSColin Finck /*************************************************************************
1803c2c66affSColin Finck  *				SQLStatistics           [ODBC32.053]
1804c2c66affSColin Finck  */
ODBC32_SQLStatistics(SQLHSTMT StatementHandle,SQLCHAR * CatalogName,SQLSMALLINT NameLength1,SQLCHAR * SchemaName,SQLSMALLINT NameLength2,SQLCHAR * TableName,SQLSMALLINT NameLength3,SQLUSMALLINT Unique,SQLUSMALLINT Reserved)1805*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1806*4658658fSAmine Khaldi                                       SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
1807*4658658fSAmine Khaldi                                       SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
1808c2c66affSColin Finck {
1809*4658658fSAmine Khaldi     SQLRETURN ret;
1810*4658658fSAmine Khaldi 
1811*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
1812*4658658fSAmine Khaldi           " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
1813*4658658fSAmine Khaldi           debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1814*4658658fSAmine Khaldi           debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1815*4658658fSAmine Khaldi           debugstr_an((const char *)TableName, NameLength3), NameLength3, Unique, Reserved);
1816c2c66affSColin Finck 
1817c2c66affSColin Finck     if (!pSQLStatistics) return SQL_ERROR;
1818c2c66affSColin Finck 
1819*4658658fSAmine Khaldi     ret = pSQLStatistics(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName,
1820*4658658fSAmine Khaldi                          NameLength3, Unique, Reserved);
1821*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1822*4658658fSAmine Khaldi     return ret;
1823*4658658fSAmine Khaldi }
1824c2c66affSColin Finck 
1825c2c66affSColin Finck /*************************************************************************
1826c2c66affSColin Finck  *				SQLTables           [ODBC32.054]
1827c2c66affSColin Finck  */
ODBC32_SQLTables(SQLHSTMT StatementHandle,SQLCHAR * CatalogName,SQLSMALLINT NameLength1,SQLCHAR * SchemaName,SQLSMALLINT NameLength2,SQLCHAR * TableName,SQLSMALLINT NameLength3,SQLCHAR * TableType,SQLSMALLINT NameLength4)1828*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1829*4658658fSAmine Khaldi                                   SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
1830*4658658fSAmine Khaldi                                   SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4)
1831c2c66affSColin Finck {
1832*4658658fSAmine Khaldi     SQLRETURN ret;
1833*4658658fSAmine Khaldi 
1834*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
1835*4658658fSAmine Khaldi           " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
1836*4658658fSAmine Khaldi           debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1837*4658658fSAmine Khaldi           debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1838*4658658fSAmine Khaldi           debugstr_an((const char *)TableName, NameLength3), NameLength3,
1839*4658658fSAmine Khaldi           debugstr_an((const char *)TableType, NameLength4), NameLength4);
1840c2c66affSColin Finck 
1841c2c66affSColin Finck     if (!pSQLTables) return SQL_ERROR;
1842c2c66affSColin Finck 
1843*4658658fSAmine Khaldi     ret = pSQLTables(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
1844*4658658fSAmine Khaldi                      TableType, NameLength4);
1845*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1846*4658658fSAmine Khaldi     return ret;
1847*4658658fSAmine Khaldi }
1848c2c66affSColin Finck 
1849c2c66affSColin Finck /*************************************************************************
1850c2c66affSColin Finck  *				SQLTransact           [ODBC32.023]
1851c2c66affSColin Finck  */
ODBC32_SQLTransact(SQLHENV EnvironmentHandle,SQLHDBC ConnectionHandle,SQLUSMALLINT CompletionType)1852*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType)
1853c2c66affSColin Finck {
1854*4658658fSAmine Khaldi     SQLRETURN ret;
1855*4658658fSAmine Khaldi 
1856*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
1857*4658658fSAmine Khaldi           CompletionType);
1858c2c66affSColin Finck 
1859c2c66affSColin Finck     if (!pSQLTransact) return SQL_ERROR;
1860c2c66affSColin Finck 
1861*4658658fSAmine Khaldi     ret = pSQLTransact(EnvironmentHandle, ConnectionHandle, CompletionType);
1862*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1863*4658658fSAmine Khaldi     return ret;
1864*4658658fSAmine Khaldi }
1865c2c66affSColin Finck 
1866c2c66affSColin Finck /*************************************************************************
1867c2c66affSColin Finck  *				SQLBrowseConnect           [ODBC32.055]
1868c2c66affSColin Finck  */
ODBC32_SQLBrowseConnect(SQLHDBC hdbc,SQLCHAR * szConnStrIn,SQLSMALLINT cbConnStrIn,SQLCHAR * szConnStrOut,SQLSMALLINT cbConnStrOutMax,SQLSMALLINT * pcbConnStrOut)1869*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
1870*4658658fSAmine Khaldi                                          SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
1871c2c66affSColin Finck                                          SQLSMALLINT *pcbConnStrOut)
1872c2c66affSColin Finck {
1873*4658658fSAmine Khaldi     SQLRETURN ret;
1874*4658658fSAmine Khaldi 
1875*4658658fSAmine Khaldi     TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
1876*4658658fSAmine Khaldi           hdbc, debugstr_an((const char *)szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax,
1877*4658658fSAmine Khaldi           pcbConnStrOut);
1878c2c66affSColin Finck 
1879c2c66affSColin Finck     if (!pSQLBrowseConnect) return SQL_ERROR;
1880c2c66affSColin Finck 
1881*4658658fSAmine Khaldi     ret = pSQLBrowseConnect(hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
1882*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1883*4658658fSAmine Khaldi     return ret;
1884*4658658fSAmine Khaldi }
1885c2c66affSColin Finck 
1886c2c66affSColin Finck /*************************************************************************
1887c2c66affSColin Finck  *				SQLBulkOperations           [ODBC32.078]
1888c2c66affSColin Finck  */
ODBC32_SQLBulkOperations(SQLHSTMT StatementHandle,SQLSMALLINT Operation)1889*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation)
1890c2c66affSColin Finck {
1891*4658658fSAmine Khaldi     SQLRETURN ret;
1892*4658658fSAmine Khaldi 
1893*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation);
1894c2c66affSColin Finck 
1895c2c66affSColin Finck     if (!pSQLBulkOperations) return SQL_ERROR;
1896c2c66affSColin Finck 
1897*4658658fSAmine Khaldi     ret = pSQLBulkOperations(StatementHandle, Operation);
1898*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1899*4658658fSAmine Khaldi     return ret;
1900*4658658fSAmine Khaldi }
1901c2c66affSColin Finck 
1902c2c66affSColin Finck /*************************************************************************
1903c2c66affSColin Finck  *				SQLColAttributes           [ODBC32.006]
1904c2c66affSColin Finck  */
ODBC32_SQLColAttributes(SQLHSTMT hstmt,SQLUSMALLINT icol,SQLUSMALLINT fDescType,SQLPOINTER rgbDesc,SQLSMALLINT cbDescMax,SQLSMALLINT * pcbDesc,SQLLEN * pfDesc)1905*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
1906*4658658fSAmine Khaldi                                          SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
1907c2c66affSColin Finck                                          SQLLEN *pfDesc)
1908c2c66affSColin Finck {
1909*4658658fSAmine Khaldi     SQLRETURN ret;
1910*4658658fSAmine Khaldi 
1911*4658658fSAmine Khaldi     TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
1912*4658658fSAmine Khaldi           fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1913c2c66affSColin Finck 
1914c2c66affSColin Finck     if (!pSQLColAttributes) return SQL_ERROR;
1915c2c66affSColin Finck 
1916*4658658fSAmine Khaldi     ret = pSQLColAttributes(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1917*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1918*4658658fSAmine Khaldi     return ret;
1919*4658658fSAmine Khaldi }
1920c2c66affSColin Finck 
1921c2c66affSColin Finck /*************************************************************************
1922c2c66affSColin Finck  *				SQLColumnPrivileges           [ODBC32.056]
1923c2c66affSColin Finck  */
ODBC32_SQLColumnPrivileges(SQLHSTMT hstmt,SQLCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLCHAR * szTableName,SQLSMALLINT cbTableName,SQLCHAR * szColumnName,SQLSMALLINT cbColumnName)1924*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1925*4658658fSAmine Khaldi                                             SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
1926*4658658fSAmine Khaldi                                             SQLSMALLINT cbTableName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
1927c2c66affSColin Finck {
1928*4658658fSAmine Khaldi     SQLRETURN ret;
1929*4658658fSAmine Khaldi 
1930*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
1931*4658658fSAmine Khaldi           " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
1932*4658658fSAmine Khaldi           debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1933*4658658fSAmine Khaldi           debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1934*4658658fSAmine Khaldi           debugstr_an((const char *)szTableName, cbTableName), cbTableName,
1935*4658658fSAmine Khaldi           debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
1936c2c66affSColin Finck 
1937c2c66affSColin Finck     if (!pSQLColumnPrivileges) return SQL_ERROR;
1938c2c66affSColin Finck 
1939*4658658fSAmine Khaldi     ret = pSQLColumnPrivileges(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
1940*4658658fSAmine Khaldi                                szTableName, cbTableName, szColumnName, cbColumnName);
1941*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1942*4658658fSAmine Khaldi     return ret;
1943*4658658fSAmine Khaldi }
1944c2c66affSColin Finck 
1945c2c66affSColin Finck /*************************************************************************
1946c2c66affSColin Finck  *				SQLDescribeParam          [ODBC32.058]
1947c2c66affSColin Finck  */
ODBC32_SQLDescribeParam(SQLHSTMT hstmt,SQLUSMALLINT ipar,SQLSMALLINT * pfSqlType,SQLULEN * pcbParamDef,SQLSMALLINT * pibScale,SQLSMALLINT * pfNullable)1948*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType,
1949*4658658fSAmine Khaldi                                          SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable)
1950c2c66affSColin Finck {
1951*4658658fSAmine Khaldi     SQLRETURN ret;
1952*4658658fSAmine Khaldi 
1953*4658658fSAmine Khaldi     TRACE("(hstmt %p, ipar %d, pfSqlType %p, pcbParamDef %p, pibScale %p, pfNullable %p)\n", hstmt, ipar,
1954*4658658fSAmine Khaldi           pfSqlType, pcbParamDef, pibScale, pfNullable);
1955c2c66affSColin Finck 
1956c2c66affSColin Finck     if (!pSQLDescribeParam) return SQL_ERROR;
1957c2c66affSColin Finck 
1958*4658658fSAmine Khaldi     ret = pSQLDescribeParam(hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable);
1959*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1960*4658658fSAmine Khaldi     return ret;
1961*4658658fSAmine Khaldi }
1962c2c66affSColin Finck 
1963c2c66affSColin Finck /*************************************************************************
1964c2c66affSColin Finck  *				SQLExtendedFetch           [ODBC32.059]
1965c2c66affSColin Finck  */
ODBC32_SQLExtendedFetch(SQLHSTMT hstmt,SQLUSMALLINT fFetchType,SQLLEN irow,SQLULEN * pcrow,SQLUSMALLINT * rgfRowStatus)1966*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow,
1967c2c66affSColin Finck                                          SQLUSMALLINT *rgfRowStatus)
1968c2c66affSColin Finck {
1969*4658658fSAmine Khaldi     SQLRETURN ret;
1970*4658658fSAmine Khaldi 
1971*4658658fSAmine Khaldi     TRACE("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow),
1972*4658658fSAmine Khaldi           pcrow, rgfRowStatus);
1973c2c66affSColin Finck 
1974c2c66affSColin Finck     if (!pSQLExtendedFetch) return SQL_ERROR;
1975c2c66affSColin Finck 
1976*4658658fSAmine Khaldi     ret = pSQLExtendedFetch(hstmt, fFetchType, irow, pcrow, rgfRowStatus);
1977*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
1978*4658658fSAmine Khaldi     return ret;
1979*4658658fSAmine Khaldi }
1980c2c66affSColin Finck 
1981c2c66affSColin Finck /*************************************************************************
1982c2c66affSColin Finck  *				SQLForeignKeys           [ODBC32.060]
1983c2c66affSColin Finck  */
ODBC32_SQLForeignKeys(SQLHSTMT hstmt,SQLCHAR * szPkCatalogName,SQLSMALLINT cbPkCatalogName,SQLCHAR * szPkSchemaName,SQLSMALLINT cbPkSchemaName,SQLCHAR * szPkTableName,SQLSMALLINT cbPkTableName,SQLCHAR * szFkCatalogName,SQLSMALLINT cbFkCatalogName,SQLCHAR * szFkSchemaName,SQLSMALLINT cbFkSchemaName,SQLCHAR * szFkTableName,SQLSMALLINT cbFkTableName)1984*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
1985*4658658fSAmine Khaldi                                        SQLCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLCHAR *szPkTableName,
1986*4658658fSAmine Khaldi                                        SQLSMALLINT cbPkTableName, SQLCHAR *szFkCatalogName,
1987*4658658fSAmine Khaldi                                        SQLSMALLINT cbFkCatalogName, SQLCHAR *szFkSchemaName,
1988*4658658fSAmine Khaldi                                        SQLSMALLINT cbFkSchemaName, SQLCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
1989c2c66affSColin Finck {
1990*4658658fSAmine Khaldi     SQLRETURN ret;
1991*4658658fSAmine Khaldi 
1992*4658658fSAmine Khaldi     TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
1993*4658658fSAmine Khaldi           " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
1994*4658658fSAmine Khaldi           " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
1995*4658658fSAmine Khaldi           debugstr_an((const char *)szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
1996*4658658fSAmine Khaldi           debugstr_an((const char *)szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
1997*4658658fSAmine Khaldi           debugstr_an((const char *)szPkTableName, cbPkTableName), cbPkTableName,
1998*4658658fSAmine Khaldi           debugstr_an((const char *)szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
1999*4658658fSAmine Khaldi           debugstr_an((const char *)szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
2000*4658658fSAmine Khaldi           debugstr_an((const char *)szFkTableName, cbFkTableName), cbFkTableName);
2001c2c66affSColin Finck 
2002c2c66affSColin Finck     if (!pSQLForeignKeys) return SQL_ERROR;
2003c2c66affSColin Finck 
2004*4658658fSAmine Khaldi     ret = pSQLForeignKeys(hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName, szPkTableName,
2005*4658658fSAmine Khaldi                           cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName, cbFkSchemaName,
2006*4658658fSAmine Khaldi                           szFkTableName, cbFkTableName);
2007*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2008*4658658fSAmine Khaldi     return ret;
2009*4658658fSAmine Khaldi }
2010c2c66affSColin Finck 
2011c2c66affSColin Finck /*************************************************************************
2012c2c66affSColin Finck  *				SQLMoreResults           [ODBC32.061]
2013c2c66affSColin Finck  */
ODBC32_SQLMoreResults(SQLHSTMT StatementHandle)2014*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLMoreResults(SQLHSTMT StatementHandle)
2015c2c66affSColin Finck {
2016*4658658fSAmine Khaldi     SQLRETURN ret;
2017*4658658fSAmine Khaldi 
2018*4658658fSAmine Khaldi     TRACE("(%p)\n", StatementHandle);
2019c2c66affSColin Finck 
2020c2c66affSColin Finck     if (!pSQLMoreResults) return SQL_ERROR;
2021c2c66affSColin Finck 
2022*4658658fSAmine Khaldi     ret = pSQLMoreResults(StatementHandle);
2023*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2024*4658658fSAmine Khaldi     return ret;
2025*4658658fSAmine Khaldi }
2026c2c66affSColin Finck 
2027c2c66affSColin Finck /*************************************************************************
2028c2c66affSColin Finck  *				SQLNativeSql           [ODBC32.062]
2029c2c66affSColin Finck  */
ODBC32_SQLNativeSql(SQLHDBC hdbc,SQLCHAR * szSqlStrIn,SQLINTEGER cbSqlStrIn,SQLCHAR * szSqlStr,SQLINTEGER cbSqlStrMax,SQLINTEGER * pcbSqlStr)2030*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr,
2031*4658658fSAmine Khaldi                                      SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
2032c2c66affSColin Finck {
2033*4658658fSAmine Khaldi     SQLRETURN ret;
2034*4658658fSAmine Khaldi 
2035*4658658fSAmine Khaldi     TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
2036*4658658fSAmine Khaldi           debugstr_an((const char *)szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2037c2c66affSColin Finck 
2038c2c66affSColin Finck     if (!pSQLNativeSql) return SQL_ERROR;
2039c2c66affSColin Finck 
2040*4658658fSAmine Khaldi     ret = pSQLNativeSql(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2041*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2042*4658658fSAmine Khaldi     return ret;
2043*4658658fSAmine Khaldi }
2044c2c66affSColin Finck 
2045c2c66affSColin Finck /*************************************************************************
2046c2c66affSColin Finck  *				SQLNumParams           [ODBC32.063]
2047c2c66affSColin Finck  */
ODBC32_SQLNumParams(SQLHSTMT hstmt,SQLSMALLINT * pcpar)2048*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar)
2049c2c66affSColin Finck {
2050*4658658fSAmine Khaldi     SQLRETURN ret;
2051*4658658fSAmine Khaldi 
2052*4658658fSAmine Khaldi     TRACE("(hstmt %p, pcpar %p)\n", hstmt, pcpar);
2053c2c66affSColin Finck 
2054c2c66affSColin Finck     if (!pSQLNumParams) return SQL_ERROR;
2055c2c66affSColin Finck 
2056*4658658fSAmine Khaldi     ret = pSQLNumParams(hstmt, pcpar);
2057*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2058*4658658fSAmine Khaldi     return ret;
2059*4658658fSAmine Khaldi }
2060c2c66affSColin Finck 
2061c2c66affSColin Finck /*************************************************************************
2062c2c66affSColin Finck  *				SQLParamOptions           [ODBC32.064]
2063c2c66affSColin Finck  */
ODBC32_SQLParamOptions(SQLHSTMT hstmt,SQLULEN crow,SQLULEN * pirow)2064*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow)
2065c2c66affSColin Finck {
2066*4658658fSAmine Khaldi     SQLRETURN ret;
2067*4658658fSAmine Khaldi 
2068*4658658fSAmine Khaldi     TRACE("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow);
2069c2c66affSColin Finck 
2070c2c66affSColin Finck     if (!pSQLParamOptions) return SQL_ERROR;
2071c2c66affSColin Finck 
2072*4658658fSAmine Khaldi     ret = pSQLParamOptions(hstmt, crow, pirow);
2073*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2074*4658658fSAmine Khaldi     return ret;
2075*4658658fSAmine Khaldi }
2076c2c66affSColin Finck 
2077c2c66affSColin Finck /*************************************************************************
2078c2c66affSColin Finck  *				SQLPrimaryKeys           [ODBC32.065]
2079c2c66affSColin Finck  */
ODBC32_SQLPrimaryKeys(SQLHSTMT hstmt,SQLCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLCHAR * szTableName,SQLSMALLINT cbTableName)2080*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2081*4658658fSAmine Khaldi                                        SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
2082c2c66affSColin Finck                                        SQLSMALLINT cbTableName)
2083c2c66affSColin Finck {
2084*4658658fSAmine Khaldi     SQLRETURN ret;
2085*4658658fSAmine Khaldi 
2086*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2087*4658658fSAmine Khaldi           " cbTableName %d)\n", hstmt,
2088*4658658fSAmine Khaldi           debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2089*4658658fSAmine Khaldi           debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2090*4658658fSAmine Khaldi           debugstr_an((const char *)szTableName, cbTableName), cbTableName);
2091c2c66affSColin Finck 
2092c2c66affSColin Finck     if (!pSQLPrimaryKeys) return SQL_ERROR;
2093c2c66affSColin Finck 
2094*4658658fSAmine Khaldi     ret = pSQLPrimaryKeys(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName);
2095*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2096*4658658fSAmine Khaldi     return ret;
2097*4658658fSAmine Khaldi }
2098c2c66affSColin Finck 
2099c2c66affSColin Finck /*************************************************************************
2100c2c66affSColin Finck  *				SQLProcedureColumns           [ODBC32.066]
2101c2c66affSColin Finck  */
ODBC32_SQLProcedureColumns(SQLHSTMT hstmt,SQLCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLCHAR * szProcName,SQLSMALLINT cbProcName,SQLCHAR * szColumnName,SQLSMALLINT cbColumnName)2102*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2103*4658658fSAmine Khaldi                                             SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
2104*4658658fSAmine Khaldi                                             SQLSMALLINT cbProcName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
2105c2c66affSColin Finck {
2106*4658658fSAmine Khaldi     SQLRETURN ret;
2107*4658658fSAmine Khaldi 
2108*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2109*4658658fSAmine Khaldi           " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2110*4658658fSAmine Khaldi           debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2111*4658658fSAmine Khaldi           debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2112*4658658fSAmine Khaldi           debugstr_an((const char *)szProcName, cbProcName), cbProcName,
2113*4658658fSAmine Khaldi           debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
2114c2c66affSColin Finck 
2115c2c66affSColin Finck     if (!pSQLProcedureColumns) return SQL_ERROR;
2116c2c66affSColin Finck 
2117*4658658fSAmine Khaldi     ret = pSQLProcedureColumns(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName,
2118*4658658fSAmine Khaldi                                cbProcName, szColumnName, cbColumnName);
2119*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2120*4658658fSAmine Khaldi     return ret;
2121*4658658fSAmine Khaldi }
2122c2c66affSColin Finck 
2123c2c66affSColin Finck /*************************************************************************
2124c2c66affSColin Finck  *				SQLProcedures           [ODBC32.067]
2125c2c66affSColin Finck  */
ODBC32_SQLProcedures(SQLHSTMT hstmt,SQLCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLCHAR * szProcName,SQLSMALLINT cbProcName)2126*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2127*4658658fSAmine Khaldi                                       SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
2128c2c66affSColin Finck                                       SQLSMALLINT cbProcName)
2129c2c66affSColin Finck {
2130*4658658fSAmine Khaldi     SQLRETURN ret;
2131*4658658fSAmine Khaldi 
2132*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2133*4658658fSAmine Khaldi           " cbProcName %d)\n", hstmt,
2134*4658658fSAmine Khaldi           debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2135*4658658fSAmine Khaldi           debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2136*4658658fSAmine Khaldi           debugstr_an((const char *)szProcName, cbProcName), cbProcName);
2137c2c66affSColin Finck 
2138c2c66affSColin Finck     if (!pSQLProcedures) return SQL_ERROR;
2139c2c66affSColin Finck 
2140*4658658fSAmine Khaldi     ret = pSQLProcedures(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName);
2141*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2142*4658658fSAmine Khaldi     return ret;
2143*4658658fSAmine Khaldi }
2144c2c66affSColin Finck 
2145c2c66affSColin Finck /*************************************************************************
2146c2c66affSColin Finck  *				SQLSetPos           [ODBC32.068]
2147c2c66affSColin Finck  */
ODBC32_SQLSetPos(SQLHSTMT hstmt,SQLSETPOSIROW irow,SQLUSMALLINT fOption,SQLUSMALLINT fLock)2148*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock)
2149c2c66affSColin Finck {
2150*4658658fSAmine Khaldi     SQLRETURN ret;
2151*4658658fSAmine Khaldi 
2152*4658658fSAmine Khaldi     TRACE("(hstmt %p, irow %s, fOption %d, fLock %d)\n", hstmt, debugstr_sqlulen(irow), fOption, fLock);
2153c2c66affSColin Finck 
2154c2c66affSColin Finck     if (!pSQLSetPos) return SQL_ERROR;
2155c2c66affSColin Finck 
2156*4658658fSAmine Khaldi     ret = pSQLSetPos(hstmt, irow, fOption, fLock);
2157*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2158*4658658fSAmine Khaldi     return ret;
2159*4658658fSAmine Khaldi }
2160c2c66affSColin Finck 
2161c2c66affSColin Finck /*************************************************************************
2162c2c66affSColin Finck  *				SQLTablePrivileges           [ODBC32.070]
2163c2c66affSColin Finck  */
ODBC32_SQLTablePrivileges(SQLHSTMT hstmt,SQLCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLCHAR * szTableName,SQLSMALLINT cbTableName)2164*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2165*4658658fSAmine Khaldi                                            SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
2166c2c66affSColin Finck                                            SQLSMALLINT cbTableName)
2167c2c66affSColin Finck {
2168*4658658fSAmine Khaldi     SQLRETURN ret;
2169*4658658fSAmine Khaldi 
2170*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2171*4658658fSAmine Khaldi           " cbTableName %d)\n", hstmt,
2172*4658658fSAmine Khaldi           debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2173*4658658fSAmine Khaldi           debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2174*4658658fSAmine Khaldi           debugstr_an((const char *)szTableName, cbTableName), cbTableName);
2175c2c66affSColin Finck 
2176c2c66affSColin Finck     if (!pSQLTablePrivileges) return SQL_ERROR;
2177c2c66affSColin Finck 
2178*4658658fSAmine Khaldi     ret = pSQLTablePrivileges(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName,
2179*4658658fSAmine Khaldi                               cbTableName);
2180*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2181*4658658fSAmine Khaldi     return ret;
2182*4658658fSAmine Khaldi }
2183c2c66affSColin Finck 
2184c2c66affSColin Finck /*************************************************************************
2185c2c66affSColin Finck  *				SQLDrivers           [ODBC32.071]
2186c2c66affSColin Finck  */
ODBC32_SQLDrivers(SQLHENV EnvironmentHandle,SQLUSMALLINT fDirection,SQLCHAR * szDriverDesc,SQLSMALLINT cbDriverDescMax,SQLSMALLINT * pcbDriverDesc,SQLCHAR * szDriverAttributes,SQLSMALLINT cbDriverAttrMax,SQLSMALLINT * pcbDriverAttr)2187*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLCHAR *szDriverDesc,
2188*4658658fSAmine Khaldi                                    SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
2189*4658658fSAmine Khaldi                                    SQLCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
2190c2c66affSColin Finck                                    SQLSMALLINT *pcbDriverAttr)
2191c2c66affSColin Finck {
2192c2c66affSColin Finck     SQLRETURN ret;
2193c2c66affSColin Finck 
2194*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
2195*4658658fSAmine Khaldi           " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
2196*4658658fSAmine Khaldi           szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2197c2c66affSColin Finck 
2198c2c66affSColin Finck     if (!pSQLDrivers) return SQL_ERROR;
2199*4658658fSAmine Khaldi 
2200*4658658fSAmine Khaldi     ret = pSQLDrivers(EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
2201c2c66affSColin Finck                       szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2202c2c66affSColin Finck 
2203c2c66affSColin Finck     if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
2204*4658658fSAmine Khaldi         ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
2205c2c66affSColin Finck 
2206*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2207c2c66affSColin Finck     return ret;
2208c2c66affSColin Finck }
2209c2c66affSColin Finck 
2210c2c66affSColin Finck /*************************************************************************
2211c2c66affSColin Finck  *				SQLBindParameter           [ODBC32.072]
2212c2c66affSColin Finck  */
ODBC32_SQLBindParameter(SQLHSTMT hstmt,SQLUSMALLINT ipar,SQLSMALLINT fParamType,SQLSMALLINT fCType,SQLSMALLINT fSqlType,SQLULEN cbColDef,SQLSMALLINT ibScale,SQLPOINTER rgbValue,SQLLEN cbValueMax,SQLLEN * pcbValue)2213*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType,
2214*4658658fSAmine Khaldi                                          SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef,
2215*4658658fSAmine Khaldi                                          SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax,
2216c2c66affSColin Finck                                          SQLLEN *pcbValue)
2217c2c66affSColin Finck {
2218*4658658fSAmine Khaldi     SQLRETURN ret;
2219*4658658fSAmine Khaldi 
2220*4658658fSAmine Khaldi     TRACE("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p,"
2221*4658658fSAmine Khaldi           " cbValueMax %s, pcbValue %p)\n", hstmt, ipar, fParamType, fCType, fSqlType, debugstr_sqlulen(cbColDef),
2222*4658658fSAmine Khaldi           ibScale, rgbValue, debugstr_sqllen(cbValueMax), pcbValue);
2223c2c66affSColin Finck 
2224c2c66affSColin Finck     if (!pSQLBindParameter) return SQL_ERROR;
2225c2c66affSColin Finck 
2226*4658658fSAmine Khaldi     ret = pSQLBindParameter(hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, cbValueMax,
2227*4658658fSAmine Khaldi                             pcbValue);
2228*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2229*4658658fSAmine Khaldi     return ret;
2230*4658658fSAmine Khaldi }
2231c2c66affSColin Finck 
2232c2c66affSColin Finck /*************************************************************************
2233c2c66affSColin Finck  *				SQLDriverConnect           [ODBC32.041]
2234c2c66affSColin Finck  */
ODBC32_SQLDriverConnect(SQLHDBC hdbc,SQLHWND hwnd,SQLCHAR * ConnectionString,SQLSMALLINT Length,SQLCHAR * conn_str_out,SQLSMALLINT conn_str_out_max,SQLSMALLINT * ptr_conn_str_out,SQLUSMALLINT driver_completion)2235*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *ConnectionString, SQLSMALLINT Length,
2236*4658658fSAmine Khaldi                                          SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max,
2237*4658658fSAmine Khaldi                                          SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion)
2238c2c66affSColin Finck {
2239c2c66affSColin Finck     SQLRETURN ret;
2240c2c66affSColin Finck 
2241*4658658fSAmine Khaldi     TRACE("(hdbc %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d,"
2242*4658658fSAmine Khaldi           " ptr_conn_str_out %p, driver_completion %d)\n", hdbc, hwnd,
2243*4658658fSAmine Khaldi           debugstr_an((const char *)ConnectionString, Length), Length, conn_str_out, conn_str_out_max,
2244*4658658fSAmine Khaldi           ptr_conn_str_out, driver_completion);
2245c2c66affSColin Finck 
2246c2c66affSColin Finck     if (!pSQLDriverConnect) return SQL_ERROR;
2247*4658658fSAmine Khaldi 
2248*4658658fSAmine Khaldi     ret = pSQLDriverConnect(hdbc, hwnd, ConnectionString, Length, conn_str_out, conn_str_out_max,
2249*4658658fSAmine Khaldi                             ptr_conn_str_out, driver_completion);
2250*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2251c2c66affSColin Finck     return ret;
2252c2c66affSColin Finck }
2253c2c66affSColin Finck 
2254c2c66affSColin Finck /*************************************************************************
2255c2c66affSColin Finck  *				SQLSetScrollOptions           [ODBC32.069]
2256c2c66affSColin Finck  */
ODBC32_SQLSetScrollOptions(SQLHSTMT statement_handle,SQLUSMALLINT f_concurrency,SQLLEN crow_keyset,SQLUSMALLINT crow_rowset)2257*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset,
2258c2c66affSColin Finck                                             SQLUSMALLINT crow_rowset)
2259c2c66affSColin Finck {
2260*4658658fSAmine Khaldi     SQLRETURN ret;
2261*4658658fSAmine Khaldi 
2262*4658658fSAmine Khaldi     TRACE("(statement_handle %p, f_concurrency %d, crow_keyset %s, crow_rowset %d)\n", statement_handle,
2263*4658658fSAmine Khaldi           f_concurrency, debugstr_sqllen(crow_keyset), crow_rowset);
2264c2c66affSColin Finck 
2265c2c66affSColin Finck     if (!pSQLSetScrollOptions) return SQL_ERROR;
2266*4658658fSAmine Khaldi 
2267*4658658fSAmine Khaldi     ret = pSQLSetScrollOptions(statement_handle, f_concurrency, crow_keyset, crow_rowset);
2268*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2269*4658658fSAmine Khaldi     return ret;
2270c2c66affSColin Finck }
2271c2c66affSColin Finck 
SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType)2272c2c66affSColin Finck static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType)
2273c2c66affSColin Finck {
2274c2c66affSColin Finck     static const SQLUSMALLINT attrList[] =
2275c2c66affSColin Finck     {
2276c2c66affSColin Finck         SQL_COLUMN_OWNER_NAME,
2277c2c66affSColin Finck         SQL_COLUMN_QUALIFIER_NAME,
2278c2c66affSColin Finck         SQL_COLUMN_LABEL,
2279c2c66affSColin Finck         SQL_COLUMN_NAME,
2280c2c66affSColin Finck         SQL_COLUMN_TABLE_NAME,
2281c2c66affSColin Finck         SQL_COLUMN_TYPE_NAME,
2282c2c66affSColin Finck         SQL_DESC_BASE_COLUMN_NAME,
2283c2c66affSColin Finck         SQL_DESC_BASE_TABLE_NAME,
2284c2c66affSColin Finck         SQL_DESC_CATALOG_NAME,
2285c2c66affSColin Finck         SQL_DESC_LABEL,
2286c2c66affSColin Finck         SQL_DESC_LITERAL_PREFIX,
2287c2c66affSColin Finck         SQL_DESC_LITERAL_SUFFIX,
2288c2c66affSColin Finck         SQL_DESC_LOCAL_TYPE_NAME,
2289c2c66affSColin Finck         SQL_DESC_NAME,
2290c2c66affSColin Finck         SQL_DESC_SCHEMA_NAME,
2291c2c66affSColin Finck         SQL_DESC_TABLE_NAME,
2292c2c66affSColin Finck         SQL_DESC_TYPE_NAME,
2293c2c66affSColin Finck     };
2294c2c66affSColin Finck     unsigned int i;
2295c2c66affSColin Finck 
229604ef5f7aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(attrList); i++) {
2297c2c66affSColin Finck         if (attrList[i] == fDescType) return TRUE;
2298c2c66affSColin Finck     }
2299c2c66affSColin Finck     return FALSE;
2300c2c66affSColin Finck }
2301c2c66affSColin Finck 
2302c2c66affSColin Finck /*************************************************************************
2303c2c66affSColin Finck  *				SQLColAttributesW          [ODBC32.106]
2304c2c66affSColin Finck  */
ODBC32_SQLColAttributesW(SQLHSTMT hstmt,SQLUSMALLINT icol,SQLUSMALLINT fDescType,SQLPOINTER rgbDesc,SQLSMALLINT cbDescMax,SQLSMALLINT * pcbDesc,SQLLEN * pfDesc)2305*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
2306*4658658fSAmine Khaldi                                           SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
2307c2c66affSColin Finck                                           SQLLEN *pfDesc)
2308c2c66affSColin Finck {
2309*4658658fSAmine Khaldi     SQLRETURN ret;
2310c2c66affSColin Finck 
2311*4658658fSAmine Khaldi     TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
2312*4658658fSAmine Khaldi           fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2313c2c66affSColin Finck 
2314c2c66affSColin Finck     if (!pSQLColAttributesW) return SQL_ERROR;
2315c2c66affSColin Finck 
2316*4658658fSAmine Khaldi     ret = pSQLColAttributesW(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2317*4658658fSAmine Khaldi 
2318*4658658fSAmine Khaldi     if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(fDescType) && rgbDesc && pcbDesc &&
2319*4658658fSAmine Khaldi         *pcbDesc != lstrlenW(rgbDesc) * 2)
2320*4658658fSAmine Khaldi     {
2321c2c66affSColin Finck         TRACE("CHEAT: resetting name length for ADO\n");
2322c2c66affSColin Finck         *pcbDesc = lstrlenW(rgbDesc) * 2;
2323c2c66affSColin Finck     }
2324*4658658fSAmine Khaldi 
2325*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2326*4658658fSAmine Khaldi     return ret;
2327c2c66affSColin Finck }
2328c2c66affSColin Finck 
2329c2c66affSColin Finck /*************************************************************************
2330c2c66affSColin Finck  *				SQLConnectW          [ODBC32.107]
2331c2c66affSColin Finck  */
ODBC32_SQLConnectW(SQLHDBC ConnectionHandle,WCHAR * ServerName,SQLSMALLINT NameLength1,WCHAR * UserName,SQLSMALLINT NameLength2,WCHAR * Authentication,SQLSMALLINT NameLength3)2332*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMALLINT NameLength1,
2333*4658658fSAmine Khaldi                                     WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication,
2334*4658658fSAmine Khaldi                                     SQLSMALLINT NameLength3)
2335c2c66affSColin Finck {
2336c2c66affSColin Finck     SQLRETURN ret;
2337*4658658fSAmine Khaldi 
2338*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
2339*4658658fSAmine Khaldi           " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1,
2340*4658658fSAmine Khaldi           debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3);
2341c2c66affSColin Finck 
2342c2c66affSColin Finck     if (!pSQLConnectW) return SQL_ERROR;
2343c2c66affSColin Finck 
2344*4658658fSAmine Khaldi     ret = pSQLConnectW(ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3);
2345*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2346c2c66affSColin Finck     return ret;
2347c2c66affSColin Finck }
2348c2c66affSColin Finck 
2349c2c66affSColin Finck /*************************************************************************
2350c2c66affSColin Finck  *				SQLDescribeColW          [ODBC32.108]
2351c2c66affSColin Finck  */
ODBC32_SQLDescribeColW(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,WCHAR * ColumnName,SQLSMALLINT BufferLength,SQLSMALLINT * NameLength,SQLSMALLINT * DataType,SQLULEN * ColumnSize,SQLSMALLINT * DecimalDigits,SQLSMALLINT * Nullable)2352*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, WCHAR *ColumnName,
2353*4658658fSAmine Khaldi                                         SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
2354*4658658fSAmine Khaldi                                         SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
2355c2c66affSColin Finck {
2356*4658658fSAmine Khaldi     SQLSMALLINT dummy;
2357*4658658fSAmine Khaldi     SQLRETURN ret;
2358*4658658fSAmine Khaldi 
2359*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
2360*4658658fSAmine Khaldi           " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
2361*4658658fSAmine Khaldi           BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
2362c2c66affSColin Finck 
2363c2c66affSColin Finck     if (!pSQLDescribeColW) return SQL_ERROR;
2364*4658658fSAmine Khaldi     if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
2365c2c66affSColin Finck 
2366*4658658fSAmine Khaldi     ret = pSQLDescribeColW(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize,
2367c2c66affSColin Finck                            DecimalDigits, Nullable);
2368*4658658fSAmine Khaldi     if (ret >= 0)
2369*4658658fSAmine Khaldi     {
2370*4658658fSAmine Khaldi         if (ColumnName && NameLength) TRACE("ColumnName %s\n", debugstr_wn(ColumnName, *NameLength));
2371*4658658fSAmine Khaldi         if (DataType) TRACE("DataType %d\n", *DataType);
2372*4658658fSAmine Khaldi         if (ColumnSize) TRACE("ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
2373*4658658fSAmine Khaldi         if (DecimalDigits) TRACE("DecimalDigits %d\n", *DecimalDigits);
2374*4658658fSAmine Khaldi         if (Nullable) TRACE("Nullable %d\n", *Nullable);
2375c2c66affSColin Finck     }
2376*4658658fSAmine Khaldi 
2377*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2378*4658658fSAmine Khaldi     return ret;
2379c2c66affSColin Finck }
2380c2c66affSColin Finck 
2381c2c66affSColin Finck /*************************************************************************
2382c2c66affSColin Finck  *				SQLErrorW          [ODBC32.110]
2383c2c66affSColin Finck  */
ODBC32_SQLErrorW(SQLHENV EnvironmentHandle,SQLHDBC ConnectionHandle,SQLHSTMT StatementHandle,WCHAR * Sqlstate,SQLINTEGER * NativeError,WCHAR * MessageText,SQLSMALLINT BufferLength,SQLSMALLINT * TextLength)2384*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
2385*4658658fSAmine Khaldi                                   WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
2386*4658658fSAmine Khaldi                                   SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2387c2c66affSColin Finck {
2388*4658658fSAmine Khaldi     SQLRETURN ret;
2389*4658658fSAmine Khaldi 
2390*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
2391*4658658fSAmine Khaldi           " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
2392*4658658fSAmine Khaldi           StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
2393c2c66affSColin Finck 
2394c2c66affSColin Finck     if (!pSQLErrorW) return SQL_ERROR;
2395*4658658fSAmine Khaldi 
2396*4658658fSAmine Khaldi     ret = pSQLErrorW(EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate, NativeError, MessageText,
2397*4658658fSAmine Khaldi                      BufferLength, TextLength);
2398*4658658fSAmine Khaldi 
2399*4658658fSAmine Khaldi     if (ret == SQL_SUCCESS)
2400*4658658fSAmine Khaldi     {
2401*4658658fSAmine Khaldi         TRACE(" SQLState %s\n", debugstr_wn(Sqlstate, 5));
2402*4658658fSAmine Khaldi         TRACE(" Error %d\n", *NativeError);
2403*4658658fSAmine Khaldi         TRACE(" MessageText %s\n", debugstr_wn(MessageText, *TextLength));
2404*4658658fSAmine Khaldi     }
2405*4658658fSAmine Khaldi 
2406*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2407*4658658fSAmine Khaldi     return ret;
2408c2c66affSColin Finck }
2409c2c66affSColin Finck 
2410c2c66affSColin Finck /*************************************************************************
2411c2c66affSColin Finck  *				SQLExecDirectW          [ODBC32.111]
2412c2c66affSColin Finck  */
ODBC32_SQLExecDirectW(SQLHSTMT StatementHandle,WCHAR * StatementText,SQLINTEGER TextLength)2413*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
2414c2c66affSColin Finck {
2415*4658658fSAmine Khaldi     SQLRETURN ret;
2416*4658658fSAmine Khaldi 
2417*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
2418*4658658fSAmine Khaldi           debugstr_wn(StatementText, TextLength), TextLength);
2419c2c66affSColin Finck 
2420c2c66affSColin Finck     if (!pSQLExecDirectW) return SQL_ERROR;
2421*4658658fSAmine Khaldi 
2422*4658658fSAmine Khaldi     ret = pSQLExecDirectW(StatementHandle, StatementText, TextLength);
2423*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2424*4658658fSAmine Khaldi     return ret;
2425c2c66affSColin Finck }
2426c2c66affSColin Finck 
2427c2c66affSColin Finck /*************************************************************************
2428c2c66affSColin Finck  *				SQLGetCursorNameW          [ODBC32.117]
2429c2c66affSColin Finck  */
ODBC32_SQLGetCursorNameW(SQLHSTMT StatementHandle,WCHAR * CursorName,SQLSMALLINT BufferLength,SQLSMALLINT * NameLength)2430*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength,
2431c2c66affSColin Finck                                           SQLSMALLINT *NameLength)
2432c2c66affSColin Finck {
2433*4658658fSAmine Khaldi     SQLRETURN ret;
2434*4658658fSAmine Khaldi 
2435*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
2436*4658658fSAmine Khaldi           BufferLength, NameLength);
2437c2c66affSColin Finck 
2438c2c66affSColin Finck     if (!pSQLGetCursorNameW) return SQL_ERROR;
2439*4658658fSAmine Khaldi 
2440*4658658fSAmine Khaldi     ret = pSQLGetCursorNameW(StatementHandle, CursorName, BufferLength, NameLength);
2441*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2442*4658658fSAmine Khaldi     return ret;
2443c2c66affSColin Finck }
2444c2c66affSColin Finck 
2445c2c66affSColin Finck /*************************************************************************
2446c2c66affSColin Finck  *				SQLPrepareW          [ODBC32.119]
2447c2c66affSColin Finck  */
ODBC32_SQLPrepareW(SQLHSTMT StatementHandle,WCHAR * StatementText,SQLINTEGER TextLength)2448*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
2449c2c66affSColin Finck {
2450*4658658fSAmine Khaldi     SQLRETURN ret;
2451*4658658fSAmine Khaldi 
2452*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
2453*4658658fSAmine Khaldi           debugstr_wn(StatementText, TextLength), TextLength);
2454c2c66affSColin Finck 
2455c2c66affSColin Finck     if (!pSQLPrepareW) return SQL_ERROR;
2456*4658658fSAmine Khaldi 
2457*4658658fSAmine Khaldi     ret = pSQLPrepareW(StatementHandle, StatementText, TextLength);
2458*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2459*4658658fSAmine Khaldi     return ret;
2460c2c66affSColin Finck }
2461c2c66affSColin Finck 
2462c2c66affSColin Finck /*************************************************************************
2463c2c66affSColin Finck  *				SQLSetCursorNameW          [ODBC32.121]
2464c2c66affSColin Finck  */
ODBC32_SQLSetCursorNameW(SQLHSTMT StatementHandle,WCHAR * CursorName,SQLSMALLINT NameLength)246504ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength)
2466c2c66affSColin Finck {
2467*4658658fSAmine Khaldi     SQLRETURN ret;
2468*4658658fSAmine Khaldi 
2469*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
2470*4658658fSAmine Khaldi           debugstr_wn(CursorName, NameLength), NameLength);
2471c2c66affSColin Finck 
2472c2c66affSColin Finck     if (!pSQLSetCursorNameW) return SQL_ERROR;
2473*4658658fSAmine Khaldi 
2474*4658658fSAmine Khaldi     ret = pSQLSetCursorNameW(StatementHandle, CursorName, NameLength);
2475*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2476*4658658fSAmine Khaldi     return ret;
2477c2c66affSColin Finck }
2478c2c66affSColin Finck 
2479c2c66affSColin Finck /*************************************************************************
2480c2c66affSColin Finck  *				SQLColAttributeW          [ODBC32.127]
2481c2c66affSColin Finck  */
ODBC32_SQLColAttributeW(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,SQLUSMALLINT FieldIdentifier,SQLPOINTER CharacterAttribute,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength,SQLLEN * NumericAttribute)2482*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
2483*4658658fSAmine Khaldi                                          SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
2484*4658658fSAmine Khaldi                                          SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
2485*4658658fSAmine Khaldi                                          SQLLEN *NumericAttribute)
2486c2c66affSColin Finck {
2487*4658658fSAmine Khaldi     SQLRETURN ret;
2488c2c66affSColin Finck 
2489*4658658fSAmine Khaldi     TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d"
2490*4658658fSAmine Khaldi           " StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier,
2491c2c66affSColin Finck           CharacterAttribute, BufferLength, StringLength, NumericAttribute);
2492c2c66affSColin Finck 
2493c2c66affSColin Finck     if (!pSQLColAttributeW) return SQL_ERROR;
2494c2c66affSColin Finck 
2495*4658658fSAmine Khaldi     ret = pSQLColAttributeW(StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength,
2496*4658658fSAmine Khaldi                             StringLength, NumericAttribute);
2497*4658658fSAmine Khaldi 
2498*4658658fSAmine Khaldi     if (ret == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier) &&
2499*4658658fSAmine Khaldi         StringLength && *StringLength != lstrlenW(CharacterAttribute) * 2)
2500*4658658fSAmine Khaldi     {
2501c2c66affSColin Finck         TRACE("CHEAT: resetting name length for ADO\n");
2502c2c66affSColin Finck         *StringLength = lstrlenW(CharacterAttribute) * 2;
2503c2c66affSColin Finck     }
2504*4658658fSAmine Khaldi 
2505*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2506*4658658fSAmine Khaldi     return ret;
2507c2c66affSColin Finck }
2508c2c66affSColin Finck 
2509c2c66affSColin Finck /*************************************************************************
2510c2c66affSColin Finck  *				SQLGetConnectAttrW          [ODBC32.132]
2511c2c66affSColin Finck  */
ODBC32_SQLGetConnectAttrW(SQLHDBC ConnectionHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER BufferLength,SQLINTEGER * StringLength)2512*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2513c2c66affSColin Finck                                            SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2514c2c66affSColin Finck {
2515*4658658fSAmine Khaldi     SQLRETURN ret;
2516*4658658fSAmine Khaldi 
2517*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2518*4658658fSAmine Khaldi           Attribute, Value, BufferLength, StringLength);
2519c2c66affSColin Finck 
2520c2c66affSColin Finck     if (!pSQLGetConnectAttrW) return SQL_ERROR;
2521*4658658fSAmine Khaldi 
2522*4658658fSAmine Khaldi     ret = pSQLGetConnectAttrW(ConnectionHandle, Attribute, Value, BufferLength, StringLength);
2523*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2524*4658658fSAmine Khaldi     return ret;
2525c2c66affSColin Finck }
2526c2c66affSColin Finck 
2527c2c66affSColin Finck /*************************************************************************
2528c2c66affSColin Finck  *				SQLGetDescFieldW          [ODBC32.133]
2529c2c66affSColin Finck  */
ODBC32_SQLGetDescFieldW(SQLHDESC DescriptorHandle,SQLSMALLINT RecNumber,SQLSMALLINT FieldIdentifier,SQLPOINTER Value,SQLINTEGER BufferLength,SQLINTEGER * StringLength)2530*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2531*4658658fSAmine Khaldi                                          SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2532c2c66affSColin Finck {
2533*4658658fSAmine Khaldi     SQLRETURN ret;
2534*4658658fSAmine Khaldi 
2535*4658658fSAmine Khaldi     TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
2536*4658658fSAmine Khaldi           DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
2537c2c66affSColin Finck 
2538c2c66affSColin Finck     if (!pSQLGetDescFieldW) return SQL_ERROR;
2539*4658658fSAmine Khaldi 
2540*4658658fSAmine Khaldi     ret = pSQLGetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
2541*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2542*4658658fSAmine Khaldi     return ret;
2543c2c66affSColin Finck }
2544c2c66affSColin Finck 
2545c2c66affSColin Finck /*************************************************************************
2546c2c66affSColin Finck  *				SQLGetDescRecW          [ODBC32.134]
2547c2c66affSColin Finck  */
ODBC32_SQLGetDescRecW(SQLHDESC DescriptorHandle,SQLSMALLINT RecNumber,WCHAR * Name,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength,SQLSMALLINT * Type,SQLSMALLINT * SubType,SQLLEN * Length,SQLSMALLINT * Precision,SQLSMALLINT * Scale,SQLSMALLINT * Nullable)2548*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, WCHAR *Name,
2549*4658658fSAmine Khaldi                                        SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
2550*4658658fSAmine Khaldi                                        SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
2551c2c66affSColin Finck                                        SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
2552c2c66affSColin Finck {
2553*4658658fSAmine Khaldi     SQLRETURN ret;
2554*4658658fSAmine Khaldi 
2555*4658658fSAmine Khaldi     TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
2556*4658658fSAmine Khaldi           " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
2557*4658658fSAmine Khaldi           StringLength, Type, SubType, Length, Precision, Scale, Nullable);
2558c2c66affSColin Finck 
2559c2c66affSColin Finck     if (!pSQLGetDescRecW) return SQL_ERROR;
2560*4658658fSAmine Khaldi 
2561*4658658fSAmine Khaldi     ret = pSQLGetDescRecW(DescriptorHandle, RecNumber, Name, BufferLength, StringLength, Type, SubType, Length,
2562*4658658fSAmine Khaldi                           Precision, Scale, Nullable);
2563*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2564*4658658fSAmine Khaldi     return ret;
2565c2c66affSColin Finck }
2566c2c66affSColin Finck 
2567c2c66affSColin Finck /*************************************************************************
2568c2c66affSColin Finck  *				SQLGetDiagFieldW          [ODBC32.135]
2569c2c66affSColin Finck  */
ODBC32_SQLGetDiagFieldW(SQLSMALLINT HandleType,SQLHANDLE Handle,SQLSMALLINT RecNumber,SQLSMALLINT DiagIdentifier,SQLPOINTER DiagInfo,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength)2570*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2571*4658658fSAmine Khaldi                                          SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
2572c2c66affSColin Finck                                          SQLSMALLINT *StringLength)
2573c2c66affSColin Finck {
2574*4658658fSAmine Khaldi     SQLRETURN ret;
2575*4658658fSAmine Khaldi 
2576*4658658fSAmine Khaldi     TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
2577*4658658fSAmine Khaldi           " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
2578c2c66affSColin Finck 
2579c2c66affSColin Finck     if (!pSQLGetDiagFieldW) return SQL_ERROR;
2580*4658658fSAmine Khaldi 
2581*4658658fSAmine Khaldi     ret = pSQLGetDiagFieldW(HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
2582*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2583*4658658fSAmine Khaldi     return ret;
2584c2c66affSColin Finck }
2585c2c66affSColin Finck 
2586c2c66affSColin Finck /*************************************************************************
2587c2c66affSColin Finck  *				SQLGetDiagRecW           [ODBC32.136]
2588c2c66affSColin Finck  */
ODBC32_SQLGetDiagRecW(SQLSMALLINT HandleType,SQLHANDLE Handle,SQLSMALLINT RecNumber,WCHAR * Sqlstate,SQLINTEGER * NativeError,WCHAR * MessageText,SQLSMALLINT BufferLength,SQLSMALLINT * TextLength)2589*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2590*4658658fSAmine Khaldi                                        WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
2591c2c66affSColin Finck                                        SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2592c2c66affSColin Finck {
2593*4658658fSAmine Khaldi     SQLRETURN ret;
2594*4658658fSAmine Khaldi 
2595*4658658fSAmine Khaldi     TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
2596*4658658fSAmine Khaldi           " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
2597*4658658fSAmine Khaldi           TextLength);
2598c2c66affSColin Finck 
2599c2c66affSColin Finck     if (!pSQLGetDiagRecW) return SQL_ERROR;
2600*4658658fSAmine Khaldi 
2601*4658658fSAmine Khaldi     ret = pSQLGetDiagRecW(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
2602*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2603*4658658fSAmine Khaldi     return ret;
2604c2c66affSColin Finck }
2605c2c66affSColin Finck 
2606c2c66affSColin Finck /*************************************************************************
2607c2c66affSColin Finck  *				SQLGetStmtAttrW          [ODBC32.138]
2608c2c66affSColin Finck  */
ODBC32_SQLGetStmtAttrW(SQLHSTMT StatementHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER BufferLength,SQLINTEGER * StringLength)2609*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2610c2c66affSColin Finck                                         SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2611c2c66affSColin Finck {
2612*4658658fSAmine Khaldi     SQLRETURN ret;
2613c2c66affSColin Finck 
2614*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
2615c2c66affSColin Finck           Attribute, Value, BufferLength, StringLength);
2616c2c66affSColin Finck 
2617*4658658fSAmine Khaldi     if (!Value)
2618*4658658fSAmine Khaldi     {
2619*4658658fSAmine Khaldi         WARN("Unexpected NULL Value return address\n");
2620*4658658fSAmine Khaldi         return SQL_ERROR;
2621c2c66affSColin Finck     }
2622*4658658fSAmine Khaldi 
2623*4658658fSAmine Khaldi     if (!pSQLGetStmtAttrW) return SQL_ERROR;
2624*4658658fSAmine Khaldi 
2625*4658658fSAmine Khaldi     ret = pSQLGetStmtAttrW(StatementHandle, Attribute, Value, BufferLength, StringLength);
2626*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2627*4658658fSAmine Khaldi     return ret;
2628c2c66affSColin Finck }
2629c2c66affSColin Finck 
2630c2c66affSColin Finck /*************************************************************************
2631c2c66affSColin Finck  *				SQLSetConnectAttrW          [ODBC32.139]
2632c2c66affSColin Finck  */
ODBC32_SQLSetConnectAttrW(SQLHDBC ConnectionHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER StringLength)2633*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2634*4658658fSAmine Khaldi                                            SQLINTEGER StringLength)
2635c2c66affSColin Finck {
2636*4658658fSAmine Khaldi     SQLRETURN ret;
2637*4658658fSAmine Khaldi 
2638*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
2639*4658658fSAmine Khaldi           StringLength);
2640c2c66affSColin Finck 
2641c2c66affSColin Finck     if (!pSQLSetConnectAttrW) return SQL_ERROR;
2642*4658658fSAmine Khaldi 
2643*4658658fSAmine Khaldi     ret = pSQLSetConnectAttrW(ConnectionHandle, Attribute, Value, StringLength);
2644*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2645*4658658fSAmine Khaldi     return ret;
2646c2c66affSColin Finck }
2647c2c66affSColin Finck 
2648c2c66affSColin Finck /*************************************************************************
2649c2c66affSColin Finck  *				SQLColumnsW          [ODBC32.140]
2650c2c66affSColin Finck  */
ODBC32_SQLColumnsW(SQLHSTMT StatementHandle,WCHAR * CatalogName,SQLSMALLINT NameLength1,WCHAR * SchemaName,SQLSMALLINT NameLength2,WCHAR * TableName,SQLSMALLINT NameLength3,WCHAR * ColumnName,SQLSMALLINT NameLength4)2651*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSMALLINT NameLength1,
2652*4658658fSAmine Khaldi                                     WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName,
2653*4658658fSAmine Khaldi                                     SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4)
2654c2c66affSColin Finck {
2655*4658658fSAmine Khaldi     SQLRETURN ret;
2656*4658658fSAmine Khaldi 
2657*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2658*4658658fSAmine Khaldi           " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
2659*4658658fSAmine Khaldi           debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2660*4658658fSAmine Khaldi           debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(ColumnName, NameLength4), NameLength4);
2661c2c66affSColin Finck 
2662c2c66affSColin Finck     if (!pSQLColumnsW) return SQL_ERROR;
2663*4658658fSAmine Khaldi 
2664*4658658fSAmine Khaldi     ret = pSQLColumnsW(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
2665*4658658fSAmine Khaldi                        ColumnName, NameLength4);
2666*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2667*4658658fSAmine Khaldi     return ret;
2668c2c66affSColin Finck }
2669c2c66affSColin Finck 
2670c2c66affSColin Finck /*************************************************************************
2671c2c66affSColin Finck  *				SQLDriverConnectW          [ODBC32.141]
2672c2c66affSColin Finck  */
ODBC32_SQLDriverConnectW(SQLHDBC ConnectionHandle,SQLHWND WindowHandle,WCHAR * InConnectionString,SQLSMALLINT Length,WCHAR * OutConnectionString,SQLSMALLINT BufferLength,SQLSMALLINT * Length2,SQLUSMALLINT DriverCompletion)2673*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, WCHAR *InConnectionString,
2674*4658658fSAmine Khaldi                                           SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength,
2675*4658658fSAmine Khaldi                                           SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion)
2676c2c66affSColin Finck {
2677*4658658fSAmine Khaldi     SQLRETURN ret;
2678*4658658fSAmine Khaldi 
2679*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
2680*4658658fSAmine Khaldi           " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
2681*4658658fSAmine Khaldi           debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2,
2682*4658658fSAmine Khaldi           DriverCompletion);
2683c2c66affSColin Finck 
2684c2c66affSColin Finck     if (!pSQLDriverConnectW) return SQL_ERROR;
2685*4658658fSAmine Khaldi 
2686*4658658fSAmine Khaldi     ret = pSQLDriverConnectW(ConnectionHandle, WindowHandle, InConnectionString, Length, OutConnectionString,
2687*4658658fSAmine Khaldi                              BufferLength, Length2, DriverCompletion);
2688*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2689*4658658fSAmine Khaldi     return ret;
2690c2c66affSColin Finck }
2691c2c66affSColin Finck 
2692c2c66affSColin Finck /*************************************************************************
2693c2c66affSColin Finck  *				SQLGetConnectOptionW      [ODBC32.142]
2694c2c66affSColin Finck  */
ODBC32_SQLGetConnectOptionW(SQLHDBC ConnectionHandle,SQLUSMALLINT Option,SQLPOINTER Value)269504ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
2696c2c66affSColin Finck {
2697*4658658fSAmine Khaldi     SQLRETURN ret;
2698*4658658fSAmine Khaldi 
2699*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
2700c2c66affSColin Finck 
2701c2c66affSColin Finck     if (!pSQLGetConnectOptionW) return SQL_ERROR;
2702*4658658fSAmine Khaldi 
2703*4658658fSAmine Khaldi     ret = pSQLGetConnectOptionW(ConnectionHandle, Option, Value);
2704*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2705*4658658fSAmine Khaldi     return ret;
2706c2c66affSColin Finck }
2707c2c66affSColin Finck 
2708c2c66affSColin Finck /*************************************************************************
2709c2c66affSColin Finck  *				SQLGetInfoW          [ODBC32.145]
2710c2c66affSColin Finck  */
ODBC32_SQLGetInfoW(SQLHDBC ConnectionHandle,SQLUSMALLINT InfoType,SQLPOINTER InfoValue,SQLSMALLINT BufferLength,SQLSMALLINT * StringLength)2711*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
2712c2c66affSColin Finck                                     SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
2713c2c66affSColin Finck {
2714*4658658fSAmine Khaldi     SQLRETURN ret;
2715c2c66affSColin Finck 
2716*4658658fSAmine Khaldi     TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2717*4658658fSAmine Khaldi           InfoType, InfoValue, BufferLength, StringLength);
2718*4658658fSAmine Khaldi 
2719*4658658fSAmine Khaldi     if (!InfoValue)
2720*4658658fSAmine Khaldi     {
2721*4658658fSAmine Khaldi         WARN("Unexpected NULL InfoValue address\n");
2722*4658658fSAmine Khaldi         return SQL_ERROR;
2723c2c66affSColin Finck     }
2724*4658658fSAmine Khaldi 
2725*4658658fSAmine Khaldi     if (!pSQLGetInfoW) return SQL_ERROR;
2726*4658658fSAmine Khaldi 
2727*4658658fSAmine Khaldi     ret = pSQLGetInfoW(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
2728*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2729*4658658fSAmine Khaldi     return ret;
2730c2c66affSColin Finck }
2731c2c66affSColin Finck 
2732c2c66affSColin Finck /*************************************************************************
2733c2c66affSColin Finck  *				SQLGetTypeInfoW          [ODBC32.147]
2734c2c66affSColin Finck  */
ODBC32_SQLGetTypeInfoW(SQLHSTMT StatementHandle,SQLSMALLINT DataType)273504ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
2736c2c66affSColin Finck {
2737*4658658fSAmine Khaldi     SQLRETURN ret;
2738*4658658fSAmine Khaldi 
2739*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
2740c2c66affSColin Finck 
2741c2c66affSColin Finck     if (!pSQLGetTypeInfoW) return SQL_ERROR;
2742*4658658fSAmine Khaldi 
2743*4658658fSAmine Khaldi     ret = pSQLGetTypeInfoW(StatementHandle, DataType);
2744*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2745*4658658fSAmine Khaldi     return ret;
2746c2c66affSColin Finck }
2747c2c66affSColin Finck 
2748c2c66affSColin Finck /*************************************************************************
2749c2c66affSColin Finck  *				SQLSetConnectOptionW          [ODBC32.150]
2750c2c66affSColin Finck  */
ODBC32_SQLSetConnectOptionW(SQLHDBC ConnectionHandle,SQLUSMALLINT Option,SQLULEN Value)275104ef5f7aSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value)
2752c2c66affSColin Finck {
2753*4658658fSAmine Khaldi     SQLRETURN ret;
2754*4658658fSAmine Khaldi 
2755*4658658fSAmine Khaldi     TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqllen(Value));
2756c2c66affSColin Finck 
2757c2c66affSColin Finck     if (!pSQLSetConnectOptionW) return SQL_ERROR;
2758*4658658fSAmine Khaldi 
2759*4658658fSAmine Khaldi     ret = pSQLSetConnectOptionW(ConnectionHandle, Option, Value);
2760*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2761*4658658fSAmine Khaldi     return ret;
2762c2c66affSColin Finck }
2763c2c66affSColin Finck 
2764c2c66affSColin Finck /*************************************************************************
2765c2c66affSColin Finck  *				SQLSpecialColumnsW          [ODBC32.152]
2766c2c66affSColin Finck  */
ODBC32_SQLSpecialColumnsW(SQLHSTMT StatementHandle,SQLUSMALLINT IdentifierType,SQLWCHAR * CatalogName,SQLSMALLINT NameLength1,SQLWCHAR * SchemaName,SQLSMALLINT NameLength2,SQLWCHAR * TableName,SQLSMALLINT NameLength3,SQLUSMALLINT Scope,SQLUSMALLINT Nullable)2767*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType,
2768*4658658fSAmine Khaldi                                            SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, SQLWCHAR *SchemaName,
2769*4658658fSAmine Khaldi                                            SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3,
2770*4658658fSAmine Khaldi                                            SQLUSMALLINT Scope, SQLUSMALLINT Nullable)
2771c2c66affSColin Finck {
2772*4658658fSAmine Khaldi     SQLRETURN ret;
2773*4658658fSAmine Khaldi 
2774*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
2775*4658658fSAmine Khaldi           " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
2776*4658658fSAmine Khaldi           debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2777*4658658fSAmine Khaldi           debugstr_wn(TableName, NameLength3), NameLength3, Scope, Nullable);
2778*4658658fSAmine Khaldi 
2779c2c66affSColin Finck     if (!pSQLSpecialColumnsW) return SQL_ERROR;
2780*4658658fSAmine Khaldi 
2781*4658658fSAmine Khaldi     ret = pSQLSpecialColumnsW(StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
2782c2c66affSColin Finck                               NameLength2, TableName, NameLength3, Scope, Nullable);
2783*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2784*4658658fSAmine Khaldi     return ret;
2785c2c66affSColin Finck }
2786c2c66affSColin Finck 
2787c2c66affSColin Finck /*************************************************************************
2788c2c66affSColin Finck  *				SQLStatisticsW          [ODBC32.153]
2789c2c66affSColin Finck  */
ODBC32_SQLStatisticsW(SQLHSTMT StatementHandle,SQLWCHAR * CatalogName,SQLSMALLINT NameLength1,SQLWCHAR * SchemaName,SQLSMALLINT NameLength2,SQLWCHAR * TableName,SQLSMALLINT NameLength3,SQLUSMALLINT Unique,SQLUSMALLINT Reserved)2790*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
2791*4658658fSAmine Khaldi                                        SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
2792*4658658fSAmine Khaldi                                        SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
2793c2c66affSColin Finck {
2794*4658658fSAmine Khaldi     SQLRETURN ret;
2795*4658658fSAmine Khaldi 
2796*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
2797*4658658fSAmine Khaldi           " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
2798*4658658fSAmine Khaldi           debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2799*4658658fSAmine Khaldi           debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved);
2800c2c66affSColin Finck 
2801c2c66affSColin Finck     if (!pSQLStatisticsW) return SQL_ERROR;
2802*4658658fSAmine Khaldi 
2803*4658658fSAmine Khaldi     ret = pSQLStatisticsW(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName,
2804*4658658fSAmine Khaldi                           NameLength3, Unique, Reserved);
2805*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2806*4658658fSAmine Khaldi     return ret;
2807c2c66affSColin Finck }
2808c2c66affSColin Finck 
2809c2c66affSColin Finck /*************************************************************************
2810c2c66affSColin Finck  *				SQLTablesW          [ODBC32.154]
2811c2c66affSColin Finck  */
ODBC32_SQLTablesW(SQLHSTMT StatementHandle,SQLWCHAR * CatalogName,SQLSMALLINT NameLength1,SQLWCHAR * SchemaName,SQLSMALLINT NameLength2,SQLWCHAR * TableName,SQLSMALLINT NameLength3,SQLWCHAR * TableType,SQLSMALLINT NameLength4)2812*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
2813*4658658fSAmine Khaldi                                    SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
2814*4658658fSAmine Khaldi                                    SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4)
2815c2c66affSColin Finck {
2816*4658658fSAmine Khaldi     SQLRETURN ret;
2817*4658658fSAmine Khaldi 
2818*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2819*4658658fSAmine Khaldi           " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
2820*4658658fSAmine Khaldi           debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2821*4658658fSAmine Khaldi           debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(TableType, NameLength4), NameLength4);
2822c2c66affSColin Finck 
2823c2c66affSColin Finck     if (!pSQLTablesW) return SQL_ERROR;
2824*4658658fSAmine Khaldi 
2825*4658658fSAmine Khaldi     ret = pSQLTablesW(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
2826*4658658fSAmine Khaldi                       TableType, NameLength4);
2827*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2828*4658658fSAmine Khaldi     return ret;
2829c2c66affSColin Finck }
2830c2c66affSColin Finck 
2831c2c66affSColin Finck /*************************************************************************
2832c2c66affSColin Finck  *				SQLBrowseConnectW          [ODBC32.155]
2833c2c66affSColin Finck  */
ODBC32_SQLBrowseConnectW(SQLHDBC hdbc,SQLWCHAR * szConnStrIn,SQLSMALLINT cbConnStrIn,SQLWCHAR * szConnStrOut,SQLSMALLINT cbConnStrOutMax,SQLSMALLINT * pcbConnStrOut)2834*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
2835*4658658fSAmine Khaldi                                           SQLWCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
2836c2c66affSColin Finck                                           SQLSMALLINT *pcbConnStrOut)
2837c2c66affSColin Finck {
2838*4658658fSAmine Khaldi     SQLRETURN ret;
2839*4658658fSAmine Khaldi 
2840*4658658fSAmine Khaldi     TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
2841*4658658fSAmine Khaldi           hdbc, debugstr_wn(szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
2842c2c66affSColin Finck 
2843c2c66affSColin Finck     if (!pSQLBrowseConnectW) return SQL_ERROR;
2844*4658658fSAmine Khaldi 
2845*4658658fSAmine Khaldi     ret = pSQLBrowseConnectW(hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
2846*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2847*4658658fSAmine Khaldi     return ret;
2848c2c66affSColin Finck }
2849c2c66affSColin Finck 
2850c2c66affSColin Finck /*************************************************************************
2851c2c66affSColin Finck  *				SQLColumnPrivilegesW          [ODBC32.156]
2852c2c66affSColin Finck  */
ODBC32_SQLColumnPrivilegesW(SQLHSTMT hstmt,SQLWCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLWCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLWCHAR * szTableName,SQLSMALLINT cbTableName,SQLWCHAR * szColumnName,SQLSMALLINT cbColumnName)2853*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLColumnPrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2854*4658658fSAmine Khaldi                                              SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2855*4658658fSAmine Khaldi                                              SQLSMALLINT cbTableName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
2856c2c66affSColin Finck {
2857*4658658fSAmine Khaldi     SQLRETURN ret;
2858*4658658fSAmine Khaldi 
2859*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2860*4658658fSAmine Khaldi           " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2861*4658658fSAmine Khaldi           debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2862*4658658fSAmine Khaldi           debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2863*4658658fSAmine Khaldi           debugstr_wn(szTableName, cbTableName), cbTableName,
2864*4658658fSAmine Khaldi           debugstr_wn(szColumnName, cbColumnName), cbColumnName);
2865c2c66affSColin Finck 
2866c2c66affSColin Finck     if (!pSQLColumnPrivilegesW) return SQL_ERROR;
2867*4658658fSAmine Khaldi 
2868*4658658fSAmine Khaldi     ret = pSQLColumnPrivilegesW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName,
2869*4658658fSAmine Khaldi                                 cbTableName, szColumnName, cbColumnName);
2870*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2871*4658658fSAmine Khaldi     return ret;
2872c2c66affSColin Finck }
2873c2c66affSColin Finck 
2874c2c66affSColin Finck /*************************************************************************
2875c2c66affSColin Finck  *				SQLDataSourcesW          [ODBC32.157]
2876c2c66affSColin Finck  */
ODBC32_SQLDataSourcesW(SQLHENV EnvironmentHandle,SQLUSMALLINT Direction,WCHAR * ServerName,SQLSMALLINT BufferLength1,SQLSMALLINT * NameLength1,WCHAR * Description,SQLSMALLINT BufferLength2,SQLSMALLINT * NameLength2)2877*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, WCHAR *ServerName,
2878*4658658fSAmine Khaldi                                         SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description,
2879*4658658fSAmine Khaldi                                         SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
2880c2c66affSColin Finck {
2881c2c66affSColin Finck     SQLRETURN ret;
2882c2c66affSColin Finck 
2883*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
2884*4658658fSAmine Khaldi           " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
2885*4658658fSAmine Khaldi           NameLength1, Description, BufferLength2, NameLength2);
2886c2c66affSColin Finck 
2887c2c66affSColin Finck     if (!pSQLDataSourcesW) return SQL_ERROR;
2888c2c66affSColin Finck 
2889*4658658fSAmine Khaldi     ret = pSQLDataSourcesW(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description,
2890*4658658fSAmine Khaldi                            BufferLength2, NameLength2);
2891c2c66affSColin Finck 
2892*4658658fSAmine Khaldi     if (ret >= 0 && TRACE_ON(odbc))
2893c2c66affSColin Finck     {
2894*4658658fSAmine Khaldi         if (ServerName && NameLength1 && *NameLength1 > 0)
2895*4658658fSAmine Khaldi             TRACE(" DataSource %s", debugstr_wn(ServerName, *NameLength1));
2896*4658658fSAmine Khaldi         if (Description && NameLength2 && *NameLength2 > 0)
2897*4658658fSAmine Khaldi             TRACE(" Description %s", debugstr_wn(Description, *NameLength2));
2898c2c66affSColin Finck         TRACE("\n");
2899c2c66affSColin Finck     }
2900c2c66affSColin Finck 
2901*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2902c2c66affSColin Finck     return ret;
2903c2c66affSColin Finck }
2904c2c66affSColin Finck 
2905c2c66affSColin Finck /*************************************************************************
2906c2c66affSColin Finck  *				SQLForeignKeysW          [ODBC32.160]
2907c2c66affSColin Finck  */
ODBC32_SQLForeignKeysW(SQLHSTMT hstmt,SQLWCHAR * szPkCatalogName,SQLSMALLINT cbPkCatalogName,SQLWCHAR * szPkSchemaName,SQLSMALLINT cbPkSchemaName,SQLWCHAR * szPkTableName,SQLSMALLINT cbPkTableName,SQLWCHAR * szFkCatalogName,SQLSMALLINT cbFkCatalogName,SQLWCHAR * szFkSchemaName,SQLSMALLINT cbFkSchemaName,SQLWCHAR * szFkTableName,SQLSMALLINT cbFkTableName)2908*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
2909*4658658fSAmine Khaldi                                         SQLWCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLWCHAR *szPkTableName,
2910*4658658fSAmine Khaldi                                         SQLSMALLINT cbPkTableName, SQLWCHAR *szFkCatalogName,
2911*4658658fSAmine Khaldi                                         SQLSMALLINT cbFkCatalogName, SQLWCHAR *szFkSchemaName,
2912*4658658fSAmine Khaldi                                         SQLSMALLINT cbFkSchemaName, SQLWCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
2913c2c66affSColin Finck {
2914*4658658fSAmine Khaldi     SQLRETURN ret;
2915*4658658fSAmine Khaldi 
2916*4658658fSAmine Khaldi     TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
2917*4658658fSAmine Khaldi           " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
2918*4658658fSAmine Khaldi           " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
2919*4658658fSAmine Khaldi           debugstr_wn(szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
2920*4658658fSAmine Khaldi           debugstr_wn(szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
2921*4658658fSAmine Khaldi           debugstr_wn(szPkTableName, cbPkTableName), cbPkTableName,
2922*4658658fSAmine Khaldi           debugstr_wn(szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
2923*4658658fSAmine Khaldi           debugstr_wn(szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
2924*4658658fSAmine Khaldi           debugstr_wn(szFkTableName, cbFkTableName), cbFkTableName);
2925c2c66affSColin Finck 
2926c2c66affSColin Finck     if (!pSQLForeignKeysW) return SQL_ERROR;
2927*4658658fSAmine Khaldi 
2928*4658658fSAmine Khaldi     ret = pSQLForeignKeysW(hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName, szPkTableName,
2929*4658658fSAmine Khaldi                            cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName, cbFkSchemaName,
2930*4658658fSAmine Khaldi                            szFkTableName, cbFkTableName);
2931*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2932*4658658fSAmine Khaldi     return ret;
2933c2c66affSColin Finck }
2934c2c66affSColin Finck 
2935c2c66affSColin Finck /*************************************************************************
2936c2c66affSColin Finck  *				SQLNativeSqlW          [ODBC32.162]
2937c2c66affSColin Finck  */
ODBC32_SQLNativeSqlW(SQLHDBC hdbc,SQLWCHAR * szSqlStrIn,SQLINTEGER cbSqlStrIn,SQLWCHAR * szSqlStr,SQLINTEGER cbSqlStrMax,SQLINTEGER * pcbSqlStr)2938*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr,
2939*4658658fSAmine Khaldi                                       SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
2940c2c66affSColin Finck {
2941*4658658fSAmine Khaldi     SQLRETURN ret;
2942*4658658fSAmine Khaldi 
2943*4658658fSAmine Khaldi     TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
2944*4658658fSAmine Khaldi           debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2945c2c66affSColin Finck 
2946c2c66affSColin Finck     if (!pSQLNativeSqlW) return SQL_ERROR;
2947*4658658fSAmine Khaldi 
2948*4658658fSAmine Khaldi     ret = pSQLNativeSqlW(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2949*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2950*4658658fSAmine Khaldi     return ret;
2951c2c66affSColin Finck }
2952c2c66affSColin Finck 
2953c2c66affSColin Finck /*************************************************************************
2954c2c66affSColin Finck  *				SQLPrimaryKeysW          [ODBC32.165]
2955c2c66affSColin Finck  */
ODBC32_SQLPrimaryKeysW(SQLHSTMT hstmt,SQLWCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLWCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLWCHAR * szTableName,SQLSMALLINT cbTableName)2956*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2957*4658658fSAmine Khaldi                                         SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2958c2c66affSColin Finck                                         SQLSMALLINT cbTableName)
2959c2c66affSColin Finck {
2960*4658658fSAmine Khaldi     SQLRETURN ret;
2961*4658658fSAmine Khaldi 
2962*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2963*4658658fSAmine Khaldi           " cbTableName %d)\n", hstmt,
2964*4658658fSAmine Khaldi           debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2965*4658658fSAmine Khaldi           debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2966*4658658fSAmine Khaldi           debugstr_wn(szTableName, cbTableName), cbTableName);
2967c2c66affSColin Finck 
2968c2c66affSColin Finck     if (!pSQLPrimaryKeysW) return SQL_ERROR;
2969*4658658fSAmine Khaldi 
2970*4658658fSAmine Khaldi     ret = pSQLPrimaryKeysW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName);
2971*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2972*4658658fSAmine Khaldi     return ret;
2973c2c66affSColin Finck }
2974c2c66affSColin Finck 
2975c2c66affSColin Finck /*************************************************************************
2976c2c66affSColin Finck  *				SQLProcedureColumnsW          [ODBC32.166]
2977c2c66affSColin Finck  */
ODBC32_SQLProcedureColumnsW(SQLHSTMT hstmt,SQLWCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLWCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLWCHAR * szProcName,SQLSMALLINT cbProcName,SQLWCHAR * szColumnName,SQLSMALLINT cbColumnName)2978*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2979*4658658fSAmine Khaldi                                              SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
2980*4658658fSAmine Khaldi                                              SQLSMALLINT cbProcName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
2981c2c66affSColin Finck {
2982*4658658fSAmine Khaldi     SQLRETURN ret;
2983*4658658fSAmine Khaldi 
2984*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2985*4658658fSAmine Khaldi           " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2986*4658658fSAmine Khaldi           debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2987*4658658fSAmine Khaldi           debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2988*4658658fSAmine Khaldi           debugstr_wn(szProcName, cbProcName), cbProcName,
2989*4658658fSAmine Khaldi           debugstr_wn(szColumnName, cbColumnName), cbColumnName);
2990c2c66affSColin Finck 
2991c2c66affSColin Finck     if (!pSQLProcedureColumnsW) return SQL_ERROR;
2992*4658658fSAmine Khaldi 
2993*4658658fSAmine Khaldi     ret = pSQLProcedureColumnsW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName,
2994*4658658fSAmine Khaldi                                 cbProcName, szColumnName, cbColumnName);
2995*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
2996*4658658fSAmine Khaldi     return ret;
2997c2c66affSColin Finck }
2998c2c66affSColin Finck 
2999c2c66affSColin Finck /*************************************************************************
3000c2c66affSColin Finck  *				SQLProceduresW          [ODBC32.167]
3001c2c66affSColin Finck  */
ODBC32_SQLProceduresW(SQLHSTMT hstmt,SQLWCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLWCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLWCHAR * szProcName,SQLSMALLINT cbProcName)3002*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
3003*4658658fSAmine Khaldi                                        SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
3004c2c66affSColin Finck                                        SQLSMALLINT cbProcName)
3005c2c66affSColin Finck {
3006*4658658fSAmine Khaldi     SQLRETURN ret;
3007*4658658fSAmine Khaldi 
3008*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
3009*4658658fSAmine Khaldi           " cbProcName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
3010*4658658fSAmine Khaldi           debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szProcName, cbProcName), cbProcName);
3011c2c66affSColin Finck 
3012c2c66affSColin Finck     if (!pSQLProceduresW) return SQL_ERROR;
3013*4658658fSAmine Khaldi 
3014*4658658fSAmine Khaldi     ret = pSQLProceduresW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName);
3015*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
3016*4658658fSAmine Khaldi     return ret;
3017c2c66affSColin Finck }
3018c2c66affSColin Finck 
3019c2c66affSColin Finck /*************************************************************************
3020c2c66affSColin Finck  *				SQLTablePrivilegesW          [ODBC32.170]
3021c2c66affSColin Finck  */
ODBC32_SQLTablePrivilegesW(SQLHSTMT hstmt,SQLWCHAR * szCatalogName,SQLSMALLINT cbCatalogName,SQLWCHAR * szSchemaName,SQLSMALLINT cbSchemaName,SQLWCHAR * szTableName,SQLSMALLINT cbTableName)3022*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
3023*4658658fSAmine Khaldi                                             SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
3024c2c66affSColin Finck                                             SQLSMALLINT cbTableName)
3025c2c66affSColin Finck {
3026*4658658fSAmine Khaldi     SQLRETURN ret;
3027*4658658fSAmine Khaldi 
3028*4658658fSAmine Khaldi     TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
3029*4658658fSAmine Khaldi           " cbTableName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
3030*4658658fSAmine Khaldi           debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szTableName, cbTableName), cbTableName);
3031c2c66affSColin Finck 
3032c2c66affSColin Finck     if (!pSQLTablePrivilegesW) return SQL_ERROR;
3033*4658658fSAmine Khaldi 
3034*4658658fSAmine Khaldi     ret = pSQLTablePrivilegesW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName,
3035*4658658fSAmine Khaldi                                cbTableName);
3036*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
3037*4658658fSAmine Khaldi     return ret;
3038c2c66affSColin Finck }
3039c2c66affSColin Finck 
3040c2c66affSColin Finck /*************************************************************************
3041c2c66affSColin Finck  *				SQLDriversW          [ODBC32.171]
3042c2c66affSColin Finck  */
ODBC32_SQLDriversW(SQLHENV EnvironmentHandle,SQLUSMALLINT fDirection,SQLWCHAR * szDriverDesc,SQLSMALLINT cbDriverDescMax,SQLSMALLINT * pcbDriverDesc,SQLWCHAR * szDriverAttributes,SQLSMALLINT cbDriverAttrMax,SQLSMALLINT * pcbDriverAttr)3043*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLWCHAR *szDriverDesc,
3044*4658658fSAmine Khaldi                                     SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
3045*4658658fSAmine Khaldi                                     SQLWCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
3046c2c66affSColin Finck                                     SQLSMALLINT *pcbDriverAttr)
3047c2c66affSColin Finck {
3048c2c66affSColin Finck     SQLRETURN ret;
3049c2c66affSColin Finck 
3050*4658658fSAmine Khaldi     TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
3051*4658658fSAmine Khaldi           " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
3052*4658658fSAmine Khaldi           szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
3053c2c66affSColin Finck 
3054c2c66affSColin Finck     if (!pSQLDriversW) return SQL_ERROR;
3055*4658658fSAmine Khaldi 
3056*4658658fSAmine Khaldi     ret = pSQLDriversW(EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
3057c2c66affSColin Finck                        szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
3058c2c66affSColin Finck 
3059c2c66affSColin Finck     if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
3060*4658658fSAmine Khaldi         ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
3061c2c66affSColin Finck 
3062*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
3063c2c66affSColin Finck     return ret;
3064c2c66affSColin Finck }
3065c2c66affSColin Finck 
3066c2c66affSColin Finck /*************************************************************************
3067c2c66affSColin Finck  *				SQLSetDescFieldW          [ODBC32.173]
3068c2c66affSColin Finck  */
ODBC32_SQLSetDescFieldW(SQLHDESC DescriptorHandle,SQLSMALLINT RecNumber,SQLSMALLINT FieldIdentifier,SQLPOINTER Value,SQLINTEGER BufferLength)3069*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
3070c2c66affSColin Finck                                          SQLPOINTER Value, SQLINTEGER BufferLength)
3071c2c66affSColin Finck {
3072*4658658fSAmine Khaldi     SQLRETURN ret;
3073*4658658fSAmine Khaldi 
3074*4658658fSAmine Khaldi     TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
3075*4658658fSAmine Khaldi           RecNumber, FieldIdentifier, Value, BufferLength);
3076c2c66affSColin Finck 
3077c2c66affSColin Finck     if (!pSQLSetDescFieldW) return SQL_ERROR;
3078*4658658fSAmine Khaldi 
3079*4658658fSAmine Khaldi     ret = pSQLSetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
3080*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
3081*4658658fSAmine Khaldi     return ret;
3082c2c66affSColin Finck }
3083c2c66affSColin Finck 
3084c2c66affSColin Finck /*************************************************************************
3085c2c66affSColin Finck  *				SQLSetStmtAttrW          [ODBC32.176]
3086c2c66affSColin Finck  */
ODBC32_SQLSetStmtAttrW(SQLHSTMT StatementHandle,SQLINTEGER Attribute,SQLPOINTER Value,SQLINTEGER StringLength)3087*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
3088c2c66affSColin Finck                                         SQLINTEGER StringLength)
3089c2c66affSColin Finck {
3090*4658658fSAmine Khaldi     SQLRETURN ret;
3091*4658658fSAmine Khaldi 
3092*4658658fSAmine Khaldi     TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
3093*4658658fSAmine Khaldi           StringLength);
3094c2c66affSColin Finck 
3095c2c66affSColin Finck     if (!pSQLSetStmtAttrW) return SQL_ERROR;
3096*4658658fSAmine Khaldi 
3097*4658658fSAmine Khaldi     ret = pSQLSetStmtAttrW(StatementHandle, Attribute, Value, StringLength);
3098*4658658fSAmine Khaldi     if (ret == SQL_ERROR && (Attribute == SQL_ROWSET_SIZE || Attribute == SQL_ATTR_ROW_ARRAY_SIZE))
3099*4658658fSAmine Khaldi     {
3100*4658658fSAmine Khaldi         TRACE("CHEAT: returning SQL_SUCCESS to ADO\n");
3101*4658658fSAmine Khaldi         return SQL_SUCCESS;
3102c2c66affSColin Finck     }
3103*4658658fSAmine Khaldi 
3104*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
3105*4658658fSAmine Khaldi     return ret;
3106c2c66affSColin Finck }
3107c2c66affSColin Finck 
310804ef5f7aSAmine Khaldi /*************************************************************************
310904ef5f7aSAmine Khaldi  *				SQLGetDiagRecA           [ODBC32.236]
311004ef5f7aSAmine Khaldi  */
ODBC32_SQLGetDiagRecA(SQLSMALLINT HandleType,SQLHANDLE Handle,SQLSMALLINT RecNumber,SQLCHAR * Sqlstate,SQLINTEGER * NativeError,SQLCHAR * MessageText,SQLSMALLINT BufferLength,SQLSMALLINT * TextLength)3111*4658658fSAmine Khaldi SQLRETURN WINAPI ODBC32_SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
3112*4658658fSAmine Khaldi                                        SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
3113*4658658fSAmine Khaldi                                        SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
311404ef5f7aSAmine Khaldi {
3115*4658658fSAmine Khaldi     SQLRETURN ret;
3116*4658658fSAmine Khaldi 
3117*4658658fSAmine Khaldi     TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
3118*4658658fSAmine Khaldi           " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
3119*4658658fSAmine Khaldi           TextLength);
312004ef5f7aSAmine Khaldi 
312104ef5f7aSAmine Khaldi     if (!pSQLGetDiagRecA) return SQL_ERROR;
3122c2c66affSColin Finck 
3123*4658658fSAmine Khaldi     ret = pSQLGetDiagRecA(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
3124*4658658fSAmine Khaldi     TRACE("Returning %d\n", ret);
3125*4658658fSAmine Khaldi     return ret;
3126*4658658fSAmine Khaldi }
3127