winemac.drv: Remove workarounds for Mac OS X 10.6 and earlier.
[wine.git] / dlls / odbc32 / proxyodbc.c
blob573a5b280a2667d38c9e2e4300a8a6cccdcd07ca
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 static unixlib_handle_t odbc_handle;
50 #define ODBC_CALL( func, params ) __wine_unix_call( odbc_handle, unix_ ## func, params )
52 /***********************************************************************
53 * ODBC_ReplicateODBCInstToRegistry
55 * PARAMS
57 * RETURNS
59 * Utility to ODBC_ReplicateToRegistry to replicate the drivers of the
60 * ODBCINST.INI settings
62 * The driver settings are not replicated to the registry. If we were to
63 * replicate them we would need to decide whether to replicate all settings
64 * or to do some translation; whether to remove any entries present only in
65 * the windows registry, etc.
68 static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv)
70 HKEY hODBCInst;
71 LONG reg_ret;
72 BOOL success;
74 success = FALSE;
75 TRACE ("Driver settings are not currently replicated to the registry\n");
76 if ((reg_ret = RegCreateKeyExA (HKEY_LOCAL_MACHINE,
77 "Software\\ODBC\\ODBCINST.INI", 0, NULL,
78 REG_OPTION_NON_VOLATILE,
79 KEY_ALL_ACCESS /* a couple more than we need */, NULL,
80 &hODBCInst, NULL)) == ERROR_SUCCESS)
82 HKEY hDrivers;
83 if ((reg_ret = RegCreateKeyExA (hODBCInst, "ODBC Drivers", 0,
84 NULL, REG_OPTION_NON_VOLATILE,
85 KEY_ALL_ACCESS /* overkill */, NULL, &hDrivers, NULL))
86 == ERROR_SUCCESS)
88 SQLRETURN sql_ret;
89 SQLUSMALLINT dirn;
90 CHAR desc [256];
91 SQLSMALLINT sizedesc;
93 success = TRUE;
94 dirn = SQL_FETCH_FIRST;
95 while ((sql_ret = SQLDrivers (hEnv, dirn, (SQLCHAR*)desc, sizeof(desc),
96 &sizedesc, NULL, 0, NULL)) == SQL_SUCCESS ||
97 sql_ret == SQL_SUCCESS_WITH_INFO)
99 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
100 dirn = SQL_FETCH_NEXT;
101 if (sizedesc == lstrlenA(desc))
103 HKEY hThis;
104 if ((reg_ret = RegQueryValueExA (hDrivers, desc, NULL,
105 NULL, NULL, NULL)) == ERROR_FILE_NOT_FOUND)
107 if ((reg_ret = RegSetValueExA (hDrivers, desc, 0,
108 REG_SZ, (const BYTE *)"Installed", 10)) != ERROR_SUCCESS)
110 TRACE ("Error %d replicating driver %s\n",
111 reg_ret, desc);
112 success = FALSE;
115 else if (reg_ret != ERROR_SUCCESS)
117 TRACE ("Error %d checking for %s in drivers\n",
118 reg_ret, desc);
119 success = FALSE;
121 if ((reg_ret = RegCreateKeyExA (hODBCInst, desc, 0,
122 NULL, REG_OPTION_NON_VOLATILE,
123 KEY_ALL_ACCESS, NULL, &hThis, NULL))
124 == ERROR_SUCCESS)
126 /* FIXME This is where the settings go.
127 * I suggest that if the disposition says it
128 * exists then we leave it alone. Alternatively
129 * include an extra value to flag that it is
130 * a replication of the unixODBC/iODBC/...
132 if ((reg_ret = RegCloseKey (hThis)) !=
133 ERROR_SUCCESS)
134 TRACE ("Error %d closing %s key\n", reg_ret,
135 desc);
137 else
139 TRACE ("Error %d ensuring driver key %s\n",
140 reg_ret, desc);
141 success = FALSE;
144 else
146 WARN ("Unusually long driver name %s not replicated\n",
147 desc);
148 success = FALSE;
151 if (sql_ret != SQL_NO_DATA)
153 TRACE ("Error %d enumerating drivers\n", (int)sql_ret);
154 success = FALSE;
156 if ((reg_ret = RegCloseKey (hDrivers)) != ERROR_SUCCESS)
158 TRACE ("Error %d closing hDrivers\n", reg_ret);
161 else
163 TRACE ("Error %d opening HKLM\\S\\O\\OI\\Drivers\n", reg_ret);
165 if ((reg_ret = RegCloseKey (hODBCInst)) != ERROR_SUCCESS)
167 TRACE ("Error %d closing HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
170 else
172 TRACE ("Error %d opening HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
174 if (!success)
176 WARN ("May not have replicated all ODBC drivers to the registry\n");
180 /***********************************************************************
181 * ODBC_ReplicateODBCToRegistry
183 * PARAMS
185 * RETURNS
187 * Utility to ODBC_ReplicateToRegistry to replicate either the USER or
188 * SYSTEM dsns
190 * For now simply place the "Driver description" (as returned by SQLDataSources)
191 * into the registry as the driver. This is enough to satisfy Crystal's
192 * requirement that there be a driver entry. (It doesn't seem to care what
193 * the setting is).
194 * A slightly more accurate setting would be to access the registry to find
195 * the actual driver library for the given description (which appears to map
196 * to one of the HKLM/Software/ODBC/ODBCINST.INI keys). (If you do this note
197 * that this will add a requirement that this function be called after
198 * ODBC_ReplicateODBCInstToRegistry)
200 static void ODBC_ReplicateODBCToRegistry (BOOL is_user, SQLHENV hEnv)
202 HKEY hODBC;
203 LONG reg_ret;
204 SQLRETURN sql_ret;
205 SQLUSMALLINT dirn;
206 CHAR dsn [SQL_MAX_DSN_LENGTH + 1];
207 SQLSMALLINT sizedsn;
208 CHAR desc [256];
209 SQLSMALLINT sizedesc;
210 BOOL success;
211 const char *which = is_user ? "user" : "system";
213 success = FALSE;
214 if ((reg_ret = RegCreateKeyExA (
215 is_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
216 "Software\\ODBC\\ODBC.INI", 0, NULL, REG_OPTION_NON_VOLATILE,
217 KEY_ALL_ACCESS /* a couple more than we need */, NULL, &hODBC,
218 NULL)) == ERROR_SUCCESS)
220 success = TRUE;
221 dirn = is_user ? SQL_FETCH_FIRST_USER : SQL_FETCH_FIRST_SYSTEM;
222 while ((sql_ret = SQLDataSources (hEnv, dirn,
223 (SQLCHAR*)dsn, sizeof(dsn), &sizedsn,
224 (SQLCHAR*)desc, sizeof(desc), &sizedesc)) == SQL_SUCCESS
225 || sql_ret == SQL_SUCCESS_WITH_INFO)
227 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
228 dirn = SQL_FETCH_NEXT;
229 if (sizedsn == lstrlenA(dsn) && sizedesc == lstrlenA(desc))
231 HKEY hDSN;
232 if ((reg_ret = RegCreateKeyExA (hODBC, dsn, 0,
233 NULL, REG_OPTION_NON_VOLATILE,
234 KEY_ALL_ACCESS, NULL, &hDSN, NULL))
235 == ERROR_SUCCESS)
237 static const char DRIVERKEY[] = "Driver";
238 if ((reg_ret = RegQueryValueExA (hDSN, DRIVERKEY,
239 NULL, NULL, NULL, NULL))
240 == ERROR_FILE_NOT_FOUND)
242 if ((reg_ret = RegSetValueExA (hDSN, DRIVERKEY, 0,
243 REG_SZ, (LPBYTE)desc, sizedesc)) != ERROR_SUCCESS)
245 TRACE ("Error %d replicating description of "
246 "%s(%s)\n", reg_ret, dsn, desc);
247 success = FALSE;
250 else if (reg_ret != ERROR_SUCCESS)
252 TRACE ("Error %d checking for description of %s\n",
253 reg_ret, dsn);
254 success = FALSE;
256 if ((reg_ret = RegCloseKey (hDSN)) != ERROR_SUCCESS)
258 TRACE ("Error %d closing %s DSN key %s\n",
259 reg_ret, which, dsn);
262 else
264 TRACE ("Error %d opening %s DSN key %s\n",
265 reg_ret, which, dsn);
266 success = FALSE;
269 else
271 WARN ("Unusually long %s data source name %s (%s) not "
272 "replicated\n", which, dsn, desc);
273 success = FALSE;
276 if (sql_ret != SQL_NO_DATA)
278 TRACE ("Error %d enumerating %s datasources\n",
279 (int)sql_ret, which);
280 success = FALSE;
282 if ((reg_ret = RegCloseKey (hODBC)) != ERROR_SUCCESS)
284 TRACE ("Error %d closing %s ODBC.INI registry key\n", reg_ret,
285 which);
288 else
290 TRACE ("Error %d creating/opening %s ODBC.INI registry key\n",
291 reg_ret, which);
293 if (!success)
295 WARN ("May not have replicated all %s ODBC DSNs to the registry\n",
296 which);
300 /***********************************************************************
301 * ODBC_ReplicateToRegistry
303 * PARAMS
305 * RETURNS
307 * Unfortunately some of the functions that Windows documents as being part
308 * of the ODBC API it implements directly during compilation or something
309 * in terms of registry access functions.
310 * e.g. SQLGetInstalledDrivers queries the list at
311 * HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC Drivers
313 * This function is called when the driver manager is loaded and is used
314 * to replicate the appropriate details into the Wine registry
317 static void ODBC_ReplicateToRegistry (void)
319 SQLRETURN sql_ret;
320 SQLHENV hEnv;
322 if ((sql_ret = SQLAllocEnv(&hEnv)) == SQL_SUCCESS)
324 ODBC_ReplicateODBCInstToRegistry (hEnv);
325 ODBC_ReplicateODBCToRegistry (FALSE /* system dsns */, hEnv);
326 ODBC_ReplicateODBCToRegistry (TRUE /* user dsns */, hEnv);
328 if ((sql_ret = SQLFreeEnv(hEnv)) != SQL_SUCCESS)
330 TRACE ("Error %d freeing the SQL environment.\n", (int)sql_ret);
333 else
335 TRACE ("Error %d opening an SQL environment.\n", (int)sql_ret);
336 WARN ("The external ODBC settings have not been replicated to the"
337 " Wine registry\n");
341 /*************************************************************************
342 * SQLAllocConnect [ODBC32.001]
344 SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
346 struct SQLAllocConnect_params params = { EnvironmentHandle, ConnectionHandle };
347 SQLRETURN ret;
349 TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle);
351 *ConnectionHandle = SQL_NULL_HDBC;
352 ret = ODBC_CALL( SQLAllocConnect, &params );
353 TRACE("Returning %d, ConnectionHandle %p\n", ret, *ConnectionHandle);
354 return ret;
357 /*************************************************************************
358 * SQLAllocEnv [ODBC32.002]
360 SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
362 struct SQLAllocEnv_params params = { EnvironmentHandle };
363 SQLRETURN ret;
365 TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
367 *EnvironmentHandle = SQL_NULL_HENV;
368 ret = ODBC_CALL( SQLAllocEnv, &params );
369 TRACE("Returning %d, EnvironmentHandle %p\n", ret, *EnvironmentHandle);
370 return ret;
373 /*************************************************************************
374 * SQLAllocHandle [ODBC32.024]
376 SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
378 struct SQLAllocHandle_params params = { HandleType, InputHandle, OutputHandle };
379 SQLRETURN ret;
381 TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
383 *OutputHandle = 0;
384 ret = ODBC_CALL( SQLAllocHandle, &params );
385 TRACE("Returning %d, Handle %p\n", ret, *OutputHandle);
386 return ret;
389 /*************************************************************************
390 * SQLAllocStmt [ODBC32.003]
392 SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
394 struct SQLAllocStmt_params params = { ConnectionHandle, StatementHandle };
395 SQLRETURN ret;
397 TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
399 *StatementHandle = SQL_NULL_HSTMT;
400 ret = ODBC_CALL( SQLAllocStmt, &params );
401 TRACE ("Returning %d, StatementHandle %p\n", ret, *StatementHandle);
402 return ret;
405 /*************************************************************************
406 * SQLAllocHandleStd [ODBC32.077]
408 SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
410 struct SQLAllocHandleStd_params params = { HandleType, InputHandle, OutputHandle };
411 SQLRETURN ret;
413 TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
415 *OutputHandle = 0;
416 ret = ODBC_CALL( SQLAllocHandleStd, &params );
417 TRACE ("Returning %d, OutputHandle %p\n", ret, *OutputHandle);
418 return ret;
421 static const char *debugstr_sqllen( SQLLEN len )
423 #ifdef _WIN64
424 return wine_dbg_sprintf( "%ld", len );
425 #else
426 return wine_dbg_sprintf( "%d", len );
427 #endif
430 /*************************************************************************
431 * SQLBindCol [ODBC32.004]
433 SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
434 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
436 struct SQLBindCol_params params = { StatementHandle, ColumnNumber, TargetType, TargetValue,
437 BufferLength, StrLen_or_Ind };
438 SQLRETURN ret;
440 TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
441 StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
443 ret = ODBC_CALL( SQLBindCol, &params );
444 TRACE ("Returning %d\n", ret);
445 return ret;
448 static const char *debugstr_sqlulen( SQLULEN len )
450 #ifdef _WIN64
451 return wine_dbg_sprintf( "%lu", len );
452 #else
453 return wine_dbg_sprintf( "%u", len );
454 #endif
457 /*************************************************************************
458 * SQLBindParam [ODBC32.025]
460 SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
461 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
462 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
464 struct SQLBindParam_params params = { StatementHandle, ParameterNumber, ValueType, ParameterType,
465 LengthPrecision, ParameterScale, ParameterValue, StrLen_or_Ind };
466 SQLRETURN ret;
468 TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
469 " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
470 ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
472 ret = ODBC_CALL( SQLBindParam, &params );
473 TRACE ("Returning %d\n", ret);
474 return ret;
477 /*************************************************************************
478 * SQLCancel [ODBC32.005]
480 SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle)
482 struct SQLCancel_params params = { StatementHandle };
483 SQLRETURN ret;
485 TRACE("(StatementHandle %p)\n", StatementHandle);
487 ret = ODBC_CALL( SQLCancel, &params );
488 TRACE("Returning %d\n", ret);
489 return ret;
492 /*************************************************************************
493 * SQLCloseCursor [ODBC32.026]
495 SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle)
497 struct SQLCloseCursor_params params = { StatementHandle };
498 SQLRETURN ret;
500 TRACE("(StatementHandle %p)\n", StatementHandle);
502 ret = ODBC_CALL( SQLCloseCursor, &params );
503 TRACE("Returning %d\n", ret);
504 return ret;
507 /*************************************************************************
508 * SQLColAttribute [ODBC32.027]
510 SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
511 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
512 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
513 SQLLEN *NumericAttribute)
515 struct SQLColAttribute_params params = { StatementHandle, ColumnNumber, FieldIdentifier,
516 CharacterAttribute, BufferLength, StringLength, NumericAttribute };
517 SQLRETURN ret;
519 TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d,"
520 " StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier,
521 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
523 ret = ODBC_CALL( SQLColAttribute, &params );
524 TRACE("Returning %d\n", ret);
525 return ret;
528 /*************************************************************************
529 * SQLColumns [ODBC32.040]
531 SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
532 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
533 SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
535 struct SQLColumns_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
536 TableName, NameLength3, ColumnName, NameLength4 };
537 SQLRETURN ret;
539 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
540 " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
541 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
542 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
543 debugstr_an((const char *)TableName, NameLength3), NameLength3,
544 debugstr_an((const char *)ColumnName, NameLength4), NameLength4);
546 ret = ODBC_CALL( SQLColumns, &params );
547 TRACE("Returning %d\n", ret);
548 return ret;
551 /*************************************************************************
552 * SQLConnect [ODBC32.007]
554 SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1,
555 SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication,
556 SQLSMALLINT NameLength3)
558 struct SQLConnect_params params = { ConnectionHandle, ServerName, NameLength1, UserName, NameLength2,
559 Authentication, NameLength3 };
560 SQLRETURN ret;
562 TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
563 " NameLength3 %d)\n", ConnectionHandle,
564 debugstr_an((const char *)ServerName, NameLength1), NameLength1,
565 debugstr_an((const char *)UserName, NameLength2), NameLength2,
566 debugstr_an((const char *)Authentication, NameLength3), NameLength3);
568 ret = ODBC_CALL( SQLConnect, &params );
569 TRACE("Returning %d\n", ret);
570 return ret;
573 /*************************************************************************
574 * SQLCopyDesc [ODBC32.028]
576 SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
578 struct SQLCopyDesc_params params = { SourceDescHandle, TargetDescHandle };
579 SQLRETURN ret;
581 TRACE("(SourceDescHandle %p, TargetDescHandle %p)\n", SourceDescHandle, TargetDescHandle);
583 ret = ODBC_CALL( SQLCopyDesc, &params );
584 TRACE("Returning %d\n", ret);
585 return ret;
588 /*************************************************************************
589 * SQLDataSources [ODBC32.057]
591 SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
592 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
593 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
595 struct SQLDataSources_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1,
596 NameLength1, Description, BufferLength2, NameLength2 };
597 SQLRETURN ret;
599 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
600 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
601 NameLength1, Description, BufferLength2, NameLength2);
603 ret = ODBC_CALL( SQLDataSources, &params );
604 if (ret >= 0 && TRACE_ON(odbc))
606 if (ServerName && NameLength1 && *NameLength1 > 0)
607 TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
608 if (Description && NameLength2 && *NameLength2 > 0)
609 TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
610 TRACE("\n");
613 TRACE("Returning %d\n", ret);
614 return ret;
617 SQLRETURN WINAPI SQLDataSourcesA(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
618 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
619 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
621 struct SQLDataSourcesA_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1,
622 NameLength1, Description, BufferLength2, NameLength2 };
623 SQLRETURN ret;
625 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
626 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
627 NameLength1, Description, BufferLength2, NameLength2);
629 ret = ODBC_CALL( SQLDataSourcesA, &params );
630 if (TRACE_ON(odbc))
632 if (ServerName && NameLength1 && *NameLength1 > 0)
633 TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
634 if (Description && NameLength2 && *NameLength2 > 0)
635 TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
636 TRACE("\n");
639 TRACE("Returning %d\n", ret);
640 return ret;
643 /*************************************************************************
644 * SQLDescribeCol [ODBC32.008]
646 SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
647 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
648 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
650 struct SQLDescribeCol_params params = { StatementHandle, ColumnNumber, ColumnName, BufferLength,
651 NameLength, DataType, ColumnSize, DecimalDigits, Nullable };
652 SQLSMALLINT dummy;
653 SQLRETURN ret;
655 TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
656 " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
657 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
659 if (!params.NameLength) params.NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
661 ret = ODBC_CALL( SQLDescribeCol, &params );
662 if (ret >= 0)
664 if (ColumnName && NameLength) TRACE(" ColumnName %s\n", debugstr_an((const char *)ColumnName, *NameLength));
665 if (DataType) TRACE(" DataType %d\n", *DataType);
666 if (ColumnSize) TRACE(" ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
667 if (DecimalDigits) TRACE(" DecimalDigits %d\n", *DecimalDigits);
668 if (Nullable) TRACE(" Nullable %d\n", *Nullable);
671 TRACE("Returning %d\n", ret);
672 return ret;
675 /*************************************************************************
676 * SQLDisconnect [ODBC32.009]
678 SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
680 struct SQLDisconnect_params params = { ConnectionHandle };
681 SQLRETURN ret;
683 TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
685 ret = ODBC_CALL( SQLDisconnect, &params );
686 TRACE("Returning %d\n", ret);
687 return ret;
690 /*************************************************************************
691 * SQLEndTran [ODBC32.029]
693 SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
695 struct SQLEndTran_params params = { HandleType, Handle, CompletionType };
696 SQLRETURN ret;
698 TRACE("(HandleType %d, Handle %p, CompletionType %d)\n", HandleType, Handle, CompletionType);
700 ret = ODBC_CALL( SQLEndTran, &params );
701 TRACE("Returning %d\n", ret);
702 return ret;
705 /*************************************************************************
706 * SQLError [ODBC32.010]
708 SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
709 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
710 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
712 struct SQLError_params params = { EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate,
713 NativeError, MessageText, BufferLength, TextLength };
714 SQLRETURN ret;
716 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
717 " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
718 StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
720 ret = ODBC_CALL( SQLError, &params );
722 if (ret == SQL_SUCCESS)
724 TRACE(" SQLState %s\n", debugstr_an((const char *)Sqlstate, 5));
725 TRACE(" Error %d\n", *NativeError);
726 TRACE(" MessageText %s\n", debugstr_an((const char *)MessageText, *TextLength));
729 TRACE("Returning %d\n", ret);
730 return ret;
733 /*************************************************************************
734 * SQLExecDirect [ODBC32.011]
736 SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
738 struct SQLExecDirect_params params = { StatementHandle, StatementText, TextLength };
739 SQLRETURN ret;
741 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
742 debugstr_an((const char *)StatementText, TextLength), TextLength);
744 ret = ODBC_CALL( SQLExecDirect, &params );
745 TRACE("Returning %d\n", ret);
746 return ret;
749 /*************************************************************************
750 * SQLExecute [ODBC32.012]
752 SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
754 struct SQLExecute_params params = { StatementHandle };
755 SQLRETURN ret;
757 TRACE("(StatementHandle %p)\n", StatementHandle);
759 ret = ODBC_CALL( SQLExecute, &params );
760 TRACE("Returning %d\n", ret);
761 return ret;
764 /*************************************************************************
765 * SQLFetch [ODBC32.013]
767 SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
769 struct SQLFetch_params params = { StatementHandle };
770 SQLRETURN ret;
772 TRACE("(StatementHandle %p)\n", StatementHandle);
774 ret = ODBC_CALL( SQLFetch, &params );
775 TRACE("Returning %d\n", ret);
776 return ret;
779 /*************************************************************************
780 * SQLFetchScroll [ODBC32.030]
782 SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset)
784 struct SQLFetchScroll_params params = { StatementHandle, FetchOrientation, FetchOffset };
785 SQLRETURN ret;
787 TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s)\n", StatementHandle, FetchOrientation,
788 debugstr_sqllen(FetchOffset));
790 ret = ODBC_CALL( SQLFetchScroll, &params );
791 TRACE("Returning %d\n", ret);
792 return ret;
795 /*************************************************************************
796 * SQLFreeConnect [ODBC32.014]
798 SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
800 struct SQLFreeConnect_params params = { ConnectionHandle };
801 SQLRETURN ret;
803 TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
805 ret = ODBC_CALL( SQLFreeConnect, &params );
806 TRACE("Returning %d\n", ret);
807 return ret;
810 /*************************************************************************
811 * SQLFreeEnv [ODBC32.015]
813 SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
815 struct SQLFreeEnv_params params = { EnvironmentHandle };
816 SQLRETURN ret;
818 TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
820 ret = ODBC_CALL( SQLFreeEnv, &params );
821 TRACE("Returning %d\n", ret);
822 return ret;
825 /*************************************************************************
826 * SQLFreeHandle [ODBC32.031]
828 SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
830 struct SQLFreeHandle_params params = { HandleType, Handle };
831 SQLRETURN ret;
833 TRACE("(HandleType %d, Handle %p)\n", HandleType, Handle);
835 ret = ODBC_CALL( SQLFreeHandle, &params );
836 TRACE ("Returning %d\n", ret);
837 return ret;
840 /*************************************************************************
841 * SQLFreeStmt [ODBC32.016]
843 SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
845 struct SQLFreeStmt_params params = { StatementHandle, Option };
846 SQLRETURN ret;
848 TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option);
850 ret = ODBC_CALL( SQLFreeStmt, &params );
851 TRACE("Returning %d\n", ret);
852 return ret;
855 /*************************************************************************
856 * SQLGetConnectAttr [ODBC32.032]
858 SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
859 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
861 struct SQLGetConnectAttr_params params = { ConnectionHandle, Attribute, Value, BufferLength, StringLength };
862 SQLRETURN ret;
864 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
865 Attribute, Value, BufferLength, StringLength);
867 ret = ODBC_CALL( SQLGetConnectAttr, &params );
868 TRACE("Returning %d\n", ret);
869 return ret;
872 /*************************************************************************
873 * SQLGetConnectOption [ODBC32.042]
875 SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
877 struct SQLGetConnectOption_params params = { ConnectionHandle, Option, Value };
878 SQLRETURN ret;
880 TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
882 ret = ODBC_CALL( SQLGetConnectOption, &params );
883 TRACE("Returning %d\n", ret);
884 return ret;
887 /*************************************************************************
888 * SQLGetCursorName [ODBC32.017]
890 SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength,
891 SQLSMALLINT *NameLength)
893 struct SQLGetCursorName_params params = { StatementHandle, CursorName, BufferLength, NameLength };
894 SQLRETURN ret;
896 TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
897 BufferLength, NameLength);
899 ret = ODBC_CALL( SQLGetCursorName, &params );
900 TRACE("Returning %d\n", ret);
901 return ret;
904 /*************************************************************************
905 * SQLGetData [ODBC32.043]
907 SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
908 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
910 struct SQLGetData_params params = { StatementHandle, ColumnNumber, TargetType, TargetValue,
911 BufferLength, StrLen_or_Ind };
912 SQLRETURN ret;
914 TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
915 StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
917 ret = ODBC_CALL( SQLGetData, &params );
918 TRACE("Returning %d\n", ret);
919 return ret;
922 /*************************************************************************
923 * SQLGetDescField [ODBC32.033]
925 SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
926 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
928 struct SQLGetDescField_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value,
929 BufferLength, StringLength };
930 SQLRETURN ret;
932 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
933 DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
935 ret = ODBC_CALL( SQLGetDescField, &params );
936 TRACE("Returning %d\n", ret);
937 return ret;
940 /*************************************************************************
941 * SQLGetDescRec [ODBC32.034]
943 SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLCHAR *Name,
944 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
945 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
946 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
948 struct SQLGetDescRec_params params = { DescriptorHandle, RecNumber, Name, BufferLength, StringLength,
949 Type, SubType, Length, Precision, Scale, Nullable };
950 SQLRETURN ret;
952 TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
953 " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
954 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
956 ret = ODBC_CALL( SQLGetDescRec, &params );
957 TRACE("Returning %d\n", ret);
958 return ret;
961 /*************************************************************************
962 * SQLGetDiagField [ODBC32.035]
964 SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
965 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
966 SQLSMALLINT *StringLength)
968 struct SQLGetDiagField_params params = { HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo,
969 BufferLength, StringLength };
970 SQLRETURN ret;
972 TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
973 " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
975 ret = ODBC_CALL( SQLGetDiagField, &params );
976 TRACE("Returning %d\n", ret);
977 return ret;
980 /*************************************************************************
981 * SQLGetDiagRec [ODBC32.036]
983 SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
984 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
985 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
987 struct SQLGetDiagRec_params params = { HandleType, Handle, RecNumber, Sqlstate, NativeError,
988 MessageText, BufferLength, TextLength };
989 SQLRETURN ret;
991 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
992 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
993 TextLength);
995 ret = ODBC_CALL( SQLGetDiagRec, &params );
996 TRACE("Returning %d\n", ret);
997 return ret;
1000 /*************************************************************************
1001 * SQLGetEnvAttr [ODBC32.037]
1003 SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1004 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1006 struct SQLGetEnvAttr_params params = { EnvironmentHandle, Attribute, Value, BufferLength, StringLength };
1007 SQLRETURN ret;
1009 TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n",
1010 EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
1012 ret = ODBC_CALL( SQLGetEnvAttr, &params );
1013 TRACE("Returning %d\n", ret);
1014 return ret;
1017 /*************************************************************************
1018 * SQLGetFunctions [ODBC32.044]
1020 SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
1022 struct SQLGetFunctions_params params = { ConnectionHandle, FunctionId, Supported };
1023 SQLRETURN ret;
1025 TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported);
1027 ret = ODBC_CALL( SQLGetFunctions, &params );
1028 TRACE("Returning %d\n", ret);
1029 return ret;
1032 /*************************************************************************
1033 * SQLGetInfo [ODBC32.045]
1035 SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
1036 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
1038 struct SQLGetInfo_params params = { ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength };
1039 SQLRETURN ret;
1041 TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
1042 InfoType, InfoValue, BufferLength, StringLength);
1044 if (!InfoValue)
1046 WARN("Unexpected NULL InfoValue address\n");
1047 return SQL_ERROR;
1050 ret = ODBC_CALL( SQLGetInfo, &params );
1051 TRACE("Returning %d\n", ret);
1052 return ret;
1055 /*************************************************************************
1056 * SQLGetStmtAttr [ODBC32.038]
1058 SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1059 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1061 struct SQLGetStmtAttr_params params = { StatementHandle, Attribute, Value, BufferLength, StringLength };
1062 SQLRETURN ret;
1064 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
1065 Attribute, Value, BufferLength, StringLength);
1067 if (!Value)
1069 WARN("Unexpected NULL Value return address\n");
1070 return SQL_ERROR;
1073 ret = ODBC_CALL( SQLGetStmtAttr, &params );
1074 TRACE("Returning %d\n", ret);
1075 return ret;
1078 /*************************************************************************
1079 * SQLGetStmtOption [ODBC32.046]
1081 SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1083 struct SQLGetStmtOption_params params = { StatementHandle, Option, Value };
1084 SQLRETURN ret;
1086 TRACE("(StatementHandle %p, Option %d, Value %p)\n", StatementHandle, Option, Value);
1088 ret = ODBC_CALL( SQLGetStmtOption, &params );
1089 TRACE("Returning %d\n", ret);
1090 return ret;
1093 /*************************************************************************
1094 * SQLGetTypeInfo [ODBC32.047]
1096 SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1098 struct SQLGetTypeInfo_params params = { StatementHandle, DataType };
1099 SQLRETURN ret;
1101 TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
1103 ret = ODBC_CALL( SQLGetTypeInfo, &params );
1104 TRACE("Returning %d\n", ret);
1105 return ret;
1108 /*************************************************************************
1109 * SQLNumResultCols [ODBC32.018]
1111 SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1113 struct SQLNumResultCols_params params = { StatementHandle, ColumnCount };
1114 SQLRETURN ret;
1116 TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount);
1118 ret = ODBC_CALL( SQLNumResultCols, &params );
1119 TRACE("Returning %d ColumnCount %d\n", ret, *ColumnCount);
1120 return ret;
1123 /*************************************************************************
1124 * SQLParamData [ODBC32.048]
1126 SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1128 struct SQLParamData_params params = { StatementHandle, Value };
1129 SQLRETURN ret;
1131 TRACE("(StatementHandle %p, Value %p)\n", StatementHandle, Value);
1133 ret = ODBC_CALL( SQLParamData, &params );
1134 TRACE("Returning %d\n", ret);
1135 return ret;
1138 /*************************************************************************
1139 * SQLPrepare [ODBC32.019]
1141 SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1143 struct SQLPrepare_params params = { StatementHandle, StatementText, TextLength };
1144 SQLRETURN ret;
1146 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1147 debugstr_an((const char *)StatementText, TextLength), TextLength);
1149 ret = ODBC_CALL( SQLPrepare, &params );
1150 TRACE("Returning %d\n", ret);
1151 return ret;
1154 /*************************************************************************
1155 * SQLPutData [ODBC32.049]
1157 SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind)
1159 struct SQLPutData_params params = { StatementHandle, Data, StrLen_or_Ind };
1160 SQLRETURN ret;
1162 TRACE("(StatementHandle %p, Data %p, StrLen_or_Ind %s)\n", StatementHandle, Data, debugstr_sqllen(StrLen_or_Ind));
1164 ret = ODBC_CALL( SQLPutData, &params );
1165 TRACE("Returning %d\n", ret);
1166 return ret;
1169 /*************************************************************************
1170 * SQLRowCount [ODBC32.020]
1172 SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
1174 struct SQLRowCount_params params = { StatementHandle, RowCount };
1175 SQLRETURN ret;
1177 TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount);
1179 ret = ODBC_CALL( SQLRowCount, &params );
1180 if (ret == SQL_SUCCESS && RowCount) TRACE(" RowCount %s\n", debugstr_sqllen(*RowCount));
1181 TRACE("Returning %d\n", ret);
1182 return ret;
1185 /*************************************************************************
1186 * SQLSetConnectAttr [ODBC32.039]
1188 SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1189 SQLINTEGER StringLength)
1191 struct SQLSetConnectAttr_params params = { ConnectionHandle, Attribute, Value, StringLength };
1192 SQLRETURN ret;
1194 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
1195 StringLength);
1197 ret = ODBC_CALL( SQLSetConnectAttr, &params );
1198 TRACE("Returning %d\n", ret);
1199 return ret;
1202 /*************************************************************************
1203 * SQLSetConnectOption [ODBC32.050]
1205 SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value)
1207 struct SQLSetConnectOption_params params = { ConnectionHandle, Option, Value };
1208 SQLRETURN ret;
1210 TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqlulen(Value));
1212 ret = ODBC_CALL( SQLSetConnectOption, &params );
1213 TRACE("Returning %d\n", ret);
1214 return ret;
1217 /*************************************************************************
1218 * SQLSetCursorName [ODBC32.021]
1220 SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
1222 struct SQLSetCursorName_params params = { StatementHandle, CursorName, NameLength };
1223 SQLRETURN ret;
1225 TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
1226 debugstr_an((const char *)CursorName, NameLength), NameLength);
1228 ret = ODBC_CALL( SQLSetCursorName, &params );
1229 TRACE("Returning %d\n", ret);
1230 return ret;
1233 /*************************************************************************
1234 * SQLSetDescField [ODBC32.073]
1236 SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1237 SQLPOINTER Value, SQLINTEGER BufferLength)
1239 struct SQLSetDescField_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength };
1240 SQLRETURN ret;
1242 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
1243 RecNumber, FieldIdentifier, Value, BufferLength);
1245 ret = ODBC_CALL( SQLSetDescField, &params );
1246 TRACE("Returning %d\n", ret);
1247 return ret;
1250 /*************************************************************************
1251 * SQLSetDescRec [ODBC32.074]
1253 SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type,
1254 SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale,
1255 SQLPOINTER Data, SQLLEN *StringLength, SQLLEN *Indicator)
1257 struct SQLSetDescRec_params params = { DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data, StringLength, Indicator };
1258 SQLRETURN ret;
1260 TRACE("(DescriptorHandle %p, RecNumber %d, Type %d, SubType %d, Length %s, Precision %d, Scale %d, Data %p,"
1261 " StringLength %p, Indicator %p)\n", DescriptorHandle, RecNumber, Type, SubType, debugstr_sqllen(Length),
1262 Precision, Scale, Data, StringLength, Indicator);
1264 ret = ODBC_CALL( SQLSetDescRec, &params );
1265 TRACE("Returning %d\n", ret);
1266 return ret;
1269 /*************************************************************************
1270 * SQLSetEnvAttr [ODBC32.075]
1272 SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1273 SQLINTEGER StringLength)
1275 struct SQLSetEnvAttr_params params = { EnvironmentHandle, Attribute, Value, StringLength };
1276 SQLRETURN ret;
1278 TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value,
1279 StringLength);
1281 ret = ODBC_CALL( SQLSetEnvAttr, &params );
1282 TRACE("Returning %d\n", ret);
1283 return ret;
1286 /*************************************************************************
1287 * SQLSetParam [ODBC32.022]
1289 SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1290 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
1291 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
1293 struct SQLSetParam_params params = { StatementHandle, ParameterNumber, ValueType, ParameterType,
1294 LengthPrecision, ParameterScale, ParameterValue, StrLen_or_Ind };
1295 SQLRETURN ret;
1297 TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
1298 " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
1299 ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
1301 ret = ODBC_CALL( SQLSetParam, &params );
1302 TRACE("Returning %d\n", ret);
1303 return ret;
1306 /*************************************************************************
1307 * SQLSetStmtAttr [ODBC32.076]
1309 SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1310 SQLINTEGER StringLength)
1312 struct SQLSetStmtAttr_params params = { StatementHandle, Attribute, Value, StringLength };
1313 SQLRETURN ret;
1315 TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
1316 StringLength);
1318 ret = ODBC_CALL( SQLSetStmtAttr, &params );
1319 TRACE("Returning %d\n", ret);
1320 return ret;
1323 /*************************************************************************
1324 * SQLSetStmtOption [ODBC32.051]
1326 SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value)
1328 struct SQLSetStmtOption_params params = { StatementHandle, Option, Value };
1329 SQLRETURN ret;
1331 TRACE("(StatementHandle %p, Option %d, Value %s)\n", StatementHandle, Option, debugstr_sqlulen(Value));
1333 ret = ODBC_CALL( SQLSetStmtOption, &params );
1334 TRACE("Returning %d\n", ret);
1335 return ret;
1338 /*************************************************************************
1339 * SQLSpecialColumns [ODBC32.052]
1341 SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
1342 SQLSMALLINT NameLength1, SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
1343 SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
1344 SQLUSMALLINT Nullable)
1346 struct SQLSpecialColumns_params params = { StatementHandle, IdentifierType, CatalogName, NameLength1,
1347 SchemaName, NameLength2, TableName, NameLength3, Scope, Nullable };
1348 SQLRETURN ret;
1350 TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
1351 " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
1352 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1353 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1354 debugstr_an((const char *)TableName, NameLength3), NameLength3, Scope, Nullable);
1356 ret = ODBC_CALL( SQLSpecialColumns, &params );
1357 TRACE("Returning %d\n", ret);
1358 return ret;
1361 /*************************************************************************
1362 * SQLStatistics [ODBC32.053]
1364 SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1365 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
1366 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
1368 struct SQLStatistics_params params = { StatementHandle, CatalogName, NameLength1, SchemaName,
1369 NameLength2, TableName, NameLength3, Unique, Reserved };
1370 SQLRETURN ret;
1372 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
1373 " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
1374 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1375 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1376 debugstr_an((const char *)TableName, NameLength3), NameLength3, Unique, Reserved);
1378 ret = ODBC_CALL( SQLStatistics, &params );
1379 TRACE("Returning %d\n", ret);
1380 return ret;
1383 /*************************************************************************
1384 * SQLTables [ODBC32.054]
1386 SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1387 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
1388 SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4)
1390 struct SQLTables_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
1391 TableName, NameLength3, TableType, NameLength4 };
1392 SQLRETURN ret;
1394 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
1395 " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
1396 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1397 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1398 debugstr_an((const char *)TableName, NameLength3), NameLength3,
1399 debugstr_an((const char *)TableType, NameLength4), NameLength4);
1401 ret = ODBC_CALL( SQLTables, &params );
1402 TRACE("Returning %d\n", ret);
1403 return ret;
1406 /*************************************************************************
1407 * SQLTransact [ODBC32.023]
1409 SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType)
1411 struct SQLTransact_params params = { EnvironmentHandle, ConnectionHandle, CompletionType };
1412 SQLRETURN ret;
1414 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
1415 CompletionType);
1417 ret = ODBC_CALL( SQLTransact, &params );
1418 TRACE("Returning %d\n", ret);
1419 return ret;
1422 /*************************************************************************
1423 * SQLBrowseConnect [ODBC32.055]
1425 SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
1426 SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
1427 SQLSMALLINT *pcbConnStrOut)
1429 struct SQLBrowseConnect_params params = { hdbc, szConnStrIn, cbConnStrIn, szConnStrOut,
1430 cbConnStrOutMax, pcbConnStrOut };
1431 SQLRETURN ret;
1433 TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
1434 hdbc, debugstr_an((const char *)szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax,
1435 pcbConnStrOut);
1437 ret = ODBC_CALL( SQLBrowseConnect, &params );
1438 TRACE("Returning %d\n", ret);
1439 return ret;
1442 /*************************************************************************
1443 * SQLBulkOperations [ODBC32.078]
1445 SQLRETURN WINAPI SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation)
1447 struct SQLBulkOperations_params params = { StatementHandle, Operation };
1448 SQLRETURN ret;
1450 TRACE("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation);
1452 ret = ODBC_CALL( SQLBulkOperations, &params );
1453 TRACE("Returning %d\n", ret);
1454 return ret;
1457 /*************************************************************************
1458 * SQLColAttributes [ODBC32.006]
1460 SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
1461 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
1462 SQLLEN *pfDesc)
1464 struct SQLColAttributes_params params = { hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc };
1465 SQLRETURN ret;
1467 TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
1468 fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1470 ret = ODBC_CALL( SQLColAttributes, &params );
1471 TRACE("Returning %d\n", ret);
1472 return ret;
1475 /*************************************************************************
1476 * SQLColumnPrivileges [ODBC32.056]
1478 SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1479 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
1480 SQLSMALLINT cbTableName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
1482 struct SQLColumnPrivileges_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1483 cbSchemaName, szTableName, cbTableName, szColumnName, cbColumnName };
1484 SQLRETURN ret;
1486 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
1487 " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
1488 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1489 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1490 debugstr_an((const char *)szTableName, cbTableName), cbTableName,
1491 debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
1493 ret = ODBC_CALL( SQLColumnPrivileges, &params );
1494 TRACE("Returning %d\n", ret);
1495 return ret;
1498 /*************************************************************************
1499 * SQLDescribeParam [ODBC32.058]
1501 SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType,
1502 SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable)
1504 struct SQLDescribeParam_params params = { hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable };
1505 SQLRETURN ret;
1507 TRACE("(hstmt %p, ipar %d, pfSqlType %p, pcbParamDef %p, pibScale %p, pfNullable %p)\n", hstmt, ipar,
1508 pfSqlType, pcbParamDef, pibScale, pfNullable);
1510 ret = ODBC_CALL( SQLDescribeParam, &params );
1511 TRACE("Returning %d\n", ret);
1512 return ret;
1515 /*************************************************************************
1516 * SQLExtendedFetch [ODBC32.059]
1518 SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow,
1519 SQLUSMALLINT *rgfRowStatus)
1521 struct SQLExtendedFetch_params params = { hstmt, fFetchType, irow, pcrow, rgfRowStatus };
1522 SQLRETURN ret;
1524 TRACE("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow),
1525 pcrow, rgfRowStatus);
1527 ret = ODBC_CALL( SQLExtendedFetch, &params );
1528 TRACE("Returning %d\n", ret);
1529 return ret;
1532 /*************************************************************************
1533 * SQLForeignKeys [ODBC32.060]
1535 SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
1536 SQLCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLCHAR *szPkTableName,
1537 SQLSMALLINT cbPkTableName, SQLCHAR *szFkCatalogName,
1538 SQLSMALLINT cbFkCatalogName, SQLCHAR *szFkSchemaName,
1539 SQLSMALLINT cbFkSchemaName, SQLCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
1541 struct SQLForeignKeys_params params = { hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName,
1542 cbPkSchemaName, szPkTableName, cbPkTableName, szFkCatalogName,
1543 cbFkCatalogName, szFkSchemaName, cbFkSchemaName,
1544 szFkTableName, cbFkTableName };
1545 SQLRETURN ret;
1547 TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
1548 " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
1549 " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
1550 debugstr_an((const char *)szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
1551 debugstr_an((const char *)szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
1552 debugstr_an((const char *)szPkTableName, cbPkTableName), cbPkTableName,
1553 debugstr_an((const char *)szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
1554 debugstr_an((const char *)szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
1555 debugstr_an((const char *)szFkTableName, cbFkTableName), cbFkTableName);
1557 ret = ODBC_CALL( SQLForeignKeys, &params );
1558 TRACE("Returning %d\n", ret);
1559 return ret;
1562 /*************************************************************************
1563 * SQLMoreResults [ODBC32.061]
1565 SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle)
1567 struct SQLMoreResults_params params = { StatementHandle };
1568 SQLRETURN ret;
1570 TRACE("(%p)\n", StatementHandle);
1572 ret = ODBC_CALL( SQLMoreResults, &params );
1573 TRACE("Returning %d\n", ret);
1574 return ret;
1577 /*************************************************************************
1578 * SQLNativeSql [ODBC32.062]
1580 SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr,
1581 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
1583 struct SQLNativeSql_params params = { hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr };
1584 SQLRETURN ret;
1586 TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
1587 debugstr_an((const char *)szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
1589 ret = ODBC_CALL( SQLNativeSql, &params );
1590 TRACE("Returning %d\n", ret);
1591 return ret;
1594 /*************************************************************************
1595 * SQLNumParams [ODBC32.063]
1597 SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar)
1599 struct SQLNumParams_params params = { hstmt, pcpar };
1600 SQLRETURN ret;
1602 TRACE("(hstmt %p, pcpar %p)\n", hstmt, pcpar);
1604 ret = ODBC_CALL( SQLNumParams, &params );
1605 TRACE("Returning %d\n", ret);
1606 return ret;
1609 /*************************************************************************
1610 * SQLParamOptions [ODBC32.064]
1612 SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow)
1614 struct SQLParamOptions_params params = { hstmt, crow, pirow };
1615 SQLRETURN ret;
1617 TRACE("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow);
1619 ret = ODBC_CALL( SQLParamOptions, &params );
1620 TRACE("Returning %d\n", ret);
1621 return ret;
1624 /*************************************************************************
1625 * SQLPrimaryKeys [ODBC32.065]
1627 SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1628 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
1629 SQLSMALLINT cbTableName)
1631 struct SQLPrimaryKeys_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1632 cbSchemaName, szTableName, cbTableName };
1633 SQLRETURN ret;
1635 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
1636 " cbTableName %d)\n", hstmt,
1637 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1638 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1639 debugstr_an((const char *)szTableName, cbTableName), cbTableName);
1641 ret = ODBC_CALL( SQLPrimaryKeys, &params );
1642 TRACE("Returning %d\n", ret);
1643 return ret;
1646 /*************************************************************************
1647 * SQLProcedureColumns [ODBC32.066]
1649 SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1650 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
1651 SQLSMALLINT cbProcName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
1653 struct SQLProcedureColumns_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1654 cbSchemaName, szProcName, cbProcName,
1655 szColumnName, cbColumnName };
1656 SQLRETURN ret;
1658 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
1659 " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
1660 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1661 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1662 debugstr_an((const char *)szProcName, cbProcName), cbProcName,
1663 debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
1665 ret = ODBC_CALL( SQLProcedureColumns, &params );
1666 TRACE("Returning %d\n", ret);
1667 return ret;
1670 /*************************************************************************
1671 * SQLProcedures [ODBC32.067]
1673 SQLRETURN WINAPI SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1674 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
1675 SQLSMALLINT cbProcName)
1677 struct SQLProcedures_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1678 cbSchemaName, szProcName, cbProcName };
1679 SQLRETURN ret;
1681 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
1682 " cbProcName %d)\n", hstmt,
1683 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1684 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1685 debugstr_an((const char *)szProcName, cbProcName), cbProcName);
1687 ret = ODBC_CALL( SQLProcedures, &params );
1688 TRACE("Returning %d\n", ret);
1689 return ret;
1692 /*************************************************************************
1693 * SQLSetPos [ODBC32.068]
1695 SQLRETURN WINAPI SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock)
1697 struct SQLSetPos_params params = { hstmt, irow, fOption, fLock };
1698 SQLRETURN ret;
1700 TRACE("(hstmt %p, irow %s, fOption %d, fLock %d)\n", hstmt, debugstr_sqlulen(irow), fOption, fLock);
1702 ret = ODBC_CALL( SQLSetPos, &params );
1703 TRACE("Returning %d\n", ret);
1704 return ret;
1707 /*************************************************************************
1708 * SQLTablePrivileges [ODBC32.070]
1710 SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
1711 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
1712 SQLSMALLINT cbTableName)
1714 struct SQLTablePrivileges_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
1715 cbSchemaName, szTableName, cbTableName };
1716 SQLRETURN ret;
1718 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
1719 " cbTableName %d)\n", hstmt,
1720 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
1721 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
1722 debugstr_an((const char *)szTableName, cbTableName), cbTableName);
1724 ret = ODBC_CALL( SQLTablePrivileges, &params );
1725 TRACE("Returning %d\n", ret);
1726 return ret;
1729 /*************************************************************************
1730 * SQLDrivers [ODBC32.071]
1732 SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLCHAR *szDriverDesc,
1733 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
1734 SQLCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
1735 SQLSMALLINT *pcbDriverAttr)
1737 struct SQLDrivers_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax,
1738 pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr };
1739 SQLRETURN ret;
1741 TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
1742 " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
1743 szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
1745 ret = ODBC_CALL( SQLDrivers, &params );
1747 if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
1748 ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
1750 TRACE("Returning %d\n", ret);
1751 return ret;
1754 /*************************************************************************
1755 * SQLBindParameter [ODBC32.072]
1757 SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType,
1758 SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef,
1759 SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax,
1760 SQLLEN *pcbValue)
1762 struct SQLBindParameter_params params = { hstmt, ipar, fParamType, fCType, fSqlType, cbColDef,
1763 ibScale, rgbValue, cbValueMax, pcbValue };
1764 SQLRETURN ret;
1766 TRACE("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p,"
1767 " cbValueMax %s, pcbValue %p)\n", hstmt, ipar, fParamType, fCType, fSqlType, debugstr_sqlulen(cbColDef),
1768 ibScale, rgbValue, debugstr_sqllen(cbValueMax), pcbValue);
1770 ret = ODBC_CALL( SQLBindParameter, &params );
1771 TRACE("Returning %d\n", ret);
1772 return ret;
1775 /*************************************************************************
1776 * SQLDriverConnect [ODBC32.041]
1778 SQLRETURN WINAPI SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *ConnectionString, SQLSMALLINT Length,
1779 SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max,
1780 SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion)
1782 struct SQLDriverConnect_params params = { hdbc, hwnd, ConnectionString, Length, conn_str_out,
1783 conn_str_out_max, ptr_conn_str_out, driver_completion };
1784 SQLRETURN ret;
1786 TRACE("(hdbc %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d,"
1787 " ptr_conn_str_out %p, driver_completion %d)\n", hdbc, hwnd,
1788 debugstr_an((const char *)ConnectionString, Length), Length, conn_str_out, conn_str_out_max,
1789 ptr_conn_str_out, driver_completion);
1791 ret = ODBC_CALL( SQLDriverConnect, &params );
1792 TRACE("Returning %d\n", ret);
1793 return ret;
1796 /*************************************************************************
1797 * SQLSetScrollOptions [ODBC32.069]
1799 SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset,
1800 SQLUSMALLINT crow_rowset)
1802 struct SQLSetScrollOptions_params params = { statement_handle, f_concurrency, crow_keyset, crow_rowset };
1803 SQLRETURN ret;
1805 TRACE("(statement_handle %p, f_concurrency %d, crow_keyset %s, crow_rowset %d)\n", statement_handle,
1806 f_concurrency, debugstr_sqllen(crow_keyset), crow_rowset);
1808 ret = ODBC_CALL( SQLSetScrollOptions, &params );
1809 TRACE("Returning %d\n", ret);
1810 return ret;
1813 static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType)
1815 static const SQLUSMALLINT attrList[] =
1817 SQL_COLUMN_OWNER_NAME,
1818 SQL_COLUMN_QUALIFIER_NAME,
1819 SQL_COLUMN_LABEL,
1820 SQL_COLUMN_NAME,
1821 SQL_COLUMN_TABLE_NAME,
1822 SQL_COLUMN_TYPE_NAME,
1823 SQL_DESC_BASE_COLUMN_NAME,
1824 SQL_DESC_BASE_TABLE_NAME,
1825 SQL_DESC_CATALOG_NAME,
1826 SQL_DESC_LABEL,
1827 SQL_DESC_LITERAL_PREFIX,
1828 SQL_DESC_LITERAL_SUFFIX,
1829 SQL_DESC_LOCAL_TYPE_NAME,
1830 SQL_DESC_NAME,
1831 SQL_DESC_SCHEMA_NAME,
1832 SQL_DESC_TABLE_NAME,
1833 SQL_DESC_TYPE_NAME,
1835 unsigned int i;
1837 for (i = 0; i < ARRAY_SIZE(attrList); i++) {
1838 if (attrList[i] == fDescType) return TRUE;
1840 return FALSE;
1843 /*************************************************************************
1844 * SQLColAttributesW [ODBC32.106]
1846 SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
1847 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
1848 SQLLEN *pfDesc)
1850 struct SQLColAttributesW_params params = { hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc };
1851 SQLRETURN ret;
1853 TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
1854 fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
1856 ret = ODBC_CALL( SQLColAttributesW, &params );
1858 if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(fDescType) && rgbDesc && pcbDesc &&
1859 *pcbDesc != lstrlenW(rgbDesc) * 2)
1861 TRACE("CHEAT: resetting name length for ADO\n");
1862 *pcbDesc = lstrlenW(rgbDesc) * 2;
1865 TRACE("Returning %d\n", ret);
1866 return ret;
1869 /*************************************************************************
1870 * SQLConnectW [ODBC32.107]
1872 SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMALLINT NameLength1,
1873 WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication,
1874 SQLSMALLINT NameLength3)
1876 struct SQLConnectW_params params = { ConnectionHandle, ServerName, NameLength1, UserName, NameLength2,
1877 Authentication, NameLength3 };
1878 SQLRETURN ret;
1880 TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
1881 " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1,
1882 debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3);
1884 ret = ODBC_CALL( SQLConnectW, &params );
1885 TRACE("Returning %d\n", ret);
1886 return ret;
1889 /*************************************************************************
1890 * SQLDescribeColW [ODBC32.108]
1892 SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, WCHAR *ColumnName,
1893 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
1894 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
1896 struct SQLDescribeColW_params params = { StatementHandle, ColumnNumber, ColumnName, BufferLength,
1897 NameLength, DataType, ColumnSize, DecimalDigits, Nullable };
1898 SQLSMALLINT dummy;
1899 SQLRETURN ret;
1901 TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
1902 " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
1903 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
1905 if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
1907 ret = ODBC_CALL( SQLDescribeColW, &params );
1908 if (ret >= 0)
1910 if (ColumnName && NameLength) TRACE("ColumnName %s\n", debugstr_wn(ColumnName, *NameLength));
1911 if (DataType) TRACE("DataType %d\n", *DataType);
1912 if (ColumnSize) TRACE("ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
1913 if (DecimalDigits) TRACE("DecimalDigits %d\n", *DecimalDigits);
1914 if (Nullable) TRACE("Nullable %d\n", *Nullable);
1917 TRACE("Returning %d\n", ret);
1918 return ret;
1921 /*************************************************************************
1922 * SQLErrorW [ODBC32.110]
1924 SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
1925 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
1926 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
1928 struct SQLErrorW_params params = { EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate,
1929 NativeError, MessageText, BufferLength, TextLength };
1930 SQLRETURN ret;
1932 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
1933 " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
1934 StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
1936 ret = ODBC_CALL( SQLErrorW, &params );
1938 if (ret == SQL_SUCCESS)
1940 TRACE(" SQLState %s\n", debugstr_wn(Sqlstate, 5));
1941 TRACE(" Error %d\n", *NativeError);
1942 TRACE(" MessageText %s\n", debugstr_wn(MessageText, *TextLength));
1945 TRACE("Returning %d\n", ret);
1946 return ret;
1949 /*************************************************************************
1950 * SQLExecDirectW [ODBC32.111]
1952 SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
1954 struct SQLExecDirectW_params params = { StatementHandle, StatementText, TextLength };
1955 SQLRETURN ret;
1957 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1958 debugstr_wn(StatementText, TextLength), TextLength);
1960 ret = ODBC_CALL( SQLExecDirectW, &params );
1961 TRACE("Returning %d\n", ret);
1962 return ret;
1965 /*************************************************************************
1966 * SQLGetCursorNameW [ODBC32.117]
1968 SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength,
1969 SQLSMALLINT *NameLength)
1971 struct SQLGetCursorNameW_params params = { StatementHandle, CursorName, BufferLength, NameLength };
1972 SQLRETURN ret;
1974 TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
1975 BufferLength, NameLength);
1977 ret = ODBC_CALL( SQLGetCursorNameW, &params );
1978 TRACE("Returning %d\n", ret);
1979 return ret;
1982 /*************************************************************************
1983 * SQLPrepareW [ODBC32.119]
1985 SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
1987 struct SQLPrepareW_params params = { StatementHandle, StatementText, TextLength };
1988 SQLRETURN ret;
1990 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1991 debugstr_wn(StatementText, TextLength), TextLength);
1993 ret = ODBC_CALL( SQLPrepareW, &params );
1994 TRACE("Returning %d\n", ret);
1995 return ret;
1998 /*************************************************************************
1999 * SQLSetCursorNameW [ODBC32.121]
2001 SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength)
2003 struct SQLSetCursorNameW_params params = { StatementHandle, CursorName, NameLength };
2004 SQLRETURN ret;
2006 TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
2007 debugstr_wn(CursorName, NameLength), NameLength);
2009 ret = ODBC_CALL( SQLSetCursorNameW, &params );
2010 TRACE("Returning %d\n", ret);
2011 return ret;
2014 /*************************************************************************
2015 * SQLColAttributeW [ODBC32.127]
2017 SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
2018 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
2019 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
2020 SQLLEN *NumericAttribute)
2022 struct SQLColAttributeW_params params = { StatementHandle, ColumnNumber, FieldIdentifier,
2023 CharacterAttribute, BufferLength, StringLength,
2024 NumericAttribute };
2025 SQLRETURN ret;
2027 TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d"
2028 " StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier,
2029 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
2031 ret = ODBC_CALL( SQLColAttributeW, &params );
2033 if (ret == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier) &&
2034 StringLength && *StringLength != lstrlenW(CharacterAttribute) * 2)
2036 TRACE("CHEAT: resetting name length for ADO\n");
2037 *StringLength = lstrlenW(CharacterAttribute) * 2;
2040 TRACE("Returning %d\n", ret);
2041 return ret;
2044 /*************************************************************************
2045 * SQLGetConnectAttrW [ODBC32.132]
2047 SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2048 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2050 struct SQLGetConnectAttrW_params params = { ConnectionHandle, Attribute, Value,
2051 BufferLength, StringLength };
2052 SQLRETURN ret;
2054 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2055 Attribute, Value, BufferLength, StringLength);
2057 ret = ODBC_CALL( SQLGetConnectAttrW, &params );
2058 TRACE("Returning %d\n", ret);
2059 return ret;
2062 /*************************************************************************
2063 * SQLGetDescFieldW [ODBC32.133]
2065 SQLRETURN WINAPI SQLGetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2066 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2068 struct SQLGetDescFieldW_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value,
2069 BufferLength, StringLength };
2070 SQLRETURN ret;
2072 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
2073 DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
2075 ret = ODBC_CALL( SQLGetDescFieldW, &params );
2076 TRACE("Returning %d\n", ret);
2077 return ret;
2080 /*************************************************************************
2081 * SQLGetDescRecW [ODBC32.134]
2083 SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, WCHAR *Name,
2084 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
2085 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
2086 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
2088 struct SQLGetDescRecW_params params = { DescriptorHandle, RecNumber, Name, BufferLength, StringLength,
2089 Type, SubType, Length, Precision, Scale, Nullable };
2090 SQLRETURN ret;
2092 TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
2093 " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
2094 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
2096 ret = ODBC_CALL( SQLGetDescRecW, &params );
2097 TRACE("Returning %d\n", ret);
2098 return ret;
2101 /*************************************************************************
2102 * SQLGetDiagFieldW [ODBC32.135]
2104 SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2105 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
2106 SQLSMALLINT *StringLength)
2108 struct SQLGetDiagFieldW_params params = { HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo,
2109 BufferLength, StringLength };
2110 SQLRETURN ret;
2112 TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
2113 " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
2115 ret = ODBC_CALL( SQLGetDiagFieldW, &params );
2116 TRACE("Returning %d\n", ret);
2117 return ret;
2120 /*************************************************************************
2121 * SQLGetDiagRecW [ODBC32.136]
2123 SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2124 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
2125 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2127 struct SQLGetDiagRecW_params params = { HandleType, Handle, RecNumber, Sqlstate, NativeError,
2128 MessageText, BufferLength, TextLength };
2129 SQLRETURN ret;
2131 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
2132 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
2133 TextLength);
2135 ret = ODBC_CALL( SQLGetDiagRecW, &params );
2136 TRACE("Returning %d\n", ret);
2137 return ret;
2140 /*************************************************************************
2141 * SQLGetStmtAttrW [ODBC32.138]
2143 SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2144 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2146 struct SQLGetStmtAttrW_params params = { StatementHandle, Attribute, Value, BufferLength, StringLength };
2147 SQLRETURN ret;
2149 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
2150 Attribute, Value, BufferLength, StringLength);
2152 if (!Value)
2154 WARN("Unexpected NULL Value return address\n");
2155 return SQL_ERROR;
2158 ret = ODBC_CALL( SQLGetStmtAttrW, &params );
2159 TRACE("Returning %d\n", ret);
2160 return ret;
2163 /*************************************************************************
2164 * SQLSetConnectAttrW [ODBC32.139]
2166 SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2167 SQLINTEGER StringLength)
2169 struct SQLSetConnectAttrW_params params = { ConnectionHandle, Attribute, Value, StringLength };
2170 SQLRETURN ret;
2172 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
2173 StringLength);
2175 ret = ODBC_CALL( SQLSetConnectAttrW, &params );
2176 TRACE("Returning %d\n", ret);
2177 return ret;
2180 /*************************************************************************
2181 * SQLColumnsW [ODBC32.140]
2183 SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSMALLINT NameLength1,
2184 WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName,
2185 SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4)
2187 struct SQLColumnsW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName,
2188 NameLength2, TableName, NameLength3, ColumnName, NameLength4 };
2189 SQLRETURN ret;
2191 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2192 " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
2193 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2194 debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(ColumnName, NameLength4), NameLength4);
2196 ret = ODBC_CALL( SQLColumnsW, &params );
2197 TRACE("Returning %d\n", ret);
2198 return ret;
2201 /*************************************************************************
2202 * SQLDriverConnectW [ODBC32.141]
2204 SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, WCHAR *InConnectionString,
2205 SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength,
2206 SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion)
2208 struct SQLDriverConnectW_params params = { ConnectionHandle, WindowHandle, InConnectionString, Length,
2209 OutConnectionString, BufferLength, Length2, DriverCompletion };
2210 SQLRETURN ret;
2212 TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
2213 " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
2214 debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2,
2215 DriverCompletion);
2217 ret = ODBC_CALL( SQLDriverConnectW, &params );
2218 TRACE("Returning %d\n", ret);
2219 return ret;
2222 /*************************************************************************
2223 * SQLGetConnectOptionW [ODBC32.142]
2225 SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
2227 struct SQLGetConnectOptionW_params params = { ConnectionHandle, Option, Value };
2228 SQLRETURN ret;
2230 TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
2232 ret = ODBC_CALL( SQLGetConnectOptionW, &params );
2233 TRACE("Returning %d\n", ret);
2234 return ret;
2237 /*************************************************************************
2238 * SQLGetInfoW [ODBC32.145]
2240 SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
2241 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
2243 struct SQLGetInfoW_params params = { ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength };
2244 SQLRETURN ret;
2246 TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2247 InfoType, InfoValue, BufferLength, StringLength);
2249 if (!InfoValue)
2251 WARN("Unexpected NULL InfoValue address\n");
2252 return SQL_ERROR;
2255 ret = ODBC_CALL( SQLGetInfoW, &params );
2256 TRACE("Returning %d\n", ret);
2257 return ret;
2260 /*************************************************************************
2261 * SQLGetTypeInfoW [ODBC32.147]
2263 SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
2265 struct SQLGetTypeInfoW_params params = { StatementHandle, DataType };
2266 SQLRETURN ret;
2268 TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
2270 ret = ODBC_CALL( SQLGetTypeInfoW, &params );
2271 TRACE("Returning %d\n", ret);
2272 return ret;
2275 /*************************************************************************
2276 * SQLSetConnectOptionW [ODBC32.150]
2278 SQLRETURN WINAPI SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLLEN Value)
2280 struct SQLSetConnectOptionW_params params = { ConnectionHandle, Option, Value };
2281 SQLRETURN ret;
2283 TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqllen(Value));
2285 ret = ODBC_CALL( SQLSetConnectOptionW, &params );
2286 TRACE("Returning %d\n", ret);
2287 return ret;
2290 /*************************************************************************
2291 * SQLSpecialColumnsW [ODBC32.152]
2293 SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType,
2294 SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, SQLWCHAR *SchemaName,
2295 SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3,
2296 SQLUSMALLINT Scope, SQLUSMALLINT Nullable)
2298 struct SQLSpecialColumnsW_params params = { StatementHandle, IdentifierType, CatalogName, NameLength1,
2299 SchemaName, NameLength2, TableName, NameLength3, Scope, Nullable };
2300 SQLRETURN ret;
2302 TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
2303 " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
2304 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2305 debugstr_wn(TableName, NameLength3), NameLength3, Scope, Nullable);
2307 ret = ODBC_CALL( SQLSpecialColumnsW, &params );
2308 TRACE("Returning %d\n", ret);
2309 return ret;
2312 /*************************************************************************
2313 * SQLStatisticsW [ODBC32.153]
2315 SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
2316 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
2317 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
2319 struct SQLStatisticsW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName,
2320 NameLength2, TableName, NameLength3, Unique, Reserved };
2321 SQLRETURN ret;
2323 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
2324 " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
2325 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2326 debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved);
2328 ret = ODBC_CALL( SQLStatisticsW, &params );
2329 TRACE("Returning %d\n", ret);
2330 return ret;
2333 /*************************************************************************
2334 * SQLTablesW [ODBC32.154]
2336 SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
2337 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
2338 SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4)
2340 struct SQLTablesW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2,
2341 TableName, NameLength3, TableType, NameLength4 };
2342 SQLRETURN ret;
2344 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2345 " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
2346 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2347 debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(TableType, NameLength4), NameLength4);
2349 ret = ODBC_CALL( SQLTablesW, &params );
2350 TRACE("Returning %d\n", ret);
2351 return ret;
2354 /*************************************************************************
2355 * SQLBrowseConnectW [ODBC32.155]
2357 SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
2358 SQLWCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
2359 SQLSMALLINT *pcbConnStrOut)
2361 struct SQLBrowseConnectW_params params = { hdbc, szConnStrIn, cbConnStrIn, szConnStrOut,
2362 cbConnStrOutMax, pcbConnStrOut };
2363 SQLRETURN ret;
2365 TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
2366 hdbc, debugstr_wn(szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
2368 ret = ODBC_CALL( SQLBrowseConnectW, &params );
2369 TRACE("Returning %d\n", ret);
2370 return ret;
2373 /*************************************************************************
2374 * SQLColumnPrivilegesW [ODBC32.156]
2376 SQLRETURN WINAPI SQLColumnPrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2377 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2378 SQLSMALLINT cbTableName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
2380 struct SQLColumnPrivilegesW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2381 cbSchemaName, szTableName, cbTableName, szColumnName,
2382 cbColumnName };
2383 SQLRETURN ret;
2385 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2386 " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2387 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2388 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2389 debugstr_wn(szTableName, cbTableName), cbTableName,
2390 debugstr_wn(szColumnName, cbColumnName), cbColumnName);
2392 ret = ODBC_CALL( SQLColumnPrivilegesW, &params );
2393 TRACE("Returning %d\n", ret);
2394 return ret;
2397 /*************************************************************************
2398 * SQLDataSourcesW [ODBC32.157]
2400 SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, WCHAR *ServerName,
2401 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description,
2402 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
2404 struct SQLDataSourcesW_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1,
2405 NameLength1, Description, BufferLength2, NameLength2 };
2406 SQLRETURN ret;
2408 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
2409 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
2410 NameLength1, Description, BufferLength2, NameLength2);
2412 ret = ODBC_CALL( SQLDataSourcesW, &params );
2414 if (ret >= 0 && TRACE_ON(odbc))
2416 if (ServerName && NameLength1 && *NameLength1 > 0)
2417 TRACE(" DataSource %s", debugstr_wn(ServerName, *NameLength1));
2418 if (Description && NameLength2 && *NameLength2 > 0)
2419 TRACE(" Description %s", debugstr_wn(Description, *NameLength2));
2420 TRACE("\n");
2423 TRACE("Returning %d\n", ret);
2424 return ret;
2427 /*************************************************************************
2428 * SQLForeignKeysW [ODBC32.160]
2430 SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
2431 SQLWCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLWCHAR *szPkTableName,
2432 SQLSMALLINT cbPkTableName, SQLWCHAR *szFkCatalogName,
2433 SQLSMALLINT cbFkCatalogName, SQLWCHAR *szFkSchemaName,
2434 SQLSMALLINT cbFkSchemaName, SQLWCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
2436 struct SQLForeignKeysW_params params = { hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName,
2437 cbPkSchemaName, szPkTableName, cbPkTableName, szFkCatalogName,
2438 cbFkCatalogName, szFkSchemaName, cbFkSchemaName, szFkTableName,
2439 cbFkTableName };
2440 SQLRETURN ret;
2442 TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
2443 " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
2444 " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
2445 debugstr_wn(szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
2446 debugstr_wn(szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
2447 debugstr_wn(szPkTableName, cbPkTableName), cbPkTableName,
2448 debugstr_wn(szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
2449 debugstr_wn(szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
2450 debugstr_wn(szFkTableName, cbFkTableName), cbFkTableName);
2452 ret = ODBC_CALL( SQLForeignKeysW, &params );
2453 TRACE("Returning %d\n", ret);
2454 return ret;
2457 /*************************************************************************
2458 * SQLNativeSqlW [ODBC32.162]
2460 SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr,
2461 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
2463 struct SQLNativeSqlW_params params = { hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr };
2464 SQLRETURN ret;
2466 TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
2467 debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2469 ret = ODBC_CALL( SQLNativeSqlW, &params );
2470 TRACE("Returning %d\n", ret);
2471 return ret;
2474 /*************************************************************************
2475 * SQLPrimaryKeysW [ODBC32.165]
2477 SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2478 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2479 SQLSMALLINT cbTableName)
2481 struct SQLPrimaryKeysW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2482 cbSchemaName, szTableName, cbTableName };
2483 SQLRETURN ret;
2485 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2486 " cbTableName %d)\n", hstmt,
2487 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2488 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2489 debugstr_wn(szTableName, cbTableName), cbTableName);
2491 ret = ODBC_CALL( SQLPrimaryKeysW, &params );
2492 TRACE("Returning %d\n", ret);
2493 return ret;
2496 /*************************************************************************
2497 * SQLProcedureColumnsW [ODBC32.166]
2499 SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2500 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
2501 SQLSMALLINT cbProcName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
2503 struct SQLProcedureColumnsW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2504 cbSchemaName, szProcName, cbProcName,
2505 szColumnName, cbColumnName };
2506 SQLRETURN ret;
2508 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2509 " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2510 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2511 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
2512 debugstr_wn(szProcName, cbProcName), cbProcName,
2513 debugstr_wn(szColumnName, cbColumnName), cbColumnName);
2515 ret = ODBC_CALL( SQLProcedureColumnsW, &params );
2516 TRACE("Returning %d\n", ret);
2517 return ret;
2520 /*************************************************************************
2521 * SQLProceduresW [ODBC32.167]
2523 SQLRETURN WINAPI SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2524 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
2525 SQLSMALLINT cbProcName)
2527 struct SQLProceduresW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2528 cbSchemaName, szProcName, cbProcName };
2529 SQLRETURN ret;
2531 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2532 " cbProcName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2533 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szProcName, cbProcName), cbProcName);
2535 ret = ODBC_CALL( SQLProceduresW, &params );
2536 TRACE("Returning %d\n", ret);
2537 return ret;
2540 /*************************************************************************
2541 * SQLTablePrivilegesW [ODBC32.170]
2543 SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2544 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
2545 SQLSMALLINT cbTableName)
2547 struct SQLTablePrivilegesW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName,
2548 cbSchemaName, szTableName, cbTableName };
2549 SQLRETURN ret;
2551 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2552 " cbTableName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
2553 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szTableName, cbTableName), cbTableName);
2555 ret = ODBC_CALL( SQLTablePrivilegesW, &params );
2556 TRACE("Returning %d\n", ret);
2557 return ret;
2560 /*************************************************************************
2561 * SQLDriversW [ODBC32.171]
2563 SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLWCHAR *szDriverDesc,
2564 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
2565 SQLWCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
2566 SQLSMALLINT *pcbDriverAttr)
2568 struct SQLDriversW_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax,
2569 pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr };
2570 SQLRETURN ret;
2572 TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
2573 " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
2574 szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2576 ret = ODBC_CALL( SQLDriversW, &params );
2578 if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
2579 ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
2581 TRACE("Returning %d\n", ret);
2582 return ret;
2585 /*************************************************************************
2586 * SQLSetDescFieldW [ODBC32.173]
2588 SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2589 SQLPOINTER Value, SQLINTEGER BufferLength)
2591 struct SQLSetDescFieldW_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength };
2592 SQLRETURN ret;
2594 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
2595 RecNumber, FieldIdentifier, Value, BufferLength);
2597 ret = ODBC_CALL( SQLSetDescFieldW, &params );
2598 TRACE("Returning %d\n", ret);
2599 return ret;
2602 /*************************************************************************
2603 * SQLSetStmtAttrW [ODBC32.176]
2605 SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2606 SQLINTEGER StringLength)
2608 struct SQLSetStmtAttrW_params params = { StatementHandle, Attribute, Value, StringLength };
2609 SQLRETURN ret;
2611 TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
2612 StringLength);
2614 ret = ODBC_CALL( SQLSetStmtAttrW, &params );
2615 if (ret == SQL_ERROR && (Attribute == SQL_ROWSET_SIZE || Attribute == SQL_ATTR_ROW_ARRAY_SIZE))
2617 TRACE("CHEAT: returning SQL_SUCCESS to ADO\n");
2618 return SQL_SUCCESS;
2621 TRACE("Returning %d\n", ret);
2622 return ret;
2625 /*************************************************************************
2626 * SQLGetDiagRecA [ODBC32.236]
2628 SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2629 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
2630 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2632 struct SQLGetDiagRecA_params params = { HandleType, Handle, RecNumber, Sqlstate, NativeError,
2633 MessageText, BufferLength, TextLength };
2634 SQLRETURN ret;
2636 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
2637 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
2638 TextLength);
2640 ret = ODBC_CALL( SQLGetDiagRecA, &params );
2641 TRACE("Returning %d\n", ret);
2642 return ret;
2646 /***********************************************************************
2647 * DllMain [Internal] Initializes the internal 'ODBC32.DLL'.
2649 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
2651 TRACE("proxy ODBC: %p,%x,%p\n", hinstDLL, reason, reserved);
2653 switch (reason)
2655 case DLL_PROCESS_ATTACH:
2656 DisableThreadLibraryCalls(hinstDLL);
2657 if (!NtQueryVirtualMemory( GetCurrentProcess(), hinstDLL, MemoryWineUnixFuncs,
2658 &odbc_handle, sizeof(odbc_handle), NULL ) &&
2659 !__wine_unix_call( odbc_handle, process_attach, NULL))
2661 ODBC_ReplicateToRegistry();
2663 break;
2665 case DLL_PROCESS_DETACH:
2666 if (reserved) break;
2667 __wine_unix_call( odbc_handle, process_detach, NULL );
2670 return TRUE;