winex11.drv: Map coordinates before calling send_mouse_input.
[wine/zf.git] / dlls / odbc32 / proxyodbc.c
blob0c0b30f0bef38ee162740e72fcdae2e0f1303b6a
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);
49 static SQLRETURN WINAPI null_SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
51 *ConnectionHandle = SQL_NULL_HDBC;
52 TRACE("Not ready\n");
53 return SQL_ERROR;
56 static SQLRETURN WINAPI null_SQLAllocEnv(SQLHENV *EnvironmentHandle)
58 *EnvironmentHandle = SQL_NULL_HENV;
59 TRACE("Not ready\n");
60 return SQL_ERROR;
63 static SQLRETURN WINAPI null_SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
65 WARN("ProxyODBC: Cannot load ODBC driver manager library.\n");
67 if (HandleType == SQL_HANDLE_ENV)
68 *OutputHandle = SQL_NULL_HENV;
69 else if (HandleType == SQL_HANDLE_DBC)
70 *OutputHandle = SQL_NULL_HDBC;
71 else if (HandleType == SQL_HANDLE_STMT)
72 *OutputHandle = SQL_NULL_HSTMT;
73 else if (HandleType == SQL_HANDLE_DESC)
74 *OutputHandle = SQL_NULL_HDESC;
76 return SQL_ERROR;
79 static SQLRETURN WINAPI null_SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
81 WARN("ProxyODBC: Cannot load ODBC driver manager library.\n");
83 if (HandleType == SQL_HANDLE_ENV)
84 *OutputHandle = SQL_NULL_HENV;
85 else if (HandleType == SQL_HANDLE_DBC)
86 *OutputHandle = SQL_NULL_HDBC;
87 else if (HandleType == SQL_HANDLE_STMT)
88 *OutputHandle = SQL_NULL_HSTMT;
89 else if (HandleType == SQL_HANDLE_DESC)
90 *OutputHandle = SQL_NULL_HDESC;
92 return SQL_ERROR;
95 static SQLRETURN WINAPI null_SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
97 *StatementHandle = SQL_NULL_HSTMT;
98 TRACE("Not ready\n");
99 return SQL_ERROR;
102 static SQLRETURN WINAPI null_SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
103 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
105 return SQL_ERROR;
108 static SQLRETURN WINAPI null_SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
109 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
110 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
112 return SQL_ERROR;
115 static SQLRETURN WINAPI null_SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType,
116 SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef,
117 SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax,
118 SQLLEN *pcbValue)
120 return SQL_ERROR;
123 static SQLRETURN WINAPI null_SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
124 SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
125 SQLSMALLINT *pcbConnStrOut)
127 return SQL_ERROR;
130 static SQLRETURN WINAPI null_SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
131 SQLWCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
132 SQLSMALLINT *pcbConnStrOut)
134 return SQL_ERROR;
137 static SQLRETURN WINAPI null_SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation)
139 return SQL_ERROR;
142 static SQLRETURN WINAPI null_SQLCancel(SQLHSTMT StatementHandle)
144 return SQL_ERROR;
147 static SQLRETURN WINAPI null_SQLCloseCursor(SQLHSTMT StatementHandle)
149 return SQL_ERROR;
152 static SQLRETURN WINAPI null_SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
153 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
154 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
155 SQLLEN *NumericAttribute)
157 return SQL_ERROR;
160 static SQLRETURN WINAPI null_SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
161 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
162 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
163 SQLLEN *NumericAttribute)
165 return SQL_ERROR;
168 static SQLRETURN WINAPI null_SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
169 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
170 SQLLEN *pfDesc)
172 return SQL_ERROR;
175 static SQLRETURN WINAPI null_SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
176 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
177 SQLLEN *pfDesc)
179 return SQL_ERROR;
182 static SQLRETURN WINAPI null_SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
183 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
184 SQLSMALLINT cbTableName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
186 return SQL_ERROR;
189 static SQLRETURN WINAPI null_SQLColumnPrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
190 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
191 SQLSMALLINT cbTableName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
193 return SQL_ERROR;
196 static SQLRETURN WINAPI null_SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
197 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
198 SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
200 return SQL_ERROR;
203 static SQLRETURN WINAPI null_SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSMALLINT NameLength1,
204 WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName,
205 SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4)
207 return SQL_ERROR;
210 static SQLRETURN WINAPI null_SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1,
211 SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication,
212 SQLSMALLINT NameLength3)
214 return SQL_ERROR;
217 static SQLRETURN WINAPI null_SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMALLINT NameLength1,
218 WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication,
219 SQLSMALLINT NameLength3)
221 return SQL_ERROR;
224 static SQLRETURN WINAPI null_SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
226 return SQL_ERROR;
229 static SQLRETURN WINAPI null_SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
230 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
231 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
233 return SQL_ERROR;
236 static SQLRETURN WINAPI null_SQLDataSourcesA(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
237 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
238 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
240 return SQL_ERROR;
243 static SQLRETURN WINAPI null_SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, WCHAR *ServerName,
244 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description,
245 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
247 return SQL_ERROR;
250 static SQLRETURN WINAPI null_SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
251 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
252 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
254 return SQL_ERROR;
257 static SQLRETURN WINAPI null_SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, WCHAR *ColumnName,
258 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
259 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
261 return SQL_ERROR;
264 static SQLRETURN WINAPI null_SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType,
265 SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable)
267 return SQL_ERROR;
270 static SQLRETURN WINAPI null_SQLDisconnect(SQLHDBC ConnectionHandle)
272 return SQL_ERROR;
275 static SQLRETURN WINAPI null_SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *ConnectionString, SQLSMALLINT Length,
276 SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max,
277 SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion)
279 return SQL_ERROR;
282 static SQLRETURN WINAPI null_SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, WCHAR *InConnectionString,
283 SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength,
284 SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion)
286 return SQL_ERROR;
289 static SQLRETURN WINAPI null_SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLCHAR *szDriverDesc,
290 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
291 SQLCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
292 SQLSMALLINT *pcbDriverAttr)
294 return SQL_ERROR;
297 static SQLRETURN WINAPI null_SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLWCHAR *szDriverDesc,
298 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
299 SQLWCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
300 SQLSMALLINT *pcbDriverAttr)
302 return SQL_ERROR;
305 static SQLRETURN WINAPI null_SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
307 return SQL_ERROR;
310 static SQLRETURN WINAPI null_SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
311 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
312 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
314 return SQL_ERROR;
317 static SQLRETURN WINAPI null_SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
318 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
319 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
321 return SQL_ERROR;
324 static SQLRETURN WINAPI null_SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
326 return SQL_ERROR;
329 static SQLRETURN WINAPI null_SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
331 return SQL_ERROR;
334 static SQLRETURN WINAPI null_SQLExecute(SQLHSTMT StatementHandle)
336 return SQL_ERROR;
339 static SQLRETURN WINAPI null_SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow,
340 SQLUSMALLINT *rgfRowStatus)
342 return SQL_ERROR;
345 static SQLRETURN WINAPI null_SQLFetch(SQLHSTMT StatementHandle)
347 return SQL_ERROR;
350 static SQLRETURN WINAPI null_SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset)
352 return SQL_ERROR;
355 static SQLRETURN WINAPI null_SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
356 SQLCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLCHAR *szPkTableName,
357 SQLSMALLINT cbPkTableName, SQLCHAR *szFkCatalogName,
358 SQLSMALLINT cbFkCatalogName, SQLCHAR *szFkSchemaName,
359 SQLSMALLINT cbFkSchemaName, SQLCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
361 return SQL_ERROR;
364 static SQLRETURN WINAPI null_SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
365 SQLWCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLWCHAR *szPkTableName,
366 SQLSMALLINT cbPkTableName, SQLWCHAR *szFkCatalogName,
367 SQLSMALLINT cbFkCatalogName, SQLWCHAR *szFkSchemaName,
368 SQLSMALLINT cbFkSchemaName, SQLWCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
370 return SQL_ERROR;
373 static SQLRETURN WINAPI null_SQLFreeConnect(SQLHDBC ConnectionHandle)
375 return SQL_ERROR;
378 static SQLRETURN WINAPI null_SQLFreeEnv(SQLHENV EnvironmentHandle)
380 return SQL_ERROR;
383 static SQLRETURN WINAPI null_SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
385 return SQL_ERROR;
388 static SQLRETURN WINAPI null_SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
390 return SQL_ERROR;
393 static SQLRETURN WINAPI null_SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
394 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
396 return SQL_ERROR;
399 static SQLRETURN WINAPI null_SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
400 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
402 return SQL_ERROR;
405 static SQLRETURN WINAPI null_SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
407 return SQL_ERROR;
410 static SQLRETURN WINAPI null_SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
412 return SQL_ERROR;
415 static SQLRETURN WINAPI null_SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength,
416 SQLSMALLINT *NameLength)
418 return SQL_ERROR;
421 static SQLRETURN WINAPI null_SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength,
422 SQLSMALLINT *NameLength)
424 return SQL_ERROR;
427 static SQLRETURN WINAPI null_SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
428 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
430 return SQL_ERROR;
433 static SQLRETURN WINAPI null_SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
434 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
436 return SQL_ERROR;
439 static SQLRETURN WINAPI null_SQLGetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
440 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
442 return SQL_ERROR;
445 static SQLRETURN WINAPI null_SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLCHAR *Name,
446 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
447 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
448 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
450 return SQL_ERROR;
453 static SQLRETURN WINAPI null_SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, WCHAR *Name,
454 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
455 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
456 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
458 return SQL_ERROR;
461 static SQLRETURN WINAPI null_SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
462 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
463 SQLSMALLINT *StringLength)
465 return SQL_ERROR;
468 static SQLRETURN WINAPI null_SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
469 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
470 SQLSMALLINT *StringLength)
472 return SQL_ERROR;
475 static SQLRETURN WINAPI null_SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
476 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
477 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
479 return SQL_ERROR;
482 static SQLRETURN WINAPI null_SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
483 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
484 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
486 return SQL_ERROR;
489 static SQLRETURN WINAPI null_SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
490 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
491 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
493 return SQL_ERROR;
496 static SQLRETURN WINAPI null_SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
497 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
499 return SQL_ERROR;
502 static SQLRETURN WINAPI null_SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
504 return SQL_ERROR;
507 static SQLRETURN WINAPI null_SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
508 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
510 return SQL_ERROR;
513 static SQLRETURN WINAPI null_SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
514 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
516 return SQL_ERROR;
519 static SQLRETURN WINAPI null_SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
520 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
522 return SQL_ERROR;
525 static SQLRETURN WINAPI null_SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
526 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
528 return SQL_ERROR;
531 static SQLRETURN WINAPI null_SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
533 return SQL_ERROR;
536 static SQLRETURN WINAPI null_SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
538 return SQL_ERROR;
541 static SQLRETURN WINAPI null_SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
543 return SQL_ERROR;
546 static SQLRETURN WINAPI null_SQLMoreResults(SQLHSTMT StatementHandle)
548 return SQL_ERROR;
551 static SQLRETURN WINAPI null_SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr,
552 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
554 return SQL_ERROR;
557 static SQLRETURN WINAPI null_SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr,
558 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
560 return SQL_ERROR;
563 static SQLRETURN WINAPI null_SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar)
565 return SQL_ERROR;
568 static SQLRETURN WINAPI null_SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
570 return SQL_ERROR;
573 static SQLRETURN WINAPI null_SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
575 return SQL_ERROR;
578 static SQLRETURN WINAPI null_SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow)
580 return SQL_ERROR;
583 static SQLRETURN WINAPI null_SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
585 return SQL_ERROR;
588 static SQLRETURN WINAPI null_SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
590 return SQL_ERROR;
593 static SQLRETURN WINAPI null_SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
594 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
595 SQLSMALLINT cbTableName)
597 return SQL_ERROR;
600 static SQLRETURN WINAPI null_SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
601 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
602 SQLSMALLINT cbTableName)
604 return SQL_ERROR;
607 static SQLRETURN WINAPI null_SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
608 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
609 SQLSMALLINT cbProcName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
611 return SQL_ERROR;
614 static SQLRETURN WINAPI null_SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
615 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
616 SQLSMALLINT cbProcName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
618 return SQL_ERROR;
621 static SQLRETURN WINAPI null_SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
622 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
623 SQLSMALLINT cbProcName)
625 return SQL_ERROR;
628 static SQLRETURN WINAPI null_SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
629 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
630 SQLSMALLINT cbProcName)
632 return SQL_ERROR;
635 static SQLRETURN WINAPI null_SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind)
637 return SQL_ERROR;
640 static SQLRETURN WINAPI null_SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
642 return SQL_ERROR;
645 static SQLRETURN WINAPI null_SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
646 SQLINTEGER StringLength)
648 return SQL_ERROR;
651 static SQLRETURN WINAPI null_SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
652 SQLINTEGER StringLength)
654 return SQL_ERROR;
657 static SQLRETURN WINAPI null_SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value)
659 return SQL_ERROR;
662 static SQLRETURN WINAPI null_SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value)
664 return SQL_ERROR;
667 static SQLRETURN WINAPI null_SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
669 return SQL_ERROR;
672 static SQLRETURN WINAPI null_SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength)
674 return SQL_ERROR;
677 static SQLRETURN WINAPI null_SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
678 SQLPOINTER Value, SQLINTEGER BufferLength)
680 return SQL_ERROR;
683 static SQLRETURN WINAPI null_SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
684 SQLPOINTER Value, SQLINTEGER BufferLength)
686 return SQL_ERROR;
689 static SQLRETURN WINAPI null_SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type,
690 SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale,
691 SQLPOINTER Data, SQLLEN *StringLength, SQLLEN *Indicator)
693 return SQL_ERROR;
696 static SQLRETURN WINAPI null_SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
697 SQLINTEGER StringLength)
699 return SQL_ERROR;
702 static SQLRETURN WINAPI null_SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
703 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
704 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
706 return SQL_ERROR;
709 static SQLRETURN WINAPI null_SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock)
711 return SQL_ERROR;
714 static SQLRETURN WINAPI null_SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset,
715 SQLUSMALLINT crow_rowset)
717 return SQL_ERROR;
720 static SQLRETURN WINAPI null_SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
721 SQLINTEGER StringLength)
723 return SQL_ERROR;
726 static SQLRETURN WINAPI null_SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
727 SQLINTEGER StringLength)
729 return SQL_ERROR;
732 static SQLRETURN WINAPI null_SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value)
734 return SQL_ERROR;
737 static SQLRETURN WINAPI null_SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
738 SQLSMALLINT NameLength1, SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
739 SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
740 SQLUSMALLINT Nullable)
742 return SQL_ERROR;
745 static SQLRETURN WINAPI null_SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType,
746 SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, SQLWCHAR *SchemaName,
747 SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3,
748 SQLUSMALLINT Scope, SQLUSMALLINT Nullable)
750 return SQL_ERROR;
753 static SQLRETURN WINAPI null_SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
754 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
755 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
757 return SQL_ERROR;
760 static SQLRETURN WINAPI null_SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
761 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
762 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
764 return SQL_ERROR;
767 static SQLRETURN WINAPI null_SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
768 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
769 SQLSMALLINT cbTableName)
771 return SQL_ERROR;
774 static SQLRETURN WINAPI null_SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
775 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
776 SQLSMALLINT cbTableName)
778 return SQL_ERROR;
781 static SQLRETURN WINAPI null_SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
782 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
783 SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4)
785 return SQL_ERROR;
788 static SQLRETURN WINAPI null_SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
789 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
790 SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4)
792 return SQL_ERROR;
795 static SQLRETURN WINAPI null_SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType)
797 return SQL_ERROR;
800 static struct sql_funcs sql_funcs =
802 null_SQLAllocConnect,
803 null_SQLAllocEnv,
804 null_SQLAllocHandle,
805 null_SQLAllocHandleStd,
806 null_SQLAllocStmt,
807 null_SQLBindCol,
808 null_SQLBindParam,
809 null_SQLBindParameter,
810 null_SQLBrowseConnect,
811 null_SQLBrowseConnectW,
812 null_SQLBulkOperations,
813 null_SQLCancel,
814 null_SQLCloseCursor,
815 null_SQLColAttribute,
816 null_SQLColAttributeW,
817 null_SQLColAttributes,
818 null_SQLColAttributesW,
819 null_SQLColumnPrivileges,
820 null_SQLColumnPrivilegesW,
821 null_SQLColumns,
822 null_SQLColumnsW,
823 null_SQLConnect,
824 null_SQLConnectW,
825 null_SQLCopyDesc,
826 null_SQLDataSources,
827 null_SQLDataSourcesA,
828 null_SQLDataSourcesW,
829 null_SQLDescribeCol,
830 null_SQLDescribeColW,
831 null_SQLDescribeParam,
832 null_SQLDisconnect,
833 null_SQLDriverConnect,
834 null_SQLDriverConnectW,
835 null_SQLDrivers,
836 null_SQLDriversW,
837 null_SQLEndTran,
838 null_SQLError,
839 null_SQLErrorW,
840 null_SQLExecDirect,
841 null_SQLExecDirectW,
842 null_SQLExecute,
843 null_SQLExtendedFetch,
844 null_SQLFetch,
845 null_SQLFetchScroll,
846 null_SQLForeignKeys,
847 null_SQLForeignKeysW,
848 null_SQLFreeConnect,
849 null_SQLFreeEnv,
850 null_SQLFreeHandle,
851 null_SQLFreeStmt,
852 null_SQLGetConnectAttr,
853 null_SQLGetConnectAttrW,
854 null_SQLGetConnectOption,
855 null_SQLGetConnectOptionW,
856 null_SQLGetCursorName,
857 null_SQLGetCursorNameW,
858 null_SQLGetData,
859 null_SQLGetDescField,
860 null_SQLGetDescFieldW,
861 null_SQLGetDescRec,
862 null_SQLGetDescRecW,
863 null_SQLGetDiagField,
864 null_SQLGetDiagFieldW,
865 null_SQLGetDiagRec,
866 null_SQLGetDiagRecA,
867 null_SQLGetDiagRecW,
868 null_SQLGetEnvAttr,
869 null_SQLGetFunctions,
870 null_SQLGetInfo,
871 null_SQLGetInfoW,
872 null_SQLGetStmtAttr,
873 null_SQLGetStmtAttrW,
874 null_SQLGetStmtOption,
875 null_SQLGetTypeInfo,
876 null_SQLGetTypeInfoW,
877 null_SQLMoreResults,
878 null_SQLNativeSql,
879 null_SQLNativeSqlW,
880 null_SQLNumParams,
881 null_SQLNumResultCols,
882 null_SQLParamData,
883 null_SQLParamOptions,
884 null_SQLPrepare,
885 null_SQLPrepareW,
886 null_SQLPrimaryKeys,
887 null_SQLPrimaryKeysW,
888 null_SQLProcedureColumns,
889 null_SQLProcedureColumnsW,
890 null_SQLProcedures,
891 null_SQLProceduresW,
892 null_SQLPutData,
893 null_SQLRowCount,
894 null_SQLSetConnectAttr,
895 null_SQLSetConnectAttrW,
896 null_SQLSetConnectOption,
897 null_SQLSetConnectOptionW,
898 null_SQLSetCursorName,
899 null_SQLSetCursorNameW,
900 null_SQLSetDescField,
901 null_SQLSetDescFieldW,
902 null_SQLSetDescRec,
903 null_SQLSetEnvAttr,
904 null_SQLSetParam,
905 null_SQLSetPos,
906 null_SQLSetScrollOptions,
907 null_SQLSetStmtAttr,
908 null_SQLSetStmtAttrW,
909 null_SQLSetStmtOption,
910 null_SQLSpecialColumns,
911 null_SQLSpecialColumnsW,
912 null_SQLStatistics,
913 null_SQLStatisticsW,
914 null_SQLTablePrivileges,
915 null_SQLTablePrivilegesW,
916 null_SQLTables,
917 null_SQLTablesW,
918 null_SQLTransact
922 /***********************************************************************
923 * ODBC_ReplicateODBCInstToRegistry
925 * PARAMS
927 * RETURNS
929 * Utility to ODBC_ReplicateToRegistry to replicate the drivers of the
930 * ODBCINST.INI settings
932 * The driver settings are not replicated to the registry. If we were to
933 * replicate them we would need to decide whether to replicate all settings
934 * or to do some translation; whether to remove any entries present only in
935 * the windows registry, etc.
938 static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv)
940 HKEY hODBCInst;
941 LONG reg_ret;
942 BOOL success;
944 success = FALSE;
945 TRACE ("Driver settings are not currently replicated to the registry\n");
946 if ((reg_ret = RegCreateKeyExA (HKEY_LOCAL_MACHINE,
947 "Software\\ODBC\\ODBCINST.INI", 0, NULL,
948 REG_OPTION_NON_VOLATILE,
949 KEY_ALL_ACCESS /* a couple more than we need */, NULL,
950 &hODBCInst, NULL)) == ERROR_SUCCESS)
952 HKEY hDrivers;
953 if ((reg_ret = RegCreateKeyExA (hODBCInst, "ODBC Drivers", 0,
954 NULL, REG_OPTION_NON_VOLATILE,
955 KEY_ALL_ACCESS /* overkill */, NULL, &hDrivers, NULL))
956 == ERROR_SUCCESS)
958 SQLRETURN sql_ret;
959 SQLUSMALLINT dirn;
960 CHAR desc [256];
961 SQLSMALLINT sizedesc;
963 success = TRUE;
964 dirn = SQL_FETCH_FIRST;
965 while ((sql_ret = SQLDrivers (hEnv, dirn, (SQLCHAR*)desc, sizeof(desc),
966 &sizedesc, NULL, 0, NULL)) == SQL_SUCCESS ||
967 sql_ret == SQL_SUCCESS_WITH_INFO)
969 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
970 dirn = SQL_FETCH_NEXT;
971 if (sizedesc == lstrlenA(desc))
973 HKEY hThis;
974 if ((reg_ret = RegQueryValueExA (hDrivers, desc, NULL,
975 NULL, NULL, NULL)) == ERROR_FILE_NOT_FOUND)
977 if ((reg_ret = RegSetValueExA (hDrivers, desc, 0,
978 REG_SZ, (const BYTE *)"Installed", 10)) != ERROR_SUCCESS)
980 TRACE ("Error %d replicating driver %s\n",
981 reg_ret, desc);
982 success = FALSE;
985 else if (reg_ret != ERROR_SUCCESS)
987 TRACE ("Error %d checking for %s in drivers\n",
988 reg_ret, desc);
989 success = FALSE;
991 if ((reg_ret = RegCreateKeyExA (hODBCInst, desc, 0,
992 NULL, REG_OPTION_NON_VOLATILE,
993 KEY_ALL_ACCESS, NULL, &hThis, NULL))
994 == ERROR_SUCCESS)
996 /* FIXME This is where the settings go.
997 * I suggest that if the disposition says it
998 * exists then we leave it alone. Alternatively
999 * include an extra value to flag that it is
1000 * a replication of the unixODBC/iODBC/...
1002 if ((reg_ret = RegCloseKey (hThis)) !=
1003 ERROR_SUCCESS)
1004 TRACE ("Error %d closing %s key\n", reg_ret,
1005 desc);
1007 else
1009 TRACE ("Error %d ensuring driver key %s\n",
1010 reg_ret, desc);
1011 success = FALSE;
1014 else
1016 WARN ("Unusually long driver name %s not replicated\n",
1017 desc);
1018 success = FALSE;
1021 if (sql_ret != SQL_NO_DATA)
1023 TRACE ("Error %d enumerating drivers\n", (int)sql_ret);
1024 success = FALSE;
1026 if ((reg_ret = RegCloseKey (hDrivers)) != ERROR_SUCCESS)
1028 TRACE ("Error %d closing hDrivers\n", reg_ret);
1031 else
1033 TRACE ("Error %d opening HKLM\\S\\O\\OI\\Drivers\n", reg_ret);
1035 if ((reg_ret = RegCloseKey (hODBCInst)) != ERROR_SUCCESS)
1037 TRACE ("Error %d closing HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
1040 else
1042 TRACE ("Error %d opening HKLM\\S\\O\\ODBCINST.INI\n", reg_ret);
1044 if (!success)
1046 WARN ("May not have replicated all ODBC drivers to the registry\n");
1050 /***********************************************************************
1051 * ODBC_ReplicateODBCToRegistry
1053 * PARAMS
1055 * RETURNS
1057 * Utility to ODBC_ReplicateToRegistry to replicate either the USER or
1058 * SYSTEM dsns
1060 * For now simply place the "Driver description" (as returned by SQLDataSources)
1061 * into the registry as the driver. This is enough to satisfy Crystal's
1062 * requirement that there be a driver entry. (It doesn't seem to care what
1063 * the setting is).
1064 * A slightly more accurate setting would be to access the registry to find
1065 * the actual driver library for the given description (which appears to map
1066 * to one of the HKLM/Software/ODBC/ODBCINST.INI keys). (If you do this note
1067 * that this will add a requirement that this function be called after
1068 * ODBC_ReplicateODBCInstToRegistry)
1070 static void ODBC_ReplicateODBCToRegistry (BOOL is_user, SQLHENV hEnv)
1072 HKEY hODBC;
1073 LONG reg_ret;
1074 SQLRETURN sql_ret;
1075 SQLUSMALLINT dirn;
1076 CHAR dsn [SQL_MAX_DSN_LENGTH + 1];
1077 SQLSMALLINT sizedsn;
1078 CHAR desc [256];
1079 SQLSMALLINT sizedesc;
1080 BOOL success;
1081 const char *which = is_user ? "user" : "system";
1083 success = FALSE;
1084 if ((reg_ret = RegCreateKeyExA (
1085 is_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
1086 "Software\\ODBC\\ODBC.INI", 0, NULL, REG_OPTION_NON_VOLATILE,
1087 KEY_ALL_ACCESS /* a couple more than we need */, NULL, &hODBC,
1088 NULL)) == ERROR_SUCCESS)
1090 success = TRUE;
1091 dirn = is_user ? SQL_FETCH_FIRST_USER : SQL_FETCH_FIRST_SYSTEM;
1092 while ((sql_ret = SQLDataSources (hEnv, dirn,
1093 (SQLCHAR*)dsn, sizeof(dsn), &sizedsn,
1094 (SQLCHAR*)desc, sizeof(desc), &sizedesc)) == SQL_SUCCESS
1095 || sql_ret == SQL_SUCCESS_WITH_INFO)
1097 /* FIXME Do some proper handling of the SUCCESS_WITH_INFO */
1098 dirn = SQL_FETCH_NEXT;
1099 if (sizedsn == lstrlenA(dsn) && sizedesc == lstrlenA(desc))
1101 HKEY hDSN;
1102 if ((reg_ret = RegCreateKeyExA (hODBC, dsn, 0,
1103 NULL, REG_OPTION_NON_VOLATILE,
1104 KEY_ALL_ACCESS, NULL, &hDSN, NULL))
1105 == ERROR_SUCCESS)
1107 static const char DRIVERKEY[] = "Driver";
1108 if ((reg_ret = RegQueryValueExA (hDSN, DRIVERKEY,
1109 NULL, NULL, NULL, NULL))
1110 == ERROR_FILE_NOT_FOUND)
1112 if ((reg_ret = RegSetValueExA (hDSN, DRIVERKEY, 0,
1113 REG_SZ, (LPBYTE)desc, sizedesc)) != ERROR_SUCCESS)
1115 TRACE ("Error %d replicating description of "
1116 "%s(%s)\n", reg_ret, dsn, desc);
1117 success = FALSE;
1120 else if (reg_ret != ERROR_SUCCESS)
1122 TRACE ("Error %d checking for description of %s\n",
1123 reg_ret, dsn);
1124 success = FALSE;
1126 if ((reg_ret = RegCloseKey (hDSN)) != ERROR_SUCCESS)
1128 TRACE ("Error %d closing %s DSN key %s\n",
1129 reg_ret, which, dsn);
1132 else
1134 TRACE ("Error %d opening %s DSN key %s\n",
1135 reg_ret, which, dsn);
1136 success = FALSE;
1139 else
1141 WARN ("Unusually long %s data source name %s (%s) not "
1142 "replicated\n", which, dsn, desc);
1143 success = FALSE;
1146 if (sql_ret != SQL_NO_DATA)
1148 TRACE ("Error %d enumerating %s datasources\n",
1149 (int)sql_ret, which);
1150 success = FALSE;
1152 if ((reg_ret = RegCloseKey (hODBC)) != ERROR_SUCCESS)
1154 TRACE ("Error %d closing %s ODBC.INI registry key\n", reg_ret,
1155 which);
1158 else
1160 TRACE ("Error %d creating/opening %s ODBC.INI registry key\n",
1161 reg_ret, which);
1163 if (!success)
1165 WARN ("May not have replicated all %s ODBC DSNs to the registry\n",
1166 which);
1170 /***********************************************************************
1171 * ODBC_ReplicateToRegistry
1173 * PARAMS
1175 * RETURNS
1177 * Unfortunately some of the functions that Windows documents as being part
1178 * of the ODBC API it implements directly during compilation or something
1179 * in terms of registry access functions.
1180 * e.g. SQLGetInstalledDrivers queries the list at
1181 * HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC Drivers
1183 * This function is called when the driver manager is loaded and is used
1184 * to replicate the appropriate details into the Wine registry
1187 static void ODBC_ReplicateToRegistry (void)
1189 SQLRETURN sql_ret;
1190 SQLHENV hEnv;
1192 if ((sql_ret = SQLAllocEnv(&hEnv)) == SQL_SUCCESS)
1194 ODBC_ReplicateODBCInstToRegistry (hEnv);
1195 ODBC_ReplicateODBCToRegistry (FALSE /* system dsns */, hEnv);
1196 ODBC_ReplicateODBCToRegistry (TRUE /* user dsns */, hEnv);
1198 if ((sql_ret = SQLFreeEnv(hEnv)) != SQL_SUCCESS)
1200 TRACE ("Error %d freeing the SQL environment.\n", (int)sql_ret);
1203 else
1205 TRACE ("Error %d opening an SQL environment.\n", (int)sql_ret);
1206 WARN ("The external ODBC settings have not been replicated to the"
1207 " Wine registry\n");
1211 /*************************************************************************
1212 * SQLAllocConnect [ODBC32.001]
1214 SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle)
1216 SQLRETURN ret;
1218 TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle);
1220 ret = sql_funcs.pSQLAllocConnect(EnvironmentHandle, ConnectionHandle);
1221 TRACE("Returning %d, ConnectionHandle %p\n", ret, *ConnectionHandle);
1222 return ret;
1225 /*************************************************************************
1226 * SQLAllocEnv [ODBC32.002]
1228 SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
1230 SQLRETURN ret;
1232 TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
1234 ret = sql_funcs.pSQLAllocEnv(EnvironmentHandle);
1235 TRACE("Returning %d, EnvironmentHandle %p\n", ret, *EnvironmentHandle);
1236 return ret;
1239 /*************************************************************************
1240 * SQLAllocHandle [ODBC32.024]
1242 SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
1244 SQLRETURN ret;
1246 TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
1248 ret = sql_funcs.pSQLAllocHandle(HandleType, InputHandle, OutputHandle);
1249 TRACE("Returning %d, Handle %p\n", ret, *OutputHandle);
1250 return ret;
1253 /*************************************************************************
1254 * SQLAllocStmt [ODBC32.003]
1256 SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
1258 SQLRETURN ret;
1260 TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
1262 ret = sql_funcs.pSQLAllocStmt(ConnectionHandle, StatementHandle);
1263 TRACE ("Returning %d, StatementHandle %p\n", ret, *StatementHandle);
1264 return ret;
1267 /*************************************************************************
1268 * SQLAllocHandleStd [ODBC32.077]
1270 SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
1272 SQLRETURN ret;
1274 TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle);
1276 ret = sql_funcs.pSQLAllocHandleStd(HandleType, InputHandle, OutputHandle);
1277 TRACE ("Returning %d, OutputHandle %p\n", ret, *OutputHandle);
1278 return ret;
1281 static const char *debugstr_sqllen( SQLLEN len )
1283 #ifdef _WIN64
1284 return wine_dbg_sprintf( "%ld", len );
1285 #else
1286 return wine_dbg_sprintf( "%d", len );
1287 #endif
1290 /*************************************************************************
1291 * SQLBindCol [ODBC32.004]
1293 SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
1294 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
1296 SQLRETURN ret;
1298 TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
1299 StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
1301 ret = sql_funcs.pSQLBindCol(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind);
1302 TRACE ("Returning %d\n", ret);
1303 return ret;
1306 static const char *debugstr_sqlulen( SQLULEN len )
1308 #ifdef _WIN64
1309 return wine_dbg_sprintf( "%lu", len );
1310 #else
1311 return wine_dbg_sprintf( "%u", len );
1312 #endif
1315 /*************************************************************************
1316 * SQLBindParam [ODBC32.025]
1318 SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
1319 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
1320 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
1322 SQLRETURN ret;
1324 TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
1325 " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
1326 ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
1328 ret = sql_funcs.pSQLBindParam(StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision, ParameterScale,
1329 ParameterValue, StrLen_or_Ind);
1330 TRACE ("Returning %d\n", ret);
1331 return ret;
1334 /*************************************************************************
1335 * SQLCancel [ODBC32.005]
1337 SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle)
1339 SQLRETURN ret;
1341 TRACE("(StatementHandle %p)\n", StatementHandle);
1343 ret = sql_funcs.pSQLCancel(StatementHandle);
1344 TRACE("Returning %d\n", ret);
1345 return ret;
1348 /*************************************************************************
1349 * SQLCloseCursor [ODBC32.026]
1351 SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle)
1353 SQLRETURN ret;
1355 TRACE("(StatementHandle %p)\n", StatementHandle);
1357 ret = sql_funcs.pSQLCloseCursor(StatementHandle);
1358 TRACE("Returning %d\n", ret);
1359 return ret;
1362 /*************************************************************************
1363 * SQLColAttribute [ODBC32.027]
1365 SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
1366 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
1367 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
1368 SQLLEN *NumericAttribute)
1370 SQLRETURN ret;
1372 TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d,"
1373 " StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier,
1374 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
1376 ret = sql_funcs.pSQLColAttribute(StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength,
1377 StringLength, NumericAttribute);
1378 TRACE("Returning %d\n", ret);
1379 return ret;
1382 /*************************************************************************
1383 * SQLColumns [ODBC32.040]
1385 SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
1386 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
1387 SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4)
1389 SQLRETURN ret;
1391 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
1392 " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
1393 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
1394 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
1395 debugstr_an((const char *)TableName, NameLength3), NameLength3,
1396 debugstr_an((const char *)ColumnName, NameLength4), NameLength4);
1398 ret = sql_funcs.pSQLColumns(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName,
1399 NameLength3, ColumnName, NameLength4);
1400 TRACE("Returning %d\n", ret);
1401 return ret;
1404 /*************************************************************************
1405 * SQLConnect [ODBC32.007]
1407 SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1,
1408 SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication,
1409 SQLSMALLINT NameLength3)
1411 SQLRETURN ret;
1413 TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
1414 " NameLength3 %d)\n", ConnectionHandle,
1415 debugstr_an((const char *)ServerName, NameLength1), NameLength1,
1416 debugstr_an((const char *)UserName, NameLength2), NameLength2,
1417 debugstr_an((const char *)Authentication, NameLength3), NameLength3);
1419 ret = sql_funcs.pSQLConnect(ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3);
1420 TRACE("Returning %d\n", ret);
1421 return ret;
1424 /*************************************************************************
1425 * SQLCopyDesc [ODBC32.028]
1427 SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)
1429 SQLRETURN ret;
1431 TRACE("(SourceDescHandle %p, TargetDescHandle %p)\n", SourceDescHandle, TargetDescHandle);
1433 ret = sql_funcs.pSQLCopyDesc(SourceDescHandle, TargetDescHandle);
1434 TRACE("Returning %d\n", ret);
1435 return ret;
1438 /*************************************************************************
1439 * SQLDataSources [ODBC32.057]
1441 SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
1442 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
1443 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
1445 SQLRETURN ret;
1447 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
1448 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
1449 NameLength1, Description, BufferLength2, NameLength2);
1451 ret = sql_funcs.pSQLDataSources(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description,
1452 BufferLength2, NameLength2);
1453 if (ret >= 0 && TRACE_ON(odbc))
1455 if (ServerName && NameLength1 && *NameLength1 > 0)
1456 TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
1457 if (Description && NameLength2 && *NameLength2 > 0)
1458 TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
1459 TRACE("\n");
1462 TRACE("Returning %d\n", ret);
1463 return ret;
1466 SQLRETURN WINAPI SQLDataSourcesA(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName,
1467 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description,
1468 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
1470 SQLRETURN ret;
1472 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
1473 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
1474 NameLength1, Description, BufferLength2, NameLength2);
1476 ret = sql_funcs.pSQLDataSourcesA(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description,
1477 BufferLength2, NameLength2);
1478 if (TRACE_ON(odbc))
1480 if (ServerName && NameLength1 && *NameLength1 > 0)
1481 TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1));
1482 if (Description && NameLength2 && *NameLength2 > 0)
1483 TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2));
1484 TRACE("\n");
1487 TRACE("Returning %d\n", ret);
1488 return ret;
1491 /*************************************************************************
1492 * SQLDescribeCol [ODBC32.008]
1494 SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
1495 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
1496 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
1498 SQLSMALLINT dummy;
1499 SQLRETURN ret;
1501 TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
1502 " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
1503 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
1505 if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
1507 ret = sql_funcs.pSQLDescribeCol(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize,
1508 DecimalDigits, Nullable);
1509 if (ret >= 0)
1511 if (ColumnName && NameLength) TRACE(" ColumnName %s\n", debugstr_an((const char *)ColumnName, *NameLength));
1512 if (DataType) TRACE(" DataType %d\n", *DataType);
1513 if (ColumnSize) TRACE(" ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
1514 if (DecimalDigits) TRACE(" DecimalDigits %d\n", *DecimalDigits);
1515 if (Nullable) TRACE(" Nullable %d\n", *Nullable);
1518 TRACE("Returning %d\n", ret);
1519 return ret;
1522 /*************************************************************************
1523 * SQLDisconnect [ODBC32.009]
1525 SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle)
1527 SQLRETURN ret;
1529 TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
1531 ret = sql_funcs.pSQLDisconnect(ConnectionHandle);
1532 TRACE("Returning %d\n", ret);
1533 return ret;
1536 /*************************************************************************
1537 * SQLEndTran [ODBC32.029]
1539 SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)
1541 SQLRETURN ret;
1543 TRACE("(HandleType %d, Handle %p, CompletionType %d)\n", HandleType, Handle, CompletionType);
1545 ret = sql_funcs.pSQLEndTran(HandleType, Handle, CompletionType);
1546 TRACE("Returning %d\n", ret);
1547 return ret;
1550 /*************************************************************************
1551 * SQLError [ODBC32.010]
1553 SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
1554 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
1555 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
1557 SQLRETURN ret;
1559 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
1560 " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
1561 StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
1563 ret = sql_funcs.pSQLError(EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate, NativeError, MessageText,
1564 BufferLength, TextLength);
1566 if (ret == SQL_SUCCESS)
1568 TRACE(" SQLState %s\n", debugstr_an((const char *)Sqlstate, 5));
1569 TRACE(" Error %d\n", *NativeError);
1570 TRACE(" MessageText %s\n", debugstr_an((const char *)MessageText, *TextLength));
1573 TRACE("Returning %d\n", ret);
1574 return ret;
1577 /*************************************************************************
1578 * SQLExecDirect [ODBC32.011]
1580 SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1582 SQLRETURN ret;
1584 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1585 debugstr_an((const char *)StatementText, TextLength), TextLength);
1587 ret = sql_funcs.pSQLExecDirect(StatementHandle, StatementText, TextLength);
1588 TRACE("Returning %d\n", ret);
1589 return ret;
1592 /*************************************************************************
1593 * SQLExecute [ODBC32.012]
1595 SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle)
1597 SQLRETURN ret;
1599 TRACE("(StatementHandle %p)\n", StatementHandle);
1601 ret = sql_funcs.pSQLExecute(StatementHandle);
1602 TRACE("Returning %d\n", ret);
1603 return ret;
1606 /*************************************************************************
1607 * SQLFetch [ODBC32.013]
1609 SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle)
1611 SQLRETURN ret;
1613 TRACE("(StatementHandle %p)\n", StatementHandle);
1615 ret = sql_funcs.pSQLFetch(StatementHandle);
1616 TRACE("Returning %d\n", ret);
1617 return ret;
1620 /*************************************************************************
1621 * SQLFetchScroll [ODBC32.030]
1623 SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset)
1625 SQLRETURN ret;
1627 TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s)\n", StatementHandle, FetchOrientation,
1628 debugstr_sqllen(FetchOffset));
1630 ret = sql_funcs.pSQLFetchScroll(StatementHandle, FetchOrientation, FetchOffset);
1631 TRACE("Returning %d\n", ret);
1632 return ret;
1635 /*************************************************************************
1636 * SQLFreeConnect [ODBC32.014]
1638 SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle)
1640 SQLRETURN ret;
1642 TRACE("(ConnectionHandle %p)\n", ConnectionHandle);
1644 ret = sql_funcs.pSQLFreeConnect(ConnectionHandle);
1645 TRACE("Returning %d\n", ret);
1646 return ret;
1649 /*************************************************************************
1650 * SQLFreeEnv [ODBC32.015]
1652 SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle)
1654 SQLRETURN ret;
1656 TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
1658 ret = sql_funcs.pSQLFreeEnv(EnvironmentHandle);
1659 TRACE("Returning %d\n", ret);
1660 return ret;
1663 /*************************************************************************
1664 * SQLFreeHandle [ODBC32.031]
1666 SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
1668 SQLRETURN ret;
1670 TRACE("(HandleType %d, Handle %p)\n", HandleType, Handle);
1672 ret = sql_funcs.pSQLFreeHandle(HandleType, Handle);
1673 TRACE ("Returning %d\n", ret);
1674 return ret;
1677 /*************************************************************************
1678 * SQLFreeStmt [ODBC32.016]
1680 SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)
1682 SQLRETURN ret;
1684 TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option);
1686 ret = sql_funcs.pSQLFreeStmt(StatementHandle, Option);
1687 TRACE("Returning %d\n", ret);
1688 return ret;
1691 /*************************************************************************
1692 * SQLGetConnectAttr [ODBC32.032]
1694 SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1695 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1697 SQLRETURN ret;
1699 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
1700 Attribute, Value, BufferLength, StringLength);
1702 ret = sql_funcs.pSQLGetConnectAttr(ConnectionHandle, Attribute, Value, BufferLength, StringLength);
1703 TRACE("Returning %d\n", ret);
1704 return ret;
1707 /*************************************************************************
1708 * SQLGetConnectOption [ODBC32.042]
1710 SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1712 SQLRETURN ret;
1714 TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
1716 ret = sql_funcs.pSQLGetConnectOption(ConnectionHandle, Option, Value);
1717 TRACE("Returning %d\n", ret);
1718 return ret;
1721 /*************************************************************************
1722 * SQLGetCursorName [ODBC32.017]
1724 SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength,
1725 SQLSMALLINT *NameLength)
1727 SQLRETURN ret;
1729 TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
1730 BufferLength, NameLength);
1732 ret = sql_funcs.pSQLGetCursorName(StatementHandle, CursorName, BufferLength, NameLength);
1733 TRACE("Returning %d\n", ret);
1734 return ret;
1737 /*************************************************************************
1738 * SQLGetData [ODBC32.043]
1740 SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
1741 SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind)
1743 SQLRETURN ret;
1745 TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n",
1746 StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind);
1748 ret = sql_funcs.pSQLGetData(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind);
1749 TRACE("Returning %d\n", ret);
1750 return ret;
1753 /*************************************************************************
1754 * SQLGetDescField [ODBC32.033]
1756 SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
1757 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1759 SQLRETURN ret;
1761 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
1762 DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
1764 ret = sql_funcs.pSQLGetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
1765 TRACE("Returning %d\n", ret);
1766 return ret;
1769 /*************************************************************************
1770 * SQLGetDescRec [ODBC32.034]
1772 SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLCHAR *Name,
1773 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
1774 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
1775 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
1777 SQLRETURN ret;
1779 TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
1780 " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
1781 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
1783 ret = sql_funcs.pSQLGetDescRec(DescriptorHandle, RecNumber, Name, BufferLength, StringLength, Type, SubType, Length,
1784 Precision, Scale, Nullable);
1785 TRACE("Returning %d\n", ret);
1786 return ret;
1789 /*************************************************************************
1790 * SQLGetDiagField [ODBC32.035]
1792 SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
1793 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
1794 SQLSMALLINT *StringLength)
1796 SQLRETURN ret;
1798 TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
1799 " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
1801 ret = sql_funcs.pSQLGetDiagField(HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
1802 TRACE("Returning %d\n", ret);
1803 return ret;
1806 /*************************************************************************
1807 * SQLGetDiagRec [ODBC32.036]
1809 SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
1810 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
1811 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
1813 SQLRETURN ret;
1815 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
1816 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
1817 TextLength);
1819 ret = sql_funcs.pSQLGetDiagRec(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
1820 TRACE("Returning %d\n", ret);
1821 return ret;
1824 /*************************************************************************
1825 * SQLGetEnvAttr [ODBC32.037]
1827 SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1828 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1830 SQLRETURN ret;
1832 TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n",
1833 EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
1835 ret = sql_funcs.pSQLGetEnvAttr(EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
1836 TRACE("Returning %d\n", ret);
1837 return ret;
1840 /*************************************************************************
1841 * SQLGetFunctions [ODBC32.044]
1843 SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
1845 SQLRETURN ret;
1847 TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported);
1849 ret = sql_funcs.pSQLGetFunctions(ConnectionHandle, FunctionId, Supported);
1850 TRACE("Returning %d\n", ret);
1851 return ret;
1854 /*************************************************************************
1855 * SQLGetInfo [ODBC32.045]
1857 SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
1858 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
1860 SQLRETURN ret;
1862 TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
1863 InfoType, InfoValue, BufferLength, StringLength);
1865 if (!InfoValue)
1867 WARN("Unexpected NULL InfoValue address\n");
1868 return SQL_ERROR;
1871 ret = sql_funcs.pSQLGetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
1872 TRACE("Returning %d\n", ret);
1873 return ret;
1876 /*************************************************************************
1877 * SQLGetStmtAttr [ODBC32.038]
1879 SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
1880 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
1882 SQLRETURN ret;
1884 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
1885 Attribute, Value, BufferLength, StringLength);
1887 if (!Value)
1889 WARN("Unexpected NULL Value return address\n");
1890 return SQL_ERROR;
1893 ret = sql_funcs.pSQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength);
1894 TRACE("Returning %d\n", ret);
1895 return ret;
1898 /*************************************************************************
1899 * SQLGetStmtOption [ODBC32.046]
1901 SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value)
1903 SQLRETURN ret;
1905 TRACE("(StatementHandle %p, Option %d, Value %p)\n", StatementHandle, Option, Value);
1907 ret = sql_funcs.pSQLGetStmtOption(StatementHandle, Option, Value);
1908 TRACE("Returning %d\n", ret);
1909 return ret;
1912 /*************************************************************************
1913 * SQLGetTypeInfo [ODBC32.047]
1915 SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
1917 SQLRETURN ret;
1919 TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
1921 ret = sql_funcs.pSQLGetTypeInfo(StatementHandle, DataType);
1922 TRACE("Returning %d\n", ret);
1923 return ret;
1926 /*************************************************************************
1927 * SQLNumResultCols [ODBC32.018]
1929 SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
1931 SQLRETURN ret;
1933 TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount);
1935 ret = sql_funcs.pSQLNumResultCols(StatementHandle, ColumnCount);
1936 TRACE("Returning %d ColumnCount %d\n", ret, *ColumnCount);
1937 return ret;
1940 /*************************************************************************
1941 * SQLParamData [ODBC32.048]
1943 SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value)
1945 SQLRETURN ret;
1947 TRACE("(StatementHandle %p, Value %p)\n", StatementHandle, Value);
1949 ret = sql_funcs.pSQLParamData(StatementHandle, Value);
1950 TRACE("Returning %d\n", ret);
1951 return ret;
1954 /*************************************************************************
1955 * SQLPrepare [ODBC32.019]
1957 SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
1959 SQLRETURN ret;
1961 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
1962 debugstr_an((const char *)StatementText, TextLength), TextLength);
1964 ret = sql_funcs.pSQLPrepare(StatementHandle, StatementText, TextLength);
1965 TRACE("Returning %d\n", ret);
1966 return ret;
1969 /*************************************************************************
1970 * SQLPutData [ODBC32.049]
1972 SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind)
1974 SQLRETURN ret;
1976 TRACE("(StatementHandle %p, Data %p, StrLen_or_Ind %s)\n", StatementHandle, Data, debugstr_sqllen(StrLen_or_Ind));
1978 ret = sql_funcs.pSQLPutData(StatementHandle, Data, StrLen_or_Ind);
1979 TRACE("Returning %d\n", ret);
1980 return ret;
1983 /*************************************************************************
1984 * SQLRowCount [ODBC32.020]
1986 SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount)
1988 SQLRETURN ret;
1990 TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount);
1992 ret = sql_funcs.pSQLRowCount(StatementHandle, RowCount);
1993 if (ret == SQL_SUCCESS && RowCount) TRACE(" RowCount %s\n", debugstr_sqllen(*RowCount));
1994 TRACE("Returning %d\n", ret);
1995 return ret;
1998 /*************************************************************************
1999 * SQLSetConnectAttr [ODBC32.039]
2001 SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2002 SQLINTEGER StringLength)
2004 SQLRETURN ret;
2006 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
2007 StringLength);
2009 ret = sql_funcs.pSQLSetConnectAttr(ConnectionHandle, Attribute, Value, StringLength);
2010 TRACE("Returning %d\n", ret);
2011 return ret;
2014 /*************************************************************************
2015 * SQLSetConnectOption [ODBC32.050]
2017 SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value)
2019 SQLRETURN ret;
2021 TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqlulen(Value));
2023 ret = sql_funcs.pSQLSetConnectOption(ConnectionHandle, Option, Value);
2024 TRACE("Returning %d\n", ret);
2025 return ret;
2028 /*************************************************************************
2029 * SQLSetCursorName [ODBC32.021]
2031 SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
2033 SQLRETURN ret;
2035 TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
2036 debugstr_an((const char *)CursorName, NameLength), NameLength);
2038 ret = sql_funcs.pSQLSetCursorName(StatementHandle, CursorName, NameLength);
2039 TRACE("Returning %d\n", ret);
2040 return ret;
2043 /*************************************************************************
2044 * SQLSetDescField [ODBC32.073]
2046 SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2047 SQLPOINTER Value, SQLINTEGER BufferLength)
2049 SQLRETURN ret;
2051 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
2052 RecNumber, FieldIdentifier, Value, BufferLength);
2054 ret = sql_funcs.pSQLSetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
2055 TRACE("Returning %d\n", ret);
2056 return ret;
2059 /*************************************************************************
2060 * SQLSetDescRec [ODBC32.074]
2062 SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type,
2063 SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale,
2064 SQLPOINTER Data, SQLLEN *StringLength, SQLLEN *Indicator)
2066 SQLRETURN ret;
2068 TRACE("(DescriptorHandle %p, RecNumber %d, Type %d, SubType %d, Length %s, Precision %d, Scale %d, Data %p,"
2069 " StringLength %p, Indicator %p)\n", DescriptorHandle, RecNumber, Type, SubType, debugstr_sqllen(Length),
2070 Precision, Scale, Data, StringLength, Indicator);
2072 ret = sql_funcs.pSQLSetDescRec(DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data,
2073 StringLength, Indicator);
2074 TRACE("Returning %d\n", ret);
2075 return ret;
2078 /*************************************************************************
2079 * SQLSetEnvAttr [ODBC32.075]
2081 SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2082 SQLINTEGER StringLength)
2084 SQLRETURN ret;
2086 TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value,
2087 StringLength);
2089 ret = sql_funcs.pSQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength);
2090 TRACE("Returning %d\n", ret);
2091 return ret;
2094 /*************************************************************************
2095 * SQLSetParam [ODBC32.022]
2097 SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
2098 SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale,
2099 SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind)
2101 SQLRETURN ret;
2103 TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s,"
2104 " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType,
2105 ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind);
2107 ret = sql_funcs.pSQLSetParam(StatementHandle, ParameterNumber, ValueType, ParameterType, LengthPrecision,
2108 ParameterScale, ParameterValue, StrLen_or_Ind);
2109 TRACE("Returning %d\n", ret);
2110 return ret;
2113 /*************************************************************************
2114 * SQLSetStmtAttr [ODBC32.076]
2116 SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2117 SQLINTEGER StringLength)
2119 SQLRETURN ret;
2121 TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
2122 StringLength);
2124 ret = sql_funcs.pSQLSetStmtAttr(StatementHandle, Attribute, Value, StringLength);
2125 TRACE("Returning %d\n", ret);
2126 return ret;
2129 /*************************************************************************
2130 * SQLSetStmtOption [ODBC32.051]
2132 SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value)
2134 SQLRETURN ret;
2136 TRACE("(StatementHandle %p, Option %d, Value %s)\n", StatementHandle, Option, debugstr_sqlulen(Value));
2138 ret = sql_funcs.pSQLSetStmtOption(StatementHandle, Option, Value);
2139 TRACE("Returning %d\n", ret);
2140 return ret;
2143 /*************************************************************************
2144 * SQLSpecialColumns [ODBC32.052]
2146 SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
2147 SQLSMALLINT NameLength1, SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
2148 SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
2149 SQLUSMALLINT Nullable)
2151 SQLRETURN ret;
2153 TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
2154 " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
2155 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
2156 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
2157 debugstr_an((const char *)TableName, NameLength3), NameLength3, Scope, Nullable);
2159 ret = sql_funcs.pSQLSpecialColumns(StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
2160 NameLength2, TableName, NameLength3, Scope, Nullable);
2161 TRACE("Returning %d\n", ret);
2162 return ret;
2165 /*************************************************************************
2166 * SQLStatistics [ODBC32.053]
2168 SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
2169 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
2170 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
2172 SQLRETURN ret;
2174 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
2175 " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
2176 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
2177 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
2178 debugstr_an((const char *)TableName, NameLength3), NameLength3, Unique, Reserved);
2180 ret = sql_funcs.pSQLStatistics(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName,
2181 NameLength3, Unique, Reserved);
2182 TRACE("Returning %d\n", ret);
2183 return ret;
2186 /*************************************************************************
2187 * SQLTables [ODBC32.054]
2189 SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
2190 SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName,
2191 SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4)
2193 SQLRETURN ret;
2195 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2196 " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
2197 debugstr_an((const char *)CatalogName, NameLength1), NameLength1,
2198 debugstr_an((const char *)SchemaName, NameLength2), NameLength2,
2199 debugstr_an((const char *)TableName, NameLength3), NameLength3,
2200 debugstr_an((const char *)TableType, NameLength4), NameLength4);
2202 ret = sql_funcs.pSQLTables(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
2203 TableType, NameLength4);
2204 TRACE("Returning %d\n", ret);
2205 return ret;
2208 /*************************************************************************
2209 * SQLTransact [ODBC32.023]
2211 SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType)
2213 SQLRETURN ret;
2215 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle,
2216 CompletionType);
2218 ret = sql_funcs.pSQLTransact(EnvironmentHandle, ConnectionHandle, CompletionType);
2219 TRACE("Returning %d\n", ret);
2220 return ret;
2223 /*************************************************************************
2224 * SQLBrowseConnect [ODBC32.055]
2226 SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
2227 SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
2228 SQLSMALLINT *pcbConnStrOut)
2230 SQLRETURN ret;
2232 TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
2233 hdbc, debugstr_an((const char *)szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax,
2234 pcbConnStrOut);
2236 ret = sql_funcs.pSQLBrowseConnect(hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
2237 TRACE("Returning %d\n", ret);
2238 return ret;
2241 /*************************************************************************
2242 * SQLBulkOperations [ODBC32.078]
2244 SQLRETURN WINAPI SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation)
2246 SQLRETURN ret;
2248 TRACE("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation);
2250 ret = sql_funcs.pSQLBulkOperations(StatementHandle, Operation);
2251 TRACE("Returning %d\n", ret);
2252 return ret;
2255 /*************************************************************************
2256 * SQLColAttributes [ODBC32.006]
2258 SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
2259 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
2260 SQLLEN *pfDesc)
2262 SQLRETURN ret;
2264 TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
2265 fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2267 ret = sql_funcs.pSQLColAttributes(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2268 TRACE("Returning %d\n", ret);
2269 return ret;
2272 /*************************************************************************
2273 * SQLColumnPrivileges [ODBC32.056]
2275 SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2276 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
2277 SQLSMALLINT cbTableName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
2279 SQLRETURN ret;
2281 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2282 " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2283 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2284 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2285 debugstr_an((const char *)szTableName, cbTableName), cbTableName,
2286 debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
2288 ret = sql_funcs.pSQLColumnPrivileges(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName,
2289 szTableName, cbTableName, szColumnName, cbColumnName);
2290 TRACE("Returning %d\n", ret);
2291 return ret;
2294 /*************************************************************************
2295 * SQLDescribeParam [ODBC32.058]
2297 SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType,
2298 SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable)
2300 SQLRETURN ret;
2302 TRACE("(hstmt %p, ipar %d, pfSqlType %p, pcbParamDef %p, pibScale %p, pfNullable %p)\n", hstmt, ipar,
2303 pfSqlType, pcbParamDef, pibScale, pfNullable);
2305 ret = sql_funcs.pSQLDescribeParam(hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable);
2306 TRACE("Returning %d\n", ret);
2307 return ret;
2310 /*************************************************************************
2311 * SQLExtendedFetch [ODBC32.059]
2313 SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow,
2314 SQLUSMALLINT *rgfRowStatus)
2316 SQLRETURN ret;
2318 TRACE("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow),
2319 pcrow, rgfRowStatus);
2321 ret = sql_funcs.pSQLExtendedFetch(hstmt, fFetchType, irow, pcrow, rgfRowStatus);
2322 TRACE("Returning %d\n", ret);
2323 return ret;
2326 /*************************************************************************
2327 * SQLForeignKeys [ODBC32.060]
2329 SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
2330 SQLCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLCHAR *szPkTableName,
2331 SQLSMALLINT cbPkTableName, SQLCHAR *szFkCatalogName,
2332 SQLSMALLINT cbFkCatalogName, SQLCHAR *szFkSchemaName,
2333 SQLSMALLINT cbFkSchemaName, SQLCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
2335 SQLRETURN ret;
2337 TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
2338 " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
2339 " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
2340 debugstr_an((const char *)szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
2341 debugstr_an((const char *)szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
2342 debugstr_an((const char *)szPkTableName, cbPkTableName), cbPkTableName,
2343 debugstr_an((const char *)szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
2344 debugstr_an((const char *)szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
2345 debugstr_an((const char *)szFkTableName, cbFkTableName), cbFkTableName);
2347 ret = sql_funcs.pSQLForeignKeys(hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName, szPkTableName,
2348 cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName, cbFkSchemaName,
2349 szFkTableName, cbFkTableName);
2350 TRACE("Returning %d\n", ret);
2351 return ret;
2354 /*************************************************************************
2355 * SQLMoreResults [ODBC32.061]
2357 SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle)
2359 SQLRETURN ret;
2361 TRACE("(%p)\n", StatementHandle);
2363 ret = sql_funcs.pSQLMoreResults(StatementHandle);
2364 TRACE("Returning %d\n", ret);
2365 return ret;
2368 /*************************************************************************
2369 * SQLNativeSql [ODBC32.062]
2371 SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr,
2372 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
2374 SQLRETURN ret;
2376 TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
2377 debugstr_an((const char *)szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2379 ret = sql_funcs.pSQLNativeSql(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
2380 TRACE("Returning %d\n", ret);
2381 return ret;
2384 /*************************************************************************
2385 * SQLNumParams [ODBC32.063]
2387 SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar)
2389 SQLRETURN ret;
2391 TRACE("(hstmt %p, pcpar %p)\n", hstmt, pcpar);
2393 ret = sql_funcs.pSQLNumParams(hstmt, pcpar);
2394 TRACE("Returning %d\n", ret);
2395 return ret;
2398 /*************************************************************************
2399 * SQLParamOptions [ODBC32.064]
2401 SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow)
2403 SQLRETURN ret;
2405 TRACE("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow);
2407 ret = sql_funcs.pSQLParamOptions(hstmt, crow, pirow);
2408 TRACE("Returning %d\n", ret);
2409 return ret;
2412 /*************************************************************************
2413 * SQLPrimaryKeys [ODBC32.065]
2415 SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2416 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
2417 SQLSMALLINT cbTableName)
2419 SQLRETURN ret;
2421 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2422 " cbTableName %d)\n", hstmt,
2423 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2424 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2425 debugstr_an((const char *)szTableName, cbTableName), cbTableName);
2427 ret = sql_funcs.pSQLPrimaryKeys(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName);
2428 TRACE("Returning %d\n", ret);
2429 return ret;
2432 /*************************************************************************
2433 * SQLProcedureColumns [ODBC32.066]
2435 SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2436 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
2437 SQLSMALLINT cbProcName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName)
2439 SQLRETURN ret;
2441 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2442 " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
2443 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2444 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2445 debugstr_an((const char *)szProcName, cbProcName), cbProcName,
2446 debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName);
2448 ret = sql_funcs.pSQLProcedureColumns(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName,
2449 cbProcName, szColumnName, cbColumnName);
2450 TRACE("Returning %d\n", ret);
2451 return ret;
2454 /*************************************************************************
2455 * SQLProcedures [ODBC32.067]
2457 SQLRETURN WINAPI SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2458 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName,
2459 SQLSMALLINT cbProcName)
2461 SQLRETURN ret;
2463 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
2464 " cbProcName %d)\n", hstmt,
2465 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2466 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2467 debugstr_an((const char *)szProcName, cbProcName), cbProcName);
2469 ret = sql_funcs.pSQLProcedures(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName);
2470 TRACE("Returning %d\n", ret);
2471 return ret;
2474 /*************************************************************************
2475 * SQLSetPos [ODBC32.068]
2477 SQLRETURN WINAPI SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock)
2479 SQLRETURN ret;
2481 TRACE("(hstmt %p, irow %s, fOption %d, fLock %d)\n", hstmt, debugstr_sqlulen(irow), fOption, fLock);
2483 ret = sql_funcs.pSQLSetPos(hstmt, irow, fOption, fLock);
2484 TRACE("Returning %d\n", ret);
2485 return ret;
2488 /*************************************************************************
2489 * SQLTablePrivileges [ODBC32.070]
2491 SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
2492 SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName,
2493 SQLSMALLINT cbTableName)
2495 SQLRETURN ret;
2497 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
2498 " cbTableName %d)\n", hstmt,
2499 debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName,
2500 debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName,
2501 debugstr_an((const char *)szTableName, cbTableName), cbTableName);
2503 ret = sql_funcs.pSQLTablePrivileges(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName,
2504 cbTableName);
2505 TRACE("Returning %d\n", ret);
2506 return ret;
2509 /*************************************************************************
2510 * SQLDrivers [ODBC32.071]
2512 SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLCHAR *szDriverDesc,
2513 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
2514 SQLCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
2515 SQLSMALLINT *pcbDriverAttr)
2517 SQLRETURN ret;
2519 TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
2520 " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
2521 szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2523 ret = sql_funcs.pSQLDrivers(EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
2524 szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
2526 if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
2527 ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
2529 TRACE("Returning %d\n", ret);
2530 return ret;
2533 /*************************************************************************
2534 * SQLBindParameter [ODBC32.072]
2536 SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType,
2537 SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef,
2538 SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax,
2539 SQLLEN *pcbValue)
2541 SQLRETURN ret;
2543 TRACE("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p,"
2544 " cbValueMax %s, pcbValue %p)\n", hstmt, ipar, fParamType, fCType, fSqlType, debugstr_sqlulen(cbColDef),
2545 ibScale, rgbValue, debugstr_sqllen(cbValueMax), pcbValue);
2547 ret = sql_funcs.pSQLBindParameter(hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, cbValueMax,
2548 pcbValue);
2549 TRACE("Returning %d\n", ret);
2550 return ret;
2553 /*************************************************************************
2554 * SQLDriverConnect [ODBC32.041]
2556 SQLRETURN WINAPI SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *ConnectionString, SQLSMALLINT Length,
2557 SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max,
2558 SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion)
2560 SQLRETURN ret;
2562 TRACE("(hdbc %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d,"
2563 " ptr_conn_str_out %p, driver_completion %d)\n", hdbc, hwnd,
2564 debugstr_an((const char *)ConnectionString, Length), Length, conn_str_out, conn_str_out_max,
2565 ptr_conn_str_out, driver_completion);
2567 ret = sql_funcs.pSQLDriverConnect(hdbc, hwnd, ConnectionString, Length, conn_str_out, conn_str_out_max,
2568 ptr_conn_str_out, driver_completion);
2569 TRACE("Returning %d\n", ret);
2570 return ret;
2573 /*************************************************************************
2574 * SQLSetScrollOptions [ODBC32.069]
2576 SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset,
2577 SQLUSMALLINT crow_rowset)
2579 SQLRETURN ret;
2581 TRACE("(statement_handle %p, f_concurrency %d, crow_keyset %s, crow_rowset %d)\n", statement_handle,
2582 f_concurrency, debugstr_sqllen(crow_keyset), crow_rowset);
2584 ret = sql_funcs.pSQLSetScrollOptions(statement_handle, f_concurrency, crow_keyset, crow_rowset);
2585 TRACE("Returning %d\n", ret);
2586 return ret;
2589 static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType)
2591 static const SQLUSMALLINT attrList[] =
2593 SQL_COLUMN_OWNER_NAME,
2594 SQL_COLUMN_QUALIFIER_NAME,
2595 SQL_COLUMN_LABEL,
2596 SQL_COLUMN_NAME,
2597 SQL_COLUMN_TABLE_NAME,
2598 SQL_COLUMN_TYPE_NAME,
2599 SQL_DESC_BASE_COLUMN_NAME,
2600 SQL_DESC_BASE_TABLE_NAME,
2601 SQL_DESC_CATALOG_NAME,
2602 SQL_DESC_LABEL,
2603 SQL_DESC_LITERAL_PREFIX,
2604 SQL_DESC_LITERAL_SUFFIX,
2605 SQL_DESC_LOCAL_TYPE_NAME,
2606 SQL_DESC_NAME,
2607 SQL_DESC_SCHEMA_NAME,
2608 SQL_DESC_TABLE_NAME,
2609 SQL_DESC_TYPE_NAME,
2611 unsigned int i;
2613 for (i = 0; i < ARRAY_SIZE(attrList); i++) {
2614 if (attrList[i] == fDescType) return TRUE;
2616 return FALSE;
2619 /*************************************************************************
2620 * SQLColAttributesW [ODBC32.106]
2622 SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType,
2623 SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc,
2624 SQLLEN *pfDesc)
2626 SQLRETURN ret;
2628 TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol,
2629 fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2631 ret = sql_funcs.pSQLColAttributesW(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
2633 if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(fDescType) && rgbDesc && pcbDesc &&
2634 *pcbDesc != lstrlenW(rgbDesc) * 2)
2636 TRACE("CHEAT: resetting name length for ADO\n");
2637 *pcbDesc = lstrlenW(rgbDesc) * 2;
2640 TRACE("Returning %d\n", ret);
2641 return ret;
2644 /*************************************************************************
2645 * SQLConnectW [ODBC32.107]
2647 SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMALLINT NameLength1,
2648 WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication,
2649 SQLSMALLINT NameLength3)
2651 SQLRETURN ret;
2653 TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s,"
2654 " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1,
2655 debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3);
2657 ret = sql_funcs.pSQLConnectW(ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3);
2658 TRACE("Returning %d\n", ret);
2659 return ret;
2662 /*************************************************************************
2663 * SQLDescribeColW [ODBC32.108]
2665 SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, WCHAR *ColumnName,
2666 SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType,
2667 SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
2669 SQLSMALLINT dummy;
2670 SQLRETURN ret;
2672 TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p,"
2673 " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName,
2674 BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
2676 if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */
2678 ret = sql_funcs.pSQLDescribeColW(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize,
2679 DecimalDigits, Nullable);
2680 if (ret >= 0)
2682 if (ColumnName && NameLength) TRACE("ColumnName %s\n", debugstr_wn(ColumnName, *NameLength));
2683 if (DataType) TRACE("DataType %d\n", *DataType);
2684 if (ColumnSize) TRACE("ColumnSize %s\n", debugstr_sqlulen(*ColumnSize));
2685 if (DecimalDigits) TRACE("DecimalDigits %d\n", *DecimalDigits);
2686 if (Nullable) TRACE("Nullable %d\n", *Nullable);
2689 TRACE("Returning %d\n", ret);
2690 return ret;
2693 /*************************************************************************
2694 * SQLErrorW [ODBC32.110]
2696 SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
2697 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
2698 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2700 SQLRETURN ret;
2702 TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p,"
2703 " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle,
2704 StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
2706 ret = sql_funcs.pSQLErrorW(EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate, NativeError, MessageText,
2707 BufferLength, TextLength);
2709 if (ret == SQL_SUCCESS)
2711 TRACE(" SQLState %s\n", debugstr_wn(Sqlstate, 5));
2712 TRACE(" Error %d\n", *NativeError);
2713 TRACE(" MessageText %s\n", debugstr_wn(MessageText, *TextLength));
2716 TRACE("Returning %d\n", ret);
2717 return ret;
2720 /*************************************************************************
2721 * SQLExecDirectW [ODBC32.111]
2723 SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
2725 SQLRETURN ret;
2727 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
2728 debugstr_wn(StatementText, TextLength), TextLength);
2730 ret = sql_funcs.pSQLExecDirectW(StatementHandle, StatementText, TextLength);
2731 TRACE("Returning %d\n", ret);
2732 return ret;
2735 /*************************************************************************
2736 * SQLGetCursorNameW [ODBC32.117]
2738 SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength,
2739 SQLSMALLINT *NameLength)
2741 SQLRETURN ret;
2743 TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName,
2744 BufferLength, NameLength);
2746 ret = sql_funcs.pSQLGetCursorNameW(StatementHandle, CursorName, BufferLength, NameLength);
2747 TRACE("Returning %d\n", ret);
2748 return ret;
2751 /*************************************************************************
2752 * SQLPrepareW [ODBC32.119]
2754 SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength)
2756 SQLRETURN ret;
2758 TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle,
2759 debugstr_wn(StatementText, TextLength), TextLength);
2761 ret = sql_funcs.pSQLPrepareW(StatementHandle, StatementText, TextLength);
2762 TRACE("Returning %d\n", ret);
2763 return ret;
2766 /*************************************************************************
2767 * SQLSetCursorNameW [ODBC32.121]
2769 SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength)
2771 SQLRETURN ret;
2773 TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle,
2774 debugstr_wn(CursorName, NameLength), NameLength);
2776 ret = sql_funcs.pSQLSetCursorNameW(StatementHandle, CursorName, NameLength);
2777 TRACE("Returning %d\n", ret);
2778 return ret;
2781 /*************************************************************************
2782 * SQLColAttributeW [ODBC32.127]
2784 SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
2785 SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
2786 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
2787 SQLLEN *NumericAttribute)
2789 SQLRETURN ret;
2791 TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d"
2792 " StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier,
2793 CharacterAttribute, BufferLength, StringLength, NumericAttribute);
2795 ret = sql_funcs.pSQLColAttributeW(StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength,
2796 StringLength, NumericAttribute);
2798 if (ret == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier) &&
2799 StringLength && *StringLength != lstrlenW(CharacterAttribute) * 2)
2801 TRACE("CHEAT: resetting name length for ADO\n");
2802 *StringLength = lstrlenW(CharacterAttribute) * 2;
2805 TRACE("Returning %d\n", ret);
2806 return ret;
2809 /*************************************************************************
2810 * SQLGetConnectAttrW [ODBC32.132]
2812 SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2813 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2815 SQLRETURN ret;
2817 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2818 Attribute, Value, BufferLength, StringLength);
2820 ret = sql_funcs.pSQLGetConnectAttrW(ConnectionHandle, Attribute, Value, BufferLength, StringLength);
2821 TRACE("Returning %d\n", ret);
2822 return ret;
2825 /*************************************************************************
2826 * SQLGetDescFieldW [ODBC32.133]
2828 SQLRETURN WINAPI SQLGetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
2829 SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2831 SQLRETURN ret;
2833 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n",
2834 DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
2836 ret = sql_funcs.pSQLGetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
2837 TRACE("Returning %d\n", ret);
2838 return ret;
2841 /*************************************************************************
2842 * SQLGetDescRecW [ODBC32.134]
2844 SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, WCHAR *Name,
2845 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type,
2846 SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision,
2847 SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
2849 SQLRETURN ret;
2851 TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p,"
2852 " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength,
2853 StringLength, Type, SubType, Length, Precision, Scale, Nullable);
2855 ret = sql_funcs.pSQLGetDescRecW(DescriptorHandle, RecNumber, Name, BufferLength, StringLength, Type, SubType, Length,
2856 Precision, Scale, Nullable);
2857 TRACE("Returning %d\n", ret);
2858 return ret;
2861 /*************************************************************************
2862 * SQLGetDiagFieldW [ODBC32.135]
2864 SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2865 SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
2866 SQLSMALLINT *StringLength)
2868 SQLRETURN ret;
2870 TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d,"
2871 " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
2873 ret = sql_funcs.pSQLGetDiagFieldW(HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
2874 TRACE("Returning %d\n", ret);
2875 return ret;
2878 /*************************************************************************
2879 * SQLGetDiagRecW [ODBC32.136]
2881 SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
2882 WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText,
2883 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
2885 SQLRETURN ret;
2887 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
2888 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
2889 TextLength);
2891 ret = sql_funcs.pSQLGetDiagRecW(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
2892 TRACE("Returning %d\n", ret);
2893 return ret;
2896 /*************************************************************************
2897 * SQLGetStmtAttrW [ODBC32.138]
2899 SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2900 SQLINTEGER BufferLength, SQLINTEGER *StringLength)
2902 SQLRETURN ret;
2904 TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle,
2905 Attribute, Value, BufferLength, StringLength);
2907 if (!Value)
2909 WARN("Unexpected NULL Value return address\n");
2910 return SQL_ERROR;
2913 ret = sql_funcs.pSQLGetStmtAttrW(StatementHandle, Attribute, Value, BufferLength, StringLength);
2914 TRACE("Returning %d\n", ret);
2915 return ret;
2918 /*************************************************************************
2919 * SQLSetConnectAttrW [ODBC32.139]
2921 SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value,
2922 SQLINTEGER StringLength)
2924 SQLRETURN ret;
2926 TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value,
2927 StringLength);
2929 ret = sql_funcs.pSQLSetConnectAttrW(ConnectionHandle, Attribute, Value, StringLength);
2930 TRACE("Returning %d\n", ret);
2931 return ret;
2934 /*************************************************************************
2935 * SQLColumnsW [ODBC32.140]
2937 SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSMALLINT NameLength1,
2938 WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName,
2939 SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4)
2941 SQLRETURN ret;
2943 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
2944 " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle,
2945 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
2946 debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(ColumnName, NameLength4), NameLength4);
2948 ret = sql_funcs.pSQLColumnsW(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
2949 ColumnName, NameLength4);
2950 TRACE("Returning %d\n", ret);
2951 return ret;
2954 /*************************************************************************
2955 * SQLDriverConnectW [ODBC32.141]
2957 SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, WCHAR *InConnectionString,
2958 SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength,
2959 SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion)
2961 SQLRETURN ret;
2963 TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p,"
2964 " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle,
2965 debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2,
2966 DriverCompletion);
2968 ret = sql_funcs.pSQLDriverConnectW(ConnectionHandle, WindowHandle, InConnectionString, Length, OutConnectionString,
2969 BufferLength, Length2, DriverCompletion);
2970 TRACE("Returning %d\n", ret);
2971 return ret;
2974 /*************************************************************************
2975 * SQLGetConnectOptionW [ODBC32.142]
2977 SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value)
2979 SQLRETURN ret;
2981 TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value);
2983 ret = sql_funcs.pSQLGetConnectOptionW(ConnectionHandle, Option, Value);
2984 TRACE("Returning %d\n", ret);
2985 return ret;
2988 /*************************************************************************
2989 * SQLGetInfoW [ODBC32.145]
2991 SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
2992 SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
2994 SQLRETURN ret;
2996 TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle,
2997 InfoType, InfoValue, BufferLength, StringLength);
2999 if (!InfoValue)
3001 WARN("Unexpected NULL InfoValue address\n");
3002 return SQL_ERROR;
3005 ret = sql_funcs.pSQLGetInfoW(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLength);
3006 TRACE("Returning %d\n", ret);
3007 return ret;
3010 /*************************************************************************
3011 * SQLGetTypeInfoW [ODBC32.147]
3013 SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
3015 SQLRETURN ret;
3017 TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType);
3019 ret = sql_funcs.pSQLGetTypeInfoW(StatementHandle, DataType);
3020 TRACE("Returning %d\n", ret);
3021 return ret;
3024 /*************************************************************************
3025 * SQLSetConnectOptionW [ODBC32.150]
3027 SQLRETURN WINAPI SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLLEN Value)
3029 SQLRETURN ret;
3031 TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqllen(Value));
3033 ret = sql_funcs.pSQLSetConnectOptionW(ConnectionHandle, Option, Value);
3034 TRACE("Returning %d\n", ret);
3035 return ret;
3038 /*************************************************************************
3039 * SQLSpecialColumnsW [ODBC32.152]
3041 SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType,
3042 SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, SQLWCHAR *SchemaName,
3043 SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3,
3044 SQLUSMALLINT Scope, SQLUSMALLINT Nullable)
3046 SQLRETURN ret;
3048 TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d,"
3049 " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType,
3050 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
3051 debugstr_wn(TableName, NameLength3), NameLength3, Scope, Nullable);
3053 ret = sql_funcs.pSQLSpecialColumnsW(StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName,
3054 NameLength2, TableName, NameLength3, Scope, Nullable);
3055 TRACE("Returning %d\n", ret);
3056 return ret;
3059 /*************************************************************************
3060 * SQLStatisticsW [ODBC32.153]
3062 SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
3063 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
3064 SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)
3066 SQLRETURN ret;
3068 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s"
3069 " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle,
3070 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
3071 debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved);
3073 ret = sql_funcs.pSQLStatisticsW(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName,
3074 NameLength3, Unique, Reserved);
3075 TRACE("Returning %d\n", ret);
3076 return ret;
3079 /*************************************************************************
3080 * SQLTablesW [ODBC32.154]
3082 SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1,
3083 SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName,
3084 SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4)
3086 SQLRETURN ret;
3088 TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s,"
3089 " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle,
3090 debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2,
3091 debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(TableType, NameLength4), NameLength4);
3093 ret = sql_funcs.pSQLTablesW(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
3094 TableType, NameLength4);
3095 TRACE("Returning %d\n", ret);
3096 return ret;
3099 /*************************************************************************
3100 * SQLBrowseConnectW [ODBC32.155]
3102 SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
3103 SQLWCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
3104 SQLSMALLINT *pcbConnStrOut)
3106 SQLRETURN ret;
3108 TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n",
3109 hdbc, debugstr_wn(szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
3111 ret = sql_funcs.pSQLBrowseConnectW(hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
3112 TRACE("Returning %d\n", ret);
3113 return ret;
3116 /*************************************************************************
3117 * SQLColumnPrivilegesW [ODBC32.156]
3119 SQLRETURN WINAPI SQLColumnPrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
3120 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
3121 SQLSMALLINT cbTableName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
3123 SQLRETURN ret;
3125 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
3126 " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
3127 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
3128 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
3129 debugstr_wn(szTableName, cbTableName), cbTableName,
3130 debugstr_wn(szColumnName, cbColumnName), cbColumnName);
3132 ret = sql_funcs.pSQLColumnPrivilegesW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName,
3133 cbTableName, szColumnName, cbColumnName);
3134 TRACE("Returning %d\n", ret);
3135 return ret;
3138 /*************************************************************************
3139 * SQLDataSourcesW [ODBC32.157]
3141 SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, WCHAR *ServerName,
3142 SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description,
3143 SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2)
3145 SQLRETURN ret;
3147 TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p,"
3148 " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1,
3149 NameLength1, Description, BufferLength2, NameLength2);
3151 ret = sql_funcs.pSQLDataSourcesW(EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description,
3152 BufferLength2, NameLength2);
3154 if (ret >= 0 && TRACE_ON(odbc))
3156 if (ServerName && NameLength1 && *NameLength1 > 0)
3157 TRACE(" DataSource %s", debugstr_wn(ServerName, *NameLength1));
3158 if (Description && NameLength2 && *NameLength2 > 0)
3159 TRACE(" Description %s", debugstr_wn(Description, *NameLength2));
3160 TRACE("\n");
3163 TRACE("Returning %d\n", ret);
3164 return ret;
3167 /*************************************************************************
3168 * SQLForeignKeysW [ODBC32.160]
3170 SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName,
3171 SQLWCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLWCHAR *szPkTableName,
3172 SQLSMALLINT cbPkTableName, SQLWCHAR *szFkCatalogName,
3173 SQLSMALLINT cbFkCatalogName, SQLWCHAR *szFkSchemaName,
3174 SQLSMALLINT cbFkSchemaName, SQLWCHAR *szFkTableName, SQLSMALLINT cbFkTableName)
3176 SQLRETURN ret;
3178 TRACE("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d,"
3179 " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s,"
3180 " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt,
3181 debugstr_wn(szPkCatalogName, cbPkCatalogName), cbPkCatalogName,
3182 debugstr_wn(szPkSchemaName, cbPkSchemaName), cbPkSchemaName,
3183 debugstr_wn(szPkTableName, cbPkTableName), cbPkTableName,
3184 debugstr_wn(szFkCatalogName, cbFkCatalogName), cbFkCatalogName,
3185 debugstr_wn(szFkSchemaName, cbFkSchemaName), cbFkSchemaName,
3186 debugstr_wn(szFkTableName, cbFkTableName), cbFkTableName);
3188 ret = sql_funcs.pSQLForeignKeysW(hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName, szPkTableName,
3189 cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName, cbFkSchemaName,
3190 szFkTableName, cbFkTableName);
3191 TRACE("Returning %d\n", ret);
3192 return ret;
3195 /*************************************************************************
3196 * SQLNativeSqlW [ODBC32.162]
3198 SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr,
3199 SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr)
3201 SQLRETURN ret;
3203 TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc,
3204 debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
3206 ret = sql_funcs.pSQLNativeSqlW(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
3207 TRACE("Returning %d\n", ret);
3208 return ret;
3211 /*************************************************************************
3212 * SQLPrimaryKeysW [ODBC32.165]
3214 SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
3215 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
3216 SQLSMALLINT cbTableName)
3218 SQLRETURN ret;
3220 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
3221 " cbTableName %d)\n", hstmt,
3222 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
3223 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
3224 debugstr_wn(szTableName, cbTableName), cbTableName);
3226 ret = sql_funcs.pSQLPrimaryKeysW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName);
3227 TRACE("Returning %d\n", ret);
3228 return ret;
3231 /*************************************************************************
3232 * SQLProcedureColumnsW [ODBC32.166]
3234 SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
3235 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
3236 SQLSMALLINT cbProcName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName)
3238 SQLRETURN ret;
3240 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
3241 " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt,
3242 debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
3243 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName,
3244 debugstr_wn(szProcName, cbProcName), cbProcName,
3245 debugstr_wn(szColumnName, cbColumnName), cbColumnName);
3247 ret = sql_funcs.pSQLProcedureColumnsW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName,
3248 cbProcName, szColumnName, cbColumnName);
3249 TRACE("Returning %d\n", ret);
3250 return ret;
3253 /*************************************************************************
3254 * SQLProceduresW [ODBC32.167]
3256 SQLRETURN WINAPI SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
3257 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName,
3258 SQLSMALLINT cbProcName)
3260 SQLRETURN ret;
3262 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s,"
3263 " cbProcName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
3264 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szProcName, cbProcName), cbProcName);
3266 ret = sql_funcs.pSQLProceduresW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName);
3267 TRACE("Returning %d\n", ret);
3268 return ret;
3271 /*************************************************************************
3272 * SQLTablePrivilegesW [ODBC32.170]
3274 SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName,
3275 SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName,
3276 SQLSMALLINT cbTableName)
3278 SQLRETURN ret;
3280 TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s,"
3281 " cbTableName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName,
3282 debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szTableName, cbTableName), cbTableName);
3284 ret = sql_funcs.pSQLTablePrivilegesW(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName,
3285 cbTableName);
3286 TRACE("Returning %d\n", ret);
3287 return ret;
3290 /*************************************************************************
3291 * SQLDriversW [ODBC32.171]
3293 SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLWCHAR *szDriverDesc,
3294 SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc,
3295 SQLWCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax,
3296 SQLSMALLINT *pcbDriverAttr)
3298 SQLRETURN ret;
3300 TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p,"
3301 " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection,
3302 szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
3304 ret = sql_funcs.pSQLDriversW(EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc,
3305 szDriverAttributes, cbDriverAttrMax, pcbDriverAttr);
3307 if (ret == SQL_NO_DATA && fDirection == SQL_FETCH_FIRST)
3308 ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n");
3310 TRACE("Returning %d\n", ret);
3311 return ret;
3314 /*************************************************************************
3315 * SQLSetDescFieldW [ODBC32.173]
3317 SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
3318 SQLPOINTER Value, SQLINTEGER BufferLength)
3320 SQLRETURN ret;
3322 TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle,
3323 RecNumber, FieldIdentifier, Value, BufferLength);
3325 ret = sql_funcs.pSQLSetDescFieldW(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
3326 TRACE("Returning %d\n", ret);
3327 return ret;
3330 /*************************************************************************
3331 * SQLSetStmtAttrW [ODBC32.176]
3333 SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value,
3334 SQLINTEGER StringLength)
3336 SQLRETURN ret;
3338 TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value,
3339 StringLength);
3341 ret = sql_funcs.pSQLSetStmtAttrW(StatementHandle, Attribute, Value, StringLength);
3342 if (ret == SQL_ERROR && (Attribute == SQL_ROWSET_SIZE || Attribute == SQL_ATTR_ROW_ARRAY_SIZE))
3344 TRACE("CHEAT: returning SQL_SUCCESS to ADO\n");
3345 return SQL_SUCCESS;
3348 TRACE("Returning %d\n", ret);
3349 return ret;
3352 /*************************************************************************
3353 * SQLGetDiagRecA [ODBC32.236]
3355 SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
3356 SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText,
3357 SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
3359 SQLRETURN ret;
3361 TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d,"
3362 " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength,
3363 TextLength);
3365 ret = sql_funcs.pSQLGetDiagRecA(HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
3366 TRACE("Returning %d\n", ret);
3367 return ret;
3371 /***********************************************************************
3372 * DllMain [Internal] Initializes the internal 'ODBC32.DLL'.
3374 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
3376 TRACE("proxy ODBC: %p,%x,%p\n", hinstDLL, reason, reserved);
3378 switch (reason)
3380 case DLL_PROCESS_ATTACH:
3381 DisableThreadLibraryCalls(hinstDLL);
3382 if (!__wine_init_unix_lib( hinstDLL, reason, NULL, &sql_funcs )) ODBC_ReplicateToRegistry();
3383 break;
3385 case DLL_PROCESS_DETACH:
3386 if (reserved) break;
3387 __wine_init_unix_lib( hinstDLL, reason, NULL, NULL );
3390 return TRUE;