imm32: Move ImmAssociateContext(Ex) around.
[wine.git] / dlls / odbc32 / proxyodbc.c
blob679f3d7380eb73b1bc7fa0e901aafe9261fe6147
1 /*
2 * Win32 ODBC functions
4 * Copyright 1999 Xiang Li, Corel Corporation
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * NOTES:
21 * Proxy ODBC driver manager. This manager delegates all ODBC
22 * calls to a real ODBC driver manager named by the environment
23 * variable LIB_ODBC_DRIVER_MANAGER, or to libodbc.so if the
24 * variable is not set.
28 #include <stdarg.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <assert.h>
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winternl.h"
37 #include "winreg.h"
38 #include "wine/debug.h"
40 #include "sql.h"
41 #include "sqltypes.h"
42 #include "sqlext.h"
43 #include "unixlib.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(odbc);
46 WINE_DECLARE_DEBUG_CHANNEL(winediag);
48 #define ODBC_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params )
50 /***********************************************************************
51 * ODBC_ReplicateODBCInstToRegistry
53 * PARAMS
55 * RETURNS
57 * Utility to ODBC_ReplicateToRegistry to replicate the drivers of the
58 * ODBCINST.INI settings
60 * The driver settings are not replicated to the registry. If we were to
61 * replicate them we would need to decide whether to replicate all settings
62 * or to do some translation; whether to remove any entries present only in
63 * the windows registry, etc.
66 static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv)
68 HKEY hODBCInst;
69 LONG reg_ret;
70 BOOL success;
72 success = FALSE;
73 TRACE ("Driver settings are not currently replicated to the registry\n");
74 if ((reg_ret = RegCreateKeyExA (HKEY_LOCAL_MACHINE,
75 "Software\\ODBC\\ODBCINST.INI", 0, NULL,
76 REG_OPTION_NON_VOLATILE,
77 KEY_ALL_ACCESS /* a couple more than we need */, NULL,
78 &hODBCInst, NULL)) == ERROR_SUCCESS)
80 HKEY hDrivers;
81 if ((reg_ret = RegCreateKeyExA (hODBCInst, "ODBC Drivers", 0,
82 NULL, REG_OPTION_NON_VOLATILE,
83 KEY_ALL_ACCESS /* overkill */, NULL, &hDrivers, NULL))
84 == ERROR_SUCCESS)
86 SQLRETURN sql_ret;
87 SQLUSMALLINT dirn;
88 CHAR desc [256];
89 SQLSMALLINT sizedesc;
91 success = TRUE;
92 dirn = SQL_FETCH_FIRST;
93 while ((sql_ret = SQLDrivers (hEnv, dirn, (SQLCHAR*)desc, sizeof(desc),
94 &sizedesc, NULL, 0, NULL)) == SQL_SUCCESS ||
95 sql_ret == SQL_SUCCESS_WITH_INFO)
97 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
98 dirn = SQL_FETCH_NEXT;
99 if (sizedesc == lstrlenA(desc))
101 HKEY hThis;
102 if ((reg_ret = RegQueryValueExA (hDrivers, desc, NULL,
103 NULL, NULL, NULL)) == ERROR_FILE_NOT_FOUND)
105 if ((reg_ret = RegSetValueExA (hDrivers, desc, 0,
106 REG_SZ, (const BYTE *)"Installed", 10)) != ERROR_SUCCESS)
108 TRACE ("Error %ld replicating driver %s\n",
109 reg_ret, desc);
110 success = FALSE;
113 else if (reg_ret != ERROR_SUCCESS)
115 TRACE ("Error %ld checking for %s in drivers\n",
116 reg_ret, desc);
117 success = FALSE;
119 if ((reg_ret = RegCreateKeyExA (hODBCInst, desc, 0,
120 NULL, REG_OPTION_NON_VOLATILE,
121 KEY_ALL_ACCESS, NULL, &hThis, NULL))
122 == ERROR_SUCCESS)
124 /* FIXME This is where the settings go.
125 * I suggest that if the disposition says it
126 * exists then we leave it alone. Alternatively
127 * include an extra value to flag that it is
128 * a replication of the unixODBC/iODBC/...
130 if ((reg_ret = RegCloseKey (hThis)) !=
131 ERROR_SUCCESS)
132 TRACE ("Error %ld closing %s key\n", reg_ret,
133 desc);
135 else
137 TRACE ("Error %ld ensuring driver key %s\n",
138 reg_ret, desc);
139 success = FALSE;
142 else
144 WARN ("Unusually long driver name %s not replicated\n",
145 desc);
146 success = FALSE;
149 if (sql_ret != SQL_NO_DATA)
151 TRACE ("Error %d enumerating drivers\n", (int)sql_ret);
152 success = FALSE;
154 if ((reg_ret = RegCloseKey (hDrivers)) != ERROR_SUCCESS)
156 TRACE ("Error %ld closing hDrivers\n", reg_ret);
159 else
161 TRACE ("Error %ld opening HKLM\\S\\O\\OI\\Drivers\n", reg_ret);
163 if ((reg_ret = RegCloseKey (hODBCInst)) != ERROR_SUCCESS)
165 TRACE ("Error %ld closing HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
168 else
170 TRACE ("Error %ld opening HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
172 if (!success)
174 WARN ("May not have replicated all ODBC drivers to the registry\n");
178 /***********************************************************************
179 * ODBC_ReplicateODBCToRegistry
181 * PARAMS
183 * RETURNS
185 * Utility to ODBC_ReplicateToRegistry to replicate either the USER or
186 * SYSTEM dsns
188 * For now simply place the "Driver description" (as returned by SQLDataSources)
189 * into the registry as the driver. This is enough to satisfy Crystal's
190 * requirement that there be a driver entry. (It doesn't seem to care what
191 * the setting is).
192 * A slightly more accurate setting would be to access the registry to find
193 * the actual driver library for the given description (which appears to map
194 * to one of the HKLM/Software/ODBC/ODBCINST.INI keys). (If you do this note
195 * that this will add a requirement that this function be called after
196 * ODBC_ReplicateODBCInstToRegistry)
198 static void ODBC_ReplicateODBCToRegistry (BOOL is_user, SQLHENV hEnv)
200 HKEY hODBC;
201 LONG reg_ret;
202 SQLRETURN sql_ret;
203 SQLUSMALLINT dirn;
204 CHAR dsn [SQL_MAX_DSN_LENGTH + 1];
205 SQLSMALLINT sizedsn;
206 CHAR desc [256];
207 SQLSMALLINT sizedesc;
208 BOOL success;
209 const char *which = is_user ? "user" : "system";
211 success = FALSE;
212 if ((reg_ret = RegCreateKeyExA (
213 is_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
214 "Software\\ODBC\\ODBC.INI", 0, NULL, REG_OPTION_NON_VOLATILE,
215 KEY_ALL_ACCESS /* a couple more than we need */, NULL, &hODBC,
216 NULL)) == ERROR_SUCCESS)
218 success = TRUE;
219 dirn = is_user ? SQL_FETCH_FIRST_USER : SQL_FETCH_FIRST_SYSTEM;
220 while ((sql_ret = SQLDataSources (hEnv, dirn,
221 (SQLCHAR*)dsn, sizeof(dsn), &sizedsn,
222 (SQLCHAR*)desc, sizeof(desc), &sizedesc)) == SQL_SUCCESS
223 || sql_ret == SQL_SUCCESS_WITH_INFO)
225 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
226 dirn = SQL_FETCH_NEXT;
227 if (sizedsn == lstrlenA(dsn) && sizedesc == lstrlenA(desc))
229 HKEY hDSN;
230 if ((reg_ret = RegCreateKeyExA (hODBC, dsn, 0,
231 NULL, REG_OPTION_NON_VOLATILE,
232 KEY_ALL_ACCESS, NULL, &hDSN, NULL))
233 == ERROR_SUCCESS)
235 static const char DRIVERKEY[] = "Driver";
236 if ((reg_ret = RegQueryValueExA (hDSN, DRIVERKEY,
237 NULL, NULL, NULL, NULL))
238 == ERROR_FILE_NOT_FOUND)
240 if ((reg_ret = RegSetValueExA (hDSN, DRIVERKEY, 0,
241 REG_SZ, (LPBYTE)desc, sizedesc)) != ERROR_SUCCESS)
243 TRACE ("Error %ld replicating description of "
244 "%s(%s)\n", reg_ret, dsn, desc);
245 success = FALSE;
248 else if (reg_ret != ERROR_SUCCESS)
250 TRACE ("Error %ld checking for description of %s\n",
251 reg_ret, dsn);
252 success = FALSE;
254 if ((reg_ret = RegCloseKey (hDSN)) != ERROR_SUCCESS)
256 TRACE ("Error %ld closing %s DSN key %s\n",
257 reg_ret, which, dsn);
260 else
262 TRACE ("Error %ld opening %s DSN key %s\n",
263 reg_ret, which, dsn);
264 success = FALSE;
267 else
269 WARN ("Unusually long %s data source name %s (%s) not "
270 "replicated\n", which, dsn, desc);
271 success = FALSE;
274 if (sql_ret != SQL_NO_DATA)
276 TRACE ("Error %d enumerating %s datasources\n",
277 (int)sql_ret, which);
278 success = FALSE;
280 if ((reg_ret = RegCloseKey (hODBC)) != ERROR_SUCCESS)
282 TRACE ("Error %ld closing %s ODBC.INI registry key\n", reg_ret,
283 which);
286 else
288 TRACE ("Error %ld creating/opening %s ODBC.INI registry key\n",
289 reg_ret, which);
291 if (!success)
293 WARN ("May not have replicated all %s ODBC DSNs to the registry\n",
294 which);
298 /***********************************************************************
299 * ODBC_ReplicateToRegistry
301 * PARAMS
303 * RETURNS
305 * Unfortunately some of the functions that Windows documents as being part
306 * of the ODBC API it implements directly during compilation or something
307 * in terms of registry access functions.
308 * e.g. SQLGetInstalledDrivers queries the list at
309 * HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC Drivers
311 * This function is called when the driver manager is loaded and is used
312 * to replicate the appropriate details into the Wine registry
315 static void ODBC_ReplicateToRegistry (void)
317 SQLRETURN sql_ret;
318 SQLHENV hEnv;
320 if ((sql_ret = SQLAllocEnv(&hEnv)) == SQL_SUCCESS)
322 ODBC_ReplicateODBCInstToRegistry (hEnv);
323 ODBC_ReplicateODBCToRegistry (FALSE /* system dsns */, hEnv);
324 ODBC_ReplicateODBCToRegistry (TRUE /* user dsns */, hEnv);
326 if ((sql_ret = SQLFreeEnv(hEnv)) != SQL_SUCCESS)
328 TRACE ("Error %d freeing the SQL environment.\n", (int)sql_ret);
331 else
333 TRACE ("Error %d opening an SQL environment.\n", (int)sql_ret);
334 WARN ("The external ODBC settings have not been replicated to the"
335 " Wine registry\n");
339 /*************************************************************************
340 * SQLAllocConnect [ODBC32.001]
342 SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
344 struct SQLAllocConnect_params params = { EnvironmentHandle, ConnectionHandle };
345 SQLRETURN ret;
347 TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle);
349 *ConnectionHandle = SQL_NULL_HDBC;
350 ret = ODBC_CALL( SQLAllocConnect, &params );
351 TRACE("Returning %d, ConnectionHandle %p\n", ret, *ConnectionHandle);
352 return ret;
355 /*************************************************************************
356 * SQLAllocEnv [ODBC32.002]
358 SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
360 struct SQLAllocEnv_params params = { EnvironmentHandle };
361 SQLRETURN ret;
363 TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
365 *EnvironmentHandle = SQL_NULL_HENV;
366 ret = ODBC_CALL( SQLAllocEnv, &params );
367 TRACE("Returning %d, EnvironmentHandle %p\n", ret, *EnvironmentHandle);
368 return ret;
371 /*************************************************************************
372 * SQLAllocHandle [ODBC32.024]
374 SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
376 struct SQLAllocHandle_params params = { HandleType, InputHandle, OutputHandle };
377 SQLRETURN ret;
379 TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
381 *OutputHandle = 0;
382 ret = ODBC_CALL( SQLAllocHandle, &params );
383 TRACE("Returning %d, Handle %p\n", ret, *OutputHandle);
384 return ret;
387 /*************************************************************************
388 * SQLAllocStmt [ODBC32.003]
390 SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
392 struct SQLAllocStmt_params params = { ConnectionHandle, StatementHandle };
393 SQLRETURN ret;
395 TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
397 *StatementHandle = SQL_NULL_HSTMT;
398 ret = ODBC_CALL( SQLAllocStmt, &params );
399 TRACE ("Returning %d, StatementHandle %p\n", ret, *StatementHandle);
400 return ret;
403 /*************************************************************************
404 * SQLAllocHandleStd [ODBC32.077]
406 SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
408 struct SQLAllocHandleStd_params params = { HandleType, InputHandle, OutputHandle };
409 SQLRETURN ret;
411 TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
413 *OutputHandle = 0;
414 ret = ODBC_CALL( SQLAllocHandleStd, &params );
415 TRACE ("Returning %d, OutputHandle %p\n", ret, *OutputHandle);
416 return ret;
419 static const char *debugstr_sqllen( SQLLEN len )
421 #ifdef _WIN64
422 return wine_dbg_sprintf( "%Id", len );
423 #else
424 return wine_dbg_sprintf( "%d", len );
425 #endif
428 /*************************************************************************
429 * SQLBindCol [ODBC32.004]
431 SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
432 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
434 struct SQLBindCol_params params = { StatementHandle, ColumnNumber, TargetType, TargetValue,
435 BufferLength, StrLen_or_Ind };
436 SQLRETURN ret;
438 TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
439 StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
441 ret = ODBC_CALL( SQLBindCol, &params );
442 TRACE ("Returning %d\n", ret);
443 return ret;
446 static const char *debugstr_sqlulen( SQLULEN len )
448 #ifdef _WIN64
449 return wine_dbg_sprintf( "%Iu", len );
450 #else
451 return wine_dbg_sprintf( "%u", len );
452 #endif
455 /*************************************************************************
456 * SQLBindParam [ODBC32.025]
458 SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
459 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
460 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
462 struct SQLBindParam_params params = { StatementHandle, ParameterNumber, ValueType, ParameterType,
463 LengthPrecision, ParameterScale, ParameterValue, StrLen_or_Ind };
464 SQLRETURN ret;
466 TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
467 " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
468 ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
470 ret = ODBC_CALL( SQLBindParam, &params );
471 TRACE ("Returning %d\n", ret);
472 return ret;
475 /*************************************************************************
476 * SQLCancel [ODBC32.005]
478 SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle)
480 struct SQLCancel_params params = { StatementHandle };
481 SQLRETURN ret;
483 TRACE("(StatementHandle %p)\n", StatementHandle);
485 ret = ODBC_CALL( SQLCancel, &params );
486 TRACE("Returning %d\n", ret);
487 return ret;
490 /*************************************************************************
491 * SQLCloseCursor [ODBC32.026]
493 SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle)
495 struct SQLCloseCursor_params params = { StatementHandle };
496 SQLRETURN ret;
498 TRACE("(StatementHandle %p)\n", StatementHandle);
500 ret = ODBC_CALL( SQLCloseCursor, &params );
501 TRACE("Returning %d\n", ret);
502 return ret;
505 /*************************************************************************
506 * SQLColAttribute [ODBC32.027]
508 SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
509 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
510 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
511 SQLLEN *NumericAttribute)
513 struct SQLColAttribute_params params = { StatementHandle, ColumnNumber, FieldIdentifier,
514 CharacterAttribute, BufferLength, StringLength, NumericAttribute };
515 SQLRETURN ret;
517 TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d,"
518 " StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier,
519 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
521 ret = ODBC_CALL( SQLColAttribute, &params );
522 TRACE("Returning %d\n", ret);
523 return ret;
526 /*************************************************************************
527 * SQLColumns [ODBC32.040]
529 SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
530 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
531 SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
533 struct SQLColumns_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
534 TableName, NameLength3, ColumnName, NameLength4 };
535 SQLRETURN ret;
537 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
538 " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
539 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
540 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
541 debugstr_an((const char *)TableName, NameLength3), NameLength3,
542 debugstr_an((const char *)ColumnName, NameLength4), NameLength4);
544 ret = ODBC_CALL( SQLColumns, &params );
545 TRACE("Returning %d\n", ret);
546 return ret;
549 /*************************************************************************
550 * SQLConnect [ODBC32.007]
552 SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1,
553 SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication,
554 SQLSMALLINT NameLength3)
556 struct SQLConnect_params params = { ConnectionHandle, ServerName, NameLength1, UserName, NameLength2,
557 Authentication, NameLength3 };
558 SQLRETURN ret;
560 TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
561 " NameLength3 %d)\n", ConnectionHandle,
562 debugstr_an((const char *)ServerName, NameLength1), NameLength1,
563 debugstr_an((const char *)UserName, NameLength2), NameLength2,
564 debugstr_an((const char *)Authentication, NameLength3), NameLength3);
566 ret = ODBC_CALL( SQLConnect, &params );
567 TRACE("Returning %d\n", ret);
568 return ret;
571 /*************************************************************************
572 * SQLCopyDesc [ODBC32.028]
574 SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
576 struct SQLCopyDesc_params params = { SourceDescHandle, TargetDescHandle };
577 SQLRETURN ret;
579 TRACE("(SourceDescHandle %p, TargetDescHandle %p)\n", SourceDescHandle, TargetDescHandle);
581 ret = ODBC_CALL( SQLCopyDesc, &params );
582 TRACE("Returning %d\n", ret);
583 return ret;
586 /*************************************************************************
587 * SQLDataSources [ODBC32.057]
589 SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
590 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
591 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
593 struct SQLDataSources_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1,
594 NameLength1, Description, BufferLength2, NameLength2 };
595 SQLRETURN ret;
597 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
598 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
599 NameLength1, Description, BufferLength2, NameLength2);
601 ret = ODBC_CALL( SQLDataSources, &params );
602 if (ret >= 0 && TRACE_ON(odbc))
604 if (ServerName && NameLength1 && *NameLength1 > 0)
605 TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
606 if (Description && NameLength2 && *NameLength2 > 0)
607 TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
608 TRACE("\n");
611 TRACE("Returning %d\n", ret);
612 return ret;
615 SQLRETURN WINAPI SQLDataSourcesA(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
616 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
617 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
619 struct SQLDataSourcesA_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1,
620 NameLength1, Description, BufferLength2, NameLength2 };
621 SQLRETURN ret;
623 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
624 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
625 NameLength1, Description, BufferLength2, NameLength2);
627 ret = ODBC_CALL( SQLDataSourcesA, &params );
628 if (TRACE_ON(odbc))
630 if (ServerName && NameLength1 && *NameLength1 > 0)
631 TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
632 if (Description && NameLength2 && *NameLength2 > 0)
633 TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
634 TRACE("\n");
637 TRACE("Returning %d\n", ret);
638 return ret;
641 /*************************************************************************
642 * SQLDescribeCol [ODBC32.008]
644 SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
645 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
646 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
648 struct SQLDescribeCol_params params = { StatementHandle, ColumnNumber, ColumnName, BufferLength,
649 NameLength, DataType, ColumnSize, DecimalDigits, Nullable };
650 SQLSMALLINT dummy;
651 SQLRETURN ret;
653 TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
654 " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
655 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
657 if (!params.NameLength) params.NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
659 ret = ODBC_CALL( SQLDescribeCol, &params );
660 if (ret >= 0)
662 if (ColumnName && NameLength) TRACE(" ColumnName %s\n", debugstr_an((const char *)ColumnName, *NameLength));
663 if (DataType) TRACE(" DataType %d\n", *DataType);
664 if (ColumnSize) TRACE(" ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
665 if (DecimalDigits) TRACE(" DecimalDigits %d\n", *DecimalDigits);
666 if (Nullable) TRACE(" Nullable %d\n", *Nullable);
669 TRACE("Returning %d\n", ret);
670 return ret;
673 /*************************************************************************
674 * SQLDisconnect [ODBC32.009]
676 SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
678 struct SQLDisconnect_params params = { ConnectionHandle };
679 SQLRETURN ret;
681 TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
683 ret = ODBC_CALL( SQLDisconnect, &params );
684 TRACE("Returning %d\n", ret);
685 return ret;
688 /*************************************************************************
689 * SQLEndTran [ODBC32.029]
691 SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
693 struct SQLEndTran_params params = { HandleType, Handle, CompletionType };
694 SQLRETURN ret;
696 TRACE("(HandleType %d, Handle %p, CompletionType %d)\n", HandleType, Handle, CompletionType);
698 ret = ODBC_CALL( SQLEndTran, &params );
699 TRACE("Returning %d\n", ret);
700 return ret;
703 /*************************************************************************
704 * SQLError [ODBC32.010]
706 SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
707 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
708 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
710 struct SQLError_params params = { EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate,
711 NativeError, MessageText, BufferLength, TextLength };
712 SQLRETURN ret;
714 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
715 " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
716 StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
718 ret = ODBC_CALL( SQLError, &params );
720 if (ret == SQL_SUCCESS)
722 TRACE(" SQLState %s\n", debugstr_an((const char *)Sqlstate, 5));
723 TRACE(" Error %d\n", *NativeError);
724 TRACE(" MessageText %s\n", debugstr_an((const char *)MessageText, *TextLength));
727 TRACE("Returning %d\n", ret);
728 return ret;
731 /*************************************************************************
732 * SQLExecDirect [ODBC32.011]
734 SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
736 struct SQLExecDirect_params params = { StatementHandle, StatementText, TextLength };
737 SQLRETURN ret;
739 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
740 debugstr_an((const char *)StatementText, TextLength), TextLength);
742 ret = ODBC_CALL( SQLExecDirect, &params );
743 TRACE("Returning %d\n", ret);
744 return ret;
747 /*************************************************************************
748 * SQLExecute [ODBC32.012]
750 SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
752 struct SQLExecute_params params = { StatementHandle };
753 SQLRETURN ret;
755 TRACE("(StatementHandle %p)\n", StatementHandle);
757 ret = ODBC_CALL( SQLExecute, &params );
758 TRACE("Returning %d\n", ret);
759 return ret;
762 /*************************************************************************
763 * SQLFetch [ODBC32.013]
765 SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
767 struct SQLFetch_params params = { StatementHandle };
768 SQLRETURN ret;
770 TRACE("(StatementHandle %p)\n", StatementHandle);
772 ret = ODBC_CALL( SQLFetch, &params );
773 TRACE("Returning %d\n", ret);
774 return ret;
777 /*************************************************************************
778 * SQLFetchScroll [ODBC32.030]
780 SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset)
782 struct SQLFetchScroll_params params = { StatementHandle, FetchOrientation, FetchOffset };
783 SQLRETURN ret;
785 TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s)\n", StatementHandle, FetchOrientation,
786 debugstr_sqllen(FetchOffset));
788 ret = ODBC_CALL( SQLFetchScroll, &params );
789 TRACE("Returning %d\n", ret);
790 return ret;
793 /*************************************************************************
794 * SQLFreeConnect [ODBC32.014]
796 SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
798 struct SQLFreeConnect_params params = { ConnectionHandle };
799 SQLRETURN ret;
801 TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
803 ret = ODBC_CALL( SQLFreeConnect, &params );
804 TRACE("Returning %d\n", ret);
805 return ret;
808 /*************************************************************************
809 * SQLFreeEnv [ODBC32.015]
811 SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
813 struct SQLFreeEnv_params params = { EnvironmentHandle };
814 SQLRETURN ret;
816 TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
818 ret = ODBC_CALL( SQLFreeEnv, &params );
819 TRACE("Returning %d\n", ret);
820 return ret;
823 /*************************************************************************
824 * SQLFreeHandle [ODBC32.031]
826 SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
828 struct SQLFreeHandle_params params = { HandleType, Handle };
829 SQLRETURN ret;
831 TRACE("(HandleType %d, Handle %p)\n", HandleType, Handle);
833 ret = ODBC_CALL( SQLFreeHandle, &params );
834 TRACE ("Returning %d\n", ret);
835 return ret;
838 /*************************************************************************
839 * SQLFreeStmt [ODBC32.016]
841 SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
843 struct SQLFreeStmt_params params = { StatementHandle, Option };
844 SQLRETURN ret;
846 TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option);
848 ret = ODBC_CALL( SQLFreeStmt, &params );
849 TRACE("Returning %d\n", ret);
850 return ret;
853 /*************************************************************************
854 * SQLGetConnectAttr [ODBC32.032]
856 SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
857 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
859 struct SQLGetConnectAttr_params params = { ConnectionHandle, Attribute, Value, BufferLength, StringLength };
860 SQLRETURN ret;
862 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
863 Attribute, Value, BufferLength, StringLength);
865 ret = ODBC_CALL( SQLGetConnectAttr, &params );
866 TRACE("Returning %d\n", ret);
867 return ret;
870 /*************************************************************************
871 * SQLGetConnectOption [ODBC32.042]
873 SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
875 struct SQLGetConnectOption_params params = { ConnectionHandle, Option, Value };
876 SQLRETURN ret;
878 TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
880 ret = ODBC_CALL( SQLGetConnectOption, &params );
881 TRACE("Returning %d\n", ret);
882 return ret;
885 /*************************************************************************
886 * SQLGetCursorName [ODBC32.017]
888 SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength,
889 SQLSMALLINT *NameLength)
891 struct SQLGetCursorName_params params = { StatementHandle, CursorName, BufferLength, NameLength };
892 SQLRETURN ret;
894 TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
895 BufferLength, NameLength);
897 ret = ODBC_CALL( SQLGetCursorName, &params );
898 TRACE("Returning %d\n", ret);
899 return ret;
902 /*************************************************************************
903 * SQLGetData [ODBC32.043]
905 SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
906 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
908 struct SQLGetData_params params = { StatementHandle, ColumnNumber, TargetType, TargetValue,
909 BufferLength, StrLen_or_Ind };
910 SQLRETURN ret;
912 TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
913 StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
915 ret = ODBC_CALL( SQLGetData, &params );
916 TRACE("Returning %d\n", ret);
917 return ret;
920 /*************************************************************************
921 * SQLGetDescField [ODBC32.033]
923 SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
924 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
926 struct SQLGetDescField_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value,
927 BufferLength, StringLength };
928 SQLRETURN ret;
930 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
931 DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
933 ret = ODBC_CALL( SQLGetDescField, &params );
934 TRACE("Returning %d\n", ret);
935 return ret;
938 /*************************************************************************
939 * SQLGetDescRec [ODBC32.034]
941 SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLCHAR *Name,
942 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
943 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
944 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
946 struct SQLGetDescRec_params params = { DescriptorHandle, RecNumber, Name, BufferLength, StringLength,
947 Type, SubType, Length, Precision, Scale, Nullable };
948 SQLRETURN ret;
950 TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
951 " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
952 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
954 ret = ODBC_CALL( SQLGetDescRec, &params );
955 TRACE("Returning %d\n", ret);
956 return ret;
959 /*************************************************************************
960 * SQLGetDiagField [ODBC32.035]
962 SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
963 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
964 SQLSMALLINT *StringLength)
966 struct SQLGetDiagField_params params = { HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo,
967 BufferLength, StringLength };
968 SQLRETURN ret;
970 TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
971 " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
973 ret = ODBC_CALL( SQLGetDiagField, &params );
974 TRACE("Returning %d\n", ret);
975 return ret;
978 /*************************************************************************
979 * SQLGetDiagRec [ODBC32.036]
981 SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
982 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
983 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
985 struct SQLGetDiagRec_params params = { HandleType, Handle, RecNumber, Sqlstate, NativeError,
986 MessageText, BufferLength, TextLength };
987 SQLRETURN ret;
989 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
990 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
991 TextLength);
993 ret = ODBC_CALL( SQLGetDiagRec, &params );
994 TRACE("Returning %d\n", ret);
995 return ret;
998 /*************************************************************************
999 * SQLGetEnvAttr [ODBC32.037]
1001 SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1002 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1004 struct SQLGetEnvAttr_params params = { EnvironmentHandle, Attribute, Value, BufferLength, StringLength };
1005 SQLRETURN ret;
1007 TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n",
1008 EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
1010 ret = ODBC_CALL( SQLGetEnvAttr, &params );
1011 TRACE("Returning %d\n", ret);
1012 return ret;
1015 /*************************************************************************
1016 * SQLGetFunctions [ODBC32.044]
1018 SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
1020 struct SQLGetFunctions_params params = { ConnectionHandle, FunctionId, Supported };
1021 SQLRETURN ret;
1023 TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported);
1025 ret = ODBC_CALL( SQLGetFunctions, &params );
1026 TRACE("Returning %d\n", ret);
1027 return ret;
1030 /*************************************************************************
1031 * SQLGetInfo [ODBC32.045]
1033 SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
1034 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
1036 struct SQLGetInfo_params params = { ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength };
1037 SQLRETURN ret;
1039 TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
1040 InfoType, InfoValue, BufferLength, StringLength);
1042 ret = ODBC_CALL( SQLGetInfo, &params );
1043 TRACE("Returning %d\n", ret);
1044 return ret;
1047 /*************************************************************************
1048 * SQLGetStmtAttr [ODBC32.038]
1050 SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1051 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1053 struct SQLGetStmtAttr_params params = { StatementHandle, Attribute, Value, BufferLength, StringLength };
1054 SQLRETURN ret;
1056 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
1057 Attribute, Value, BufferLength, StringLength);
1059 if (!Value)
1061 WARN("Unexpected NULL Value return address\n");
1062 return SQL_ERROR;
1065 ret = ODBC_CALL( SQLGetStmtAttr, &params );
1066 TRACE("Returning %d\n", ret);
1067 return ret;
1070 /*************************************************************************
1071 * SQLGetStmtOption [ODBC32.046]
1073 SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1075 struct SQLGetStmtOption_params params = { StatementHandle, Option, Value };
1076 SQLRETURN ret;
1078 TRACE("(StatementHandle %p, Option %d, Value %p)\n", StatementHandle, Option, Value);
1080 ret = ODBC_CALL( SQLGetStmtOption, &params );
1081 TRACE("Returning %d\n", ret);
1082 return ret;
1085 /*************************************************************************
1086 * SQLGetTypeInfo [ODBC32.047]
1088 SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1090 struct SQLGetTypeInfo_params params = { StatementHandle, DataType };
1091 SQLRETURN ret;
1093 TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
1095 ret = ODBC_CALL( SQLGetTypeInfo, &params );
1096 TRACE("Returning %d\n", ret);
1097 return ret;
1100 /*************************************************************************
1101 * SQLNumResultCols [ODBC32.018]
1103 SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1105 struct SQLNumResultCols_params params = { StatementHandle, ColumnCount };
1106 SQLRETURN ret;
1108 TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount);
1110 ret = ODBC_CALL( SQLNumResultCols, &params );
1111 TRACE("Returning %d ColumnCount %d\n", ret, *ColumnCount);
1112 return ret;
1115 /*************************************************************************
1116 * SQLParamData [ODBC32.048]
1118 SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1120 struct SQLParamData_params params = { StatementHandle, Value };
1121 SQLRETURN ret;
1123 TRACE("(StatementHandle %p, Value %p)\n", StatementHandle, Value);
1125 ret = ODBC_CALL( SQLParamData, &params );
1126 TRACE("Returning %d\n", ret);
1127 return ret;
1130 /*************************************************************************
1131 * SQLPrepare [ODBC32.019]
1133 SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1135 struct SQLPrepare_params params = { StatementHandle, StatementText, TextLength };
1136 SQLRETURN ret;
1138 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1139 debugstr_an((const char *)StatementText, TextLength), TextLength);
1141 ret = ODBC_CALL( SQLPrepare, &params );
1142 TRACE("Returning %d\n", ret);
1143 return ret;
1146 /*************************************************************************
1147 * SQLPutData [ODBC32.049]
1149 SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind)
1151 struct SQLPutData_params params = { StatementHandle, Data, StrLen_or_Ind };
1152 SQLRETURN ret;
1154 TRACE("(StatementHandle %p, Data %p, StrLen_or_Ind %s)\n", StatementHandle, Data, debugstr_sqllen(StrLen_or_Ind));
1156 ret = ODBC_CALL( SQLPutData, &params );
1157 TRACE("Returning %d\n", ret);
1158 return ret;
1161 /*************************************************************************
1162 * SQLRowCount [ODBC32.020]
1164 SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
1166 struct SQLRowCount_params params = { StatementHandle, RowCount };
1167 SQLRETURN ret;
1169 TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount);
1171 ret = ODBC_CALL( SQLRowCount, &params );
1172 if (ret == SQL_SUCCESS && RowCount) TRACE(" RowCount %s\n", debugstr_sqllen(*RowCount));
1173 TRACE("Returning %d\n", ret);
1174 return ret;
1177 /*************************************************************************
1178 * SQLSetConnectAttr [ODBC32.039]
1180 SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1181 SQLINTEGER StringLength)
1183 struct SQLSetConnectAttr_params params = { ConnectionHandle, Attribute, Value, StringLength };
1184 SQLRETURN ret;
1186 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
1187 StringLength);
1189 ret = ODBC_CALL( SQLSetConnectAttr, &params );
1190 TRACE("Returning %d\n", ret);
1191 return ret;
1194 /*************************************************************************
1195 * SQLSetConnectOption [ODBC32.050]
1197 SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value)
1199 struct SQLSetConnectOption_params params = { ConnectionHandle, Option, Value };
1200 SQLRETURN ret;
1202 TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqlulen(Value));
1204 ret = ODBC_CALL( SQLSetConnectOption, &params );
1205 TRACE("Returning %d\n", ret);
1206 return ret;
1209 /*************************************************************************
1210 * SQLSetCursorName [ODBC32.021]
1212 SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
1214 struct SQLSetCursorName_params params = { StatementHandle, CursorName, NameLength };
1215 SQLRETURN ret;
1217 TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
1218 debugstr_an((const char *)CursorName, NameLength), NameLength);
1220 ret = ODBC_CALL( SQLSetCursorName, &params );
1221 TRACE("Returning %d\n", ret);
1222 return ret;
1225 /*************************************************************************
1226 * SQLSetDescField [ODBC32.073]
1228 SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1229 SQLPOINTER Value, SQLINTEGER BufferLength)
1231 struct SQLSetDescField_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength };
1232 SQLRETURN ret;
1234 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
1235 RecNumber, FieldIdentifier, Value, BufferLength);
1237 ret = ODBC_CALL( SQLSetDescField, &params );
1238 TRACE("Returning %d\n", ret);
1239 return ret;
1242 /*************************************************************************
1243 * SQLSetDescRec [ODBC32.074]
1245 SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type,
1246 SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale,
1247 SQLPOINTER Data, SQLLEN *StringLength, SQLLEN *Indicator)
1249 struct SQLSetDescRec_params params = { DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data, StringLength, Indicator };
1250 SQLRETURN ret;
1252 TRACE("(DescriptorHandle %p, RecNumber %d, Type %d, SubType %d, Length %s, Precision %d, Scale %d, Data %p,"
1253 " StringLength %p, Indicator %p)\n", DescriptorHandle, RecNumber, Type, SubType, debugstr_sqllen(Length),
1254 Precision, Scale, Data, StringLength, Indicator);
1256 ret = ODBC_CALL( SQLSetDescRec, &params );
1257 TRACE("Returning %d\n", ret);
1258 return ret;
1261 /*************************************************************************
1262 * SQLSetEnvAttr [ODBC32.075]
1264 SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1265 SQLINTEGER StringLength)
1267 struct SQLSetEnvAttr_params params = { EnvironmentHandle, Attribute, Value, StringLength };
1268 SQLRETURN ret;
1270 TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value,
1271 StringLength);
1273 ret = ODBC_CALL( SQLSetEnvAttr, &params );
1274 TRACE("Returning %d\n", ret);
1275 return ret;
1278 /*************************************************************************
1279 * SQLSetParam [ODBC32.022]
1281 SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1282 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
1283 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
1285 struct SQLSetParam_params params = { StatementHandle, ParameterNumber, ValueType, ParameterType,
1286 LengthPrecision, ParameterScale, ParameterValue, StrLen_or_Ind };
1287 SQLRETURN ret;
1289 TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
1290 " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
1291 ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
1293 ret = ODBC_CALL( SQLSetParam, &params );
1294 TRACE("Returning %d\n", ret);
1295 return ret;
1298 /*************************************************************************
1299 * SQLSetStmtAttr [ODBC32.076]
1301 SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1302 SQLINTEGER StringLength)
1304 struct SQLSetStmtAttr_params params = { StatementHandle, Attribute, Value, StringLength };
1305 SQLRETURN ret;
1307 TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
1308 StringLength);
1310 ret = ODBC_CALL( SQLSetStmtAttr, &params );
1311 TRACE("Returning %d\n", ret);
1312 return ret;
1315 /*************************************************************************
1316 * SQLSetStmtOption [ODBC32.051]
1318 SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value)
1320 struct SQLSetStmtOption_params params = { StatementHandle, Option, Value };
1321 SQLRETURN ret;
1323 TRACE("(StatementHandle %p, Option %d, Value %s)\n", StatementHandle, Option, debugstr_sqlulen(Value));
1325 ret = ODBC_CALL( SQLSetStmtOption, &params );
1326 TRACE("Returning %d\n", ret);
1327 return ret;
1330 /*************************************************************************
1331 * SQLSpecialColumns [ODBC32.052]
1333 SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
1334 SQLSMALLINT NameLength1, SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1335 SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
1336 SQLUSMALLINT Nullable)
1338 struct SQLSpecialColumns_params params = { StatementHandle, IdentifierType, CatalogName, NameLength1,
1339 SchemaName, NameLength2, TableName, NameLength3, Scope, Nullable };
1340 SQLRETURN ret;
1342 TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
1343 " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
1344 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1345 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1346 debugstr_an((const char *)TableName, NameLength3), NameLength3, Scope, Nullable);
1348 ret = ODBC_CALL( SQLSpecialColumns, &params );
1349 TRACE("Returning %d\n", ret);
1350 return ret;
1353 /*************************************************************************
1354 * SQLStatistics [ODBC32.053]
1356 SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1357 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
1358 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
1360 struct SQLStatistics_params params = { StatementHandle, CatalogName, NameLength1, SchemaName,
1361 NameLength2, TableName, NameLength3, Unique, Reserved };
1362 SQLRETURN ret;
1364 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
1365 " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
1366 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1367 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1368 debugstr_an((const char *)TableName, NameLength3), NameLength3, Unique, Reserved);
1370 ret = ODBC_CALL( SQLStatistics, &params );
1371 TRACE("Returning %d\n", ret);
1372 return ret;
1375 /*************************************************************************
1376 * SQLTables [ODBC32.054]
1378 SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1379 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
1380 SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4)
1382 struct SQLTables_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
1383 TableName, NameLength3, TableType, NameLength4 };
1384 SQLRETURN ret;
1386 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
1387 " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
1388 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1389 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1390 debugstr_an((const char *)TableName, NameLength3), NameLength3,
1391 debugstr_an((const char *)TableType, NameLength4), NameLength4);
1393 ret = ODBC_CALL( SQLTables, &params );
1394 TRACE("Returning %d\n", ret);
1395 return ret;
1398 /*************************************************************************
1399 * SQLTransact [ODBC32.023]
1401 SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType)
1403 struct SQLTransact_params params = { EnvironmentHandle, ConnectionHandle, CompletionType };
1404 SQLRETURN ret;
1406 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
1407 CompletionType);
1409 ret = ODBC_CALL( SQLTransact, &params );
1410 TRACE("Returning %d\n", ret);
1411 return ret;
1414 /*************************************************************************
1415 * SQLBrowseConnect [ODBC32.055]
1417 SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
1418 SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
1419 SQLSMALLINT *pcbConnStrOut)
1421 struct SQLBrowseConnect_params params = { hdbc, szConnStrIn, cbConnStrIn, szConnStrOut,
1422 cbConnStrOutMax, pcbConnStrOut };
1423 SQLRETURN ret;
1425 TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
1426 hdbc, debugstr_an((const char *)szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax,
1427 pcbConnStrOut);
1429 ret = ODBC_CALL( SQLBrowseConnect, &params );
1430 TRACE("Returning %d\n", ret);
1431 return ret;
1434 /*************************************************************************
1435 * SQLBulkOperations [ODBC32.078]
1437 SQLRETURN WINAPI SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation)
1439 struct SQLBulkOperations_params params = { StatementHandle, Operation };
1440 SQLRETURN ret;
1442 TRACE("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation);
1444 ret = ODBC_CALL( SQLBulkOperations, &params );
1445 TRACE("Returning %d\n", ret);
1446 return ret;
1449 /*************************************************************************
1450 * SQLColAttributes [ODBC32.006]
1452 SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
1453 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
1454 SQLLEN *pfDesc)
1456 struct SQLColAttributes_params params = { hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc };
1457 SQLRETURN ret;
1459 TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
1460 fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1462 ret = ODBC_CALL( SQLColAttributes, &params );
1463 TRACE("Returning %d\n", ret);
1464 return ret;
1467 /*************************************************************************
1468 * SQLColumnPrivileges [ODBC32.056]
1470 SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1471 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
1472 SQLSMALLINT cbTableName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
1474 struct SQLColumnPrivileges_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1475 cbSchemaName, szTableName, cbTableName, szColumnName, cbColumnName };
1476 SQLRETURN ret;
1478 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
1479 " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
1480 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1481 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1482 debugstr_an((const char *)szTableName, cbTableName), cbTableName,
1483 debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
1485 ret = ODBC_CALL( SQLColumnPrivileges, &params );
1486 TRACE("Returning %d\n", ret);
1487 return ret;
1490 /*************************************************************************
1491 * SQLDescribeParam [ODBC32.058]
1493 SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType,
1494 SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable)
1496 struct SQLDescribeParam_params params = { hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable };
1497 SQLRETURN ret;
1499 TRACE("(hstmt %p, ipar %d, pfSqlType %p, pcbParamDef %p, pibScale %p, pfNullable %p)\n", hstmt, ipar,
1500 pfSqlType, pcbParamDef, pibScale, pfNullable);
1502 ret = ODBC_CALL( SQLDescribeParam, &params );
1503 TRACE("Returning %d\n", ret);
1504 return ret;
1507 /*************************************************************************
1508 * SQLExtendedFetch [ODBC32.059]
1510 SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow,
1511 SQLUSMALLINT *rgfRowStatus)
1513 struct SQLExtendedFetch_params params = { hstmt, fFetchType, irow, pcrow, rgfRowStatus };
1514 SQLRETURN ret;
1516 TRACE("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow),
1517 pcrow, rgfRowStatus);
1519 ret = ODBC_CALL( SQLExtendedFetch, &params );
1520 TRACE("Returning %d\n", ret);
1521 return ret;
1524 /*************************************************************************
1525 * SQLForeignKeys [ODBC32.060]
1527 SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
1528 SQLCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLCHAR *szPkTableName,
1529 SQLSMALLINT cbPkTableName, SQLCHAR *szFkCatalogName,
1530 SQLSMALLINT cbFkCatalogName, SQLCHAR *szFkSchemaName,
1531 SQLSMALLINT cbFkSchemaName, SQLCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
1533 struct SQLForeignKeys_params params = { hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName,
1534 cbPkSchemaName, szPkTableName, cbPkTableName, szFkCatalogName,
1535 cbFkCatalogName, szFkSchemaName, cbFkSchemaName,
1536 szFkTableName, cbFkTableName };
1537 SQLRETURN ret;
1539 TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
1540 " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
1541 " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
1542 debugstr_an((const char *)szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
1543 debugstr_an((const char *)szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
1544 debugstr_an((const char *)szPkTableName, cbPkTableName), cbPkTableName,
1545 debugstr_an((const char *)szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
1546 debugstr_an((const char *)szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
1547 debugstr_an((const char *)szFkTableName, cbFkTableName), cbFkTableName);
1549 ret = ODBC_CALL( SQLForeignKeys, &params );
1550 TRACE("Returning %d\n", ret);
1551 return ret;
1554 /*************************************************************************
1555 * SQLMoreResults [ODBC32.061]
1557 SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle)
1559 struct SQLMoreResults_params params = { StatementHandle };
1560 SQLRETURN ret;
1562 TRACE("(%p)\n", StatementHandle);
1564 ret = ODBC_CALL( SQLMoreResults, &params );
1565 TRACE("Returning %d\n", ret);
1566 return ret;
1569 /*************************************************************************
1570 * SQLNativeSql [ODBC32.062]
1572 SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr,
1573 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
1575 struct SQLNativeSql_params params = { hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr };
1576 SQLRETURN ret;
1578 TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
1579 debugstr_an((const char *)szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
1581 ret = ODBC_CALL( SQLNativeSql, &params );
1582 TRACE("Returning %d\n", ret);
1583 return ret;
1586 /*************************************************************************
1587 * SQLNumParams [ODBC32.063]
1589 SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar)
1591 struct SQLNumParams_params params = { hstmt, pcpar };
1592 SQLRETURN ret;
1594 TRACE("(hstmt %p, pcpar %p)\n", hstmt, pcpar);
1596 ret = ODBC_CALL( SQLNumParams, &params );
1597 TRACE("Returning %d\n", ret);
1598 return ret;
1601 /*************************************************************************
1602 * SQLParamOptions [ODBC32.064]
1604 SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow)
1606 struct SQLParamOptions_params params = { hstmt, crow, pirow };
1607 SQLRETURN ret;
1609 TRACE("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow);
1611 ret = ODBC_CALL( SQLParamOptions, &params );
1612 TRACE("Returning %d\n", ret);
1613 return ret;
1616 /*************************************************************************
1617 * SQLPrimaryKeys [ODBC32.065]
1619 SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1620 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
1621 SQLSMALLINT cbTableName)
1623 struct SQLPrimaryKeys_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1624 cbSchemaName, szTableName, cbTableName };
1625 SQLRETURN ret;
1627 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
1628 " cbTableName %d)\n", hstmt,
1629 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1630 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1631 debugstr_an((const char *)szTableName, cbTableName), cbTableName);
1633 ret = ODBC_CALL( SQLPrimaryKeys, &params );
1634 TRACE("Returning %d\n", ret);
1635 return ret;
1638 /*************************************************************************
1639 * SQLProcedureColumns [ODBC32.066]
1641 SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1642 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
1643 SQLSMALLINT cbProcName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
1645 struct SQLProcedureColumns_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1646 cbSchemaName, szProcName, cbProcName,
1647 szColumnName, cbColumnName };
1648 SQLRETURN ret;
1650 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
1651 " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
1652 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1653 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1654 debugstr_an((const char *)szProcName, cbProcName), cbProcName,
1655 debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
1657 ret = ODBC_CALL( SQLProcedureColumns, &params );
1658 TRACE("Returning %d\n", ret);
1659 return ret;
1662 /*************************************************************************
1663 * SQLProcedures [ODBC32.067]
1665 SQLRETURN WINAPI SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1666 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
1667 SQLSMALLINT cbProcName)
1669 struct SQLProcedures_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1670 cbSchemaName, szProcName, cbProcName };
1671 SQLRETURN ret;
1673 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
1674 " cbProcName %d)\n", hstmt,
1675 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1676 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1677 debugstr_an((const char *)szProcName, cbProcName), cbProcName);
1679 ret = ODBC_CALL( SQLProcedures, &params );
1680 TRACE("Returning %d\n", ret);
1681 return ret;
1684 /*************************************************************************
1685 * SQLSetPos [ODBC32.068]
1687 SQLRETURN WINAPI SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock)
1689 struct SQLSetPos_params params = { hstmt, irow, fOption, fLock };
1690 SQLRETURN ret;
1692 TRACE("(hstmt %p, irow %s, fOption %d, fLock %d)\n", hstmt, debugstr_sqlulen(irow), fOption, fLock);
1694 ret = ODBC_CALL( SQLSetPos, &params );
1695 TRACE("Returning %d\n", ret);
1696 return ret;
1699 /*************************************************************************
1700 * SQLTablePrivileges [ODBC32.070]
1702 SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1703 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
1704 SQLSMALLINT cbTableName)
1706 struct SQLTablePrivileges_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1707 cbSchemaName, szTableName, cbTableName };
1708 SQLRETURN ret;
1710 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
1711 " cbTableName %d)\n", hstmt,
1712 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1713 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1714 debugstr_an((const char *)szTableName, cbTableName), cbTableName);
1716 ret = ODBC_CALL( SQLTablePrivileges, &params );
1717 TRACE("Returning %d\n", ret);
1718 return ret;
1721 /*************************************************************************
1722 * SQLDrivers [ODBC32.071]
1724 SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLCHAR *szDriverDesc,
1725 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
1726 SQLCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
1727 SQLSMALLINT *pcbDriverAttr)
1729 struct SQLDrivers_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax,
1730 pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr };
1731 SQLRETURN ret;
1733 TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
1734 " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
1735 szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
1737 ret = ODBC_CALL( SQLDrivers, &params );
1739 if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
1740 ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
1742 TRACE("Returning %d\n", ret);
1743 return ret;
1746 /*************************************************************************
1747 * SQLBindParameter [ODBC32.072]
1749 SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType,
1750 SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef,
1751 SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax,
1752 SQLLEN *pcbValue)
1754 struct SQLBindParameter_params params = { hstmt, ipar, fParamType, fCType, fSqlType, cbColDef,
1755 ibScale, rgbValue, cbValueMax, pcbValue };
1756 SQLRETURN ret;
1758 TRACE("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p,"
1759 " cbValueMax %s, pcbValue %p)\n", hstmt, ipar, fParamType, fCType, fSqlType, debugstr_sqlulen(cbColDef),
1760 ibScale, rgbValue, debugstr_sqllen(cbValueMax), pcbValue);
1762 ret = ODBC_CALL( SQLBindParameter, &params );
1763 TRACE("Returning %d\n", ret);
1764 return ret;
1767 /*************************************************************************
1768 * SQLDriverConnect [ODBC32.041]
1770 SQLRETURN WINAPI SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *ConnectionString, SQLSMALLINT Length,
1771 SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max,
1772 SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion)
1774 struct SQLDriverConnect_params params = { hdbc, hwnd, ConnectionString, Length, conn_str_out,
1775 conn_str_out_max, ptr_conn_str_out, driver_completion };
1776 SQLRETURN ret;
1778 TRACE("(hdbc %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d,"
1779 " ptr_conn_str_out %p, driver_completion %d)\n", hdbc, hwnd,
1780 debugstr_an((const char *)ConnectionString, Length), Length, conn_str_out, conn_str_out_max,
1781 ptr_conn_str_out, driver_completion);
1783 ret = ODBC_CALL( SQLDriverConnect, &params );
1784 TRACE("Returning %d\n", ret);
1785 return ret;
1788 /*************************************************************************
1789 * SQLSetScrollOptions [ODBC32.069]
1791 SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset,
1792 SQLUSMALLINT crow_rowset)
1794 struct SQLSetScrollOptions_params params = { statement_handle, f_concurrency, crow_keyset, crow_rowset };
1795 SQLRETURN ret;
1797 TRACE("(statement_handle %p, f_concurrency %d, crow_keyset %s, crow_rowset %d)\n", statement_handle,
1798 f_concurrency, debugstr_sqllen(crow_keyset), crow_rowset);
1800 ret = ODBC_CALL( SQLSetScrollOptions, &params );
1801 TRACE("Returning %d\n", ret);
1802 return ret;
1805 static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType)
1807 static const SQLUSMALLINT attrList[] =
1809 SQL_COLUMN_OWNER_NAME,
1810 SQL_COLUMN_QUALIFIER_NAME,
1811 SQL_COLUMN_LABEL,
1812 SQL_COLUMN_NAME,
1813 SQL_COLUMN_TABLE_NAME,
1814 SQL_COLUMN_TYPE_NAME,
1815 SQL_DESC_BASE_COLUMN_NAME,
1816 SQL_DESC_BASE_TABLE_NAME,
1817 SQL_DESC_CATALOG_NAME,
1818 SQL_DESC_LABEL,
1819 SQL_DESC_LITERAL_PREFIX,
1820 SQL_DESC_LITERAL_SUFFIX,
1821 SQL_DESC_LOCAL_TYPE_NAME,
1822 SQL_DESC_NAME,
1823 SQL_DESC_SCHEMA_NAME,
1824 SQL_DESC_TABLE_NAME,
1825 SQL_DESC_TYPE_NAME,
1827 unsigned int i;
1829 for (i = 0; i < ARRAY_SIZE(attrList); i++) {
1830 if (attrList[i] == fDescType) return TRUE;
1832 return FALSE;
1835 /*************************************************************************
1836 * SQLColAttributesW [ODBC32.106]
1838 SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
1839 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
1840 SQLLEN *pfDesc)
1842 struct SQLColAttributesW_params params = { hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc };
1843 SQLRETURN ret;
1845 TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
1846 fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1848 ret = ODBC_CALL( SQLColAttributesW, &params );
1850 if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(fDescType) && rgbDesc && pcbDesc &&
1851 *pcbDesc != lstrlenW(rgbDesc) * 2)
1853 TRACE("CHEAT: resetting name length for ADO\n");
1854 *pcbDesc = lstrlenW(rgbDesc) * 2;
1857 TRACE("Returning %d\n", ret);
1858 return ret;
1861 /*************************************************************************
1862 * SQLConnectW [ODBC32.107]
1864 SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMALLINT NameLength1,
1865 WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication,
1866 SQLSMALLINT NameLength3)
1868 struct SQLConnectW_params params = { ConnectionHandle, ServerName, NameLength1, UserName, NameLength2,
1869 Authentication, NameLength3 };
1870 SQLRETURN ret;
1872 TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
1873 " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1,
1874 debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3);
1876 ret = ODBC_CALL( SQLConnectW, &params );
1877 TRACE("Returning %d\n", ret);
1878 return ret;
1881 /*************************************************************************
1882 * SQLDescribeColW [ODBC32.108]
1884 SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, WCHAR *ColumnName,
1885 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
1886 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
1888 struct SQLDescribeColW_params params = { StatementHandle, ColumnNumber, ColumnName, BufferLength,
1889 NameLength, DataType, ColumnSize, DecimalDigits, Nullable };
1890 SQLSMALLINT dummy;
1891 SQLRETURN ret;
1893 TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
1894 " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
1895 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
1897 if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
1899 ret = ODBC_CALL( SQLDescribeColW, &params );
1900 if (ret >= 0)
1902 if (ColumnName && NameLength) TRACE("ColumnName %s\n", debugstr_wn(ColumnName, *NameLength));
1903 if (DataType) TRACE("DataType %d\n", *DataType);
1904 if (ColumnSize) TRACE("ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
1905 if (DecimalDigits) TRACE("DecimalDigits %d\n", *DecimalDigits);
1906 if (Nullable) TRACE("Nullable %d\n", *Nullable);
1909 TRACE("Returning %d\n", ret);
1910 return ret;
1913 /*************************************************************************
1914 * SQLErrorW [ODBC32.110]
1916 SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
1917 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
1918 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
1920 struct SQLErrorW_params params = { EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate,
1921 NativeError, MessageText, BufferLength, TextLength };
1922 SQLRETURN ret;
1924 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
1925 " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
1926 StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
1928 ret = ODBC_CALL( SQLErrorW, &params );
1930 if (ret == SQL_SUCCESS)
1932 TRACE(" SQLState %s\n", debugstr_wn(Sqlstate, 5));
1933 TRACE(" Error %d\n", *NativeError);
1934 TRACE(" MessageText %s\n", debugstr_wn(MessageText, *TextLength));
1937 TRACE("Returning %d\n", ret);
1938 return ret;
1941 /*************************************************************************
1942 * SQLExecDirectW [ODBC32.111]
1944 SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
1946 struct SQLExecDirectW_params params = { StatementHandle, StatementText, TextLength };
1947 SQLRETURN ret;
1949 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1950 debugstr_wn(StatementText, TextLength), TextLength);
1952 ret = ODBC_CALL( SQLExecDirectW, &params );
1953 TRACE("Returning %d\n", ret);
1954 return ret;
1957 /*************************************************************************
1958 * SQLGetCursorNameW [ODBC32.117]
1960 SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength,
1961 SQLSMALLINT *NameLength)
1963 struct SQLGetCursorNameW_params params = { StatementHandle, CursorName, BufferLength, NameLength };
1964 SQLRETURN ret;
1966 TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
1967 BufferLength, NameLength);
1969 ret = ODBC_CALL( SQLGetCursorNameW, &params );
1970 TRACE("Returning %d\n", ret);
1971 return ret;
1974 /*************************************************************************
1975 * SQLPrepareW [ODBC32.119]
1977 SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
1979 struct SQLPrepareW_params params = { StatementHandle, StatementText, TextLength };
1980 SQLRETURN ret;
1982 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1983 debugstr_wn(StatementText, TextLength), TextLength);
1985 ret = ODBC_CALL( SQLPrepareW, &params );
1986 TRACE("Returning %d\n", ret);
1987 return ret;
1990 /*************************************************************************
1991 * SQLSetCursorNameW [ODBC32.121]
1993 SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength)
1995 struct SQLSetCursorNameW_params params = { StatementHandle, CursorName, NameLength };
1996 SQLRETURN ret;
1998 TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
1999 debugstr_wn(CursorName, NameLength), NameLength);
2001 ret = ODBC_CALL( SQLSetCursorNameW, &params );
2002 TRACE("Returning %d\n", ret);
2003 return ret;
2006 /*************************************************************************
2007 * SQLColAttributeW [ODBC32.127]
2009 SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
2010 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
2011 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
2012 SQLLEN *NumericAttribute)
2014 struct SQLColAttributeW_params params = { StatementHandle, ColumnNumber, FieldIdentifier,
2015 CharacterAttribute, BufferLength, StringLength,
2016 NumericAttribute };
2017 SQLRETURN ret;
2019 TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d"
2020 " StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier,
2021 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
2023 ret = ODBC_CALL( SQLColAttributeW, &params );
2025 if (ret == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier) &&
2026 StringLength && *StringLength != lstrlenW(CharacterAttribute) * 2)
2028 TRACE("CHEAT: resetting name length for ADO\n");
2029 *StringLength = lstrlenW(CharacterAttribute) * 2;
2032 TRACE("Returning %d\n", ret);
2033 return ret;
2036 /*************************************************************************
2037 * SQLGetConnectAttrW [ODBC32.132]
2039 SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2040 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2042 struct SQLGetConnectAttrW_params params = { ConnectionHandle, Attribute, Value,
2043 BufferLength, StringLength };
2044 SQLRETURN ret;
2046 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2047 Attribute, Value, BufferLength, StringLength);
2049 ret = ODBC_CALL( SQLGetConnectAttrW, &params );
2050 TRACE("Returning %d\n", ret);
2051 return ret;
2054 /*************************************************************************
2055 * SQLGetDescFieldW [ODBC32.133]
2057 SQLRETURN WINAPI SQLGetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2058 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2060 struct SQLGetDescFieldW_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value,
2061 BufferLength, StringLength };
2062 SQLRETURN ret;
2064 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
2065 DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
2067 ret = ODBC_CALL( SQLGetDescFieldW, &params );
2068 TRACE("Returning %d\n", ret);
2069 return ret;
2072 /*************************************************************************
2073 * SQLGetDescRecW [ODBC32.134]
2075 SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, WCHAR *Name,
2076 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
2077 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
2078 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
2080 struct SQLGetDescRecW_params params = { DescriptorHandle, RecNumber, Name, BufferLength, StringLength,
2081 Type, SubType, Length, Precision, Scale, Nullable };
2082 SQLRETURN ret;
2084 TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
2085 " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
2086 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
2088 ret = ODBC_CALL( SQLGetDescRecW, &params );
2089 TRACE("Returning %d\n", ret);
2090 return ret;
2093 /*************************************************************************
2094 * SQLGetDiagFieldW [ODBC32.135]
2096 SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2097 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
2098 SQLSMALLINT *StringLength)
2100 struct SQLGetDiagFieldW_params params = { HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo,
2101 BufferLength, StringLength };
2102 SQLRETURN ret;
2104 TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
2105 " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
2107 ret = ODBC_CALL( SQLGetDiagFieldW, &params );
2108 TRACE("Returning %d\n", ret);
2109 return ret;
2112 /*************************************************************************
2113 * SQLGetDiagRecW [ODBC32.136]
2115 SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2116 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
2117 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2119 struct SQLGetDiagRecW_params params = { HandleType, Handle, RecNumber, Sqlstate, NativeError,
2120 MessageText, BufferLength, TextLength };
2121 SQLRETURN ret;
2123 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
2124 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
2125 TextLength);
2127 ret = ODBC_CALL( SQLGetDiagRecW, &params );
2128 TRACE("Returning %d\n", ret);
2129 return ret;
2132 /*************************************************************************
2133 * SQLGetStmtAttrW [ODBC32.138]
2135 SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2136 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2138 struct SQLGetStmtAttrW_params params = { StatementHandle, Attribute, Value, BufferLength, StringLength };
2139 SQLRETURN ret;
2141 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
2142 Attribute, Value, BufferLength, StringLength);
2144 if (!Value)
2146 WARN("Unexpected NULL Value return address\n");
2147 return SQL_ERROR;
2150 ret = ODBC_CALL( SQLGetStmtAttrW, &params );
2151 TRACE("Returning %d\n", ret);
2152 return ret;
2155 /*************************************************************************
2156 * SQLSetConnectAttrW [ODBC32.139]
2158 SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2159 SQLINTEGER StringLength)
2161 struct SQLSetConnectAttrW_params params = { ConnectionHandle, Attribute, Value, StringLength };
2162 SQLRETURN ret;
2164 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
2165 StringLength);
2167 ret = ODBC_CALL( SQLSetConnectAttrW, &params );
2168 TRACE("Returning %d\n", ret);
2169 return ret;
2172 /*************************************************************************
2173 * SQLColumnsW [ODBC32.140]
2175 SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSMALLINT NameLength1,
2176 WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName,
2177 SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4)
2179 struct SQLColumnsW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName,
2180 NameLength2, TableName, NameLength3, ColumnName, NameLength4 };
2181 SQLRETURN ret;
2183 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2184 " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
2185 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2186 debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(ColumnName, NameLength4), NameLength4);
2188 ret = ODBC_CALL( SQLColumnsW, &params );
2189 TRACE("Returning %d\n", ret);
2190 return ret;
2193 /*************************************************************************
2194 * SQLDriverConnectW [ODBC32.141]
2196 SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, WCHAR *InConnectionString,
2197 SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength,
2198 SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion)
2200 struct SQLDriverConnectW_params params = { ConnectionHandle, WindowHandle, InConnectionString, Length,
2201 OutConnectionString, BufferLength, Length2, DriverCompletion };
2202 SQLRETURN ret;
2204 TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
2205 " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
2206 debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2,
2207 DriverCompletion);
2209 ret = ODBC_CALL( SQLDriverConnectW, &params );
2210 TRACE("Returning %d\n", ret);
2211 return ret;
2214 /*************************************************************************
2215 * SQLGetConnectOptionW [ODBC32.142]
2217 SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
2219 struct SQLGetConnectOptionW_params params = { ConnectionHandle, Option, Value };
2220 SQLRETURN ret;
2222 TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
2224 ret = ODBC_CALL( SQLGetConnectOptionW, &params );
2225 TRACE("Returning %d\n", ret);
2226 return ret;
2229 /*************************************************************************
2230 * SQLGetInfoW [ODBC32.145]
2232 SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
2233 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
2235 struct SQLGetInfoW_params params = { ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength };
2236 SQLRETURN ret;
2238 TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2239 InfoType, InfoValue, BufferLength, StringLength);
2241 ret = ODBC_CALL( SQLGetInfoW, &params );
2242 TRACE("Returning %d\n", ret);
2243 return ret;
2246 /*************************************************************************
2247 * SQLGetTypeInfoW [ODBC32.147]
2249 SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
2251 struct SQLGetTypeInfoW_params params = { StatementHandle, DataType };
2252 SQLRETURN ret;
2254 TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
2256 ret = ODBC_CALL( SQLGetTypeInfoW, &params );
2257 TRACE("Returning %d\n", ret);
2258 return ret;
2261 /*************************************************************************
2262 * SQLSetConnectOptionW [ODBC32.150]
2264 SQLRETURN WINAPI SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLLEN Value)
2266 struct SQLSetConnectOptionW_params params = { ConnectionHandle, Option, Value };
2267 SQLRETURN ret;
2269 TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqllen(Value));
2271 ret = ODBC_CALL( SQLSetConnectOptionW, &params );
2272 TRACE("Returning %d\n", ret);
2273 return ret;
2276 /*************************************************************************
2277 * SQLSpecialColumnsW [ODBC32.152]
2279 SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType,
2280 SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, SQLWCHAR *SchemaName,
2281 SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3,
2282 SQLUSMALLINT Scope, SQLUSMALLINT Nullable)
2284 struct SQLSpecialColumnsW_params params = { StatementHandle, IdentifierType, CatalogName, NameLength1,
2285 SchemaName, NameLength2, TableName, NameLength3, Scope, Nullable };
2286 SQLRETURN ret;
2288 TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
2289 " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
2290 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2291 debugstr_wn(TableName, NameLength3), NameLength3, Scope, Nullable);
2293 ret = ODBC_CALL( SQLSpecialColumnsW, &params );
2294 TRACE("Returning %d\n", ret);
2295 return ret;
2298 /*************************************************************************
2299 * SQLStatisticsW [ODBC32.153]
2301 SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
2302 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
2303 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
2305 struct SQLStatisticsW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName,
2306 NameLength2, TableName, NameLength3, Unique, Reserved };
2307 SQLRETURN ret;
2309 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
2310 " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
2311 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2312 debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved);
2314 ret = ODBC_CALL( SQLStatisticsW, &params );
2315 TRACE("Returning %d\n", ret);
2316 return ret;
2319 /*************************************************************************
2320 * SQLTablesW [ODBC32.154]
2322 SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
2323 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
2324 SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4)
2326 struct SQLTablesW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
2327 TableName, NameLength3, TableType, NameLength4 };
2328 SQLRETURN ret;
2330 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2331 " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
2332 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2333 debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(TableType, NameLength4), NameLength4);
2335 ret = ODBC_CALL( SQLTablesW, &params );
2336 TRACE("Returning %d\n", ret);
2337 return ret;
2340 /*************************************************************************
2341 * SQLBrowseConnectW [ODBC32.155]
2343 SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
2344 SQLWCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
2345 SQLSMALLINT *pcbConnStrOut)
2347 struct SQLBrowseConnectW_params params = { hdbc, szConnStrIn, cbConnStrIn, szConnStrOut,
2348 cbConnStrOutMax, pcbConnStrOut };
2349 SQLRETURN ret;
2351 TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
2352 hdbc, debugstr_wn(szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
2354 ret = ODBC_CALL( SQLBrowseConnectW, &params );
2355 TRACE("Returning %d\n", ret);
2356 return ret;
2359 /*************************************************************************
2360 * SQLColumnPrivilegesW [ODBC32.156]
2362 SQLRETURN WINAPI SQLColumnPrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2363 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2364 SQLSMALLINT cbTableName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
2366 struct SQLColumnPrivilegesW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2367 cbSchemaName, szTableName, cbTableName, szColumnName,
2368 cbColumnName };
2369 SQLRETURN ret;
2371 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2372 " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2373 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2374 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2375 debugstr_wn(szTableName, cbTableName), cbTableName,
2376 debugstr_wn(szColumnName, cbColumnName), cbColumnName);
2378 ret = ODBC_CALL( SQLColumnPrivilegesW, &params );
2379 TRACE("Returning %d\n", ret);
2380 return ret;
2383 /*************************************************************************
2384 * SQLDataSourcesW [ODBC32.157]
2386 SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, WCHAR *ServerName,
2387 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description,
2388 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
2390 struct SQLDataSourcesW_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1,
2391 NameLength1, Description, BufferLength2, NameLength2 };
2392 SQLRETURN ret;
2394 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
2395 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
2396 NameLength1, Description, BufferLength2, NameLength2);
2398 ret = ODBC_CALL( SQLDataSourcesW, &params );
2400 if (ret >= 0 && TRACE_ON(odbc))
2402 if (ServerName && NameLength1 && *NameLength1 > 0)
2403 TRACE(" DataSource %s", debugstr_wn(ServerName, *NameLength1));
2404 if (Description && NameLength2 && *NameLength2 > 0)
2405 TRACE(" Description %s", debugstr_wn(Description, *NameLength2));
2406 TRACE("\n");
2409 TRACE("Returning %d\n", ret);
2410 return ret;
2413 /*************************************************************************
2414 * SQLForeignKeysW [ODBC32.160]
2416 SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
2417 SQLWCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLWCHAR *szPkTableName,
2418 SQLSMALLINT cbPkTableName, SQLWCHAR *szFkCatalogName,
2419 SQLSMALLINT cbFkCatalogName, SQLWCHAR *szFkSchemaName,
2420 SQLSMALLINT cbFkSchemaName, SQLWCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
2422 struct SQLForeignKeysW_params params = { hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName,
2423 cbPkSchemaName, szPkTableName, cbPkTableName, szFkCatalogName,
2424 cbFkCatalogName, szFkSchemaName, cbFkSchemaName, szFkTableName,
2425 cbFkTableName };
2426 SQLRETURN ret;
2428 TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
2429 " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
2430 " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
2431 debugstr_wn(szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
2432 debugstr_wn(szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
2433 debugstr_wn(szPkTableName, cbPkTableName), cbPkTableName,
2434 debugstr_wn(szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
2435 debugstr_wn(szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
2436 debugstr_wn(szFkTableName, cbFkTableName), cbFkTableName);
2438 ret = ODBC_CALL( SQLForeignKeysW, &params );
2439 TRACE("Returning %d\n", ret);
2440 return ret;
2443 /*************************************************************************
2444 * SQLNativeSqlW [ODBC32.162]
2446 SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr,
2447 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
2449 struct SQLNativeSqlW_params params = { hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr };
2450 SQLRETURN ret;
2452 TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
2453 debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2455 ret = ODBC_CALL( SQLNativeSqlW, &params );
2456 TRACE("Returning %d\n", ret);
2457 return ret;
2460 /*************************************************************************
2461 * SQLPrimaryKeysW [ODBC32.165]
2463 SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2464 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2465 SQLSMALLINT cbTableName)
2467 struct SQLPrimaryKeysW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2468 cbSchemaName, szTableName, cbTableName };
2469 SQLRETURN ret;
2471 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2472 " cbTableName %d)\n", hstmt,
2473 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2474 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2475 debugstr_wn(szTableName, cbTableName), cbTableName);
2477 ret = ODBC_CALL( SQLPrimaryKeysW, &params );
2478 TRACE("Returning %d\n", ret);
2479 return ret;
2482 /*************************************************************************
2483 * SQLProcedureColumnsW [ODBC32.166]
2485 SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2486 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
2487 SQLSMALLINT cbProcName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
2489 struct SQLProcedureColumnsW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2490 cbSchemaName, szProcName, cbProcName,
2491 szColumnName, cbColumnName };
2492 SQLRETURN ret;
2494 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2495 " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2496 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2497 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2498 debugstr_wn(szProcName, cbProcName), cbProcName,
2499 debugstr_wn(szColumnName, cbColumnName), cbColumnName);
2501 ret = ODBC_CALL( SQLProcedureColumnsW, &params );
2502 TRACE("Returning %d\n", ret);
2503 return ret;
2506 /*************************************************************************
2507 * SQLProceduresW [ODBC32.167]
2509 SQLRETURN WINAPI SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2510 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
2511 SQLSMALLINT cbProcName)
2513 struct SQLProceduresW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2514 cbSchemaName, szProcName, cbProcName };
2515 SQLRETURN ret;
2517 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2518 " cbProcName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2519 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szProcName, cbProcName), cbProcName);
2521 ret = ODBC_CALL( SQLProceduresW, &params );
2522 TRACE("Returning %d\n", ret);
2523 return ret;
2526 /*************************************************************************
2527 * SQLTablePrivilegesW [ODBC32.170]
2529 SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2530 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2531 SQLSMALLINT cbTableName)
2533 struct SQLTablePrivilegesW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2534 cbSchemaName, szTableName, cbTableName };
2535 SQLRETURN ret;
2537 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2538 " cbTableName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2539 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szTableName, cbTableName), cbTableName);
2541 ret = ODBC_CALL( SQLTablePrivilegesW, &params );
2542 TRACE("Returning %d\n", ret);
2543 return ret;
2546 /*************************************************************************
2547 * SQLDriversW [ODBC32.171]
2549 SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLWCHAR *szDriverDesc,
2550 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
2551 SQLWCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
2552 SQLSMALLINT *pcbDriverAttr)
2554 struct SQLDriversW_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax,
2555 pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr };
2556 SQLRETURN ret;
2558 TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
2559 " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
2560 szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2562 ret = ODBC_CALL( SQLDriversW, &params );
2564 if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
2565 ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
2567 TRACE("Returning %d\n", ret);
2568 return ret;
2571 /*************************************************************************
2572 * SQLSetDescFieldW [ODBC32.173]
2574 SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2575 SQLPOINTER Value, SQLINTEGER BufferLength)
2577 struct SQLSetDescFieldW_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength };
2578 SQLRETURN ret;
2580 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
2581 RecNumber, FieldIdentifier, Value, BufferLength);
2583 ret = ODBC_CALL( SQLSetDescFieldW, &params );
2584 TRACE("Returning %d\n", ret);
2585 return ret;
2588 /*************************************************************************
2589 * SQLSetStmtAttrW [ODBC32.176]
2591 SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2592 SQLINTEGER StringLength)
2594 struct SQLSetStmtAttrW_params params = { StatementHandle, Attribute, Value, StringLength };
2595 SQLRETURN ret;
2597 TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
2598 StringLength);
2600 ret = ODBC_CALL( SQLSetStmtAttrW, &params );
2601 if (ret == SQL_ERROR && (Attribute == SQL_ROWSET_SIZE || Attribute == SQL_ATTR_ROW_ARRAY_SIZE))
2603 TRACE("CHEAT: returning SQL_SUCCESS to ADO\n");
2604 return SQL_SUCCESS;
2607 TRACE("Returning %d\n", ret);
2608 return ret;
2611 /*************************************************************************
2612 * SQLGetDiagRecA [ODBC32.236]
2614 SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2615 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
2616 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2618 struct SQLGetDiagRecA_params params = { HandleType, Handle, RecNumber, Sqlstate, NativeError,
2619 MessageText, BufferLength, TextLength };
2620 SQLRETURN ret;
2622 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
2623 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
2624 TextLength);
2626 ret = ODBC_CALL( SQLGetDiagRecA, &params );
2627 TRACE("Returning %d\n", ret);
2628 return ret;
2632 /***********************************************************************
2633 * DllMain [Internal] Initializes the internal 'ODBC32.DLL'.
2635 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
2637 TRACE("proxy ODBC: %p,%lx,%p\n", hinstDLL, reason, reserved);
2639 switch (reason)
2641 case DLL_PROCESS_ATTACH:
2642 DisableThreadLibraryCalls(hinstDLL);
2643 if (!__wine_init_unix_call() && !WINE_UNIX_CALL( process_attach, NULL ))
2645 ODBC_ReplicateToRegistry();
2647 break;
2649 case DLL_PROCESS_DETACH:
2650 if (reserved) break;
2651 WINE_UNIX_CALL( process_detach, NULL );
2654 return TRUE;