diff --git a/patches/odbc-remove-unixodbc/0001-wineodbc-Make-an-ODBC-driver-for-unixODBC-usage.patch b/patches/odbc-remove-unixodbc/0001-wineodbc-Make-an-ODBC-driver-for-unixODBC-usage.patch deleted file mode 100644 index 1f4d4c88..00000000 --- a/patches/odbc-remove-unixodbc/0001-wineodbc-Make-an-ODBC-driver-for-unixODBC-usage.patch +++ /dev/null @@ -1,8042 +0,0 @@ -From 1263e8ef51aeee619e2220477fe40e1205cb230d Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Sun, 23 Jun 2024 16:05:20 +1000 -Subject: [PATCH] wineodbc: Make an ODBC driver for unixODBC usage - ---- - configure.ac | 3 +- - dlls/odbc32/Makefile.in | 5 +- - dlls/odbc32/proxyodbc.c | 2145 ++++-------------- - dlls/wineodbc/Makefile.in | 9 + - dlls/wineodbc/proxyodbc.c | 3110 +++++++++++++++++++++++++++ - dlls/wineodbc/rsrc.rc | 26 + - dlls/{odbc32 => wineodbc}/unixlib.c | 0 - dlls/wineodbc/unixlib.h | 1291 +++++++++++ - dlls/wineodbc/wineodbc.spec | 176 ++ - 9 files changed, 5033 insertions(+), 1732 deletions(-) - create mode 100644 dlls/wineodbc/Makefile.in - create mode 100644 dlls/wineodbc/proxyodbc.c - create mode 100644 dlls/wineodbc/rsrc.rc - rename dlls/{odbc32 => wineodbc}/unixlib.c (100%) - create mode 100644 dlls/wineodbc/unixlib.h - create mode 100644 dlls/wineodbc/wineodbc.spec - -diff --git a/configure.ac b/configure.ac -index 6f48132b22a..70b9e431417 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1435,7 +1435,7 @@ then - fi - WINE_NOTICE_WITH(odbc,[test "x$ODBC_LIBS" = x], - [libodbc not found, ODBC won't be supported.], -- [enable_odbc32]) -+ [enable_wineodbc]) - - dnl **** Check for inotify **** - if test "x$with_inotify" != "xno" -@@ -3281,6 +3281,7 @@ WINE_CONFIG_MAKEFILE(dlls/winegstreamer) - WINE_CONFIG_MAKEFILE(dlls/winehid.sys) - WINE_CONFIG_MAKEFILE(dlls/winemac.drv) - WINE_CONFIG_MAKEFILE(dlls/winemapi) -+WINE_CONFIG_MAKEFILE(dlls/wineodbc) - WINE_CONFIG_MAKEFILE(dlls/wineoss.drv) - WINE_CONFIG_MAKEFILE(dlls/wineps.drv) - WINE_CONFIG_MAKEFILE(dlls/wineps16.drv16,enable_win16) -diff --git a/dlls/odbc32/Makefile.in b/dlls/odbc32/Makefile.in -index 0ec0ae8eaf4..a42f1473d67 100644 ---- a/dlls/odbc32/Makefile.in -+++ b/dlls/odbc32/Makefile.in -@@ -1,10 +1,7 @@ - MODULE = odbc32.dll --UNIXLIB = odbc32.so - IMPORTLIB = odbc32 - IMPORTS = advapi32 --UNIX_LIBS = $(ODBC_LIBS) - - SOURCES = \ - proxyodbc.c \ -- rsrc.rc \ -- unixlib.c -+ rsrc.rc -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 47e0aff0b18..89e4545f068 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -40,46 +40,19 @@ - #include "sql.h" - #include "sqltypes.h" - #include "sqlext.h" --#include "unixlib.h" - - WINE_DEFAULT_DEBUG_CHANNEL(odbc); --WINE_DECLARE_DEBUG_CHANNEL(winediag); - --#define ODBC_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params ) -- --static BOOL is_wow64; -- --static struct handle *alloc_handle( void ) --{ -- struct handle *ret; -- if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL; -- ret->row_count = 1; -- return ret; --} - - /************************************************************************* - * SQLAllocConnect [ODBC32.001] - */ - SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle) - { -- struct SQLAllocConnect_params params; -- struct handle *con, *env = EnvironmentHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle); -- -- *ConnectionHandle = 0; -- if (!(con = alloc_handle())) return SQL_ERROR; -- -- params.EnvironmentHandle = env->unix_handle; -- if (SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms )))) -- { -- con->unix_handle = params.ConnectionHandle; -- *ConnectionHandle = con; -- } -- else free( con ); -- -- TRACE("Returning %d, ConnectionHandle %p\n", ret, *ConnectionHandle); -+ FIXME("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle); -+ *ConnectionHandle = SQL_NULL_HDBC; - return ret; - } - -@@ -88,23 +61,12 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH - */ - SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) - { -- struct SQLAllocEnv_params params; -- struct handle *env; -- SQLRETURN ret; -- -- TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle); -+ SQLRETURN ret = SQL_ERROR; - -- *EnvironmentHandle = 0; -- if (!(env = alloc_handle())) return SQL_ERROR; -+ FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle); - -- if (SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms )))) -- { -- env->unix_handle = params.EnvironmentHandle; -- *EnvironmentHandle = env; -- } -- else free( env ); -+ *EnvironmentHandle = SQL_NULL_HENV; - -- TRACE("Returning %d, EnvironmentHandle %p\n", ret, *EnvironmentHandle); - return ret; - } - -@@ -113,25 +75,11 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) - */ - SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) - { -- struct SQLAllocHandle_params params; -- struct handle *output, *input = InputHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); -+ FIXME("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); - - *OutputHandle = 0; -- if (!(output = alloc_handle())) return SQL_ERROR; -- -- params.HandleType = HandleType; -- params.InputHandle = input ? input->unix_handle : 0; -- if (SUCCESS((ret = ODBC_CALL( SQLAllocHandle, ¶ms )))) -- { -- output->unix_handle = params.OutputHandle; -- *OutputHandle = output; -- } -- else free( output ); -- -- TRACE("Returning %d, OutputHandle %p\n", ret, *OutputHandle); - return ret; - } - -@@ -140,24 +88,11 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S - */ - SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle) - { -- struct SQLAllocStmt_params params; -- struct handle *stmt, *con = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle); -+ FIXME("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle); - -- *StatementHandle = 0; -- if (!(stmt = alloc_handle())) return SQL_ERROR; -- -- params.ConnectionHandle = con->unix_handle; -- if (SUCCESS((ret = ODBC_CALL( SQLAllocStmt, ¶ms )))) -- { -- stmt->unix_handle = params.StatementHandle; -- *StatementHandle = stmt; -- } -- else free( stmt ); -- -- TRACE ("Returning %d, StatementHandle %p\n", ret, *StatementHandle); -+ *StatementHandle = SQL_NULL_HSTMT; - return ret; - } - -@@ -166,25 +101,11 @@ SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandl - */ - SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) - { -- struct SQLAllocHandleStd_params params; -- struct handle *output, *input = InputHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); -+ FIXME("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); - - *OutputHandle = 0; -- if (!(output = alloc_handle())) return SQL_ERROR; -- -- params.HandleType = HandleType; -- params.InputHandle = input ? input->unix_handle : 0; -- if (SUCCESS((ret = ODBC_CALL( SQLAllocHandleStd, ¶ms )))) -- { -- output->unix_handle = params.OutputHandle; -- *OutputHandle = output; -- } -- else free( output ); -- -- TRACE ("Returning %d, OutputHandle %p\n", ret, *OutputHandle); - return ret; - } - -@@ -197,51 +118,17 @@ static const char *debugstr_sqllen( SQLLEN len ) - #endif - } - --#define MAX_BINDING_PARAMS 1024 --static BOOL alloc_binding( struct param_binding *binding, USHORT type, UINT column, UINT row_count ) --{ -- if (column > MAX_BINDING_PARAMS) -- { -- FIXME( "increase maximum number of parameters\n" ); -- return FALSE; -- } -- if (!binding->param && !(binding->param = calloc( MAX_BINDING_PARAMS, sizeof(*binding->param)))) return FALSE; -- -- if (!(binding->param[column - 1].len = calloc( row_count, sizeof(UINT64) ))) return FALSE; -- binding->param[column - 1].type = type; -- binding->count = column; -- return TRUE; --} -- - /************************************************************************* - * SQLBindCol [ODBC32.004] - */ - SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, - SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind) - { -- struct SQLBindCol_params params = { 0, ColumnNumber, TargetType, TargetValue, BufferLength }; -- struct handle *handle = StatementHandle; -- UINT i = ColumnNumber - 1; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", -+ FIXME("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", - StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); - -- if (!handle) return SQL_INVALID_HANDLE; -- if (!ColumnNumber) -- { -- FIXME( "column 0 not handled\n" ); -- return SQL_ERROR; -- } -- if (!alloc_binding( &handle->bind_col, SQL_PARAM_INPUT_OUTPUT, ColumnNumber, handle->row_count )) return SQL_ERROR; -- handle->bind_col.param[i].col.target_type = TargetType; -- handle->bind_col.param[i].col.target_value = TargetValue; -- handle->bind_col.param[i].col.buffer_length = BufferLength; -- -- params.StatementHandle = handle->unix_handle; -- if (StrLen_or_Ind) params.StrLen_or_Ind = handle->bind_col.param[i].len; -- if (SUCCESS(( ret = ODBC_CALL( SQLBindCol, ¶ms )))) handle->bind_col.param[i].ptr = StrLen_or_Ind; -- TRACE ("Returning %d\n", ret); - return ret; - } - -@@ -261,34 +148,12 @@ SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNu - SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, - SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind) - { -- struct SQLBindParam_params params = { 0, ParameterNumber, ValueType, ParameterType, LengthPrecision, -- ParameterScale, ParameterValue }; -- struct handle *handle = StatementHandle; -- UINT i = ParameterNumber - 1; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s," -+ FIXME("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s," - " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType, - ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind); - -- if (!handle) return SQL_INVALID_HANDLE; -- if (!ParameterNumber) -- { -- FIXME( "parameter 0 not handled\n" ); -- return SQL_ERROR; -- } -- if (!alloc_binding( &handle->bind_param, SQL_PARAM_INPUT, ParameterNumber, handle->row_count )) return SQL_ERROR; -- handle->bind_param.param[i].param.value_type = ValueType; -- handle->bind_param.param[i].param.parameter_type = ParameterType; -- handle->bind_param.param[i].param.length_precision = LengthPrecision; -- handle->bind_param.param[i].param.parameter_scale = ParameterScale; -- handle->bind_param.param[i].param.parameter_value = ParameterValue; -- -- params.StatementHandle = handle->unix_handle; -- params.StrLen_or_Ind = handle->bind_param.param[i].len; -- *(UINT64 *)params.StrLen_or_Ind = *StrLen_or_Ind; -- if (SUCCESS(( ret = ODBC_CALL( SQLBindParam, ¶ms )))) handle->bind_param.param[i].ptr = StrLen_or_Ind; -- TRACE ("Returning %d\n", ret); - return ret; - } - -@@ -297,17 +162,10 @@ SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNu - */ - SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle) - { -- struct SQLCancel_params params; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p)\n", StatementHandle); -+ FIXME("(StatementHandle %p)\n", StatementHandle); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLCancel, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -316,43 +174,27 @@ SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle) - */ - SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle) - { -- struct SQLCloseCursor_params params; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p)\n", StatementHandle); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(StatementHandle %p)\n", StatementHandle); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLCloseCursor, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLColAttribute [ODBC32.027] - */ --SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, -- SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, -+SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, -+ SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute, -+ SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, - SQLLEN *NumericAttribute) - { -- struct SQLColAttribute_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, -- StringLength }; -- struct handle *handle = StatementHandle; -- INT64 num_attr = 0; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d," -+ FIXME("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d," - " StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier, - CharacterAttribute, BufferLength, StringLength, NumericAttribute); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- params.NumericAttribute = &num_attr; -- if (SUCCESS(( ret = ODBC_CALL( SQLColAttribute, ¶ms ))) && NumericAttribute) *NumericAttribute = num_attr; -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -363,23 +205,15 @@ SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLS - SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, - SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4) - { -- struct SQLColumns_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3, ColumnName, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," - " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, - debugstr_an((const char *)CatalogName, NameLength1), NameLength1, - debugstr_an((const char *)SchemaName, NameLength2), NameLength2, - debugstr_an((const char *)TableName, NameLength3), NameLength3, - debugstr_an((const char *)ColumnName, NameLength4), NameLength4); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLColumns, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -390,21 +224,14 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM - SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication, - SQLSMALLINT NameLength3) - { -- struct SQLConnect_params params = { 0, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3 }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," -+ FIXME("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," - " NameLength3 %d)\n", ConnectionHandle, - debugstr_an((const char *)ServerName, NameLength1), NameLength1, - debugstr_an((const char *)UserName, NameLength2), NameLength2, - debugstr_an((const char *)Authentication, NameLength3), NameLength3); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLConnect, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -413,18 +240,10 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM - */ - SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle) - { -- struct SQLCopyDesc_params params; -- struct handle *source = SourceDescHandle, *target = TargetDescHandle; -- SQLRETURN ret; -- -- TRACE("(SourceDescHandle %p, TargetDescHandle %p)\n", SourceDescHandle, TargetDescHandle); -+ SQLRETURN ret = SQL_ERROR; - -- if (!source || !target) return SQL_INVALID_HANDLE; -+ FIXME("(SourceDescHandle %p, TargetDescHandle %p)\n", SourceDescHandle, TargetDescHandle); - -- params.SourceDescHandle = source->unix_handle; -- params.TargetDescHandle = target->unix_handle; -- ret = ODBC_CALL( SQLCopyDesc, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -435,28 +254,12 @@ SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Directio - SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description, - SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) - { -- struct SQLDataSources_params params = { 0, Direction, ServerName, BufferLength1, NameLength1, Description, -- BufferLength2, NameLength2 }; -- struct handle *handle = EnvironmentHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_NO_DATA; - -- TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," -+ FIXME("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," - " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1, - NameLength1, Description, BufferLength2, NameLength2); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.EnvironmentHandle = handle->unix_handle; -- if (SUCCESS((ret = ODBC_CALL( SQLDataSources, ¶ms ))) && TRACE_ON(odbc)) -- { -- if (ServerName && NameLength1 && *NameLength1 > 0) -- TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1)); -- if (Description && NameLength2 && *NameLength2 > 0) -- TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2)); -- TRACE("\n"); -- } -- -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -464,8 +267,13 @@ SQLRETURN WINAPI SQLDataSourcesA(SQLHENV EnvironmentHandle, SQLUSMALLINT Directi - SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description, - SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) - { -- return SQLDataSources( EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description, -- BufferLength2, NameLength2 ); -+ SQLRETURN ret = SQL_NO_DATA; -+ -+ FIXME("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," -+ " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1, -+ NameLength1, Description, BufferLength2, NameLength2); -+ -+ return ret; - } - - /************************************************************************* -@@ -475,36 +283,12 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum - SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, - SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) - { -- struct SQLDescribeCol_params params = { 0, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, -- NULL, DecimalDigits, Nullable }; -- struct handle *handle = StatementHandle; -- UINT64 size; -- SQLSMALLINT dummy; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," -+ FIXME("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," - " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName, - BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- if (!params.NameLength) params.NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ -- params.ColumnSize = &size; -- if (SUCCESS((ret = ODBC_CALL( SQLDescribeCol, ¶ms )))) -- { -- if (ColumnName && NameLength) TRACE(" ColumnName %s\n", debugstr_an((const char *)ColumnName, *NameLength)); -- if (DataType) TRACE(" DataType %d\n", *DataType); -- if (ColumnSize) -- { -- *ColumnSize = size; -- TRACE(" ColumnSize %s\n", debugstr_sqlulen(*ColumnSize)); -- } -- if (DecimalDigits) TRACE(" DecimalDigits %d\n", *DecimalDigits); -- if (Nullable) TRACE(" Nullable %d\n", *Nullable); -- } -- -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -513,17 +297,10 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum - */ - SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle) - { -- struct SQLDisconnect_params params; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p)\n", ConnectionHandle); -+ FIXME("(ConnectionHandle %p)\n", ConnectionHandle); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLDisconnect, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -532,17 +309,10 @@ SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle) - */ - SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType) - { -- struct SQLEndTran_params params = { HandleType, 0, CompletionType }; -- struct handle *handle = Handle; -- SQLRETURN ret; -- -- TRACE("(HandleType %d, Handle %p, CompletionType %d)\n", HandleType, Handle, CompletionType); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(HandleType %d, Handle %p, CompletionType %d)\n", HandleType, Handle, CompletionType); - -- params.Handle = handle->unix_handle; -- ret = ODBC_CALL( SQLEndTran, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -550,28 +320,15 @@ SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLIN - * SQLError [ODBC32.010] - */ - SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, -- SQLCHAR *SqlState, SQLINTEGER *NativeError, SQLCHAR *MessageText, -+ SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, - SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) - { -- struct SQLError_params params = { 0, 0, 0, SqlState, NativeError, MessageText, BufferLength, TextLength }; -- struct handle *env = EnvironmentHandle, *con = ConnectionHandle, *stmt = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, SqlState %p, NativeError %p," -+ FIXME("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p," - " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle, -- StatementHandle, SqlState, NativeError, MessageText, BufferLength, TextLength); -+ StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - -- if (env) params.EnvironmentHandle = env->unix_handle; -- if (con) params.ConnectionHandle = con->unix_handle; -- if (stmt) params.StatementHandle = stmt->unix_handle; -- if (SUCCESS((ret = ODBC_CALL( SQLError, ¶ms )))) -- { -- TRACE(" SqlState %s\n", debugstr_an((const char *)SqlState, 5)); -- TRACE(" Error %d\n", *NativeError); -- TRACE(" MessageText %s\n", debugstr_an((const char *)MessageText, *TextLength)); -- } -- -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -580,98 +337,23 @@ SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, S - */ - SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) - { -- struct SQLExecDirect_params params = { 0, StatementText, TextLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, - debugstr_an((const char *)StatementText, TextLength), TextLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLExecDirect, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - --static void len_to_user( SQLLEN *ptr, UINT8 *len, UINT row_count, UINT width ) --{ -- UINT i; -- for (i = 0; i < row_count; i++) -- { -- *ptr++ = *(SQLLEN *)(len + i * width); -- } --} -- --static void len_from_user( UINT8 *len, SQLLEN *ptr, UINT row_count, UINT width ) --{ -- UINT i; -- for (i = 0; i < row_count; i++) -- { -- *(SQLLEN *)(len + i * width) = *ptr++; -- } --} -- --static void update_result_lengths( struct handle *handle, USHORT type ) --{ -- UINT i, width = sizeof(void *) == 8 ? 8 : is_wow64 ? 8 : 4; -- -- switch (type) -- { -- case SQL_PARAM_OUTPUT: -- for (i = 0; i < handle->bind_col.count; i++) -- { -- len_to_user( handle->bind_col.param[i].ptr, handle->bind_col.param[i].len, handle->row_count, width ); -- } -- for (i = 0; i < handle->bind_param.count; i++) -- { -- len_to_user( handle->bind_param.param[i].ptr, handle->bind_param.param[i].len, handle->row_count, width ); -- } -- for (i = 0; i < handle->bind_parameter.count; i++) -- { -- if (handle->bind_parameter.param[i].type != SQL_PARAM_OUTPUT && -- handle->bind_parameter.param[i].type != SQL_PARAM_INPUT_OUTPUT) continue; -- -- len_to_user( handle->bind_parameter.param[i].ptr, handle->bind_parameter.param[i].len, handle->row_count, width ); -- } -- break; -- -- case SQL_PARAM_INPUT: -- for (i = 0; i < handle->bind_col.count; i++) -- { -- len_from_user( handle->bind_col.param[i].len, handle->bind_col.param[i].ptr, handle->row_count, width ); -- } -- /* FIXME: handle bind_param */ -- for (i = 0; i < handle->bind_parameter.count; i++) -- { -- if (handle->bind_parameter.param[i].type != SQL_PARAM_INPUT && -- handle->bind_parameter.param[i].type != SQL_PARAM_INPUT_OUTPUT) continue; -- -- len_from_user( handle->bind_parameter.param[i].len, handle->bind_parameter.param[i].ptr, handle->row_count, width ); -- } -- -- default: break; -- } --} -- - /************************************************************************* - * SQLExecute [ODBC32.012] - */ - SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle) - { -- struct SQLExecute_params params; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p)\n", StatementHandle); -+ FIXME("(StatementHandle %p)\n", StatementHandle); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- update_result_lengths( handle, SQL_PARAM_INPUT ); -- if (SUCCESS(( ret = ODBC_CALL( SQLExecute, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -680,17 +362,10 @@ SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle) - */ - SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle) - { -- struct SQLFetch_params params; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p)\n", StatementHandle); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(StatementHandle %p)\n", StatementHandle); - -- params.StatementHandle = handle->unix_handle; -- if (SUCCESS(( ret = ODBC_CALL( SQLFetch, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -699,18 +374,11 @@ SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle) - */ - SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset) - { -- struct SQLFetchScroll_params params = { 0, FetchOrientation, FetchOffset }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s)\n", StatementHandle, FetchOrientation, -+ FIXME("(StatementHandle %p, FetchOrientation %d, FetchOffset %s)\n", StatementHandle, FetchOrientation, - debugstr_sqllen(FetchOffset)); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- if (SUCCESS(( ret = ODBC_CALL( SQLFetchScroll, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -719,18 +387,10 @@ SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrien - */ - SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) - { -- struct SQLFreeConnect_params params; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p)\n", ConnectionHandle); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(ConnectionHandle %p)\n", ConnectionHandle); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLFreeConnect, ¶ms ); -- free( handle ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -739,59 +399,22 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) - */ - SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) - { -- struct SQLFreeEnv_params params; -- struct handle *handle = EnvironmentHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle); -+ FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.EnvironmentHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLFreeEnv, ¶ms ); -- free( handle ); -- TRACE("Returning %d\n", ret); - return ret; - } - --static void free_bindings( struct handle *handle ) --{ -- if (handle->bind_col.param) -- { -- free( handle->bind_col.param->len ); -- free( handle->bind_col.param ); -- } -- if (handle->bind_param.param) -- { -- free( handle->bind_param.param->len ); -- free( handle->bind_param.param ); -- } -- if (handle->bind_parameter.param) -- { -- free( handle->bind_parameter.param->len ); -- free( handle->bind_parameter.param ); -- } --} -- - /************************************************************************* - * SQLFreeHandle [ODBC32.031] - */ - SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) - { -- struct SQLFreeHandle_params params; -- struct handle *handle = Handle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(HandleType %d, Handle %p)\n", HandleType, Handle); -+ FIXME("(HandleType %d, Handle %p)\n", HandleType, Handle); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.HandleType = HandleType; -- params.Handle = handle->unix_handle; -- ret = ODBC_CALL( SQLFreeHandle, ¶ms ); -- free_bindings( handle ); -- free( handle ); -- TRACE ("Returning %d\n", ret); - return ret; - } - -@@ -800,20 +423,10 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) - */ - SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) - { -- struct SQLFreeStmt_params params; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(StatementHandle %p, Option %d)\n", StatementHandle, Option); - -- params.StatementHandle = handle->unix_handle; -- params.Option = Option; -- ret = ODBC_CALL( SQLFreeStmt, ¶ms ); -- free_bindings( handle ); -- free( handle ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -823,18 +436,11 @@ SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) - SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- struct SQLGetConnectAttr_params params = { 0, Attribute, Value, BufferLength, StringLength }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ FIXME("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - Attribute, Value, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetConnectAttr, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -843,17 +449,10 @@ SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut - */ - SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value) - { -- struct SQLGetConnectOption_params params = { 0, Option, Value }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetConnectOption, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -863,18 +462,11 @@ SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Opti - SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength, - SQLSMALLINT *NameLength) - { -- struct SQLGetCursorName_params params = { 0, CursorName, BufferLength, NameLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName, -+ FIXME("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName, - BufferLength, NameLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetCursorName, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -884,20 +476,11 @@ SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, - SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, - SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind) - { -- struct SQLGetData_params params = { 0, ColumnNumber, TargetType, TargetValue, BufferLength }; -- struct handle *handle = StatementHandle; -- INT64 len; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", -+ FIXME("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", - StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- params.StrLen_or_Ind = &len; -- if (SUCCESS((ret = ODBC_CALL( SQLGetData, ¶ms )))) *StrLen_or_Ind = len; -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -907,18 +490,11 @@ SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, - SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, - SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- struct SQLGetDescField_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength, StringLength }; -- struct handle *handle = DescriptorHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n", -+ FIXME("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n", - DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.DescriptorHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetDescField, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -930,22 +506,12 @@ SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, - SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision, - SQLSMALLINT *Scale, SQLSMALLINT *Nullable) - { -- struct SQLGetDescRec_params params = { 0, RecNumber, Name, BufferLength, StringLength, Type, SubType, NULL, -- Precision, Scale, Nullable }; -- struct handle *handle = DescriptorHandle; -- INT64 len; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p," -+ FIXME("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p," - " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength, - StringLength, Type, SubType, Length, Precision, Scale, Nullable); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.DescriptorHandle = handle->unix_handle; -- params.Length = &len; -- if (SUCCESS((ret = ODBC_CALL( SQLGetDescRec, ¶ms )))) *Length = len; -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -956,19 +522,11 @@ SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSM - SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, - SQLSMALLINT *StringLength) - { -- struct SQLGetDiagField_params params = { HandleType, 0, RecNumber, DiagIdentifier, DiagInfo, BufferLength, -- StringLength }; -- struct handle *handle = Handle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_NO_DATA; - -- TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," -+ FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," - " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.Handle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetDiagField, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -976,23 +534,15 @@ SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSM - * SQLGetDiagRec [ODBC32.036] - */ - SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, -- SQLCHAR *SqlState, SQLINTEGER *NativeError, SQLCHAR *MessageText, -+ SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, - SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) - { -- struct SQLGetDiagRec_params params = { HandleType, 0, RecNumber, SqlState, NativeError, MessageText, -- BufferLength, TextLength }; -- struct handle *handle = Handle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_NO_DATA; - -- TRACE("(HandleType %d, Handle %p, RecNumber %d, SqlState %p, NativeError %p, MessageText %p, BufferLength %d," -- " TextLength %p)\n", HandleType, Handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, -+ FIXME("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d," -+ " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, - TextLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.Handle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetDiagRec, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1002,18 +552,11 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL - SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- struct SQLGetEnvAttr_params params = { 0, Attribute, Value, BufferLength, StringLength }; -- struct handle *handle = EnvironmentHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", -+ FIXME("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", - EnvironmentHandle, Attribute, Value, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.EnvironmentHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetEnvAttr, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1022,17 +565,10 @@ SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, - */ - SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported) - { -- struct SQLGetFunctions_params params = { 0, FunctionId, Supported }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetFunctions, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1042,18 +578,11 @@ SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT Function - SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) - { -- struct SQLGetInfo_params params = { 0, InfoType, InfoValue, BufferLength, StringLength }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ FIXME("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - InfoType, InfoValue, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetInfo, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1063,11 +592,9 @@ SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQL - SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- struct SQLGetStmtAttr_params params = { 0, Attribute, Value, BufferLength, StringLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, -+ FIXME("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, - Attribute, Value, BufferLength, StringLength); - - if (!Value) -@@ -1076,11 +603,6 @@ SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - return SQL_ERROR; - } - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetStmtAttr, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1089,17 +611,10 @@ SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - */ - SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value) - { -- struct SQLGetStmtOption_params params = { 0, Option, Value }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, Option %d, Value %p)\n", StatementHandle, Option, Value); -+ FIXME("(StatementHandle %p, Option %d, Value %p)\n", StatementHandle, Option, Value); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetStmtOption, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1108,17 +623,10 @@ SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, - */ - SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) - { -- struct SQLGetTypeInfo_params params = { 0, DataType }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetTypeInfo, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1127,17 +635,10 @@ SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) - */ - SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount) - { -- struct SQLNumResultCols_params params = { 0, ColumnCount }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount); -+ FIXME("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLNumResultCols, ¶ms ); -- TRACE("Returning %d ColumnCount %d\n", ret, *ColumnCount); - return ret; - } - -@@ -1146,17 +647,10 @@ SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnC - */ - SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) - { -- struct SQLParamData_params params = { 0, Value }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, Value %p)\n", StatementHandle, Value); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(StatementHandle %p, Value %p)\n", StatementHandle, Value); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLParamData, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1165,18 +659,11 @@ SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) - */ - SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) - { -- struct SQLPrepare_params params = { 0, StatementText, TextLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, - debugstr_an((const char *)StatementText, TextLength), TextLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLPrepare, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1185,17 +672,10 @@ SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQ - */ - SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind) - { -- struct SQLPutData_params params = { 0, Data, StrLen_or_Ind }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, Data %p, StrLen_or_Ind %s)\n", StatementHandle, Data, debugstr_sqllen(StrLen_or_Ind)); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(StatementHandle %p, Data %p, StrLen_or_Ind %s)\n", StatementHandle, Data, debugstr_sqllen(StrLen_or_Ind)); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLPutData, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1204,23 +684,10 @@ SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN St - */ - SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount) - { -- struct SQLRowCount_params params; -- struct handle *handle = StatementHandle; -- INT64 count; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount); -+ FIXME("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- params.RowCount = &count; -- if (SUCCESS((ret = ODBC_CALL( SQLRowCount, ¶ms ))) && RowCount) -- { -- *RowCount = count; -- TRACE(" RowCount %s\n", debugstr_sqllen(*RowCount)); -- } -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1230,18 +697,11 @@ SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount) - SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- struct SQLSetConnectAttr_params params = { 0, Attribute, Value, StringLength }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, -+ FIXME("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, - StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetConnectAttr, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1250,17 +710,10 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut - */ - SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value) - { -- struct SQLSetConnectOption_params params = { 0, Option, Value }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqlulen(Value)); -+ FIXME("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqlulen(Value)); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetConnectOption, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1269,18 +722,11 @@ SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Opti - */ - SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength) - { -- struct SQLSetCursorName_params params = { 0, CursorName, NameLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle, -+ FIXME("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle, - debugstr_an((const char *)CursorName, NameLength), NameLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetCursorName, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1290,18 +736,11 @@ SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, - SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, - SQLPOINTER Value, SQLINTEGER BufferLength) - { -- struct SQLSetDescField_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength }; -- struct handle *handle = DescriptorHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -+ FIXME("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, - RecNumber, FieldIdentifier, Value, BufferLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.DescriptorHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetDescField, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1312,26 +751,12 @@ SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, - SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale, - SQLPOINTER Data, SQLLEN *StringLength, SQLLEN *Indicator) - { -- struct SQLSetDescRec_params params = { 0, RecNumber, Type, SubType, Length, Precision, Scale, Data }; -- struct handle *handle = DescriptorHandle; -- INT64 stringlen, indicator; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(DescriptorHandle %p, RecNumber %d, Type %d, SubType %d, Length %s, Precision %d, Scale %d, Data %p," -+ FIXME("(DescriptorHandle %p, RecNumber %d, Type %d, SubType %d, Length %s, Precision %d, Scale %d, Data %p," - " StringLength %p, Indicator %p)\n", DescriptorHandle, RecNumber, Type, SubType, debugstr_sqllen(Length), - Precision, Scale, Data, StringLength, Indicator); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.DescriptorHandle = handle->unix_handle; -- params.StringLength = &stringlen; -- params.Indicator = &indicator; -- if (SUCCESS((ret = ODBC_CALL( SQLSetDescRec, ¶ms )))) -- { -- *StringLength = stringlen; -- *Indicator = indicator; -- } -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1341,16 +766,11 @@ SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, - SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- struct SQLSetEnvAttr_params params = { 0, Attribute, Value, StringLength }; -- struct handle *handle = EnvironmentHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value, -+ FIXME("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value, - StringLength); - -- params.EnvironmentHandle = handle ? handle->unix_handle : 0; -- ret = ODBC_CALL( SQLSetEnvAttr, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1361,132 +781,26 @@ SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNum - SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, - SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind) - { -- struct SQLSetParam_params params = { 0, ParameterNumber, ValueType, ParameterType, LengthPrecision, ParameterScale, -- ParameterValue }; -- struct handle *handle = StatementHandle; -- INT64 len; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s," -+ FIXME("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s," - " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType, - ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- params.StrLen_or_Ind = &len; -- if (SUCCESS((ret = ODBC_CALL( SQLSetParam, ¶ms )))) *StrLen_or_Ind = len; -- TRACE("Returning %d\n", ret); - return ret; - } - --static BOOL resize_result_lengths( struct handle *handle, UINT size ) --{ -- UINT i; -- for (i = 0; i < handle->bind_col.count; i++) -- { -- UINT8 *tmp; -- if (!handle->bind_col.param[i].ptr) continue; -- if (!(tmp = realloc( handle->bind_col.param[i].len, size * sizeof(UINT64) ))) return FALSE; -- if (tmp != handle->bind_col.param[i].len) -- { -- struct SQLBindCol_params params; -- -- params.StatementHandle = handle->unix_handle; -- params.ColumnNumber = i + 1; -- params.TargetType = handle->bind_col.param[i].col.target_type; -- params.TargetValue = handle->bind_col.param[i].col.target_value; -- params.BufferLength = handle->bind_col.param[i].col.buffer_length; -- params.StrLen_or_Ind = tmp; -- if (!SUCCESS(ODBC_CALL( SQLBindCol, ¶ms ))) -- { -- free( tmp ); -- return FALSE; -- } -- } -- handle->bind_col.param[i].len = tmp; -- } -- for (i = 0; i < handle->bind_param.count; i++) -- { -- UINT8 *tmp; -- if (!handle->bind_param.param[i].ptr) continue; -- if (!(tmp = realloc( handle->bind_param.param[i].len, size * sizeof(UINT64) ))) return FALSE; -- if (tmp != handle->bind_param.param[i].len) -- { -- struct SQLBindParam_params params; -- -- params.StatementHandle = handle->unix_handle; -- params.ParameterNumber = i + 1; -- params.ValueType = handle->bind_param.param[i].param.value_type; -- params.ParameterType = handle->bind_param.param[i].param.parameter_type; -- params.LengthPrecision = handle->bind_param.param[i].param.length_precision; -- params.ParameterScale = handle->bind_param.param[i].param.parameter_scale; -- params.ParameterValue = handle->bind_param.param[i].param.parameter_value; -- params.StrLen_or_Ind = tmp; -- if (!SUCCESS(ODBC_CALL( SQLBindParam, ¶ms ))) -- { -- free( tmp ); -- return FALSE; -- } -- } -- handle->bind_param.param[i].len = tmp; -- } -- for (i = 0; i < handle->bind_parameter.count; i++) -- { -- UINT8 *tmp; -- if (!(tmp = realloc( handle->bind_parameter.param[i].len, size * sizeof(UINT64) ))) return FALSE; -- if (tmp != handle->bind_parameter.param[i].len) -- { -- struct SQLBindParameter_params params; -- -- params.StatementHandle = handle->unix_handle; -- params.ParameterNumber = i + 1; -- params.InputOutputType = handle->bind_parameter.param[i].parameter.input_output_type; -- params.ValueType = handle->bind_parameter.param[i].parameter.value_type; -- params.ParameterType = handle->bind_parameter.param[i].parameter.parameter_type; -- params.ColumnSize = handle->bind_parameter.param[i].parameter.column_size; -- params.DecimalDigits = handle->bind_parameter.param[i].parameter.decimal_digits; -- params.ParameterValue = handle->bind_parameter.param[i].parameter.parameter_value; -- params.BufferLength = handle->bind_parameter.param[i].parameter.buffer_length; -- params.StrLen_or_Ind = tmp; -- if (!SUCCESS(ODBC_CALL( SQLBindParameter, ¶ms ))) -- { -- free( tmp ); -- return FALSE; -- } -- } -- handle->bind_parameter.param[i].len = tmp; -- } -- return TRUE; --} -- - /************************************************************************* - * SQLSetStmtAttr [ODBC32.076] - */ - SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- struct SQLSetStmtAttr_params params = { 0, Attribute, Value, StringLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, -+ FIXME("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, - StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- if (SUCCESS((ret = ODBC_CALL( SQLSetStmtAttr, ¶ms )))) -- { -- SQLULEN row_count = (SQLULEN)Value; -- if (Attribute == SQL_ATTR_ROW_ARRAY_SIZE && row_count != handle->row_count) -- { -- TRACE( "resizing result length array\n" ); -- if (!resize_result_lengths( handle, row_count )) ret = SQL_ERROR; -- else handle->row_count = row_count; -- } -- } -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1495,17 +809,10 @@ SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - */ - SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value) - { -- struct SQLSetStmtOption_params params = { 0, Option, Value }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, Option %d, Value %s)\n", StatementHandle, Option, debugstr_sqlulen(Value)); -+ FIXME("(StatementHandle %p, Option %d, Value %s)\n", StatementHandle, Option, debugstr_sqlulen(Value)); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetStmtOption, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1517,22 +824,14 @@ SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT Identi - SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope, - SQLUSMALLINT Nullable) - { -- struct SQLSpecialColumns_params params = { 0, IdentifierType, CatalogName, NameLength1, SchemaName, NameLength2, -- TableName, NameLength3, Scope, Nullable }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d," -+ FIXME("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d," - " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType, - debugstr_an((const char *)CatalogName, NameLength1), NameLength1, - debugstr_an((const char *)SchemaName, NameLength2), NameLength2, - debugstr_an((const char *)TableName, NameLength3), NameLength3, Scope, Nullable); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSpecialColumns, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1543,22 +842,14 @@ SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, S - SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, - SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) - { -- struct SQLStatistics_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3, Unique, Reserved }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" -+ FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" - " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle, - debugstr_an((const char *)CatalogName, NameLength1), NameLength1, - debugstr_an((const char *)SchemaName, NameLength2), NameLength2, - debugstr_an((const char *)TableName, NameLength3), NameLength3, Unique, Reserved); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLStatistics, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1569,23 +860,15 @@ SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSM - SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, - SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4) - { -- struct SQLTables_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3, TableType, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," - " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle, - debugstr_an((const char *)CatalogName, NameLength1), NameLength1, - debugstr_an((const char *)SchemaName, NameLength2), NameLength2, - debugstr_an((const char *)TableName, NameLength3), NameLength3, - debugstr_an((const char *)TableType, NameLength4), NameLength4); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLTables, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1594,42 +877,27 @@ SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSM - */ - SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType) - { -- struct SQLTransact_params params = { 0, 0, CompletionType }; -- struct handle *env = EnvironmentHandle, *con = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle, -+ FIXME("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle, - CompletionType); - -- if (!env || !con) return SQL_INVALID_HANDLE; -- -- params.EnvironmentHandle = env->unix_handle; -- params.ConnectionHandle = con->unix_handle; -- ret = ODBC_CALL( SQLTransact, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLBrowseConnect [ODBC32.055] - */ --SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectionString, SQLSMALLINT StringLength1, -- SQLCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength2) -+SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn, -+ SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax, -+ SQLSMALLINT *pcbConnStrOut) - { -- struct SQLBrowseConnect_params params = { 0, InConnectionString, StringLength1, OutConnectionString, BufferLength, -- StringLength2 }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength, %d, " -- "StringLength2 %p)\n", ConnectionHandle, debugstr_an((const char *)InConnectionString, StringLength1), -- StringLength1, OutConnectionString, BufferLength, StringLength2); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n", -+ hdbc, debugstr_an((const char *)szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, -+ pcbConnStrOut); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLBrowseConnect, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1638,149 +906,96 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio - */ - SQLRETURN WINAPI SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation) - { -- struct SQLBulkOperations_params params = { 0, Operation }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation); -+ FIXME("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- if (SUCCESS(( ret = ODBC_CALL( SQLBulkOperations, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLColAttributes [ODBC32.006] - */ --SQLRETURN WINAPI SQLColAttributes(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, -- SQLPOINTER CharacterAttributes, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, -- SQLLEN *NumericAttributes) -+SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, -+ SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, -+ SQLLEN *pfDesc) - { -- struct SQLColAttributes_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttributes, BufferLength, -- StringLength }; -- struct handle *handle = StatementHandle; -- INT64 attrs; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttributes %p, BufferLength %d, " -- "StringLength %p, NumericAttributes %p)\n", StatementHandle, ColumnNumber, FieldIdentifier, -- CharacterAttributes, BufferLength, StringLength, NumericAttributes); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, -+ fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); - -- params.StatementHandle = handle->unix_handle; -- params.NumericAttributes = &attrs; -- if (SUCCESS((ret = ODBC_CALL( SQLColAttributes, ¶ms )))) *NumericAttributes = attrs; -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLColumnPrivileges [ODBC32.056] - */ --SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -- SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4) -+SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName, -+ SQLSMALLINT cbTableName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName) - { -- struct SQLColumnPrivileges_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -- TableName, NameLength3, ColumnName, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -- " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -- debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -- debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -- debugstr_an((const char *)TableName, NameLength3), NameLength3, -- debugstr_an((const char *)ColumnName, NameLength4), NameLength4); -- -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," -+ " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt, -+ debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_an((const char *)szTableName, cbTableName), cbTableName, -+ debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLColumnPrivileges, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLDescribeParam [ODBC32.058] - */ --SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT *DataType, -- SQLULEN *ParameterSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) -+SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType, -+ SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable) - { -- struct SQLDescribeParam_params params = { 0, ParameterNumber, DataType, NULL, DecimalDigits, Nullable }; -- struct handle *handle = StatementHandle; -- UINT64 size; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ParameterNumber %d, DataType %p, ParameterSize %p, DecimalDigits %p, Nullable %p)\n", -- StatementHandle, ParameterNumber, DataType, ParameterSize, DecimalDigits, Nullable); -+ FIXME("(hstmt %p, ipar %d, pfSqlType %p, pcbParamDef %p, pibScale %p, pfNullable %p)\n", hstmt, ipar, -+ pfSqlType, pcbParamDef, pibScale, pfNullable); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- params.ParameterSize = &size; -- if (SUCCESS((ret = ODBC_CALL( SQLDescribeParam, ¶ms )))) *ParameterSize = size; -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLExtendedFetch [ODBC32.059] - */ --SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT StatementHandle, SQLUSMALLINT FetchOrientation, SQLLEN FetchOffset, -- SQLULEN *RowCount, SQLUSMALLINT *RowStatusArray) -+SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow, -+ SQLUSMALLINT *rgfRowStatus) - { -- struct SQLExtendedFetch_params params = { 0, FetchOrientation, FetchOffset, NULL, RowStatusArray }; -- struct handle *handle = StatementHandle; -- UINT64 count; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s, RowCount %p, RowStatusArray %p)\n", -- StatementHandle, FetchOrientation, debugstr_sqllen(FetchOffset), RowCount, RowStatusArray); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow), -+ pcrow, rgfRowStatus); - -- params.StatementHandle = handle->unix_handle; -- params.RowCount = &count; -- if (SUCCESS((ret = ODBC_CALL( SQLExtendedFetch, ¶ms )))) *RowCount = count; -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLForeignKeys [ODBC32.060] - */ --SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT StatementHandle, SQLCHAR *PkCatalogName, SQLSMALLINT NameLength1, -- SQLCHAR *PkSchemaName, SQLSMALLINT NameLength2, SQLCHAR *PkTableName, -- SQLSMALLINT NameLength3, SQLCHAR *FkCatalogName, SQLSMALLINT NameLength4, -- SQLCHAR *FkSchemaName, SQLSMALLINT NameLength5, SQLCHAR *FkTableName, -- SQLSMALLINT NameLength6) -+SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName, -+ SQLCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLCHAR *szPkTableName, -+ SQLSMALLINT cbPkTableName, SQLCHAR *szFkCatalogName, -+ SQLSMALLINT cbFkCatalogName, SQLCHAR *szFkSchemaName, -+ SQLSMALLINT cbFkSchemaName, SQLCHAR *szFkTableName, SQLSMALLINT cbFkTableName) - { -- struct SQLForeignKeys_params params = { 0, PkCatalogName, NameLength1, PkSchemaName, NameLength2, -- PkTableName, NameLength3, FkCatalogName, NameLength4, -- FkSchemaName, NameLength5, FkTableName, NameLength6 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, PkCatalogName %s, NameLength1 %d, PkSchemaName %s, NameLength2 %d," -- " PkTableName %s, NameLength3 %d, FkCatalogName %s, NameLength4 %d, FkSchemaName %s," -- " NameLength5 %d, FkTableName %s, NameLength6 %d)\n", StatementHandle, -- debugstr_an((const char *)PkCatalogName, NameLength1), NameLength1, -- debugstr_an((const char *)PkSchemaName, NameLength2), NameLength2, -- debugstr_an((const char *)PkTableName, NameLength3), NameLength3, -- debugstr_an((const char *)FkCatalogName, NameLength4), NameLength4, -- debugstr_an((const char *)FkSchemaName, NameLength5), NameLength5, -- debugstr_an((const char *)FkTableName, NameLength6), NameLength6); -+ FIXME("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d," -+ " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s," -+ " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt, -+ debugstr_an((const char *)szPkCatalogName, cbPkCatalogName), cbPkCatalogName, -+ debugstr_an((const char *)szPkSchemaName, cbPkSchemaName), cbPkSchemaName, -+ debugstr_an((const char *)szPkTableName, cbPkTableName), cbPkTableName, -+ debugstr_an((const char *)szFkCatalogName, cbFkCatalogName), cbFkCatalogName, -+ debugstr_an((const char *)szFkSchemaName, cbFkSchemaName), cbFkSchemaName, -+ debugstr_an((const char *)szFkTableName, cbFkTableName), cbFkTableName); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLForeignKeys, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -1789,389 +1004,213 @@ SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT StatementHandle, SQLCHAR *PkCatalogName - */ - SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle) - { -- struct SQLMoreResults_params params; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(%p)\n", StatementHandle); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(%p)\n", StatementHandle); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLMoreResults, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLNativeSql [ODBC32.062] - */ --SQLRETURN WINAPI SQLNativeSql(SQLHDBC ConnectionHandle, SQLCHAR *InStatementText, SQLINTEGER TextLength1, -- SQLCHAR *OutStatementText, SQLINTEGER BufferLength, SQLINTEGER *TextLength2) -+SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr, -+ SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr) - { -- struct SQLNativeSql_params params = { 0, InStatementText, TextLength1, OutStatementText, BufferLength, -- TextLength2 }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, InStatementText %s, TextLength1 %d, OutStatementText %p, BufferLength, %d, " -- "TextLength2 %p)\n", ConnectionHandle, debugstr_an((const char *)InStatementText, TextLength1), -- TextLength1, OutStatementText, BufferLength, TextLength2); -+ FIXME("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc, -+ debugstr_an((const char *)szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLNativeSql, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLNumParams [ODBC32.063] - */ --SQLRETURN WINAPI SQLNumParams(SQLHSTMT StatementHandle, SQLSMALLINT *ParameterCount) -+SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar) - { -- struct SQLNumParams_params params = { 0, ParameterCount }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, pcpar %p)\n", StatementHandle, ParameterCount); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, pcpar %p)\n", hstmt, pcpar); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLNumParams, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLParamOptions [ODBC32.064] - */ --SQLRETURN WINAPI SQLParamOptions(SQLHSTMT StatementHandle, SQLULEN RowCount, SQLULEN *RowNumber) -+SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow) - { -- struct SQLParamOptions_params params = { 0, RowCount }; -- struct handle *handle = StatementHandle; -- UINT64 row; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, RowCount %s, RowNumber %p)\n", StatementHandle, debugstr_sqlulen(RowCount), -- RowNumber); -+ FIXME("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- params.RowNumber = &row; -- if (SUCCESS((ret = ODBC_CALL( SQLParamOptions, ¶ms )))) *RowNumber = row; -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLPrimaryKeys [ODBC32.065] - */ --SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -- SQLSMALLINT NameLength3) -+SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName, -+ SQLSMALLINT cbTableName) - { -- struct SQLPrimaryKeys_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -- " NameLength3 %d)\n", StatementHandle, -- debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -- debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -- debugstr_an((const char *)TableName, NameLength3), NameLength3); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," -+ " cbTableName %d)\n", hstmt, -+ debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_an((const char *)szTableName, cbTableName), cbTableName); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLPrimaryKeys, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLProcedureColumns [ODBC32.066] - */ --SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *ProcName, -- SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4) -+SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName, -+ SQLSMALLINT cbProcName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName) - { -- struct SQLProcedureColumns_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -- ProcName, NameLength3, ColumnName, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -- " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -- debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -- debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -- debugstr_an((const char *)ProcName, NameLength3), NameLength3, -- debugstr_an((const char *)ColumnName, NameLength4), NameLength4); -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s," -+ " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt, -+ debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_an((const char *)szProcName, cbProcName), cbProcName, -+ debugstr_an((const char *)szColumnName, cbColumnName), cbColumnName); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLProcedureColumns, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLProcedures [ODBC32.067] - */ --SQLRETURN WINAPI SQLProcedures(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *ProcName, -- SQLSMALLINT NameLength3) -+SQLRETURN WINAPI SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName, -+ SQLSMALLINT cbProcName) - { -- struct SQLProcedures_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, -- NameLength3 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -- " NameLength3 %d)\n", StatementHandle, -- debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -- debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -- debugstr_an((const char *)ProcName, NameLength3), NameLength3); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s," -+ " cbProcName %d)\n", hstmt, -+ debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_an((const char *)szProcName, cbProcName), cbProcName); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLProcedures, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLSetPos [ODBC32.068] - */ --SQLRETURN WINAPI SQLSetPos(SQLHSTMT StatementHandle, SQLSETPOSIROW RowNumber, SQLUSMALLINT Operation, -- SQLUSMALLINT LockType) -+SQLRETURN WINAPI SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock) - { -- struct SQLSetPos_params params = { 0, RowNumber, Operation, LockType }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, RowNumber %s, Operation %d, LockType %d)\n", StatementHandle, -- debugstr_sqlulen(RowNumber), Operation, LockType); -+ FIXME("(hstmt %p, irow %s, fOption %d, fLock %d)\n", hstmt, debugstr_sqlulen(irow), fOption, fLock); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- if (SUCCESS(( ret = ODBC_CALL( SQLSetPos, ¶ms ))) && Operation == SQL_REFRESH) -- update_result_lengths( handle, SQL_PARAM_OUTPUT ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLTablePrivileges [ODBC32.070] - */ --SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -- SQLSMALLINT NameLength3) -+SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName, -+ SQLSMALLINT cbTableName) - { -- struct SQLTablePrivileges_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -- TableName, NameLength3 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -- "NameLength3 %d)\n", StatementHandle, -- debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -- debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -- debugstr_an((const char *)TableName, NameLength3), NameLength3); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," -+ " cbTableName %d)\n", hstmt, -+ debugstr_an((const char *)szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_an((const char *)szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_an((const char *)szTableName, cbTableName), cbTableName); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLTablePrivileges, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLDrivers [ODBC32.071] - */ --SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *DriverDescription, -- SQLSMALLINT BufferLength1, SQLSMALLINT *DescriptionLength, -- SQLCHAR *DriverAttributes, SQLSMALLINT BufferLength2, -- SQLSMALLINT *AttributesLength) -+SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLCHAR *szDriverDesc, -+ SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc, -+ SQLCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax, -+ SQLSMALLINT *pcbDriverAttr) - { -- struct SQLDrivers_params params = { 0, Direction, DriverDescription, BufferLength1, DescriptionLength, -- DriverAttributes, BufferLength2, AttributesLength }; -- struct handle *handle = EnvironmentHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_NO_DATA; - -- TRACE("(EnvironmentHandle %p, Direction %d, DriverDescription %p, BufferLength1 %d, DescriptionLength %p," -- " DriverAttributes %p, BufferLength2 %d, AttributesLength %p)\n", EnvironmentHandle, Direction, -- DriverDescription, BufferLength1, DescriptionLength, DriverAttributes, BufferLength2, AttributesLength); -+ FIXME("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p," -+ " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection, -+ szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.EnvironmentHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLDrivers, ¶ms ); -- -- if (ret == SQL_NO_DATA && Direction == SQL_FETCH_FIRST) -- ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n"); -- -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLBindParameter [ODBC32.072] - */ --SQLRETURN WINAPI SQLBindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT InputOutputType, -- SQLSMALLINT ValueType, SQLSMALLINT ParameterType, SQLULEN ColumnSize, -- SQLSMALLINT DecimalDigits, SQLPOINTER ParameterValue, SQLLEN BufferLength, -- SQLLEN *StrLen_or_Ind) -+SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType, -+ SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef, -+ SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax, -+ SQLLEN *pcbValue) - { -- struct SQLBindParameter_params params = { 0, ParameterNumber, InputOutputType, ValueType, ParameterType, -- ColumnSize, DecimalDigits, ParameterValue, BufferLength }; -- struct handle *handle = StatementHandle; -- UINT i = ParameterNumber - 1; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, ParameterNumber %d, InputOutputType %d, ValueType %d, ParameterType %d, " -- "ColumnSize %s, DecimalDigits %d, ParameterValue, %p, BufferLength %s, StrLen_or_Ind %p)\n", -- StatementHandle, ParameterNumber, InputOutputType, ValueType, ParameterType, debugstr_sqlulen(ColumnSize), -- DecimalDigits, ParameterValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -- if (!ParameterNumber) -- { -- FIXME( "parameter 0 not handled\n" ); -- return SQL_ERROR; -- } -- if (!alloc_binding( &handle->bind_parameter, InputOutputType, ParameterNumber, handle->row_count )) return SQL_ERROR; -- handle->bind_parameter.param[i].parameter.input_output_type = InputOutputType; -- handle->bind_parameter.param[i].parameter.value_type = ValueType; -- handle->bind_parameter.param[i].parameter.parameter_type = ParameterType; -- handle->bind_parameter.param[i].parameter.column_size = ColumnSize; -- handle->bind_parameter.param[i].parameter.decimal_digits = DecimalDigits; -- handle->bind_parameter.param[i].parameter.parameter_value = ParameterValue; -- handle->bind_parameter.param[i].parameter.buffer_length = BufferLength; -+ FIXME("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p," -+ " cbValueMax %s, pcbValue %p)\n", hstmt, ipar, fParamType, fCType, fSqlType, debugstr_sqlulen(cbColDef), -+ ibScale, rgbValue, debugstr_sqllen(cbValueMax), pcbValue); - -- params.StatementHandle = handle->unix_handle; -- params.StrLen_or_Ind = handle->bind_parameter.param[i].len; -- *(UINT64 *)params.StrLen_or_Ind = *StrLen_or_Ind; -- if (SUCCESS((ret = ODBC_CALL( SQLBindParameter, ¶ms )))) handle->bind_parameter.param[i].ptr = StrLen_or_Ind; -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLDriverConnect [ODBC32.041] - */ --SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, SQLCHAR *ConnectionString, -- SQLSMALLINT Length, SQLCHAR *OutConnectionString, SQLSMALLINT BufferLength, -- SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) -+SQLRETURN WINAPI SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *ConnectionString, SQLSMALLINT Length, -+ SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max, -+ SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion) - { -- struct SQLDriverConnect_params params = { 0, WindowHandle, ConnectionString, Length, OutConnectionString, -- BufferLength, Length2, DriverCompletion }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d," -- " ptr_conn_str_out %p, driver_completion %d)\n", ConnectionHandle, WindowHandle, -- debugstr_an((const char *)ConnectionString, Length), Length, OutConnectionString, BufferLength, -- Length2, DriverCompletion); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hdbc %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d," -+ " ptr_conn_str_out %p, driver_completion %d)\n", hdbc, hwnd, -+ debugstr_an((const char *)ConnectionString, Length), Length, conn_str_out, conn_str_out_max, -+ ptr_conn_str_out, driver_completion); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLDriverConnect, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLSetScrollOptions [ODBC32.069] - */ --SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT StatementHandle, SQLUSMALLINT Concurrency, SQLLEN KeySetSize, -- SQLUSMALLINT RowSetSize) -+SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset, -+ SQLUSMALLINT crow_rowset) - { -- struct SQLSetScrollOptions_params params = { 0, Concurrency, KeySetSize, RowSetSize }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, Concurrency %d, KeySetSize %s, RowSetSize %d)\n", StatementHandle, -- Concurrency, debugstr_sqllen(KeySetSize), RowSetSize); -+ FIXME("(statement_handle %p, f_concurrency %d, crow_keyset %s, crow_rowset %d)\n", statement_handle, -+ f_concurrency, debugstr_sqllen(crow_keyset), crow_rowset); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetScrollOptions, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - --static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType) --{ -- static const SQLUSMALLINT attrList[] = -- { -- SQL_COLUMN_OWNER_NAME, -- SQL_COLUMN_QUALIFIER_NAME, -- SQL_COLUMN_LABEL, -- SQL_COLUMN_NAME, -- SQL_COLUMN_TABLE_NAME, -- SQL_COLUMN_TYPE_NAME, -- SQL_DESC_BASE_COLUMN_NAME, -- SQL_DESC_BASE_TABLE_NAME, -- SQL_DESC_CATALOG_NAME, -- SQL_DESC_LABEL, -- SQL_DESC_LITERAL_PREFIX, -- SQL_DESC_LITERAL_SUFFIX, -- SQL_DESC_LOCAL_TYPE_NAME, -- SQL_DESC_NAME, -- SQL_DESC_SCHEMA_NAME, -- SQL_DESC_TABLE_NAME, -- SQL_DESC_TYPE_NAME, -- }; -- unsigned int i; -- -- for (i = 0; i < ARRAY_SIZE(attrList); i++) { -- if (attrList[i] == fDescType) return TRUE; -- } -- return FALSE; --} -- - /************************************************************************* - * SQLColAttributesW [ODBC32.106] - */ --SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, -- SQLPOINTER CharacterAttributes, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, -- SQLLEN *NumericAttributes) -+SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, -+ SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, -+ SQLLEN *pfDesc) - { -- struct SQLColAttributesW_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttributes, BufferLength, -- StringLength }; -- struct handle *handle = StatementHandle; -- INT64 attrs; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttributes %p, BufferLength %d, " -- "StringLength %p, NumericAttributes %p)\n", StatementHandle, ColumnNumber, FieldIdentifier, -- CharacterAttributes, BufferLength, StringLength, NumericAttributes); -- -- if (!handle) return SQL_INVALID_HANDLE; -+ SQLRETURN ret = SQL_ERROR; - -- params.StatementHandle = handle->unix_handle; -- params.NumericAttributes = &attrs; -- if (SUCCESS((ret = ODBC_CALL( SQLColAttributesW, ¶ms )))) *NumericAttributes = attrs; -+ FIXME("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, -+ fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); - -- if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(FieldIdentifier) && CharacterAttributes && -- StringLength && *StringLength != wcslen(CharacterAttributes) * 2) -- { -- TRACE("CHEAT: resetting name length for ADO\n"); -- *StringLength = wcslen(CharacterAttributes) * 2; -- } -- -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2182,20 +1221,12 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA - WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication, - SQLSMALLINT NameLength3) - { -- struct SQLConnectW_params params = { 0, ServerName, NameLength1, UserName, NameLength2, Authentication, -- NameLength3 }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," -+ FIXME("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," - " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1, - debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLConnectW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2206,36 +1237,15 @@ SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu - SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, - SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) - { -- struct SQLDescribeColW_params params = { 0, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, -- NULL, DecimalDigits, Nullable }; -- struct handle *handle = StatementHandle; - SQLSMALLINT dummy; -- UINT64 size; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," -+ FIXME("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," - " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName, - BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); - -- if (!handle) return SQL_INVALID_HANDLE; -+ if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ - -- params.StatementHandle = handle->unix_handle; -- if (!NameLength) params.NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ -- params.ColumnSize = &size; -- if (SUCCESS((ret = ODBC_CALL( SQLDescribeColW, ¶ms )))) -- { -- if (ColumnName && NameLength) TRACE("ColumnName %s\n", debugstr_wn(ColumnName, *NameLength)); -- if (DataType) TRACE("DataType %d\n", *DataType); -- if (ColumnSize) -- { -- *ColumnSize = size; -- TRACE("ColumnSize %s\n", debugstr_sqlulen(*ColumnSize)); -- } -- if (DecimalDigits) TRACE("DecimalDigits %d\n", *DecimalDigits); -- if (Nullable) TRACE("Nullable %d\n", *Nullable); -- } -- -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2243,28 +1253,15 @@ SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu - * SQLErrorW [ODBC32.110] - */ - SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, -- WCHAR *SqlState, SQLINTEGER *NativeError, WCHAR *MessageText, -+ WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText, - SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) - { -- struct SQLErrorW_params params = { 0, 0, 0, SqlState, NativeError, MessageText, BufferLength, TextLength }; -- struct handle *env = EnvironmentHandle, *con = ConnectionHandle, *stmt = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, SqlState %p, NativeError %p," -+ FIXME("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p," - " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle, -- StatementHandle, SqlState, NativeError, MessageText, BufferLength, TextLength); -- -- if (env) params.EnvironmentHandle = env->unix_handle; -- if (con) params.ConnectionHandle = con->unix_handle; -- if (stmt) params.StatementHandle = stmt->unix_handle; -- if (SUCCESS((ret = ODBC_CALL( SQLErrorW, ¶ms )))) -- { -- TRACE(" SqlState %s\n", debugstr_wn(SqlState, 5)); -- TRACE(" Error %d\n", *NativeError); -- TRACE(" MessageText %s\n", debugstr_wn(MessageText, *TextLength)); -- } -+ StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2273,18 +1270,11 @@ SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, - */ - SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) - { -- struct SQLExecDirectW_params params = { 0, StatementText, TextLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, - debugstr_wn(StatementText, TextLength), TextLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLExecDirectW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2294,18 +1284,11 @@ SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, - SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength, - SQLSMALLINT *NameLength) - { -- struct SQLGetCursorNameW_params params = { 0, CursorName, BufferLength, NameLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName, -+ FIXME("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName, - BufferLength, NameLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetCursorNameW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2314,18 +1297,11 @@ SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, - */ - SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) - { -- struct SQLPrepareW_params params = { 0, StatementText, TextLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, - debugstr_wn(StatementText, TextLength), TextLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLPrepareW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2334,18 +1310,11 @@ SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQL - */ - SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength) - { -- struct SQLSetCursorNameW_params params = { 0, CursorName, NameLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle, -+ FIXME("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle, - debugstr_wn(CursorName, NameLength), NameLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetCursorNameW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2357,30 +1326,12 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, - SQLLEN *NumericAttribute) - { -- struct SQLColAttributeW_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, -- StringLength }; -- struct handle *handle = StatementHandle; -- INT64 attr; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d" -+ FIXME("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d" - " StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier, - CharacterAttribute, BufferLength, StringLength, NumericAttribute); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- params.NumericAttribute = &attr; -- if (SUCCESS((ret = ODBC_CALL( SQLColAttributeW, ¶ms ))) && NumericAttribute) *NumericAttribute = attr; -- -- if (ret == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier) && -- StringLength && *StringLength != wcslen(CharacterAttribute) * 2) -- { -- TRACE("CHEAT: resetting name length for ADO\n"); -- *StringLength = wcslen(CharacterAttribute) * 2; -- } -- -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2390,18 +1341,11 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN - SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- struct SQLGetConnectAttrW_params params = { 0, Attribute, Value, BufferLength, StringLength }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ FIXME("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - Attribute, Value, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetConnectAttrW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2411,18 +1355,11 @@ SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu - SQLRETURN WINAPI SQLGetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, - SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- struct SQLGetDescFieldW_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength, StringLength }; -- struct handle *handle = DescriptorHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n", -+ FIXME("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n", - DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.DescriptorHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetDescFieldW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2434,22 +1371,12 @@ SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber - SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision, - SQLSMALLINT *Scale, SQLSMALLINT *Nullable) - { -- struct SQLGetDescRecW_params params = { 0, RecNumber, Name, BufferLength, StringLength, Type, SubType, -- NULL, Precision, Scale, Nullable }; -- struct handle *handle = DescriptorHandle; -- INT64 len; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p," -+ FIXME("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p," - " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength, - StringLength, Type, SubType, Length, Precision, Scale, Nullable); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.DescriptorHandle = handle->unix_handle; -- params.Length = &len; -- if (SUCCESS((ret = ODBC_CALL( SQLGetDescRecW, ¶ms )))) *Length = len; -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2460,43 +1387,27 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS - SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, - SQLSMALLINT *StringLength) - { -- struct SQLGetDiagFieldW_params params = { HandleType, 0, RecNumber, DiagIdentifier, DiagInfo, BufferLength, -- StringLength }; -- struct handle *handle = Handle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_NO_DATA; - -- TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," -+ FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," - " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.Handle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetDiagFieldW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLGetDiagRecW [ODBC32.136] - */ --SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, WCHAR *SqlState, -- SQLINTEGER *NativeError, WCHAR *MessageText, SQLSMALLINT BufferLength, -- SQLSMALLINT *TextLength) -+SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, -+ WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText, -+ SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) - { -- struct SQLGetDiagRecW_params params = { HandleType, 0, RecNumber, SqlState, NativeError, MessageText, -- BufferLength, TextLength }; -- struct handle *handle = Handle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(HandleType %d, Handle %p, RecNumber %d, SqlState %p, NativeError %p, MessageText %p, BufferLength %d," -- " TextLength %p)\n", HandleType, Handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, -+ FIXME("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d," -+ " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, - TextLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.Handle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetDiagRecW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2506,11 +1417,9 @@ SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA - SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- struct SQLGetStmtAttrW_params params = { 0, Attribute, Value, BufferLength, StringLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, -+ FIXME("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, - Attribute, Value, BufferLength, StringLength); - - if (!Value) -@@ -2519,11 +1428,6 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - return SQL_ERROR; - } - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetStmtAttrW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2533,18 +1437,11 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- struct SQLSetConnectAttrW_params params = { 0, Attribute, Value, StringLength }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, -- Value, StringLength); -- -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, -+ StringLength); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetConnectAttrW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2555,21 +1452,14 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM - WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName, - SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4) - { -- struct SQLColumnsW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3, ColumnName, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," - " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, - debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, - debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(ColumnName, NameLength4), NameLength4); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLColumnsW, ¶ms ); -- TRACE("Returning %d\n", ret); -+ FIXME("Returning %d\n", ret); - return ret; - } - -@@ -2580,21 +1470,13 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl - SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength, - SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) - { -- struct SQLDriverConnectW_params params = { 0, WindowHandle, InConnectionString, Length, OutConnectionString, -- BufferLength, Length2, DriverCompletion }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," -+ FIXME("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," - " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, - debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2, - DriverCompletion); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLDriverConnectW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2603,17 +1485,10 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl - */ - SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value) - { -- struct SQLGetConnectOptionW_params params = { 0, Option, Value }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value); -+ FIXME("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetConnectOptionW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2623,18 +1498,11 @@ SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Opt - SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) - { -- struct SQLGetInfoW_params params = { 0, InfoType, InfoValue, BufferLength, StringLength }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ FIXME("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - InfoType, InfoValue, BufferLength, StringLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetInfoW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2643,17 +1511,10 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ - */ - SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType) - { -- struct SQLGetTypeInfoW_params params = { 0, DataType }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); -+ FIXME("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLGetTypeInfoW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2662,17 +1523,10 @@ SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType) - */ - SQLRETURN WINAPI SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value) - { -- struct SQLSetConnectOptionW_params params = { 0, Option, Value }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqllen(Value)); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqllen(Value)); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetConnectOptionW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2684,21 +1538,13 @@ SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT Ident - SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3, - SQLUSMALLINT Scope, SQLUSMALLINT Nullable) - { -- struct SQLSpecialColumnsW_params params = { 0, IdentifierType, CatalogName, NameLength1, SchemaName, NameLength2, -- TableName, NameLength3, Scope, Nullable }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d," -+ FIXME("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d," - " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType, - debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, - debugstr_wn(TableName, NameLength3), NameLength3, Scope, Nullable); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSpecialColumnsW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2709,21 +1555,13 @@ SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, - SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, - SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) - { -- struct SQLStatisticsW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3, Unique, Reserved }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" -+ FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" - " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle, - debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, - debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLStatisticsW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2734,71 +1572,47 @@ SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQL - SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, - SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4) - { -- struct SQLTablesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3, TableType, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," - " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle, - debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, - debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(TableType, NameLength4), NameLength4); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLTablesW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLBrowseConnectW [ODBC32.155] - */ --SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnectionString, SQLSMALLINT StringLength1, -- SQLWCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength2) -+SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn, -+ SQLWCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax, -+ SQLSMALLINT *pcbConnStrOut) - { -- struct SQLBrowseConnectW_params params = { 0, InConnectionString, StringLength1, OutConnectionString, -- BufferLength, StringLength2 }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength %d, " -- "StringLength2 %p)\n", ConnectionHandle, debugstr_wn(InConnectionString, StringLength1), StringLength1, -- OutConnectionString, BufferLength, StringLength2); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n", -+ hdbc, debugstr_wn(szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLBrowseConnectW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLColumnPrivilegesW [ODBC32.156] - */ --SQLRETURN WINAPI SQLColumnPrivilegesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -- SQLSMALLINT NameLength3, SQLWCHAR *ColumnName, SQLSMALLINT NameLength4) -+SQLRETURN WINAPI SQLColumnPrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, -+ SQLSMALLINT cbTableName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName) - { -- struct SQLColumnPrivilegesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -- TableName, NameLength3, ColumnName, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -- " NameLength3 %d, ColumnName %s, NameLength3 %d)\n", StatementHandle, -- debugstr_wn(CatalogName, NameLength1), NameLength1, -- debugstr_wn(SchemaName, NameLength2), NameLength2, -- debugstr_wn(TableName, NameLength3), NameLength3, -- debugstr_wn(ColumnName, NameLength4), NameLength4); -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," -+ " cbTableName %d, szColumnName %s, cbColumnName %d)\n", hstmt, -+ debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_wn(szTableName, cbTableName), cbTableName, -+ debugstr_wn(szColumnName, cbColumnName), cbColumnName); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLColumnPrivilegesW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -2809,215 +1623,136 @@ SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Directi - SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description, - SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) - { -- struct SQLDataSourcesW_params params = { 0, Direction, ServerName, BufferLength1, NameLength1, Description, -- BufferLength2, NameLength2 }; -- struct handle *handle = EnvironmentHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_NO_DATA; - -- TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," -+ FIXME("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," - " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1, - NameLength1, Description, BufferLength2, NameLength2); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.EnvironmentHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLDataSourcesW, ¶ms ); -- -- if (ret >= 0 && TRACE_ON(odbc)) -- { -- if (ServerName && NameLength1 && *NameLength1 > 0) -- TRACE(" DataSource %s", debugstr_wn(ServerName, *NameLength1)); -- if (Description && NameLength2 && *NameLength2 > 0) -- TRACE(" Description %s", debugstr_wn(Description, *NameLength2)); -- TRACE("\n"); -- } -- -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLForeignKeysW [ODBC32.160] - */ --SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT StatementHandle, SQLWCHAR *PkCatalogName, SQLSMALLINT NameLength1, -- SQLWCHAR *PkSchemaName, SQLSMALLINT NameLength2, SQLWCHAR *PkTableName, -- SQLSMALLINT NameLength3, SQLWCHAR *FkCatalogName, SQLSMALLINT NameLength4, -- SQLWCHAR *FkSchemaName, SQLSMALLINT NameLength5, SQLWCHAR *FkTableName, -- SQLSMALLINT NameLength6) -+SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLSMALLINT cbPkCatalogName, -+ SQLWCHAR *szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLWCHAR *szPkTableName, -+ SQLSMALLINT cbPkTableName, SQLWCHAR *szFkCatalogName, -+ SQLSMALLINT cbFkCatalogName, SQLWCHAR *szFkSchemaName, -+ SQLSMALLINT cbFkSchemaName, SQLWCHAR *szFkTableName, SQLSMALLINT cbFkTableName) - { -- struct SQLForeignKeysW_params params = { 0, PkCatalogName, NameLength1, PkSchemaName, NameLength2, -- PkTableName, NameLength2, FkCatalogName, NameLength3, -- FkSchemaName, NameLength5, FkTableName, NameLength6 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, PkCatalogName %s, NameLength1 %d, PkSchemaName %s, NameLength2 %d," -- " PkTableName %s, NameLength3 %d, FkCatalogName %s, NameLength4 %d, FkSchemaName %s," -- " NameLength5 %d, FkTableName %s, NameLength6 %d)\n", StatementHandle, -- debugstr_wn(PkCatalogName, NameLength1), NameLength1, -- debugstr_wn(PkSchemaName, NameLength2), NameLength2, -- debugstr_wn(PkTableName, NameLength3), NameLength3, -- debugstr_wn(FkCatalogName, NameLength4), NameLength4, -- debugstr_wn(FkSchemaName, NameLength5), NameLength5, -- debugstr_wn(FkTableName, NameLength6), NameLength6); -+ FIXME("(hstmt %p, szPkCatalogName %s, cbPkCatalogName %d, szPkSchemaName %s, cbPkSchemaName %d," -+ " szPkTableName %s, cbPkTableName %d, szFkCatalogName %s, cbFkCatalogName %d, szFkSchemaName %s," -+ " cbFkSchemaName %d, szFkTableName %s, cbFkTableName %d)\n", hstmt, -+ debugstr_wn(szPkCatalogName, cbPkCatalogName), cbPkCatalogName, -+ debugstr_wn(szPkSchemaName, cbPkSchemaName), cbPkSchemaName, -+ debugstr_wn(szPkTableName, cbPkTableName), cbPkTableName, -+ debugstr_wn(szFkCatalogName, cbFkCatalogName), cbFkCatalogName, -+ debugstr_wn(szFkSchemaName, cbFkSchemaName), cbFkSchemaName, -+ debugstr_wn(szFkTableName, cbFkTableName), cbFkTableName); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLForeignKeysW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLNativeSqlW [ODBC32.162] - */ --SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC ConnectionHandle, SQLWCHAR *InStatementText, SQLINTEGER TextLength1, -- SQLWCHAR *OutStatementText, SQLINTEGER BufferLength, SQLINTEGER *TextLength2) -+SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr, -+ SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr) - { -- struct SQLNativeSqlW_params params = { 0, InStatementText, TextLength1, OutStatementText, BufferLength, -- TextLength2 }; -- struct handle *handle = ConnectionHandle; -- SQLRETURN ret; -- -- TRACE("(ConnectionHandle %p, InStatementText %s, TextLength1 %d, OutStatementText %p, BufferLength %d, " -- "TextLength2 %p)\n", ConnectionHandle, debugstr_wn(InStatementText, TextLength1), TextLength1, -- OutStatementText, BufferLength, TextLength2); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc, -+ debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); - -- params.ConnectionHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLNativeSqlW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLPrimaryKeysW [ODBC32.165] - */ --SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -- SQLSMALLINT NameLength3) -+SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, -+ SQLSMALLINT cbTableName) - { -- struct SQLPrimaryKeysW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength2 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -- " NameLength3 %d)\n", StatementHandle, -- debugstr_wn(CatalogName, NameLength1), NameLength1, -- debugstr_wn(SchemaName, NameLength2), NameLength2, -- debugstr_wn(TableName, NameLength3), NameLength3); -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," -+ " cbTableName %d)\n", hstmt, -+ debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_wn(szTableName, cbTableName), cbTableName); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLPrimaryKeysW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLProcedureColumnsW [ODBC32.166] - */ --SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *ProcName, -- SQLSMALLINT NameLength3, SQLWCHAR *ColumnName, SQLSMALLINT NameLength4 ) -+SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName, -+ SQLSMALLINT cbProcName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName) - { -- struct SQLProcedureColumnsW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -- ProcName, NameLength3, ColumnName, NameLength4 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -- " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -- debugstr_wn(CatalogName, NameLength1), NameLength1, -- debugstr_wn(SchemaName, NameLength2), NameLength2, -- debugstr_wn(ProcName, NameLength3), NameLength3, -- debugstr_wn(ColumnName, NameLength4), NameLength4); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s," -+ " cbProcName %d, szColumnName %s, cbColumnName %d)\n", hstmt, -+ debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, -+ debugstr_wn(szProcName, cbProcName), cbProcName, -+ debugstr_wn(szColumnName, cbColumnName), cbColumnName); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLProcedureColumnsW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLProceduresW [ODBC32.167] - */ --SQLRETURN WINAPI SQLProceduresW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *ProcName, -- SQLSMALLINT NameLength3) -+SQLRETURN WINAPI SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName, -+ SQLSMALLINT cbProcName) - { -- struct SQLProceduresW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, -- NameLength3 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -- " NameLength3 %d)\n", StatementHandle, debugstr_wn(CatalogName, NameLength1), NameLength1, -- debugstr_wn(SchemaName, NameLength2), NameLength2, debugstr_wn(ProcName, NameLength3), NameLength3); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szProcName %s," -+ " cbProcName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szProcName, cbProcName), cbProcName); - -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLProceduresW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLTablePrivilegesW [ODBC32.170] - */ --SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -- SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -- SQLSMALLINT NameLength3) -+SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, -+ SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, -+ SQLSMALLINT cbTableName) - { -- struct SQLTablePrivilegesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -- NameLength3 }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -- " NameLength3 %d)\n", StatementHandle, debugstr_wn(CatalogName, NameLength1), NameLength1, -- debugstr_wn(SchemaName, NameLength2), NameLength2, debugstr_wn(TableName, NameLength3), NameLength3); -+ FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," -+ " cbTableName %d)\n", hstmt, debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName, -+ debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, debugstr_wn(szTableName, cbTableName), cbTableName); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLTablePrivilegesW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - - /************************************************************************* - * SQLDriversW [ODBC32.171] - */ --SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLWCHAR *DriverDescription, -- SQLSMALLINT BufferLength1, SQLSMALLINT *DescriptionLength, SQLWCHAR *DriverAttributes, -- SQLSMALLINT BufferLength2, SQLSMALLINT *AttributesLength) -+SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLWCHAR *szDriverDesc, -+ SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc, -+ SQLWCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax, -+ SQLSMALLINT *pcbDriverAttr) - { -- struct SQLDriversW_params params = { 0, Direction, DriverDescription, BufferLength1, DescriptionLength, -- DriverAttributes, BufferLength2, AttributesLength }; -- struct handle *handle = EnvironmentHandle; -- SQLRETURN ret; -- -- TRACE("(EnvironmentHandle %p, Direction %d, DriverDescription %p, BufferLength1 %d, DescriptionLength %p," -- " DriverAttributes %p, BufferLength2 %d, AttributesLength %p)\n", EnvironmentHandle, Direction, -- DriverDescription, BufferLength1, DescriptionLength, DriverAttributes, BufferLength2, AttributesLength); -+ SQLRETURN ret = SQL_NO_DATA; - -- if (!handle) return SQL_INVALID_HANDLE; -+ FIXME("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p," -+ " DriverAttributes %p, cbDriverAttrMax %d, pcbDriverAttr %p)\n", EnvironmentHandle, fDirection, -+ szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr); - -- params.EnvironmentHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLDriversW, ¶ms ); -- -- if (ret == SQL_NO_DATA && Direction == SQL_FETCH_FIRST) -- ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n"); -- -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -3027,18 +1762,11 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, - SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, - SQLPOINTER Value, SQLINTEGER BufferLength) - { -- struct SQLSetDescFieldW_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength }; -- struct handle *handle = DescriptorHandle; -- SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; - -- TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -+ FIXME("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, - RecNumber, FieldIdentifier, Value, BufferLength); - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.DescriptorHandle = handle->unix_handle; -- ret = ODBC_CALL( SQLSetDescFieldW, ¶ms ); -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -3048,28 +1776,11 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb - SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- struct SQLSetStmtAttrW_params params = { 0, Attribute, Value, StringLength }; -- struct handle *handle = StatementHandle; -- SQLRETURN ret; -- -- TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, -- Value, StringLength); -+ SQLRETURN ret = SQL_ERROR; - -- if (!handle) return SQL_INVALID_HANDLE; -- -- params.StatementHandle = handle->unix_handle; -- if (SUCCESS((ret = ODBC_CALL( SQLSetStmtAttrW, ¶ms )))) -- { -- SQLULEN row_count = (SQLULEN)Value; -- if (Attribute == SQL_ATTR_ROW_ARRAY_SIZE && row_count != handle->row_count) -- { -- TRACE( "resizing result length array\n" ); -- if (!resize_result_lengths( handle, row_count )) ret = SQL_ERROR; -- else handle->row_count = row_count; -- } -- } -+ FIXME("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, -+ StringLength); - -- TRACE("Returning %d\n", ret); - return ret; - } - -@@ -3077,34 +1788,14 @@ SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - * SQLGetDiagRecA [ODBC32.236] - */ - SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, -- SQLCHAR *SqlState, SQLINTEGER *NativeError, SQLCHAR *MessageText, -+ SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, - SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) - { -- return SQLGetDiagRec( HandleType, Handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, -- TextLength ); --} -- --/*********************************************************************** -- * DllMain [Internal] Initializes the internal 'ODBC32.DLL'. -- */ --BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) --{ -- TRACE("proxy ODBC: %p,%lx,%p\n", hinstDLL, reason, reserved); -+ SQLRETURN ret = SQL_ERROR; - -- switch (reason) -- { -- case DLL_PROCESS_ATTACH: -- DisableThreadLibraryCalls(hinstDLL); -- if (!__wine_init_unix_call()) -- { -- if (WINE_UNIX_CALL( process_attach, NULL )) __wine_unixlib_handle = 0; -- } -- IsWow64Process( GetCurrentProcess(), &is_wow64 ); -- break; -- -- case DLL_PROCESS_DETACH: -- if (reserved) break; -- } -+ FIXME("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d," -+ " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, -+ TextLength); - -- return TRUE; -+ return ret; - } -diff --git a/dlls/wineodbc/Makefile.in b/dlls/wineodbc/Makefile.in -new file mode 100644 -index 00000000000..017daca7d3f ---- /dev/null -+++ b/dlls/wineodbc/Makefile.in -@@ -0,0 +1,9 @@ -+MODULE = wineodbc.dll -+UNIXLIB = wineodbc.so -+IMPORTS = advapi32 -+UNIX_LIBS = $(ODBC_LIBS) -+ -+SOURCES = \ -+ proxyodbc.c \ -+ rsrc.rc \ -+ unixlib.c -diff --git a/dlls/wineodbc/proxyodbc.c b/dlls/wineodbc/proxyodbc.c -new file mode 100644 -index 00000000000..47e0aff0b18 ---- /dev/null -+++ b/dlls/wineodbc/proxyodbc.c -@@ -0,0 +1,3110 @@ -+/* -+ * Win32 ODBC functions -+ * -+ * Copyright 1999 Xiang Li, Corel Corporation -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ * -+ * NOTES: -+ * Proxy ODBC driver manager. This manager delegates all ODBC -+ * calls to a real ODBC driver manager named by the environment -+ * variable LIB_ODBC_DRIVER_MANAGER, or to libodbc.so if the -+ * variable is not set. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "windef.h" -+#include "winbase.h" -+#include "winternl.h" -+#include "winreg.h" -+#include "wine/debug.h" -+ -+#include "sql.h" -+#include "sqltypes.h" -+#include "sqlext.h" -+#include "unixlib.h" -+ -+WINE_DEFAULT_DEBUG_CHANNEL(odbc); -+WINE_DECLARE_DEBUG_CHANNEL(winediag); -+ -+#define ODBC_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params ) -+ -+static BOOL is_wow64; -+ -+static struct handle *alloc_handle( void ) -+{ -+ struct handle *ret; -+ if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL; -+ ret->row_count = 1; -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLAllocConnect [ODBC32.001] -+ */ -+SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle) -+{ -+ struct SQLAllocConnect_params params; -+ struct handle *con, *env = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle); -+ -+ *ConnectionHandle = 0; -+ if (!(con = alloc_handle())) return SQL_ERROR; -+ -+ params.EnvironmentHandle = env->unix_handle; -+ if (SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms )))) -+ { -+ con->unix_handle = params.ConnectionHandle; -+ *ConnectionHandle = con; -+ } -+ else free( con ); -+ -+ TRACE("Returning %d, ConnectionHandle %p\n", ret, *ConnectionHandle); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLAllocEnv [ODBC32.002] -+ */ -+SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) -+{ -+ struct SQLAllocEnv_params params; -+ struct handle *env; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle); -+ -+ *EnvironmentHandle = 0; -+ if (!(env = alloc_handle())) return SQL_ERROR; -+ -+ if (SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms )))) -+ { -+ env->unix_handle = params.EnvironmentHandle; -+ *EnvironmentHandle = env; -+ } -+ else free( env ); -+ -+ TRACE("Returning %d, EnvironmentHandle %p\n", ret, *EnvironmentHandle); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLAllocHandle [ODBC32.024] -+ */ -+SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) -+{ -+ struct SQLAllocHandle_params params; -+ struct handle *output, *input = InputHandle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); -+ -+ *OutputHandle = 0; -+ if (!(output = alloc_handle())) return SQL_ERROR; -+ -+ params.HandleType = HandleType; -+ params.InputHandle = input ? input->unix_handle : 0; -+ if (SUCCESS((ret = ODBC_CALL( SQLAllocHandle, ¶ms )))) -+ { -+ output->unix_handle = params.OutputHandle; -+ *OutputHandle = output; -+ } -+ else free( output ); -+ -+ TRACE("Returning %d, OutputHandle %p\n", ret, *OutputHandle); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLAllocStmt [ODBC32.003] -+ */ -+SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle) -+{ -+ struct SQLAllocStmt_params params; -+ struct handle *stmt, *con = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle); -+ -+ *StatementHandle = 0; -+ if (!(stmt = alloc_handle())) return SQL_ERROR; -+ -+ params.ConnectionHandle = con->unix_handle; -+ if (SUCCESS((ret = ODBC_CALL( SQLAllocStmt, ¶ms )))) -+ { -+ stmt->unix_handle = params.StatementHandle; -+ *StatementHandle = stmt; -+ } -+ else free( stmt ); -+ -+ TRACE ("Returning %d, StatementHandle %p\n", ret, *StatementHandle); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLAllocHandleStd [ODBC32.077] -+ */ -+SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) -+{ -+ struct SQLAllocHandleStd_params params; -+ struct handle *output, *input = InputHandle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); -+ -+ *OutputHandle = 0; -+ if (!(output = alloc_handle())) return SQL_ERROR; -+ -+ params.HandleType = HandleType; -+ params.InputHandle = input ? input->unix_handle : 0; -+ if (SUCCESS((ret = ODBC_CALL( SQLAllocHandleStd, ¶ms )))) -+ { -+ output->unix_handle = params.OutputHandle; -+ *OutputHandle = output; -+ } -+ else free( output ); -+ -+ TRACE ("Returning %d, OutputHandle %p\n", ret, *OutputHandle); -+ return ret; -+} -+ -+static const char *debugstr_sqllen( SQLLEN len ) -+{ -+#ifdef _WIN64 -+ return wine_dbg_sprintf( "%Id", len ); -+#else -+ return wine_dbg_sprintf( "%d", len ); -+#endif -+} -+ -+#define MAX_BINDING_PARAMS 1024 -+static BOOL alloc_binding( struct param_binding *binding, USHORT type, UINT column, UINT row_count ) -+{ -+ if (column > MAX_BINDING_PARAMS) -+ { -+ FIXME( "increase maximum number of parameters\n" ); -+ return FALSE; -+ } -+ if (!binding->param && !(binding->param = calloc( MAX_BINDING_PARAMS, sizeof(*binding->param)))) return FALSE; -+ -+ if (!(binding->param[column - 1].len = calloc( row_count, sizeof(UINT64) ))) return FALSE; -+ binding->param[column - 1].type = type; -+ binding->count = column; -+ return TRUE; -+} -+ -+/************************************************************************* -+ * SQLBindCol [ODBC32.004] -+ */ -+SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, -+ SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind) -+{ -+ struct SQLBindCol_params params = { 0, ColumnNumber, TargetType, TargetValue, BufferLength }; -+ struct handle *handle = StatementHandle; -+ UINT i = ColumnNumber - 1; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", -+ StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ if (!ColumnNumber) -+ { -+ FIXME( "column 0 not handled\n" ); -+ return SQL_ERROR; -+ } -+ if (!alloc_binding( &handle->bind_col, SQL_PARAM_INPUT_OUTPUT, ColumnNumber, handle->row_count )) return SQL_ERROR; -+ handle->bind_col.param[i].col.target_type = TargetType; -+ handle->bind_col.param[i].col.target_value = TargetValue; -+ handle->bind_col.param[i].col.buffer_length = BufferLength; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (StrLen_or_Ind) params.StrLen_or_Ind = handle->bind_col.param[i].len; -+ if (SUCCESS(( ret = ODBC_CALL( SQLBindCol, ¶ms )))) handle->bind_col.param[i].ptr = StrLen_or_Ind; -+ TRACE ("Returning %d\n", ret); -+ return ret; -+} -+ -+static const char *debugstr_sqlulen( SQLULEN len ) -+{ -+#ifdef _WIN64 -+ return wine_dbg_sprintf( "%Iu", len ); -+#else -+ return wine_dbg_sprintf( "%u", len ); -+#endif -+} -+ -+/************************************************************************* -+ * SQLBindParam [ODBC32.025] -+ */ -+SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, -+ SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, -+ SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind) -+{ -+ struct SQLBindParam_params params = { 0, ParameterNumber, ValueType, ParameterType, LengthPrecision, -+ ParameterScale, ParameterValue }; -+ struct handle *handle = StatementHandle; -+ UINT i = ParameterNumber - 1; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s," -+ " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType, -+ ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ if (!ParameterNumber) -+ { -+ FIXME( "parameter 0 not handled\n" ); -+ return SQL_ERROR; -+ } -+ if (!alloc_binding( &handle->bind_param, SQL_PARAM_INPUT, ParameterNumber, handle->row_count )) return SQL_ERROR; -+ handle->bind_param.param[i].param.value_type = ValueType; -+ handle->bind_param.param[i].param.parameter_type = ParameterType; -+ handle->bind_param.param[i].param.length_precision = LengthPrecision; -+ handle->bind_param.param[i].param.parameter_scale = ParameterScale; -+ handle->bind_param.param[i].param.parameter_value = ParameterValue; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.StrLen_or_Ind = handle->bind_param.param[i].len; -+ *(UINT64 *)params.StrLen_or_Ind = *StrLen_or_Ind; -+ if (SUCCESS(( ret = ODBC_CALL( SQLBindParam, ¶ms )))) handle->bind_param.param[i].ptr = StrLen_or_Ind; -+ TRACE ("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLCancel [ODBC32.005] -+ */ -+SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle) -+{ -+ struct SQLCancel_params params; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p)\n", StatementHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLCancel, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLCloseCursor [ODBC32.026] -+ */ -+SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle) -+{ -+ struct SQLCloseCursor_params params; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p)\n", StatementHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLCloseCursor, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLColAttribute [ODBC32.027] -+ */ -+SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, -+ SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, -+ SQLLEN *NumericAttribute) -+{ -+ struct SQLColAttribute_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, -+ StringLength }; -+ struct handle *handle = StatementHandle; -+ INT64 num_attr = 0; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d," -+ " StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier, -+ CharacterAttribute, BufferLength, StringLength, NumericAttribute); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.NumericAttribute = &num_attr; -+ if (SUCCESS(( ret = ODBC_CALL( SQLColAttribute, ¶ms ))) && NumericAttribute) *NumericAttribute = num_attr; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLColumns [ODBC32.040] -+ */ -+SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -+ SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4) -+{ -+ struct SQLColumns_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3, ColumnName, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)TableName, NameLength3), NameLength3, -+ debugstr_an((const char *)ColumnName, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLColumns, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLConnect [ODBC32.007] -+ */ -+SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1, -+ SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLConnect_params params = { 0, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3 }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," -+ " NameLength3 %d)\n", ConnectionHandle, -+ debugstr_an((const char *)ServerName, NameLength1), NameLength1, -+ debugstr_an((const char *)UserName, NameLength2), NameLength2, -+ debugstr_an((const char *)Authentication, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLConnect, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLCopyDesc [ODBC32.028] -+ */ -+SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle) -+{ -+ struct SQLCopyDesc_params params; -+ struct handle *source = SourceDescHandle, *target = TargetDescHandle; -+ SQLRETURN ret; -+ -+ TRACE("(SourceDescHandle %p, TargetDescHandle %p)\n", SourceDescHandle, TargetDescHandle); -+ -+ if (!source || !target) return SQL_INVALID_HANDLE; -+ -+ params.SourceDescHandle = source->unix_handle; -+ params.TargetDescHandle = target->unix_handle; -+ ret = ODBC_CALL( SQLCopyDesc, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDataSources [ODBC32.057] -+ */ -+SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName, -+ SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description, -+ SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) -+{ -+ struct SQLDataSources_params params = { 0, Direction, ServerName, BufferLength1, NameLength1, Description, -+ BufferLength2, NameLength2 }; -+ struct handle *handle = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," -+ " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1, -+ NameLength1, Description, BufferLength2, NameLength2); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.EnvironmentHandle = handle->unix_handle; -+ if (SUCCESS((ret = ODBC_CALL( SQLDataSources, ¶ms ))) && TRACE_ON(odbc)) -+ { -+ if (ServerName && NameLength1 && *NameLength1 > 0) -+ TRACE(" DataSource %s", debugstr_an((const char *)ServerName, *NameLength1)); -+ if (Description && NameLength2 && *NameLength2 > 0) -+ TRACE(" Description %s", debugstr_an((const char *)Description, *NameLength2)); -+ TRACE("\n"); -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+SQLRETURN WINAPI SQLDataSourcesA(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *ServerName, -+ SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description, -+ SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) -+{ -+ return SQLDataSources( EnvironmentHandle, Direction, ServerName, BufferLength1, NameLength1, Description, -+ BufferLength2, NameLength2 ); -+} -+ -+/************************************************************************* -+ * SQLDescribeCol [ODBC32.008] -+ */ -+SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, -+ SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, -+ SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) -+{ -+ struct SQLDescribeCol_params params = { 0, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, -+ NULL, DecimalDigits, Nullable }; -+ struct handle *handle = StatementHandle; -+ UINT64 size; -+ SQLSMALLINT dummy; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," -+ " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName, -+ BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (!params.NameLength) params.NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ -+ params.ColumnSize = &size; -+ if (SUCCESS((ret = ODBC_CALL( SQLDescribeCol, ¶ms )))) -+ { -+ if (ColumnName && NameLength) TRACE(" ColumnName %s\n", debugstr_an((const char *)ColumnName, *NameLength)); -+ if (DataType) TRACE(" DataType %d\n", *DataType); -+ if (ColumnSize) -+ { -+ *ColumnSize = size; -+ TRACE(" ColumnSize %s\n", debugstr_sqlulen(*ColumnSize)); -+ } -+ if (DecimalDigits) TRACE(" DecimalDigits %d\n", *DecimalDigits); -+ if (Nullable) TRACE(" Nullable %d\n", *Nullable); -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDisconnect [ODBC32.009] -+ */ -+SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle) -+{ -+ struct SQLDisconnect_params params; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p)\n", ConnectionHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLDisconnect, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLEndTran [ODBC32.029] -+ */ -+SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType) -+{ -+ struct SQLEndTran_params params = { HandleType, 0, CompletionType }; -+ struct handle *handle = Handle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, Handle %p, CompletionType %d)\n", HandleType, Handle, CompletionType); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.Handle = handle->unix_handle; -+ ret = ODBC_CALL( SQLEndTran, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLError [ODBC32.010] -+ */ -+SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, -+ SQLCHAR *SqlState, SQLINTEGER *NativeError, SQLCHAR *MessageText, -+ SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) -+{ -+ struct SQLError_params params = { 0, 0, 0, SqlState, NativeError, MessageText, BufferLength, TextLength }; -+ struct handle *env = EnvironmentHandle, *con = ConnectionHandle, *stmt = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, SqlState %p, NativeError %p," -+ " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle, -+ StatementHandle, SqlState, NativeError, MessageText, BufferLength, TextLength); -+ -+ if (env) params.EnvironmentHandle = env->unix_handle; -+ if (con) params.ConnectionHandle = con->unix_handle; -+ if (stmt) params.StatementHandle = stmt->unix_handle; -+ if (SUCCESS((ret = ODBC_CALL( SQLError, ¶ms )))) -+ { -+ TRACE(" SqlState %s\n", debugstr_an((const char *)SqlState, 5)); -+ TRACE(" Error %d\n", *NativeError); -+ TRACE(" MessageText %s\n", debugstr_an((const char *)MessageText, *TextLength)); -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLExecDirect [ODBC32.011] -+ */ -+SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) -+{ -+ struct SQLExecDirect_params params = { 0, StatementText, TextLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ debugstr_an((const char *)StatementText, TextLength), TextLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLExecDirect, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+static void len_to_user( SQLLEN *ptr, UINT8 *len, UINT row_count, UINT width ) -+{ -+ UINT i; -+ for (i = 0; i < row_count; i++) -+ { -+ *ptr++ = *(SQLLEN *)(len + i * width); -+ } -+} -+ -+static void len_from_user( UINT8 *len, SQLLEN *ptr, UINT row_count, UINT width ) -+{ -+ UINT i; -+ for (i = 0; i < row_count; i++) -+ { -+ *(SQLLEN *)(len + i * width) = *ptr++; -+ } -+} -+ -+static void update_result_lengths( struct handle *handle, USHORT type ) -+{ -+ UINT i, width = sizeof(void *) == 8 ? 8 : is_wow64 ? 8 : 4; -+ -+ switch (type) -+ { -+ case SQL_PARAM_OUTPUT: -+ for (i = 0; i < handle->bind_col.count; i++) -+ { -+ len_to_user( handle->bind_col.param[i].ptr, handle->bind_col.param[i].len, handle->row_count, width ); -+ } -+ for (i = 0; i < handle->bind_param.count; i++) -+ { -+ len_to_user( handle->bind_param.param[i].ptr, handle->bind_param.param[i].len, handle->row_count, width ); -+ } -+ for (i = 0; i < handle->bind_parameter.count; i++) -+ { -+ if (handle->bind_parameter.param[i].type != SQL_PARAM_OUTPUT && -+ handle->bind_parameter.param[i].type != SQL_PARAM_INPUT_OUTPUT) continue; -+ -+ len_to_user( handle->bind_parameter.param[i].ptr, handle->bind_parameter.param[i].len, handle->row_count, width ); -+ } -+ break; -+ -+ case SQL_PARAM_INPUT: -+ for (i = 0; i < handle->bind_col.count; i++) -+ { -+ len_from_user( handle->bind_col.param[i].len, handle->bind_col.param[i].ptr, handle->row_count, width ); -+ } -+ /* FIXME: handle bind_param */ -+ for (i = 0; i < handle->bind_parameter.count; i++) -+ { -+ if (handle->bind_parameter.param[i].type != SQL_PARAM_INPUT && -+ handle->bind_parameter.param[i].type != SQL_PARAM_INPUT_OUTPUT) continue; -+ -+ len_from_user( handle->bind_parameter.param[i].len, handle->bind_parameter.param[i].ptr, handle->row_count, width ); -+ } -+ -+ default: break; -+ } -+} -+ -+/************************************************************************* -+ * SQLExecute [ODBC32.012] -+ */ -+SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle) -+{ -+ struct SQLExecute_params params; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p)\n", StatementHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ update_result_lengths( handle, SQL_PARAM_INPUT ); -+ if (SUCCESS(( ret = ODBC_CALL( SQLExecute, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLFetch [ODBC32.013] -+ */ -+SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle) -+{ -+ struct SQLFetch_params params; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p)\n", StatementHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (SUCCESS(( ret = ODBC_CALL( SQLFetch, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLFetchScroll [ODBC32.030] -+ */ -+SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset) -+{ -+ struct SQLFetchScroll_params params = { 0, FetchOrientation, FetchOffset }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s)\n", StatementHandle, FetchOrientation, -+ debugstr_sqllen(FetchOffset)); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (SUCCESS(( ret = ODBC_CALL( SQLFetchScroll, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLFreeConnect [ODBC32.014] -+ */ -+SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) -+{ -+ struct SQLFreeConnect_params params; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p)\n", ConnectionHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLFreeConnect, ¶ms ); -+ free( handle ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLFreeEnv [ODBC32.015] -+ */ -+SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) -+{ -+ struct SQLFreeEnv_params params; -+ struct handle *handle = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.EnvironmentHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLFreeEnv, ¶ms ); -+ free( handle ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+static void free_bindings( struct handle *handle ) -+{ -+ if (handle->bind_col.param) -+ { -+ free( handle->bind_col.param->len ); -+ free( handle->bind_col.param ); -+ } -+ if (handle->bind_param.param) -+ { -+ free( handle->bind_param.param->len ); -+ free( handle->bind_param.param ); -+ } -+ if (handle->bind_parameter.param) -+ { -+ free( handle->bind_parameter.param->len ); -+ free( handle->bind_parameter.param ); -+ } -+} -+ -+/************************************************************************* -+ * SQLFreeHandle [ODBC32.031] -+ */ -+SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) -+{ -+ struct SQLFreeHandle_params params; -+ struct handle *handle = Handle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, Handle %p)\n", HandleType, Handle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.HandleType = HandleType; -+ params.Handle = handle->unix_handle; -+ ret = ODBC_CALL( SQLFreeHandle, ¶ms ); -+ free_bindings( handle ); -+ free( handle ); -+ TRACE ("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLFreeStmt [ODBC32.016] -+ */ -+SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) -+{ -+ struct SQLFreeStmt_params params; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.Option = Option; -+ ret = ODBC_CALL( SQLFreeStmt, ¶ms ); -+ free_bindings( handle ); -+ free( handle ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetConnectAttr [ODBC32.032] -+ */ -+SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER BufferLength, SQLINTEGER *StringLength) -+{ -+ struct SQLGetConnectAttr_params params = { 0, Attribute, Value, BufferLength, StringLength }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ Attribute, Value, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetConnectAttr, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetConnectOption [ODBC32.042] -+ */ -+SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value) -+{ -+ struct SQLGetConnectOption_params params = { 0, Option, Value }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetConnectOption, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetCursorName [ODBC32.017] -+ */ -+SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength, -+ SQLSMALLINT *NameLength) -+{ -+ struct SQLGetCursorName_params params = { 0, CursorName, BufferLength, NameLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName, -+ BufferLength, NameLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetCursorName, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetData [ODBC32.043] -+ */ -+SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, -+ SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind) -+{ -+ struct SQLGetData_params params = { 0, ColumnNumber, TargetType, TargetValue, BufferLength }; -+ struct handle *handle = StatementHandle; -+ INT64 len; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", -+ StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.StrLen_or_Ind = &len; -+ if (SUCCESS((ret = ODBC_CALL( SQLGetData, ¶ms )))) *StrLen_or_Ind = len; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDescField [ODBC32.033] -+ */ -+SQLRETURN WINAPI SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, -+ SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) -+{ -+ struct SQLGetDescField_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength, StringLength }; -+ struct handle *handle = DescriptorHandle; -+ SQLRETURN ret; -+ -+ TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n", -+ DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.DescriptorHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetDescField, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDescRec [ODBC32.034] -+ */ -+SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLCHAR *Name, -+ SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type, -+ SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision, -+ SQLSMALLINT *Scale, SQLSMALLINT *Nullable) -+{ -+ struct SQLGetDescRec_params params = { 0, RecNumber, Name, BufferLength, StringLength, Type, SubType, NULL, -+ Precision, Scale, Nullable }; -+ struct handle *handle = DescriptorHandle; -+ INT64 len; -+ SQLRETURN ret; -+ -+ TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p," -+ " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength, -+ StringLength, Type, SubType, Length, Precision, Scale, Nullable); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.DescriptorHandle = handle->unix_handle; -+ params.Length = &len; -+ if (SUCCESS((ret = ODBC_CALL( SQLGetDescRec, ¶ms )))) *Length = len; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDiagField [ODBC32.035] -+ */ -+SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, -+ SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, -+ SQLSMALLINT *StringLength) -+{ -+ struct SQLGetDiagField_params params = { HandleType, 0, RecNumber, DiagIdentifier, DiagInfo, BufferLength, -+ StringLength }; -+ struct handle *handle = Handle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," -+ " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.Handle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetDiagField, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDiagRec [ODBC32.036] -+ */ -+SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, -+ SQLCHAR *SqlState, SQLINTEGER *NativeError, SQLCHAR *MessageText, -+ SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) -+{ -+ struct SQLGetDiagRec_params params = { HandleType, 0, RecNumber, SqlState, NativeError, MessageText, -+ BufferLength, TextLength }; -+ struct handle *handle = Handle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, SqlState %p, NativeError %p, MessageText %p, BufferLength %d," -+ " TextLength %p)\n", HandleType, Handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, -+ TextLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.Handle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetDiagRec, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetEnvAttr [ODBC32.037] -+ */ -+SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER BufferLength, SQLINTEGER *StringLength) -+{ -+ struct SQLGetEnvAttr_params params = { 0, Attribute, Value, BufferLength, StringLength }; -+ struct handle *handle = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", -+ EnvironmentHandle, Attribute, Value, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.EnvironmentHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetEnvAttr, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetFunctions [ODBC32.044] -+ */ -+SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported) -+{ -+ struct SQLGetFunctions_params params = { 0, FunctionId, Supported }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetFunctions, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetInfo [ODBC32.045] -+ */ -+SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, -+ SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) -+{ -+ struct SQLGetInfo_params params = { 0, InfoType, InfoValue, BufferLength, StringLength }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ InfoType, InfoValue, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetInfo, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetStmtAttr [ODBC32.038] -+ */ -+SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER BufferLength, SQLINTEGER *StringLength) -+{ -+ struct SQLGetStmtAttr_params params = { 0, Attribute, Value, BufferLength, StringLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, -+ Attribute, Value, BufferLength, StringLength); -+ -+ if (!Value) -+ { -+ WARN("Unexpected NULL Value return address\n"); -+ return SQL_ERROR; -+ } -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetStmtAttr, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetStmtOption [ODBC32.046] -+ */ -+SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value) -+{ -+ struct SQLGetStmtOption_params params = { 0, Option, Value }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Option %d, Value %p)\n", StatementHandle, Option, Value); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetStmtOption, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetTypeInfo [ODBC32.047] -+ */ -+SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) -+{ -+ struct SQLGetTypeInfo_params params = { 0, DataType }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetTypeInfo, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLNumResultCols [ODBC32.018] -+ */ -+SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount) -+{ -+ struct SQLNumResultCols_params params = { 0, ColumnCount }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLNumResultCols, ¶ms ); -+ TRACE("Returning %d ColumnCount %d\n", ret, *ColumnCount); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLParamData [ODBC32.048] -+ */ -+SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) -+{ -+ struct SQLParamData_params params = { 0, Value }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Value %p)\n", StatementHandle, Value); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLParamData, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLPrepare [ODBC32.019] -+ */ -+SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) -+{ -+ struct SQLPrepare_params params = { 0, StatementText, TextLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ debugstr_an((const char *)StatementText, TextLength), TextLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLPrepare, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLPutData [ODBC32.049] -+ */ -+SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind) -+{ -+ struct SQLPutData_params params = { 0, Data, StrLen_or_Ind }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Data %p, StrLen_or_Ind %s)\n", StatementHandle, Data, debugstr_sqllen(StrLen_or_Ind)); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLPutData, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLRowCount [ODBC32.020] -+ */ -+SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount) -+{ -+ struct SQLRowCount_params params; -+ struct handle *handle = StatementHandle; -+ INT64 count; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.RowCount = &count; -+ if (SUCCESS((ret = ODBC_CALL( SQLRowCount, ¶ms ))) && RowCount) -+ { -+ *RowCount = count; -+ TRACE(" RowCount %s\n", debugstr_sqllen(*RowCount)); -+ } -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetConnectAttr [ODBC32.039] -+ */ -+SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER StringLength) -+{ -+ struct SQLSetConnectAttr_params params = { 0, Attribute, Value, StringLength }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, -+ StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetConnectAttr, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetConnectOption [ODBC32.050] -+ */ -+SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value) -+{ -+ struct SQLSetConnectOption_params params = { 0, Option, Value }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqlulen(Value)); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetConnectOption, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetCursorName [ODBC32.021] -+ */ -+SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength) -+{ -+ struct SQLSetCursorName_params params = { 0, CursorName, NameLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle, -+ debugstr_an((const char *)CursorName, NameLength), NameLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetCursorName, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetDescField [ODBC32.073] -+ */ -+SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, -+ SQLPOINTER Value, SQLINTEGER BufferLength) -+{ -+ struct SQLSetDescField_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength }; -+ struct handle *handle = DescriptorHandle; -+ SQLRETURN ret; -+ -+ TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -+ RecNumber, FieldIdentifier, Value, BufferLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.DescriptorHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetDescField, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetDescRec [ODBC32.074] -+ */ -+SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type, -+ SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale, -+ SQLPOINTER Data, SQLLEN *StringLength, SQLLEN *Indicator) -+{ -+ struct SQLSetDescRec_params params = { 0, RecNumber, Type, SubType, Length, Precision, Scale, Data }; -+ struct handle *handle = DescriptorHandle; -+ INT64 stringlen, indicator; -+ SQLRETURN ret; -+ -+ TRACE("(DescriptorHandle %p, RecNumber %d, Type %d, SubType %d, Length %s, Precision %d, Scale %d, Data %p," -+ " StringLength %p, Indicator %p)\n", DescriptorHandle, RecNumber, Type, SubType, debugstr_sqllen(Length), -+ Precision, Scale, Data, StringLength, Indicator); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.DescriptorHandle = handle->unix_handle; -+ params.StringLength = &stringlen; -+ params.Indicator = &indicator; -+ if (SUCCESS((ret = ODBC_CALL( SQLSetDescRec, ¶ms )))) -+ { -+ *StringLength = stringlen; -+ *Indicator = indicator; -+ } -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetEnvAttr [ODBC32.075] -+ */ -+SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER StringLength) -+{ -+ struct SQLSetEnvAttr_params params = { 0, Attribute, Value, StringLength }; -+ struct handle *handle = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value, -+ StringLength); -+ -+ params.EnvironmentHandle = handle ? handle->unix_handle : 0; -+ ret = ODBC_CALL( SQLSetEnvAttr, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetParam [ODBC32.022] -+ */ -+SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, -+ SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, -+ SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind) -+{ -+ struct SQLSetParam_params params = { 0, ParameterNumber, ValueType, ParameterType, LengthPrecision, ParameterScale, -+ ParameterValue }; -+ struct handle *handle = StatementHandle; -+ INT64 len; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ParameterNumber %d, ValueType %d, ParameterType %d, LengthPrecision %s," -+ " ParameterScale %d, ParameterValue %p, StrLen_or_Ind %p)\n", StatementHandle, ParameterNumber, ValueType, -+ ParameterType, debugstr_sqlulen(LengthPrecision), ParameterScale, ParameterValue, StrLen_or_Ind); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.StrLen_or_Ind = &len; -+ if (SUCCESS((ret = ODBC_CALL( SQLSetParam, ¶ms )))) *StrLen_or_Ind = len; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+static BOOL resize_result_lengths( struct handle *handle, UINT size ) -+{ -+ UINT i; -+ for (i = 0; i < handle->bind_col.count; i++) -+ { -+ UINT8 *tmp; -+ if (!handle->bind_col.param[i].ptr) continue; -+ if (!(tmp = realloc( handle->bind_col.param[i].len, size * sizeof(UINT64) ))) return FALSE; -+ if (tmp != handle->bind_col.param[i].len) -+ { -+ struct SQLBindCol_params params; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.ColumnNumber = i + 1; -+ params.TargetType = handle->bind_col.param[i].col.target_type; -+ params.TargetValue = handle->bind_col.param[i].col.target_value; -+ params.BufferLength = handle->bind_col.param[i].col.buffer_length; -+ params.StrLen_or_Ind = tmp; -+ if (!SUCCESS(ODBC_CALL( SQLBindCol, ¶ms ))) -+ { -+ free( tmp ); -+ return FALSE; -+ } -+ } -+ handle->bind_col.param[i].len = tmp; -+ } -+ for (i = 0; i < handle->bind_param.count; i++) -+ { -+ UINT8 *tmp; -+ if (!handle->bind_param.param[i].ptr) continue; -+ if (!(tmp = realloc( handle->bind_param.param[i].len, size * sizeof(UINT64) ))) return FALSE; -+ if (tmp != handle->bind_param.param[i].len) -+ { -+ struct SQLBindParam_params params; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.ParameterNumber = i + 1; -+ params.ValueType = handle->bind_param.param[i].param.value_type; -+ params.ParameterType = handle->bind_param.param[i].param.parameter_type; -+ params.LengthPrecision = handle->bind_param.param[i].param.length_precision; -+ params.ParameterScale = handle->bind_param.param[i].param.parameter_scale; -+ params.ParameterValue = handle->bind_param.param[i].param.parameter_value; -+ params.StrLen_or_Ind = tmp; -+ if (!SUCCESS(ODBC_CALL( SQLBindParam, ¶ms ))) -+ { -+ free( tmp ); -+ return FALSE; -+ } -+ } -+ handle->bind_param.param[i].len = tmp; -+ } -+ for (i = 0; i < handle->bind_parameter.count; i++) -+ { -+ UINT8 *tmp; -+ if (!(tmp = realloc( handle->bind_parameter.param[i].len, size * sizeof(UINT64) ))) return FALSE; -+ if (tmp != handle->bind_parameter.param[i].len) -+ { -+ struct SQLBindParameter_params params; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.ParameterNumber = i + 1; -+ params.InputOutputType = handle->bind_parameter.param[i].parameter.input_output_type; -+ params.ValueType = handle->bind_parameter.param[i].parameter.value_type; -+ params.ParameterType = handle->bind_parameter.param[i].parameter.parameter_type; -+ params.ColumnSize = handle->bind_parameter.param[i].parameter.column_size; -+ params.DecimalDigits = handle->bind_parameter.param[i].parameter.decimal_digits; -+ params.ParameterValue = handle->bind_parameter.param[i].parameter.parameter_value; -+ params.BufferLength = handle->bind_parameter.param[i].parameter.buffer_length; -+ params.StrLen_or_Ind = tmp; -+ if (!SUCCESS(ODBC_CALL( SQLBindParameter, ¶ms ))) -+ { -+ free( tmp ); -+ return FALSE; -+ } -+ } -+ handle->bind_parameter.param[i].len = tmp; -+ } -+ return TRUE; -+} -+ -+/************************************************************************* -+ * SQLSetStmtAttr [ODBC32.076] -+ */ -+SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER StringLength) -+{ -+ struct SQLSetStmtAttr_params params = { 0, Attribute, Value, StringLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, -+ StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (SUCCESS((ret = ODBC_CALL( SQLSetStmtAttr, ¶ms )))) -+ { -+ SQLULEN row_count = (SQLULEN)Value; -+ if (Attribute == SQL_ATTR_ROW_ARRAY_SIZE && row_count != handle->row_count) -+ { -+ TRACE( "resizing result length array\n" ); -+ if (!resize_result_lengths( handle, row_count )) ret = SQL_ERROR; -+ else handle->row_count = row_count; -+ } -+ } -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetStmtOption [ODBC32.051] -+ */ -+SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value) -+{ -+ struct SQLSetStmtOption_params params = { 0, Option, Value }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Option %d, Value %s)\n", StatementHandle, Option, debugstr_sqlulen(Value)); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetStmtOption, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSpecialColumns [ODBC32.052] -+ */ -+SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName, -+ SQLSMALLINT NameLength1, SQLCHAR *SchemaName, SQLSMALLINT NameLength2, -+ SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope, -+ SQLUSMALLINT Nullable) -+{ -+ struct SQLSpecialColumns_params params = { 0, IdentifierType, CatalogName, NameLength1, SchemaName, NameLength2, -+ TableName, NameLength3, Scope, Nullable }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d," -+ " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)TableName, NameLength3), NameLength3, Scope, Nullable); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSpecialColumns, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLStatistics [ODBC32.053] -+ */ -+SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -+ SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) -+{ -+ struct SQLStatistics_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3, Unique, Reserved }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" -+ " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)TableName, NameLength3), NameLength3, Unique, Reserved); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLStatistics, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLTables [ODBC32.054] -+ */ -+SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -+ SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4) -+{ -+ struct SQLTables_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3, TableType, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)TableName, NameLength3), NameLength3, -+ debugstr_an((const char *)TableType, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLTables, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLTransact [ODBC32.023] -+ */ -+SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType) -+{ -+ struct SQLTransact_params params = { 0, 0, CompletionType }; -+ struct handle *env = EnvironmentHandle, *con = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle, -+ CompletionType); -+ -+ if (!env || !con) return SQL_INVALID_HANDLE; -+ -+ params.EnvironmentHandle = env->unix_handle; -+ params.ConnectionHandle = con->unix_handle; -+ ret = ODBC_CALL( SQLTransact, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLBrowseConnect [ODBC32.055] -+ */ -+SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectionString, SQLSMALLINT StringLength1, -+ SQLCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength2) -+{ -+ struct SQLBrowseConnect_params params = { 0, InConnectionString, StringLength1, OutConnectionString, BufferLength, -+ StringLength2 }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength, %d, " -+ "StringLength2 %p)\n", ConnectionHandle, debugstr_an((const char *)InConnectionString, StringLength1), -+ StringLength1, OutConnectionString, BufferLength, StringLength2); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLBrowseConnect, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLBulkOperations [ODBC32.078] -+ */ -+SQLRETURN WINAPI SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation) -+{ -+ struct SQLBulkOperations_params params = { 0, Operation }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (SUCCESS(( ret = ODBC_CALL( SQLBulkOperations, ¶ms )))) update_result_lengths( handle, SQL_PARAM_OUTPUT ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLColAttributes [ODBC32.006] -+ */ -+SQLRETURN WINAPI SQLColAttributes(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, -+ SQLPOINTER CharacterAttributes, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, -+ SQLLEN *NumericAttributes) -+{ -+ struct SQLColAttributes_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttributes, BufferLength, -+ StringLength }; -+ struct handle *handle = StatementHandle; -+ INT64 attrs; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttributes %p, BufferLength %d, " -+ "StringLength %p, NumericAttributes %p)\n", StatementHandle, ColumnNumber, FieldIdentifier, -+ CharacterAttributes, BufferLength, StringLength, NumericAttributes); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.NumericAttributes = &attrs; -+ if (SUCCESS((ret = ODBC_CALL( SQLColAttributes, ¶ms )))) *NumericAttributes = attrs; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLColumnPrivileges [ODBC32.056] -+ */ -+SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -+ SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4) -+{ -+ struct SQLColumnPrivileges_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -+ TableName, NameLength3, ColumnName, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)TableName, NameLength3), NameLength3, -+ debugstr_an((const char *)ColumnName, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLColumnPrivileges, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDescribeParam [ODBC32.058] -+ */ -+SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT *DataType, -+ SQLULEN *ParameterSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) -+{ -+ struct SQLDescribeParam_params params = { 0, ParameterNumber, DataType, NULL, DecimalDigits, Nullable }; -+ struct handle *handle = StatementHandle; -+ UINT64 size; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ParameterNumber %d, DataType %p, ParameterSize %p, DecimalDigits %p, Nullable %p)\n", -+ StatementHandle, ParameterNumber, DataType, ParameterSize, DecimalDigits, Nullable); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.ParameterSize = &size; -+ if (SUCCESS((ret = ODBC_CALL( SQLDescribeParam, ¶ms )))) *ParameterSize = size; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLExtendedFetch [ODBC32.059] -+ */ -+SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT StatementHandle, SQLUSMALLINT FetchOrientation, SQLLEN FetchOffset, -+ SQLULEN *RowCount, SQLUSMALLINT *RowStatusArray) -+{ -+ struct SQLExtendedFetch_params params = { 0, FetchOrientation, FetchOffset, NULL, RowStatusArray }; -+ struct handle *handle = StatementHandle; -+ UINT64 count; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, FetchOrientation %d, FetchOffset %s, RowCount %p, RowStatusArray %p)\n", -+ StatementHandle, FetchOrientation, debugstr_sqllen(FetchOffset), RowCount, RowStatusArray); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.RowCount = &count; -+ if (SUCCESS((ret = ODBC_CALL( SQLExtendedFetch, ¶ms )))) *RowCount = count; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLForeignKeys [ODBC32.060] -+ */ -+SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT StatementHandle, SQLCHAR *PkCatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *PkSchemaName, SQLSMALLINT NameLength2, SQLCHAR *PkTableName, -+ SQLSMALLINT NameLength3, SQLCHAR *FkCatalogName, SQLSMALLINT NameLength4, -+ SQLCHAR *FkSchemaName, SQLSMALLINT NameLength5, SQLCHAR *FkTableName, -+ SQLSMALLINT NameLength6) -+{ -+ struct SQLForeignKeys_params params = { 0, PkCatalogName, NameLength1, PkSchemaName, NameLength2, -+ PkTableName, NameLength3, FkCatalogName, NameLength4, -+ FkSchemaName, NameLength5, FkTableName, NameLength6 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, PkCatalogName %s, NameLength1 %d, PkSchemaName %s, NameLength2 %d," -+ " PkTableName %s, NameLength3 %d, FkCatalogName %s, NameLength4 %d, FkSchemaName %s," -+ " NameLength5 %d, FkTableName %s, NameLength6 %d)\n", StatementHandle, -+ debugstr_an((const char *)PkCatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)PkSchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)PkTableName, NameLength3), NameLength3, -+ debugstr_an((const char *)FkCatalogName, NameLength4), NameLength4, -+ debugstr_an((const char *)FkSchemaName, NameLength5), NameLength5, -+ debugstr_an((const char *)FkTableName, NameLength6), NameLength6); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLForeignKeys, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLMoreResults [ODBC32.061] -+ */ -+SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle) -+{ -+ struct SQLMoreResults_params params; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(%p)\n", StatementHandle); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLMoreResults, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLNativeSql [ODBC32.062] -+ */ -+SQLRETURN WINAPI SQLNativeSql(SQLHDBC ConnectionHandle, SQLCHAR *InStatementText, SQLINTEGER TextLength1, -+ SQLCHAR *OutStatementText, SQLINTEGER BufferLength, SQLINTEGER *TextLength2) -+{ -+ struct SQLNativeSql_params params = { 0, InStatementText, TextLength1, OutStatementText, BufferLength, -+ TextLength2 }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, InStatementText %s, TextLength1 %d, OutStatementText %p, BufferLength, %d, " -+ "TextLength2 %p)\n", ConnectionHandle, debugstr_an((const char *)InStatementText, TextLength1), -+ TextLength1, OutStatementText, BufferLength, TextLength2); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLNativeSql, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLNumParams [ODBC32.063] -+ */ -+SQLRETURN WINAPI SQLNumParams(SQLHSTMT StatementHandle, SQLSMALLINT *ParameterCount) -+{ -+ struct SQLNumParams_params params = { 0, ParameterCount }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, pcpar %p)\n", StatementHandle, ParameterCount); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLNumParams, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLParamOptions [ODBC32.064] -+ */ -+SQLRETURN WINAPI SQLParamOptions(SQLHSTMT StatementHandle, SQLULEN RowCount, SQLULEN *RowNumber) -+{ -+ struct SQLParamOptions_params params = { 0, RowCount }; -+ struct handle *handle = StatementHandle; -+ UINT64 row; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, RowCount %s, RowNumber %p)\n", StatementHandle, debugstr_sqlulen(RowCount), -+ RowNumber); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.RowNumber = &row; -+ if (SUCCESS((ret = ODBC_CALL( SQLParamOptions, ¶ms )))) *RowNumber = row; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLPrimaryKeys [ODBC32.065] -+ */ -+SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLPrimaryKeys_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)TableName, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLPrimaryKeys, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLProcedureColumns [ODBC32.066] -+ */ -+SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *ProcName, -+ SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4) -+{ -+ struct SQLProcedureColumns_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -+ ProcName, NameLength3, ColumnName, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -+ " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)ProcName, NameLength3), NameLength3, -+ debugstr_an((const char *)ColumnName, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLProcedureColumns, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLProcedures [ODBC32.067] -+ */ -+SQLRETURN WINAPI SQLProcedures(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *ProcName, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLProcedures_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, -+ NameLength3 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -+ " NameLength3 %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)ProcName, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLProcedures, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetPos [ODBC32.068] -+ */ -+SQLRETURN WINAPI SQLSetPos(SQLHSTMT StatementHandle, SQLSETPOSIROW RowNumber, SQLUSMALLINT Operation, -+ SQLUSMALLINT LockType) -+{ -+ struct SQLSetPos_params params = { 0, RowNumber, Operation, LockType }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, RowNumber %s, Operation %d, LockType %d)\n", StatementHandle, -+ debugstr_sqlulen(RowNumber), Operation, LockType); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (SUCCESS(( ret = ODBC_CALL( SQLSetPos, ¶ms ))) && Operation == SQL_REFRESH) -+ update_result_lengths( handle, SQL_PARAM_OUTPUT ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLTablePrivileges [ODBC32.070] -+ */ -+SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLTablePrivileges_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -+ TableName, NameLength3 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ "NameLength3 %d)\n", StatementHandle, -+ debugstr_an((const char *)CatalogName, NameLength1), NameLength1, -+ debugstr_an((const char *)SchemaName, NameLength2), NameLength2, -+ debugstr_an((const char *)TableName, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLTablePrivileges, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDrivers [ODBC32.071] -+ */ -+SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *DriverDescription, -+ SQLSMALLINT BufferLength1, SQLSMALLINT *DescriptionLength, -+ SQLCHAR *DriverAttributes, SQLSMALLINT BufferLength2, -+ SQLSMALLINT *AttributesLength) -+{ -+ struct SQLDrivers_params params = { 0, Direction, DriverDescription, BufferLength1, DescriptionLength, -+ DriverAttributes, BufferLength2, AttributesLength }; -+ struct handle *handle = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, Direction %d, DriverDescription %p, BufferLength1 %d, DescriptionLength %p," -+ " DriverAttributes %p, BufferLength2 %d, AttributesLength %p)\n", EnvironmentHandle, Direction, -+ DriverDescription, BufferLength1, DescriptionLength, DriverAttributes, BufferLength2, AttributesLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.EnvironmentHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLDrivers, ¶ms ); -+ -+ if (ret == SQL_NO_DATA && Direction == SQL_FETCH_FIRST) -+ ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n"); -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLBindParameter [ODBC32.072] -+ */ -+SQLRETURN WINAPI SQLBindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT InputOutputType, -+ SQLSMALLINT ValueType, SQLSMALLINT ParameterType, SQLULEN ColumnSize, -+ SQLSMALLINT DecimalDigits, SQLPOINTER ParameterValue, SQLLEN BufferLength, -+ SQLLEN *StrLen_or_Ind) -+{ -+ struct SQLBindParameter_params params = { 0, ParameterNumber, InputOutputType, ValueType, ParameterType, -+ ColumnSize, DecimalDigits, ParameterValue, BufferLength }; -+ struct handle *handle = StatementHandle; -+ UINT i = ParameterNumber - 1; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ParameterNumber %d, InputOutputType %d, ValueType %d, ParameterType %d, " -+ "ColumnSize %s, DecimalDigits %d, ParameterValue, %p, BufferLength %s, StrLen_or_Ind %p)\n", -+ StatementHandle, ParameterNumber, InputOutputType, ValueType, ParameterType, debugstr_sqlulen(ColumnSize), -+ DecimalDigits, ParameterValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ if (!ParameterNumber) -+ { -+ FIXME( "parameter 0 not handled\n" ); -+ return SQL_ERROR; -+ } -+ if (!alloc_binding( &handle->bind_parameter, InputOutputType, ParameterNumber, handle->row_count )) return SQL_ERROR; -+ handle->bind_parameter.param[i].parameter.input_output_type = InputOutputType; -+ handle->bind_parameter.param[i].parameter.value_type = ValueType; -+ handle->bind_parameter.param[i].parameter.parameter_type = ParameterType; -+ handle->bind_parameter.param[i].parameter.column_size = ColumnSize; -+ handle->bind_parameter.param[i].parameter.decimal_digits = DecimalDigits; -+ handle->bind_parameter.param[i].parameter.parameter_value = ParameterValue; -+ handle->bind_parameter.param[i].parameter.buffer_length = BufferLength; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.StrLen_or_Ind = handle->bind_parameter.param[i].len; -+ *(UINT64 *)params.StrLen_or_Ind = *StrLen_or_Ind; -+ if (SUCCESS((ret = ODBC_CALL( SQLBindParameter, ¶ms )))) handle->bind_parameter.param[i].ptr = StrLen_or_Ind; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDriverConnect [ODBC32.041] -+ */ -+SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, SQLCHAR *ConnectionString, -+ SQLSMALLINT Length, SQLCHAR *OutConnectionString, SQLSMALLINT BufferLength, -+ SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) -+{ -+ struct SQLDriverConnect_params params = { 0, WindowHandle, ConnectionString, Length, OutConnectionString, -+ BufferLength, Length2, DriverCompletion }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d," -+ " ptr_conn_str_out %p, driver_completion %d)\n", ConnectionHandle, WindowHandle, -+ debugstr_an((const char *)ConnectionString, Length), Length, OutConnectionString, BufferLength, -+ Length2, DriverCompletion); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLDriverConnect, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetScrollOptions [ODBC32.069] -+ */ -+SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT StatementHandle, SQLUSMALLINT Concurrency, SQLLEN KeySetSize, -+ SQLUSMALLINT RowSetSize) -+{ -+ struct SQLSetScrollOptions_params params = { 0, Concurrency, KeySetSize, RowSetSize }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Concurrency %d, KeySetSize %s, RowSetSize %d)\n", StatementHandle, -+ Concurrency, debugstr_sqllen(KeySetSize), RowSetSize); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetScrollOptions, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType) -+{ -+ static const SQLUSMALLINT attrList[] = -+ { -+ SQL_COLUMN_OWNER_NAME, -+ SQL_COLUMN_QUALIFIER_NAME, -+ SQL_COLUMN_LABEL, -+ SQL_COLUMN_NAME, -+ SQL_COLUMN_TABLE_NAME, -+ SQL_COLUMN_TYPE_NAME, -+ SQL_DESC_BASE_COLUMN_NAME, -+ SQL_DESC_BASE_TABLE_NAME, -+ SQL_DESC_CATALOG_NAME, -+ SQL_DESC_LABEL, -+ SQL_DESC_LITERAL_PREFIX, -+ SQL_DESC_LITERAL_SUFFIX, -+ SQL_DESC_LOCAL_TYPE_NAME, -+ SQL_DESC_NAME, -+ SQL_DESC_SCHEMA_NAME, -+ SQL_DESC_TABLE_NAME, -+ SQL_DESC_TYPE_NAME, -+ }; -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(attrList); i++) { -+ if (attrList[i] == fDescType) return TRUE; -+ } -+ return FALSE; -+} -+ -+/************************************************************************* -+ * SQLColAttributesW [ODBC32.106] -+ */ -+SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, -+ SQLPOINTER CharacterAttributes, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, -+ SQLLEN *NumericAttributes) -+{ -+ struct SQLColAttributesW_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttributes, BufferLength, -+ StringLength }; -+ struct handle *handle = StatementHandle; -+ INT64 attrs; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttributes %p, BufferLength %d, " -+ "StringLength %p, NumericAttributes %p)\n", StatementHandle, ColumnNumber, FieldIdentifier, -+ CharacterAttributes, BufferLength, StringLength, NumericAttributes); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.NumericAttributes = &attrs; -+ if (SUCCESS((ret = ODBC_CALL( SQLColAttributesW, ¶ms )))) *NumericAttributes = attrs; -+ -+ if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(FieldIdentifier) && CharacterAttributes && -+ StringLength && *StringLength != wcslen(CharacterAttributes) * 2) -+ { -+ TRACE("CHEAT: resetting name length for ADO\n"); -+ *StringLength = wcslen(CharacterAttributes) * 2; -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLConnectW [ODBC32.107] -+ */ -+SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMALLINT NameLength1, -+ WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLConnectW_params params = { 0, ServerName, NameLength1, UserName, NameLength2, Authentication, -+ NameLength3 }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," -+ " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1, -+ debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLConnectW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDescribeColW [ODBC32.108] -+ */ -+SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, WCHAR *ColumnName, -+ SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, -+ SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) -+{ -+ struct SQLDescribeColW_params params = { 0, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, -+ NULL, DecimalDigits, Nullable }; -+ struct handle *handle = StatementHandle; -+ SQLSMALLINT dummy; -+ UINT64 size; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," -+ " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName, -+ BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (!NameLength) params.NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ -+ params.ColumnSize = &size; -+ if (SUCCESS((ret = ODBC_CALL( SQLDescribeColW, ¶ms )))) -+ { -+ if (ColumnName && NameLength) TRACE("ColumnName %s\n", debugstr_wn(ColumnName, *NameLength)); -+ if (DataType) TRACE("DataType %d\n", *DataType); -+ if (ColumnSize) -+ { -+ *ColumnSize = size; -+ TRACE("ColumnSize %s\n", debugstr_sqlulen(*ColumnSize)); -+ } -+ if (DecimalDigits) TRACE("DecimalDigits %d\n", *DecimalDigits); -+ if (Nullable) TRACE("Nullable %d\n", *Nullable); -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLErrorW [ODBC32.110] -+ */ -+SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, -+ WCHAR *SqlState, SQLINTEGER *NativeError, WCHAR *MessageText, -+ SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) -+{ -+ struct SQLErrorW_params params = { 0, 0, 0, SqlState, NativeError, MessageText, BufferLength, TextLength }; -+ struct handle *env = EnvironmentHandle, *con = ConnectionHandle, *stmt = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, SqlState %p, NativeError %p," -+ " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle, -+ StatementHandle, SqlState, NativeError, MessageText, BufferLength, TextLength); -+ -+ if (env) params.EnvironmentHandle = env->unix_handle; -+ if (con) params.ConnectionHandle = con->unix_handle; -+ if (stmt) params.StatementHandle = stmt->unix_handle; -+ if (SUCCESS((ret = ODBC_CALL( SQLErrorW, ¶ms )))) -+ { -+ TRACE(" SqlState %s\n", debugstr_wn(SqlState, 5)); -+ TRACE(" Error %d\n", *NativeError); -+ TRACE(" MessageText %s\n", debugstr_wn(MessageText, *TextLength)); -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLExecDirectW [ODBC32.111] -+ */ -+SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) -+{ -+ struct SQLExecDirectW_params params = { 0, StatementText, TextLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ debugstr_wn(StatementText, TextLength), TextLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLExecDirectW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetCursorNameW [ODBC32.117] -+ */ -+SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength, -+ SQLSMALLINT *NameLength) -+{ -+ struct SQLGetCursorNameW_params params = { 0, CursorName, BufferLength, NameLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CursorName %p, BufferLength %d, NameLength %p)\n", StatementHandle, CursorName, -+ BufferLength, NameLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetCursorNameW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLPrepareW [ODBC32.119] -+ */ -+SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) -+{ -+ struct SQLPrepareW_params params = { 0, StatementText, TextLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ debugstr_wn(StatementText, TextLength), TextLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLPrepareW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetCursorNameW [ODBC32.121] -+ */ -+SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength) -+{ -+ struct SQLSetCursorNameW_params params = { 0, CursorName, NameLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CursorName %s, NameLength %d)\n", StatementHandle, -+ debugstr_wn(CursorName, NameLength), NameLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetCursorNameW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLColAttributeW [ODBC32.127] -+ */ -+SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, -+ SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute, -+ SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, -+ SQLLEN *NumericAttribute) -+{ -+ struct SQLColAttributeW_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, -+ StringLength }; -+ struct handle *handle = StatementHandle; -+ INT64 attr; -+ SQLRETURN ret; -+ -+ TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d" -+ " StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier, -+ CharacterAttribute, BufferLength, StringLength, NumericAttribute); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ params.NumericAttribute = &attr; -+ if (SUCCESS((ret = ODBC_CALL( SQLColAttributeW, ¶ms ))) && NumericAttribute) *NumericAttribute = attr; -+ -+ if (ret == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier) && -+ StringLength && *StringLength != wcslen(CharacterAttribute) * 2) -+ { -+ TRACE("CHEAT: resetting name length for ADO\n"); -+ *StringLength = wcslen(CharacterAttribute) * 2; -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetConnectAttrW [ODBC32.132] -+ */ -+SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER BufferLength, SQLINTEGER *StringLength) -+{ -+ struct SQLGetConnectAttrW_params params = { 0, Attribute, Value, BufferLength, StringLength }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ Attribute, Value, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetConnectAttrW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDescFieldW [ODBC32.133] -+ */ -+SQLRETURN WINAPI SQLGetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, -+ SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) -+{ -+ struct SQLGetDescFieldW_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength, StringLength }; -+ struct handle *handle = DescriptorHandle; -+ SQLRETURN ret; -+ -+ TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d, StringLength %p)\n", -+ DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.DescriptorHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetDescFieldW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDescRecW [ODBC32.134] -+ */ -+SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, WCHAR *Name, -+ SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type, -+ SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision, -+ SQLSMALLINT *Scale, SQLSMALLINT *Nullable) -+{ -+ struct SQLGetDescRecW_params params = { 0, RecNumber, Name, BufferLength, StringLength, Type, SubType, -+ NULL, Precision, Scale, Nullable }; -+ struct handle *handle = DescriptorHandle; -+ INT64 len; -+ SQLRETURN ret; -+ -+ TRACE("(DescriptorHandle %p, RecNumber %d, Name %p, BufferLength %d, StringLength %p, Type %p, SubType %p," -+ " Length %p, Precision %p, Scale %p, Nullable %p)\n", DescriptorHandle, RecNumber, Name, BufferLength, -+ StringLength, Type, SubType, Length, Precision, Scale, Nullable); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.DescriptorHandle = handle->unix_handle; -+ params.Length = &len; -+ if (SUCCESS((ret = ODBC_CALL( SQLGetDescRecW, ¶ms )))) *Length = len; -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDiagFieldW [ODBC32.135] -+ */ -+SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, -+ SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, -+ SQLSMALLINT *StringLength) -+{ -+ struct SQLGetDiagFieldW_params params = { HandleType, 0, RecNumber, DiagIdentifier, DiagInfo, BufferLength, -+ StringLength }; -+ struct handle *handle = Handle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," -+ " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.Handle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetDiagFieldW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDiagRecW [ODBC32.136] -+ */ -+SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, WCHAR *SqlState, -+ SQLINTEGER *NativeError, WCHAR *MessageText, SQLSMALLINT BufferLength, -+ SQLSMALLINT *TextLength) -+{ -+ struct SQLGetDiagRecW_params params = { HandleType, 0, RecNumber, SqlState, NativeError, MessageText, -+ BufferLength, TextLength }; -+ struct handle *handle = Handle; -+ SQLRETURN ret; -+ -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, SqlState %p, NativeError %p, MessageText %p, BufferLength %d," -+ " TextLength %p)\n", HandleType, Handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, -+ TextLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.Handle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetDiagRecW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetStmtAttrW [ODBC32.138] -+ */ -+SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER BufferLength, SQLINTEGER *StringLength) -+{ -+ struct SQLGetStmtAttrW_params params = { 0, Attribute, Value, BufferLength, StringLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, -+ Attribute, Value, BufferLength, StringLength); -+ -+ if (!Value) -+ { -+ WARN("Unexpected NULL Value return address\n"); -+ return SQL_ERROR; -+ } -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetStmtAttrW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetConnectAttrW [ODBC32.139] -+ */ -+SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER StringLength) -+{ -+ struct SQLSetConnectAttrW_params params = { 0, Attribute, Value, StringLength }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, -+ Value, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetConnectAttrW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLColumnsW [ODBC32.140] -+ */ -+SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSMALLINT NameLength1, -+ WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName, -+ SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4) -+{ -+ struct SQLColumnsW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3, ColumnName, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -+ debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, -+ debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(ColumnName, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLColumnsW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDriverConnectW [ODBC32.141] -+ */ -+SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, WCHAR *InConnectionString, -+ SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength, -+ SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) -+{ -+ struct SQLDriverConnectW_params params = { 0, WindowHandle, InConnectionString, Length, OutConnectionString, -+ BufferLength, Length2, DriverCompletion }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," -+ " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -+ debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2, -+ DriverCompletion); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLDriverConnectW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetConnectOptionW [ODBC32.142] -+ */ -+SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value) -+{ -+ struct SQLGetConnectOptionW_params params = { 0, Option, Value }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Option %d, Value %p)\n", ConnectionHandle, Option, Value); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetConnectOptionW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetInfoW [ODBC32.145] -+ */ -+SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, -+ SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) -+{ -+ struct SQLGetInfoW_params params = { 0, InfoType, InfoValue, BufferLength, StringLength }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ InfoType, InfoValue, BufferLength, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetInfoW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetTypeInfoW [ODBC32.147] -+ */ -+SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType) -+{ -+ struct SQLGetTypeInfoW_params params = { 0, DataType }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLGetTypeInfoW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetConnectOptionW [ODBC32.150] -+ */ -+SQLRETURN WINAPI SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value) -+{ -+ struct SQLSetConnectOptionW_params params = { 0, Option, Value }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, Option %d, Value %s)\n", ConnectionHandle, Option, debugstr_sqllen(Value)); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetConnectOptionW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSpecialColumnsW [ODBC32.152] -+ */ -+SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, -+ SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, SQLWCHAR *SchemaName, -+ SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3, -+ SQLUSMALLINT Scope, SQLUSMALLINT Nullable) -+{ -+ struct SQLSpecialColumnsW_params params = { 0, IdentifierType, CatalogName, NameLength1, SchemaName, NameLength2, -+ TableName, NameLength3, Scope, Nullable }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, IdentifierType %d, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d," -+ " TableName %s, NameLength3 %d, Scope %d, Nullable %d)\n", StatementHandle, IdentifierType, -+ debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, -+ debugstr_wn(TableName, NameLength3), NameLength3, Scope, Nullable); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSpecialColumnsW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLStatisticsW [ODBC32.153] -+ */ -+SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -+ SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) -+{ -+ struct SQLStatisticsW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3, Unique, Reserved }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" -+ " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle, -+ debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, -+ debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLStatisticsW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLTablesW [ODBC32.154] -+ */ -+SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -+ SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4) -+{ -+ struct SQLTablesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3, TableType, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d, TableType %s, NameLength4 %d)\n", StatementHandle, -+ debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, -+ debugstr_wn(TableName, NameLength3), NameLength3, debugstr_wn(TableType, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLTablesW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLBrowseConnectW [ODBC32.155] -+ */ -+SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnectionString, SQLSMALLINT StringLength1, -+ SQLWCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength2) -+{ -+ struct SQLBrowseConnectW_params params = { 0, InConnectionString, StringLength1, OutConnectionString, -+ BufferLength, StringLength2 }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, InConnectionString %s, StringLength1 %d, OutConnectionString %p, BufferLength %d, " -+ "StringLength2 %p)\n", ConnectionHandle, debugstr_wn(InConnectionString, StringLength1), StringLength1, -+ OutConnectionString, BufferLength, StringLength2); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLBrowseConnectW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLColumnPrivilegesW [ODBC32.156] -+ */ -+SQLRETURN WINAPI SQLColumnPrivilegesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -+ SQLSMALLINT NameLength3, SQLWCHAR *ColumnName, SQLSMALLINT NameLength4) -+{ -+ struct SQLColumnPrivilegesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -+ TableName, NameLength3, ColumnName, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d, ColumnName %s, NameLength3 %d)\n", StatementHandle, -+ debugstr_wn(CatalogName, NameLength1), NameLength1, -+ debugstr_wn(SchemaName, NameLength2), NameLength2, -+ debugstr_wn(TableName, NameLength3), NameLength3, -+ debugstr_wn(ColumnName, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLColumnPrivilegesW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDataSourcesW [ODBC32.157] -+ */ -+SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, WCHAR *ServerName, -+ SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description, -+ SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) -+{ -+ struct SQLDataSourcesW_params params = { 0, Direction, ServerName, BufferLength1, NameLength1, Description, -+ BufferLength2, NameLength2 }; -+ struct handle *handle = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," -+ " BufferLength2 %d, NameLength2 %p)\n", EnvironmentHandle, Direction, ServerName, BufferLength1, -+ NameLength1, Description, BufferLength2, NameLength2); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.EnvironmentHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLDataSourcesW, ¶ms ); -+ -+ if (ret >= 0 && TRACE_ON(odbc)) -+ { -+ if (ServerName && NameLength1 && *NameLength1 > 0) -+ TRACE(" DataSource %s", debugstr_wn(ServerName, *NameLength1)); -+ if (Description && NameLength2 && *NameLength2 > 0) -+ TRACE(" Description %s", debugstr_wn(Description, *NameLength2)); -+ TRACE("\n"); -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLForeignKeysW [ODBC32.160] -+ */ -+SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT StatementHandle, SQLWCHAR *PkCatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *PkSchemaName, SQLSMALLINT NameLength2, SQLWCHAR *PkTableName, -+ SQLSMALLINT NameLength3, SQLWCHAR *FkCatalogName, SQLSMALLINT NameLength4, -+ SQLWCHAR *FkSchemaName, SQLSMALLINT NameLength5, SQLWCHAR *FkTableName, -+ SQLSMALLINT NameLength6) -+{ -+ struct SQLForeignKeysW_params params = { 0, PkCatalogName, NameLength1, PkSchemaName, NameLength2, -+ PkTableName, NameLength2, FkCatalogName, NameLength3, -+ FkSchemaName, NameLength5, FkTableName, NameLength6 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, PkCatalogName %s, NameLength1 %d, PkSchemaName %s, NameLength2 %d," -+ " PkTableName %s, NameLength3 %d, FkCatalogName %s, NameLength4 %d, FkSchemaName %s," -+ " NameLength5 %d, FkTableName %s, NameLength6 %d)\n", StatementHandle, -+ debugstr_wn(PkCatalogName, NameLength1), NameLength1, -+ debugstr_wn(PkSchemaName, NameLength2), NameLength2, -+ debugstr_wn(PkTableName, NameLength3), NameLength3, -+ debugstr_wn(FkCatalogName, NameLength4), NameLength4, -+ debugstr_wn(FkSchemaName, NameLength5), NameLength5, -+ debugstr_wn(FkTableName, NameLength6), NameLength6); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLForeignKeysW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLNativeSqlW [ODBC32.162] -+ */ -+SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC ConnectionHandle, SQLWCHAR *InStatementText, SQLINTEGER TextLength1, -+ SQLWCHAR *OutStatementText, SQLINTEGER BufferLength, SQLINTEGER *TextLength2) -+{ -+ struct SQLNativeSqlW_params params = { 0, InStatementText, TextLength1, OutStatementText, BufferLength, -+ TextLength2 }; -+ struct handle *handle = ConnectionHandle; -+ SQLRETURN ret; -+ -+ TRACE("(ConnectionHandle %p, InStatementText %s, TextLength1 %d, OutStatementText %p, BufferLength %d, " -+ "TextLength2 %p)\n", ConnectionHandle, debugstr_wn(InStatementText, TextLength1), TextLength1, -+ OutStatementText, BufferLength, TextLength2); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.ConnectionHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLNativeSqlW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLPrimaryKeysW [ODBC32.165] -+ */ -+SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLPrimaryKeysW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength2 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d)\n", StatementHandle, -+ debugstr_wn(CatalogName, NameLength1), NameLength1, -+ debugstr_wn(SchemaName, NameLength2), NameLength2, -+ debugstr_wn(TableName, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLPrimaryKeysW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLProcedureColumnsW [ODBC32.166] -+ */ -+SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *ProcName, -+ SQLSMALLINT NameLength3, SQLWCHAR *ColumnName, SQLSMALLINT NameLength4 ) -+{ -+ struct SQLProcedureColumnsW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, -+ ProcName, NameLength3, ColumnName, NameLength4 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -+ " NameLength3 %d, ColumnName %s, NameLength4 %d)\n", StatementHandle, -+ debugstr_wn(CatalogName, NameLength1), NameLength1, -+ debugstr_wn(SchemaName, NameLength2), NameLength2, -+ debugstr_wn(ProcName, NameLength3), NameLength3, -+ debugstr_wn(ColumnName, NameLength4), NameLength4); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLProcedureColumnsW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLProceduresW [ODBC32.167] -+ */ -+SQLRETURN WINAPI SQLProceduresW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *ProcName, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLProceduresW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, -+ NameLength3 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, ProcName %s," -+ " NameLength3 %d)\n", StatementHandle, debugstr_wn(CatalogName, NameLength1), NameLength1, -+ debugstr_wn(SchemaName, NameLength2), NameLength2, debugstr_wn(ProcName, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLProceduresW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLTablePrivilegesW [ODBC32.170] -+ */ -+SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, -+ SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, -+ SQLSMALLINT NameLength3) -+{ -+ struct SQLTablePrivilegesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, -+ NameLength3 }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d, SchemaName %s, NameLength2 %d, TableName %s," -+ " NameLength3 %d)\n", StatementHandle, debugstr_wn(CatalogName, NameLength1), NameLength1, -+ debugstr_wn(SchemaName, NameLength2), NameLength2, debugstr_wn(TableName, NameLength3), NameLength3); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLTablePrivilegesW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLDriversW [ODBC32.171] -+ */ -+SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLWCHAR *DriverDescription, -+ SQLSMALLINT BufferLength1, SQLSMALLINT *DescriptionLength, SQLWCHAR *DriverAttributes, -+ SQLSMALLINT BufferLength2, SQLSMALLINT *AttributesLength) -+{ -+ struct SQLDriversW_params params = { 0, Direction, DriverDescription, BufferLength1, DescriptionLength, -+ DriverAttributes, BufferLength2, AttributesLength }; -+ struct handle *handle = EnvironmentHandle; -+ SQLRETURN ret; -+ -+ TRACE("(EnvironmentHandle %p, Direction %d, DriverDescription %p, BufferLength1 %d, DescriptionLength %p," -+ " DriverAttributes %p, BufferLength2 %d, AttributesLength %p)\n", EnvironmentHandle, Direction, -+ DriverDescription, BufferLength1, DescriptionLength, DriverAttributes, BufferLength2, AttributesLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.EnvironmentHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLDriversW, ¶ms ); -+ -+ if (ret == SQL_NO_DATA && Direction == SQL_FETCH_FIRST) -+ ERR_(winediag)("No ODBC drivers could be found. Check the settings for your libodbc provider.\n"); -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetDescFieldW [ODBC32.173] -+ */ -+SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, -+ SQLPOINTER Value, SQLINTEGER BufferLength) -+{ -+ struct SQLSetDescFieldW_params params = { 0, RecNumber, FieldIdentifier, Value, BufferLength }; -+ struct handle *handle = DescriptorHandle; -+ SQLRETURN ret; -+ -+ TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -+ RecNumber, FieldIdentifier, Value, BufferLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.DescriptorHandle = handle->unix_handle; -+ ret = ODBC_CALL( SQLSetDescFieldW, ¶ms ); -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLSetStmtAttrW [ODBC32.176] -+ */ -+SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, -+ SQLINTEGER StringLength) -+{ -+ struct SQLSetStmtAttrW_params params = { 0, Attribute, Value, StringLength }; -+ struct handle *handle = StatementHandle; -+ SQLRETURN ret; -+ -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, -+ Value, StringLength); -+ -+ if (!handle) return SQL_INVALID_HANDLE; -+ -+ params.StatementHandle = handle->unix_handle; -+ if (SUCCESS((ret = ODBC_CALL( SQLSetStmtAttrW, ¶ms )))) -+ { -+ SQLULEN row_count = (SQLULEN)Value; -+ if (Attribute == SQL_ATTR_ROW_ARRAY_SIZE && row_count != handle->row_count) -+ { -+ TRACE( "resizing result length array\n" ); -+ if (!resize_result_lengths( handle, row_count )) ret = SQL_ERROR; -+ else handle->row_count = row_count; -+ } -+ } -+ -+ TRACE("Returning %d\n", ret); -+ return ret; -+} -+ -+/************************************************************************* -+ * SQLGetDiagRecA [ODBC32.236] -+ */ -+SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, -+ SQLCHAR *SqlState, SQLINTEGER *NativeError, SQLCHAR *MessageText, -+ SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) -+{ -+ return SQLGetDiagRec( HandleType, Handle, RecNumber, SqlState, NativeError, MessageText, BufferLength, -+ TextLength ); -+} -+ -+/*********************************************************************** -+ * DllMain [Internal] Initializes the internal 'ODBC32.DLL'. -+ */ -+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) -+{ -+ TRACE("proxy ODBC: %p,%lx,%p\n", hinstDLL, reason, reserved); -+ -+ switch (reason) -+ { -+ case DLL_PROCESS_ATTACH: -+ DisableThreadLibraryCalls(hinstDLL); -+ if (!__wine_init_unix_call()) -+ { -+ if (WINE_UNIX_CALL( process_attach, NULL )) __wine_unixlib_handle = 0; -+ } -+ IsWow64Process( GetCurrentProcess(), &is_wow64 ); -+ break; -+ -+ case DLL_PROCESS_DETACH: -+ if (reserved) break; -+ } -+ -+ return TRUE; -+} -diff --git a/dlls/wineodbc/rsrc.rc b/dlls/wineodbc/rsrc.rc -new file mode 100644 -index 00000000000..b8fad8fe35b ---- /dev/null -+++ b/dlls/wineodbc/rsrc.rc -@@ -0,0 +1,26 @@ -+/* -+ * Copyright 2014 Hans Leidekker for CodeWeavers -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#define WINE_FILEDESCRIPTION_STR "Wine ODBC Library" -+#define WINE_FILENAME_STR "odbc32.dll" -+#define WINE_FILEVERSION 3,520,6301,0 -+#define WINE_FILEVERSION_STR "3.520.6301.0" -+#define WINE_PRODUCTVERSION 3,520,6301,0 -+#define WINE_PRODUCTVERSION_STR "3.520.6301.0" -+ -+#include "wine/wine_common_ver.rc" -diff --git a/dlls/odbc32/unixlib.c b/dlls/wineodbc/unixlib.c -similarity index 100% -rename from dlls/odbc32/unixlib.c -rename to dlls/wineodbc/unixlib.c -diff --git a/dlls/wineodbc/unixlib.h b/dlls/wineodbc/unixlib.h -new file mode 100644 -index 00000000000..b1f42363429 ---- /dev/null -+++ b/dlls/wineodbc/unixlib.h -@@ -0,0 +1,1291 @@ -+/* -+ * Win32 ODBC functions -+ * -+ * Copyright 1999 Xiang Li, Corel Corporation -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ * -+ * NOTES: -+ * Proxy ODBC driver manager. This manager delegates all ODBC -+ * calls to a real ODBC driver manager named by the environment -+ * variable LIB_ODBC_DRIVER_MANAGER, or to libodbc.so if the -+ * variable is not set. -+ */ -+ -+#include -+#include "windef.h" -+#include "winbase.h" -+#include "wine/unixlib.h" -+ -+static inline BOOL SUCCESS( SQLRETURN ret ) { return ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO; } -+ -+enum sql_funcs -+{ -+ process_attach, -+ unix_SQLAllocConnect, -+ unix_SQLAllocEnv, -+ unix_SQLAllocHandle, -+ unix_SQLAllocHandleStd, -+ unix_SQLAllocStmt, -+ unix_SQLBindCol, -+ unix_SQLBindParam, -+ unix_SQLBindParameter, -+ unix_SQLBrowseConnect, -+ unix_SQLBrowseConnectW, -+ unix_SQLBulkOperations, -+ unix_SQLCancel, -+ unix_SQLCloseCursor, -+ unix_SQLColAttribute, -+ unix_SQLColAttributeW, -+ unix_SQLColAttributes, -+ unix_SQLColAttributesW, -+ unix_SQLColumnPrivileges, -+ unix_SQLColumnPrivilegesW, -+ unix_SQLColumns, -+ unix_SQLColumnsW, -+ unix_SQLConnect, -+ unix_SQLConnectW, -+ unix_SQLCopyDesc, -+ unix_SQLDataSources, -+ unix_SQLDataSourcesW, -+ unix_SQLDescribeCol, -+ unix_SQLDescribeColW, -+ unix_SQLDescribeParam, -+ unix_SQLDisconnect, -+ unix_SQLDriverConnect, -+ unix_SQLDriverConnectW, -+ unix_SQLDrivers, -+ unix_SQLDriversW, -+ unix_SQLEndTran, -+ unix_SQLError, -+ unix_SQLErrorW, -+ unix_SQLExecDirect, -+ unix_SQLExecDirectW, -+ unix_SQLExecute, -+ unix_SQLExtendedFetch, -+ unix_SQLFetch, -+ unix_SQLFetchScroll, -+ unix_SQLForeignKeys, -+ unix_SQLForeignKeysW, -+ unix_SQLFreeConnect, -+ unix_SQLFreeEnv, -+ unix_SQLFreeHandle, -+ unix_SQLFreeStmt, -+ unix_SQLGetConnectAttr, -+ unix_SQLGetConnectAttrW, -+ unix_SQLGetConnectOption, -+ unix_SQLGetConnectOptionW, -+ unix_SQLGetCursorName, -+ unix_SQLGetCursorNameW, -+ unix_SQLGetData, -+ unix_SQLGetDescField, -+ unix_SQLGetDescFieldW, -+ unix_SQLGetDescRec, -+ unix_SQLGetDescRecW, -+ unix_SQLGetDiagField, -+ unix_SQLGetDiagFieldW, -+ unix_SQLGetDiagRec, -+ unix_SQLGetDiagRecW, -+ unix_SQLGetEnvAttr, -+ unix_SQLGetFunctions, -+ unix_SQLGetInfo, -+ unix_SQLGetInfoW, -+ unix_SQLGetStmtAttr, -+ unix_SQLGetStmtAttrW, -+ unix_SQLGetStmtOption, -+ unix_SQLGetTypeInfo, -+ unix_SQLGetTypeInfoW, -+ unix_SQLMoreResults, -+ unix_SQLNativeSql, -+ unix_SQLNativeSqlW, -+ unix_SQLNumParams, -+ unix_SQLNumResultCols, -+ unix_SQLParamData, -+ unix_SQLParamOptions, -+ unix_SQLPrepare, -+ unix_SQLPrepareW, -+ unix_SQLPrimaryKeys, -+ unix_SQLPrimaryKeysW, -+ unix_SQLProcedureColumns, -+ unix_SQLProcedureColumnsW, -+ unix_SQLProcedures, -+ unix_SQLProceduresW, -+ unix_SQLPutData, -+ unix_SQLRowCount, -+ unix_SQLSetConnectAttr, -+ unix_SQLSetConnectAttrW, -+ unix_SQLSetConnectOption, -+ unix_SQLSetConnectOptionW, -+ unix_SQLSetCursorName, -+ unix_SQLSetCursorNameW, -+ unix_SQLSetDescField, -+ unix_SQLSetDescFieldW, -+ unix_SQLSetDescRec, -+ unix_SQLSetEnvAttr, -+ unix_SQLSetParam, -+ unix_SQLSetPos, -+ unix_SQLSetScrollOptions, -+ unix_SQLSetStmtAttr, -+ unix_SQLSetStmtAttrW, -+ unix_SQLSetStmtOption, -+ unix_SQLSpecialColumns, -+ unix_SQLSpecialColumnsW, -+ unix_SQLStatistics, -+ unix_SQLStatisticsW, -+ unix_SQLTablePrivileges, -+ unix_SQLTablePrivilegesW, -+ unix_SQLTables, -+ unix_SQLTablesW, -+ unix_SQLTransact, -+ unix_funcs_count -+}; -+ -+struct bind_col_args -+{ -+ INT16 target_type; -+ void *target_value; -+ INT64 buffer_length; -+}; -+ -+struct bind_param_args -+{ -+ INT16 value_type; -+ INT16 parameter_type; -+ UINT64 length_precision; -+ INT16 parameter_scale; -+ void *parameter_value; -+}; -+ -+struct bind_parameter_args -+{ -+ INT16 input_output_type; -+ INT16 value_type; -+ INT16 parameter_type; -+ UINT64 column_size; -+ INT16 decimal_digits; -+ void *parameter_value; -+ INT64 buffer_length; -+}; -+ -+struct param -+{ -+ INT16 type; -+ union -+ { -+ struct bind_col_args col; -+ struct bind_param_args param; -+ struct bind_parameter_args parameter; -+ }; -+ UINT8 *len; /* result length array stored in Unix lib */ -+ void *ptr; /* result length ptr passed by client */ -+}; -+ -+struct param_binding -+{ -+ UINT32 count; -+ struct param *param; -+}; -+ -+struct handle -+{ -+ UINT64 unix_handle; -+ struct param_binding bind_col; -+ struct param_binding bind_param; -+ struct param_binding bind_parameter; -+ UINT32 row_count; /* number of rows returned by SQLFetch() */ -+}; -+ -+struct SQLAllocConnect_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT64 ConnectionHandle; -+}; -+ -+struct SQLAllocEnv_params -+{ -+ UINT64 EnvironmentHandle; -+}; -+ -+struct SQLAllocHandle_params -+{ -+ INT16 HandleType; -+ UINT64 InputHandle; -+ UINT64 OutputHandle; -+}; -+ -+struct SQLAllocHandleStd_params -+{ -+ INT16 HandleType; -+ UINT64 InputHandle; -+ UINT64 OutputHandle; -+}; -+ -+struct SQLAllocStmt_params -+{ -+ UINT64 ConnectionHandle; -+ UINT64 StatementHandle; -+}; -+ -+struct SQLBindCol_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ INT16 TargetType; -+ void *TargetValue; -+ INT64 BufferLength; -+ void *StrLen_or_Ind; -+}; -+ -+struct SQLBindParam_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ParameterNumber; -+ INT16 ValueType; -+ INT16 ParameterType; -+ UINT64 LengthPrecision; -+ INT16 ParameterScale; -+ void *ParameterValue; -+ void *StrLen_or_Ind; -+}; -+ -+struct SQLBindParameter_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ParameterNumber; -+ INT16 InputOutputType; -+ INT16 ValueType; -+ INT16 ParameterType; -+ UINT64 ColumnSize; -+ INT16 DecimalDigits; -+ void *ParameterValue; -+ INT64 BufferLength; -+ void *StrLen_or_Ind; -+}; -+ -+struct SQLBrowseConnect_params -+{ -+ UINT64 ConnectionHandle; -+ UCHAR *InConnectionString; -+ INT16 StringLength1; -+ UCHAR *OutConnectionString; -+ INT16 BufferLength; -+ INT16 *StringLength2; -+}; -+ -+struct SQLBrowseConnectW_params -+{ -+ UINT64 ConnectionHandle; -+ WCHAR *InConnectionString; -+ INT16 StringLength1; -+ WCHAR *OutConnectionString; -+ INT16 BufferLength; -+ INT16 *StringLength2; -+}; -+ -+struct SQLBulkOperations_params -+{ -+ UINT64 StatementHandle; -+ INT16 Operation; -+}; -+ -+struct SQLCancel_params -+{ -+ UINT64 StatementHandle; -+}; -+ -+struct SQLCloseCursor_params -+{ -+ UINT64 StatementHandle; -+}; -+ -+struct SQLColAttribute_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ UINT16 FieldIdentifier; -+ void *CharacterAttribute; -+ INT16 BufferLength; -+ INT16 *StringLength; -+ INT64 *NumericAttribute; -+}; -+ -+struct SQLColAttributeW_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ UINT16 FieldIdentifier; -+ void *CharacterAttribute; -+ INT16 BufferLength; -+ INT16 *StringLength; -+ INT64 *NumericAttribute; -+}; -+ -+struct SQLColAttributes_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ UINT16 FieldIdentifier; -+ void *CharacterAttributes; -+ INT16 BufferLength; -+ INT16 *StringLength; -+ INT64 *NumericAttributes; -+}; -+ -+struct SQLColAttributesW_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ UINT16 FieldIdentifier; -+ void *CharacterAttributes; -+ INT16 BufferLength; -+ INT16 *StringLength; -+ INT64 *NumericAttributes; -+}; -+ -+struct SQLColumnPrivileges_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *TableName; -+ INT16 NameLength3; -+ UCHAR *ColumnName; -+ INT16 NameLength4; -+}; -+ -+struct SQLColumnPrivilegesW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *TableName; -+ INT16 NameLength3; -+ WCHAR *ColumnName; -+ INT16 NameLength4; -+}; -+ -+struct SQLColumns_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *TableName; -+ INT16 NameLength3; -+ UCHAR *ColumnName; -+ INT16 NameLength4; -+}; -+ -+struct SQLColumnsW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *TableName; -+ INT16 NameLength3; -+ WCHAR *ColumnName; -+ INT16 NameLength4; -+}; -+ -+struct SQLConnect_params -+{ -+ UINT64 ConnectionHandle; -+ UCHAR *ServerName; -+ INT16 NameLength1; -+ UCHAR *UserName; -+ INT16 NameLength2; -+ UCHAR *Authentication; -+ INT16 NameLength3; -+}; -+ -+struct SQLConnectW_params -+{ -+ UINT64 ConnectionHandle; -+ WCHAR *ServerName; -+ INT16 NameLength1; -+ WCHAR *UserName; -+ INT16 NameLength2; -+ WCHAR *Authentication; -+ INT16 NameLength3; -+}; -+ -+struct SQLCopyDesc_params -+{ -+ UINT64 SourceDescHandle; -+ UINT64 TargetDescHandle; -+}; -+ -+struct SQLDataSources_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT16 Direction; -+ UCHAR *ServerName; -+ INT16 BufferLength1; -+ INT16 *NameLength1; -+ UCHAR *Description; -+ INT16 BufferLength2; -+ INT16 *NameLength2; -+}; -+ -+struct SQLDataSourcesW_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT16 Direction; -+ WCHAR *ServerName; -+ INT16 BufferLength1; -+ INT16 *NameLength1; -+ WCHAR *Description; -+ INT16 BufferLength2; -+ INT16 *NameLength2; -+}; -+ -+struct SQLDescribeCol_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ UCHAR *ColumnName; -+ INT16 BufferLength; -+ INT16 *NameLength; -+ INT16 *DataType; -+ UINT64 *ColumnSize; -+ INT16 *DecimalDigits; -+ INT16 *Nullable; -+}; -+ -+struct SQLDescribeColW_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ WCHAR *ColumnName; -+ INT16 BufferLength; -+ INT16 *NameLength; -+ INT16 *DataType; -+ UINT64 *ColumnSize; -+ INT16 *DecimalDigits; -+ INT16 *Nullable; -+}; -+ -+struct SQLDescribeParam_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ParameterNumber; -+ INT16 *DataType; -+ UINT64 *ParameterSize; -+ INT16 *DecimalDigits; -+ INT16 *Nullable; -+}; -+ -+struct SQLDisconnect_params -+{ -+ UINT64 ConnectionHandle; -+}; -+ -+struct SQLDriverConnect_params -+{ -+ UINT64 ConnectionHandle; -+ void *WindowHandle; -+ UCHAR *ConnectionString; -+ INT16 Length; -+ UCHAR *OutConnectionString; -+ INT16 BufferLength; -+ INT16 *Length2; -+ UINT16 DriverCompletion; -+}; -+ -+struct SQLDriverConnectW_params -+{ -+ UINT64 ConnectionHandle; -+ void *WindowHandle; -+ WCHAR *InConnectionString; -+ INT16 Length; -+ WCHAR *OutConnectionString; -+ INT16 BufferLength; -+ INT16 *Length2; -+ UINT16 DriverCompletion; -+}; -+ -+struct SQLDrivers_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT16 Direction; -+ UCHAR *DriverDescription; -+ INT16 BufferLength1; -+ INT16 *DescriptionLength; -+ UCHAR *DriverAttributes; -+ INT16 BufferLength2; -+ INT16 *AttributesLength; -+}; -+ -+struct SQLDriversW_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT16 Direction; -+ WCHAR *DriverDescription; -+ INT16 BufferLength1; -+ INT16 *DescriptionLength; -+ WCHAR *DriverAttributes; -+ INT16 BufferLength2; -+ INT16 *AttributesLength; -+}; -+ -+struct SQLEndTran_params -+{ -+ INT16 HandleType; -+ UINT64 Handle; -+ INT16 CompletionType; -+}; -+ -+struct SQLError_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT64 ConnectionHandle; -+ UINT64 StatementHandle; -+ UCHAR *SqlState; -+ INT32 *NativeError; -+ UCHAR *MessageText; -+ INT16 BufferLength; -+ INT16 *TextLength; -+}; -+ -+struct SQLErrorW_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT64 ConnectionHandle; -+ UINT64 StatementHandle; -+ WCHAR *SqlState; -+ INT32 *NativeError; -+ WCHAR *MessageText; -+ INT16 BufferLength; -+ INT16 *TextLength; -+}; -+ -+struct SQLExecDirect_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *StatementText; -+ INT32 TextLength; -+}; -+ -+struct SQLExecDirectW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *StatementText; -+ INT32 TextLength; -+}; -+ -+struct SQLExecute_params -+{ -+ UINT64 StatementHandle; -+}; -+ -+struct SQLExtendedFetch_params -+{ -+ UINT64 StatementHandle; -+ UINT16 FetchOrientation; -+ INT64 FetchOffset; -+ UINT64 *RowCount; -+ UINT16 *RowStatusArray; -+}; -+ -+struct SQLFetch_params -+{ -+ UINT64 StatementHandle; -+}; -+ -+struct SQLFetchScroll_params -+{ -+ UINT64 StatementHandle; -+ INT16 FetchOrientation; -+ INT64 FetchOffset; -+}; -+ -+struct SQLForeignKeys_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *PkCatalogName; -+ INT16 NameLength1; -+ UCHAR *PkSchemaName; -+ INT16 NameLength2; -+ UCHAR *PkTableName; -+ INT16 NameLength3; -+ UCHAR *FkCatalogName; -+ INT16 NameLength4; -+ UCHAR *FkSchemaName; -+ INT16 NameLength5; -+ UCHAR *FkTableName; -+ INT16 NameLength6; -+}; -+ -+struct SQLForeignKeysW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *PkCatalogName; -+ INT16 NameLength1; -+ WCHAR *PkSchemaName; -+ INT16 NameLength2; -+ WCHAR *PkTableName; -+ INT16 NameLength3; -+ WCHAR *FkCatalogName; -+ INT16 NameLength4; -+ WCHAR *FkSchemaName; -+ INT16 NameLength5; -+ WCHAR *FkTableName; -+ INT16 NameLength6; -+}; -+ -+struct SQLFreeConnect_params -+{ -+ UINT64 ConnectionHandle; -+}; -+ -+struct SQLFreeEnv_params -+{ -+ UINT64 EnvironmentHandle; -+}; -+ -+struct SQLFreeHandle_params -+{ -+ INT16 HandleType; -+ UINT64 Handle; -+}; -+ -+struct SQLFreeStmt_params -+{ -+ UINT64 StatementHandle; -+ UINT16 Option; -+}; -+ -+struct SQLGetConnectAttr_params -+{ -+ UINT64 ConnectionHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 BufferLength; -+ INT32 *StringLength; -+}; -+ -+struct SQLGetConnectAttrW_params -+{ -+ UINT64 ConnectionHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 BufferLength; -+ INT32 *StringLength; -+}; -+ -+struct SQLGetConnectOption_params -+{ -+ UINT64 ConnectionHandle; -+ UINT16 Option; -+ void *Value; -+}; -+ -+struct SQLGetConnectOptionW_params -+{ -+ UINT64 ConnectionHandle; -+ INT16 Option; -+ void *Value; -+}; -+ -+struct SQLGetCursorName_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CursorName; -+ INT16 BufferLength; -+ INT16 *NameLength; -+}; -+ -+struct SQLGetCursorNameW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CursorName; -+ INT16 BufferLength; -+ INT16 *NameLength; -+}; -+ -+struct SQLGetData_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ColumnNumber; -+ INT16 TargetType; -+ void *TargetValue; -+ INT64 BufferLength; -+ INT64 *StrLen_or_Ind; -+}; -+ -+struct SQLGetDescField_params -+{ -+ UINT64 DescriptorHandle; -+ INT16 RecNumber; -+ INT16 FieldIdentifier; -+ void *Value; -+ INT32 BufferLength; -+ INT32 *StringLength; -+} -+; -+struct SQLGetDescFieldW_params -+{ -+ UINT64 DescriptorHandle; -+ INT16 RecNumber; -+ INT16 FieldIdentifier; -+ void *Value; -+ INT32 BufferLength; -+ INT32 *StringLength; -+}; -+ -+struct SQLGetDescRec_params -+{ -+ UINT64 DescriptorHandle; -+ INT16 RecNumber; -+ UCHAR *Name; -+ INT16 BufferLength; -+ INT16 *StringLength; -+ INT16 *Type; -+ INT16 *SubType; -+ INT64 *Length; -+ INT16 *Precision; -+ INT16 *Scale; -+ INT16 *Nullable; -+}; -+ -+struct SQLGetDescRecW_params -+{ -+ UINT64 DescriptorHandle; -+ INT16 RecNumber; -+ WCHAR *Name; -+ INT16 BufferLength; -+ INT16 *StringLength; -+ INT16 *Type; -+ INT16 *SubType; -+ INT64 *Length; -+ INT16 *Precision; -+ INT16 *Scale; -+ INT16 *Nullable; -+}; -+ -+struct SQLGetDiagField_params -+{ -+ INT16 HandleType; -+ UINT64 Handle; -+ INT16 RecNumber; -+ INT16 DiagIdentifier; -+ void *DiagInfo; -+ INT16 BufferLength; -+ INT16 *StringLength; -+}; -+ -+struct SQLGetDiagFieldW_params -+{ -+ INT16 HandleType; -+ UINT64 Handle; -+ INT16 RecNumber; -+ INT16 DiagIdentifier; -+ void *DiagInfo; -+ INT16 BufferLength; -+ INT16 *StringLength; -+}; -+ -+struct SQLGetDiagRec_params -+{ -+ INT16 HandleType; -+ UINT64 Handle; -+ INT16 RecNumber; -+ UCHAR *SqlState; -+ INT32 *NativeError; -+ UCHAR *MessageText; -+ INT16 BufferLength; -+ INT16 *TextLength; -+}; -+ -+struct SQLGetDiagRecW_params -+{ -+ INT16 HandleType; -+ UINT64 Handle; -+ INT16 RecNumber; -+ WCHAR *SqlState; -+ INT32 *NativeError; -+ WCHAR *MessageText; -+ INT16 BufferLength; -+ INT16 *TextLength; -+}; -+ -+struct SQLGetEnvAttr_params -+{ -+ UINT64 EnvironmentHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 BufferLength; -+ INT32 *StringLength; -+}; -+ -+struct SQLGetFunctions_params -+{ -+ UINT64 ConnectionHandle; -+ UINT16 FunctionId; -+ UINT16 *Supported; -+}; -+ -+struct SQLGetInfo_params -+{ -+ UINT64 ConnectionHandle; -+ UINT16 InfoType; -+ void *InfoValue; -+ INT16 BufferLength; -+ INT16 *StringLength; -+}; -+ -+struct SQLGetInfoW_params -+{ -+ UINT64 ConnectionHandle; -+ UINT16 InfoType; -+ void *InfoValue; -+ INT16 BufferLength; -+ INT16 *StringLength; -+}; -+ -+struct SQLGetStmtAttr_params -+{ -+ UINT64 StatementHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 BufferLength; -+ INT32 *StringLength; -+}; -+ -+struct SQLGetStmtAttrW_params -+{ -+ UINT64 StatementHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 BufferLength; -+ INT32 *StringLength; -+}; -+ -+struct SQLGetStmtOption_params -+{ -+ UINT64 StatementHandle; -+ UINT16 Option; -+ void *Value; -+}; -+ -+struct SQLGetTypeInfo_params -+{ -+ UINT64 StatementHandle; -+ INT16 DataType; -+}; -+ -+struct SQLGetTypeInfoW_params -+{ -+ UINT64 StatementHandle; -+ INT16 DataType; -+}; -+ -+struct SQLMoreResults_params -+{ -+ UINT64 StatementHandle; -+}; -+ -+struct SQLNativeSql_params -+{ -+ UINT64 ConnectionHandle; -+ UCHAR *InStatementText; -+ INT32 TextLength1; -+ UCHAR *OutStatementText; -+ INT32 BufferLength; -+ INT32 *TextLength2; -+}; -+ -+struct SQLNativeSqlW_params -+{ -+ UINT64 ConnectionHandle; -+ WCHAR *InStatementText; -+ INT32 TextLength1; -+ WCHAR *OutStatementText; -+ INT32 BufferLength; -+ INT32 *TextLength2; -+}; -+ -+struct SQLNumParams_params -+{ -+ UINT64 StatementHandle; -+ INT16 *ParameterCount; -+}; -+ -+struct SQLNumResultCols_params -+{ -+ UINT64 StatementHandle; -+ INT16 *ColumnCount; -+}; -+ -+struct SQLParamData_params -+{ -+ UINT64 StatementHandle; -+ void *Value; -+}; -+ -+struct SQLParamOptions_params -+{ -+ UINT64 StatementHandle; -+ UINT64 RowCount; -+ UINT64 *RowNumber; -+}; -+ -+struct SQLPrepare_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *StatementText; -+ INT32 TextLength; -+}; -+ -+struct SQLPrepareW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *StatementText; -+ INT32 TextLength; -+}; -+ -+struct SQLPrimaryKeys_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *TableName; -+ INT16 NameLength3; -+}; -+ -+struct SQLPrimaryKeysW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *TableName; -+ INT16 NameLength3; -+}; -+ -+struct SQLProcedureColumns_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *ProcName; -+ INT16 NameLength3; -+ UCHAR *ColumnName; -+ INT16 NameLength4; -+}; -+ -+struct SQLProcedureColumnsW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *ProcName; -+ INT16 NameLength3; -+ WCHAR *ColumnName; -+ INT16 NameLength4; -+}; -+ -+struct SQLProcedures_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *ProcName; -+ INT16 NameLength3; -+}; -+ -+struct SQLProceduresW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *ProcName; -+ INT16 NameLength3; -+}; -+ -+struct SQLPutData_params -+{ -+ UINT64 StatementHandle; -+ void *Data; -+ INT64 StrLen_or_Ind; -+}; -+ -+struct SQLRowCount_params -+{ -+ UINT64 StatementHandle; -+ INT64 *RowCount; -+}; -+ -+struct SQLSetConnectAttr_params -+{ -+ UINT64 ConnectionHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 StringLength; -+}; -+ -+struct SQLSetConnectAttrW_params -+{ -+ UINT64 ConnectionHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 StringLength; -+}; -+ -+struct SQLSetConnectOption_params -+{ -+ UINT64 ConnectionHandle; -+ UINT16 Option; -+ UINT64 Value; -+}; -+ -+struct SQLSetConnectOptionW_params -+{ -+ UINT64 ConnectionHandle; -+ UINT16 Option; -+ UINT64 Value; -+}; -+ -+struct SQLSetCursorName_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CursorName; -+ INT16 NameLength; -+}; -+ -+struct SQLSetCursorNameW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CursorName; -+ INT16 NameLength; -+}; -+ -+struct SQLSetDescField_params -+{ -+ UINT64 DescriptorHandle; -+ INT16 RecNumber; -+ INT16 FieldIdentifier; -+ void *Value; -+ INT32 BufferLength; -+}; -+ -+struct SQLSetDescFieldW_params -+{ -+ UINT64 DescriptorHandle; -+ INT16 RecNumber; -+ INT16 FieldIdentifier; -+ void *Value; -+ INT32 BufferLength; -+}; -+ -+struct SQLSetDescRec_params -+{ -+ UINT64 DescriptorHandle; -+ INT16 RecNumber; -+ INT16 Type; -+ INT16 SubType; -+ INT64 Length; -+ INT16 Precision; -+ INT16 Scale; -+ void *Data; -+ INT64 *StringLength; -+ INT64 *Indicator; -+}; -+ -+struct SQLSetEnvAttr_params -+{ -+ UINT64 EnvironmentHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 StringLength; -+}; -+ -+struct SQLSetParam_params -+{ -+ UINT64 StatementHandle; -+ UINT16 ParameterNumber; -+ INT16 ValueType; -+ INT16 ParameterType; -+ UINT64 LengthPrecision; -+ INT16 ParameterScale; -+ void *ParameterValue; -+ INT64 *StrLen_or_Ind; -+}; -+ -+struct SQLSetPos_params -+{ -+ UINT64 StatementHandle; -+ UINT64 RowNumber; -+ UINT16 Operation; -+ UINT16 LockType; -+}; -+ -+struct SQLSetScrollOptions_params -+{ -+ UINT64 StatementHandle; -+ UINT16 Concurrency; -+ INT64 KeySetSize; -+ UINT16 RowSetSize; -+}; -+ -+struct SQLSetStmtAttr_params -+{ -+ UINT64 StatementHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 StringLength; -+}; -+ -+struct SQLSetStmtAttrW_params -+{ -+ UINT64 StatementHandle; -+ INT32 Attribute; -+ void *Value; -+ INT32 StringLength; -+}; -+ -+struct SQLSetStmtOption_params -+{ -+ UINT64 StatementHandle; -+ UINT16 Option; -+ UINT64 Value; -+}; -+ -+struct SQLSpecialColumns_params -+{ -+ UINT64 StatementHandle; -+ UINT16 IdentifierType; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *TableName; -+ INT16 NameLength3; -+ UINT16 Scope; -+ UINT16 Nullable; -+}; -+ -+struct SQLSpecialColumnsW_params -+{ -+ UINT64 StatementHandle; -+ UINT16 IdentifierType; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *TableName; -+ INT16 NameLength3; -+ UINT16 Scope; -+ UINT16 Nullable; -+}; -+ -+struct SQLStatistics_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *TableName; -+ INT16 NameLength3; -+ UINT16 Unique; -+ UINT16 Reserved; -+}; -+ -+struct SQLStatisticsW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *TableName; -+ INT16 NameLength3; -+ UINT16 Unique; -+ UINT16 Reserved; -+}; -+ -+struct SQLTablePrivileges_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *TableName; -+ INT16 NameLength3; -+}; -+ -+struct SQLTablePrivilegesW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *TableName; -+ INT16 NameLength3; -+}; -+ -+struct SQLTables_params -+{ -+ UINT64 StatementHandle; -+ UCHAR *CatalogName; -+ INT16 NameLength1; -+ UCHAR *SchemaName; -+ INT16 NameLength2; -+ UCHAR *TableName; -+ INT16 NameLength3; -+ UCHAR *TableType; -+ INT16 NameLength4; -+}; -+ -+struct SQLTablesW_params -+{ -+ UINT64 StatementHandle; -+ WCHAR *CatalogName; -+ INT16 NameLength1; -+ WCHAR *SchemaName; -+ INT16 NameLength2; -+ WCHAR *TableName; -+ INT16 NameLength3; -+ WCHAR *TableType; -+ INT16 NameLength4; -+}; -+ -+struct SQLTransact_params -+{ -+ UINT64 EnvironmentHandle; -+ UINT64 ConnectionHandle; -+ UINT16 CompletionType; -+}; -diff --git a/dlls/wineodbc/wineodbc.spec b/dlls/wineodbc/wineodbc.spec -new file mode 100644 -index 00000000000..f94eaabea26 ---- /dev/null -+++ b/dlls/wineodbc/wineodbc.spec -@@ -0,0 +1,176 @@ -+ 1 stdcall SQLAllocConnect(long ptr) -+ 2 stdcall SQLAllocEnv(ptr) -+ 3 stdcall SQLAllocStmt(long ptr) -+ 4 stdcall SQLBindCol(long long long ptr long ptr) -+ 5 stdcall SQLCancel(long) -+ 6 stdcall SQLColAttributes(long long long ptr long ptr ptr) -+ 7 stdcall SQLConnect(long str long str long str long) -+ 8 stdcall SQLDescribeCol(long long str long ptr ptr ptr ptr ptr) -+ 9 stdcall SQLDisconnect(long) -+ 10 stdcall SQLError(long long long str ptr str long ptr) -+ 11 stdcall SQLExecDirect(long str long) -+ 12 stdcall SQLExecute(long) -+ 13 stdcall SQLFetch(long) -+ 14 stdcall SQLFreeConnect(long) -+ 15 stdcall SQLFreeEnv(long) -+ 16 stdcall SQLFreeStmt(long long ) -+ 17 stdcall SQLGetCursorName(long str long ptr) -+ 18 stdcall SQLNumResultCols(long ptr) -+ 19 stdcall SQLPrepare(long str long) -+ 20 stdcall SQLRowCount(long ptr) -+ 21 stdcall SQLSetCursorName(long str long) -+ 22 stdcall SQLSetParam(long long long long long long ptr ptr) -+ 23 stdcall SQLTransact(long long long) -+ 24 stdcall SQLAllocHandle(long long ptr) -+ 25 stdcall SQLBindParam(long long long long long long ptr ptr) -+ 26 stdcall SQLCloseCursor(long) -+ 27 stdcall SQLColAttribute(long long long ptr long ptr ptr) -+ 28 stdcall SQLCopyDesc(long long) -+ 29 stdcall SQLEndTran(long long long) -+ 30 stdcall SQLFetchScroll(long long long) -+ 31 stdcall SQLFreeHandle(long long) -+ 32 stdcall SQLGetConnectAttr(long long ptr long ptr) -+ 33 stdcall SQLGetDescField(long long long ptr long ptr) -+ 34 stdcall SQLGetDescRec(long long str long ptr ptr ptr ptr ptr ptr ptr) -+ 35 stdcall SQLGetDiagField(long long long long ptr long ptr) -+ 36 stdcall SQLGetDiagRec(long long long str ptr str long ptr) -+ 37 stdcall SQLGetEnvAttr(long long ptr long ptr) -+ 38 stdcall SQLGetStmtAttr(long long ptr long ptr) -+ 39 stdcall SQLSetConnectAttr(long long ptr long) -+ 40 stdcall SQLColumns(long str long str long str long str long) -+ 41 stdcall SQLDriverConnect(long long str long str long ptr long) -+ 42 stdcall SQLGetConnectOption(long long ptr) -+ 43 stdcall SQLGetData(long long long ptr long ptr) -+ 44 stdcall SQLGetFunctions(long long ptr) -+ 45 stdcall SQLGetInfo(long long ptr long ptr) -+ 46 stdcall SQLGetStmtOption(long long ptr) -+ 47 stdcall SQLGetTypeInfo(long long) -+ 48 stdcall SQLParamData(long ptr) -+ 49 stdcall SQLPutData(long ptr long) -+ 50 stdcall SQLSetConnectOption(long long long) -+ 51 stdcall SQLSetStmtOption(long long long) -+ 52 stdcall SQLSpecialColumns(long long str long str long str long long long) -+ 53 stdcall SQLStatistics(long str long str long str long long long) -+ 54 stdcall SQLTables(long str long str long str long str long) -+ 55 stdcall SQLBrowseConnect(long str long str long ptr) -+ 56 stdcall SQLColumnPrivileges(long str long str long str long str long) -+ 57 stdcall SQLDataSources(long long str long ptr str long ptr) -+ 58 stdcall SQLDescribeParam(long long ptr ptr ptr ptr) -+ 59 stdcall SQLExtendedFetch(long long long ptr ptr) -+ 60 stdcall SQLForeignKeys(long str long str long str long str long str long str long) -+ 61 stdcall SQLMoreResults(long) -+ 62 stdcall SQLNativeSql(long str long str long ptr) -+ 63 stdcall SQLNumParams(long ptr) -+ 64 stdcall SQLParamOptions(long long ptr) -+ 65 stdcall SQLPrimaryKeys(long str long str long str long) -+ 66 stdcall SQLProcedureColumns(long str long str long str long str long) -+ 67 stdcall SQLProcedures(long str long str long str long) -+ 68 stdcall SQLSetPos(long long long long) -+ 69 stdcall SQLSetScrollOptions(long long long long) -+ 70 stdcall SQLTablePrivileges(long str long str long str long) -+ 71 stdcall SQLDrivers(long long str long ptr str long ptr) -+ 72 stdcall SQLBindParameter(long long long long long long long ptr long ptr) -+ 73 stdcall SQLSetDescField(long long long ptr long) -+ 74 stdcall SQLSetDescRec(long long long long long long long ptr ptr ptr) -+ 75 stdcall SQLSetEnvAttr(long long ptr long) -+ 76 stdcall SQLSetStmtAttr(long long ptr long) -+ 77 stdcall SQLAllocHandleStd(long long ptr) -+ 78 stdcall SQLBulkOperations(long long) -+ 79 stub CloseODBCPerfData -+ 80 stub CollectODBCPerfData -+ 81 stub CursorLibLockDbc -+ 82 stub CursorLibLockDesc -+ 83 stub CursorLibLockStmt -+ 84 stub ODBCGetTryWaitValue -+ 85 stub CursorLibTransact -+ 86 stub ODBSetTryWaitValue -+ 89 stub ODBCSharedPerfMon -+ 90 stub ODBCSharedVSFlag -+106 stdcall SQLColAttributesW(long long long ptr long ptr ptr) -+107 stdcall SQLConnectW(long wstr long wstr long wstr long) -+108 stdcall SQLDescribeColW(long long wstr long ptr ptr ptr ptr ptr) -+110 stdcall SQLErrorW(long long long wstr ptr wstr long ptr) -+111 stdcall SQLExecDirectW(long wstr long) -+117 stdcall SQLGetCursorNameW(long wstr long ptr) -+119 stdcall SQLPrepareW(long wstr long) -+121 stdcall SQLSetCursorNameW(long wstr long) -+127 stdcall SQLColAttributeW(long long long ptr long ptr ptr) -+132 stdcall SQLGetConnectAttrW(long long ptr long ptr) -+133 stdcall SQLGetDescFieldW(long long long ptr long ptr) -+134 stdcall SQLGetDescRecW(long long wstr long ptr ptr ptr ptr ptr ptr ptr) -+135 stdcall SQLGetDiagFieldW(long long long long ptr long ptr) -+136 stdcall SQLGetDiagRecW(long long long wstr ptr wstr long ptr) -+138 stdcall SQLGetStmtAttrW(long long ptr long ptr) -+139 stdcall SQLSetConnectAttrW(long long ptr long) -+140 stdcall SQLColumnsW(long wstr long wstr long wstr long wstr long) -+141 stdcall SQLDriverConnectW(long long wstr long wstr long ptr long) -+142 stdcall SQLGetConnectOptionW(long long ptr) -+145 stdcall SQLGetInfoW(long long ptr long ptr) -+147 stdcall SQLGetTypeInfoW(long long) -+150 stdcall SQLSetConnectOptionW(long long long) -+152 stdcall SQLSpecialColumnsW(long long wstr long wstr long wstr long long long) -+153 stdcall SQLStatisticsW(long wstr long wstr long wstr long long long) -+154 stdcall SQLTablesW(long wstr long wstr long wstr long wstr long) -+155 stdcall SQLBrowseConnectW(long wstr long wstr long ptr) -+156 stdcall SQLColumnPrivilegesW(long wstr long wstr long wstr long wstr long) -+157 stdcall SQLDataSourcesW(long long wstr long ptr wstr long ptr) -+160 stdcall SQLForeignKeysW(long wstr long wstr long wstr long wstr long wstr long wstr long) -+162 stdcall SQLNativeSqlW(long wstr long wstr long ptr) -+165 stdcall SQLPrimaryKeysW(long wstr long wstr long wstr long) -+166 stdcall SQLProcedureColumnsW(long wstr long wstr long wstr long wstr long) -+167 stdcall SQLProceduresW(long wstr long wstr long wstr long) -+170 stdcall SQLTablePrivilegesW(long wstr long wstr long wstr long) -+171 stdcall SQLDriversW(long long wstr long ptr wstr long ptr) -+173 stdcall SQLSetDescFieldW(long long long ptr long) -+176 stdcall SQLSetStmtAttrW(long long ptr long) -+206 stub SQLColAttributesA -+207 stub SQLConnectA -+208 stub SQLDescribeColA -+210 stub SQLErrorA -+211 stub SQLExecDirectA -+217 stub SQLGetCursorNameA -+219 stub SQLPrepareA -+221 stub SQLSetCursorNameA -+227 stub SQLColAttributeA -+232 stub SQLGetConnectAttrA -+233 stub SQLGetDescFieldA -+234 stub SQLGetDescRecA -+235 stub SQLGetDiagFieldA -+236 stdcall SQLGetDiagRecA(long long long ptr ptr ptr long ptr) -+238 stub SQLGetStmtAttrA -+239 stub SQLSetConnectAttrA -+240 stub SQLColumnsA -+241 stub SQLDriverConnectA -+242 stub SQLGetConnectOptionA -+245 stub SQLGetInfoA -+247 stub SQLGetTypeInfoA -+250 stub SQLSetConnectOptionA -+252 stub SQLSpecialColumnsA -+253 stub SQLStatisticsA -+254 stub SQLTablesA -+255 stub SQLBrowseConnectA -+256 stub SQLColumnPrivilegesA -+257 stdcall SQLDataSourcesA(long long str long ptr str long ptr) -+260 stub SQLForeignKeysA -+262 stub SQLNativeSqlA -+265 stub SQLPrimaryKeysA -+266 stub SQLProcedureColumnsA -+267 stub SQLProceduresA -+270 stub SQLTablePrivilegesA -+271 stub SQLDriversA -+273 stub SQLSetDescFieldA -+276 stub SQLSetStmtAttrA -+300 stub ODBCSharedTraceFlag -+301 stub ODBCQualifyFileDSNW -+ -+ -+ @ stub LockHandle -+ @ stub ODBCInternalConnectW -+ @ stub OpenODBCPerfData -+ @ stub PostComponentError -+ @ stub PostODBCComponentError -+ @ stub PostODBCError -+ @ stub SearchStatusCode -+ @ stub VFreeErrors -+ @ stub VRetrieveDriverErrorsRowCol -+ @ stub ValidateErrorQueue --- -2.45.2 - diff --git a/patches/odbc-remove-unixodbc/0002-wineodbc-Register-as-Driver.patch b/patches/odbc-remove-unixodbc/0002-wineodbc-Register-as-Driver.patch deleted file mode 100644 index 3d46168f..00000000 --- a/patches/odbc-remove-unixodbc/0002-wineodbc-Register-as-Driver.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 54841f013e3f88c885ad4bc252083e6aa5958472 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Sun, 23 Jun 2024 16:45:43 +1000 -Subject: [PATCH] wineodbc: Register as Driver - ---- - dlls/wineodbc/rsrc.rc | 3 +++ - dlls/wineodbc/wineodbc.rgs | 23 +++++++++++++++++++++++ - 2 files changed, 26 insertions(+) - create mode 100644 dlls/wineodbc/wineodbc.rgs - -diff --git a/dlls/wineodbc/rsrc.rc b/dlls/wineodbc/rsrc.rc -index b8fad8fe35b..9bc9d2934ab 100644 ---- a/dlls/wineodbc/rsrc.rc -+++ b/dlls/wineodbc/rsrc.rc -@@ -24,3 +24,6 @@ - #define WINE_PRODUCTVERSION_STR "3.520.6301.0" - - #include "wine/wine_common_ver.rc" -+ -+/* @makedep: wineodbc.rgs */ -+1 WINE_REGISTRY wineodbc.rgs -diff --git a/dlls/wineodbc/wineodbc.rgs b/dlls/wineodbc/wineodbc.rgs -new file mode 100644 -index 00000000000..c83d37976d7 ---- /dev/null -+++ b/dlls/wineodbc/wineodbc.rgs -@@ -0,0 +1,23 @@ -+HKLM -+{ -+ NoRemove Software -+ { -+ NoRemove ODBC -+ { -+ NoRemove ODBCINST.INI -+ { -+ 'Wine ODBC Driver' -+ { -+ val 'Driver' = s '%MODULE%' -+ val 'DriverODBCVer' = s '03.50' -+ val 'Setup' = s '%MODULE%' -+ } -+ -+ NoRemove ODBC Drivers -+ { -+ val 'Wine ODBC Driver' = s 'Installed' -+ } -+ } -+ } -+ } -+} --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0003-odbc32-Implement-SQLAllocEnv-SQLFreeEnv.patch b/patches/odbc-remove-unixodbc/0003-odbc32-Implement-SQLAllocEnv-SQLFreeEnv.patch deleted file mode 100644 index 77ce72ac..00000000 --- a/patches/odbc-remove-unixodbc/0003-odbc32-Implement-SQLAllocEnv-SQLFreeEnv.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 4f4f45e8aad723b7372d422f01df15e2320d23d6 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 3 Feb 2023 11:44:19 +1100 -Subject: [PATCH] odbc32: Implement SQLAllocEnv/SQLFreeEnv - ---- - dlls/odbc32/proxyodbc.c | 31 +++++++++++++++++++++++++------ - 1 file changed, 25 insertions(+), 6 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 89e4545f068..48ba33bb0f5 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -43,6 +43,11 @@ - - WINE_DEFAULT_DEBUG_CHANNEL(odbc); - -+struct SQLHENV_data -+{ -+ int type; -+}; -+ - - /************************************************************************* - * SQLAllocConnect [ODBC32.001] -@@ -61,13 +66,23 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH - */ - SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHENV_data *henv; - -- FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle); -+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle); -+ -+ if (!EnvironmentHandle) -+ return SQL_ERROR; - - *EnvironmentHandle = SQL_NULL_HENV; -+ henv = calloc(1, sizeof(*henv)); -+ if (!henv) -+ return SQL_ERROR; - -- return ret; -+ henv->type = SQL_HANDLE_ENV; -+ -+ *EnvironmentHandle = henv; -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* -@@ -399,11 +414,15 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) - */ - SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHENV_data *data = EnvironmentHandle; -+ TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle); - -- FIXME("(EnvironmentHandle %p)\n", EnvironmentHandle); -+ if (data && data->type != SQL_HANDLE_ENV) -+ WARN("EnvironmentHandle isn't of type SQL_HANDLE_ENV\n"); -+ else -+ free(data); - -- return ret; -+ return SQL_SUCCESS; - } - - /************************************************************************* --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0004-odbc32-Support-SQL_ATTR_CONNECTION_POOLING-in-SQLGet.patch b/patches/odbc-remove-unixodbc/0004-odbc32-Support-SQL_ATTR_CONNECTION_POOLING-in-SQLGet.patch deleted file mode 100644 index 2395ef94..00000000 --- a/patches/odbc-remove-unixodbc/0004-odbc32-Support-SQL_ATTR_CONNECTION_POOLING-in-SQLGet.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 35c784055b2af9d8d19f69f1d46bb257d9a70de3 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 3 Feb 2023 13:41:20 +1100 -Subject: [PATCH] odbc32: Support SQL_ATTR_CONNECTION_POOLING in - SQLGetEnvAttr/SQLSetEnvAttr - ---- - dlls/odbc32/proxyodbc.c | 63 +++++++++++++++++++++++++++++++++++++---- - 1 file changed, 57 insertions(+), 6 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 48ba33bb0f5..89b8663d888 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -46,6 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(odbc); - struct SQLHENV_data - { - int type; -+ SQLUINTEGER pooling; - }; - - -@@ -79,6 +80,7 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) - return SQL_ERROR; - - henv->type = SQL_HANDLE_ENV; -+ henv->pooling = SQL_CP_OFF; - - *EnvironmentHandle = henv; - -@@ -571,12 +573,42 @@ SQLRETURN WINAPI SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMAL - SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHENV_data *data = EnvironmentHandle; - -- FIXME("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", -+ TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", - EnvironmentHandle, Attribute, Value, BufferLength, StringLength); - -- return ret; -+ if (EnvironmentHandle == SQL_NULL_HENV) -+ { -+ if (StringLength) -+ *StringLength = 0; -+ if (Value) -+ *(SQLINTEGER*)Value = 0; -+ return SQL_SUCCESS; -+ } -+ -+ if (data->type != SQL_HANDLE_ENV) -+ { -+ WARN("Wrong handle type %d\n", data->type); -+ return SQL_ERROR; -+ } -+ -+ switch (Attribute) -+ { -+ case SQL_ATTR_CONNECTION_POOLING: -+ if (BufferLength != sizeof(data->pooling)) -+ { -+ WARN("Invalid buffer size\n"); -+ return SQL_ERROR; -+ } -+ *(SQLUINTEGER*)Value = data->pooling; -+ break; -+ default: -+ FIXME("Unhandle attribute %d\n", Attribute); -+ return SQL_ERROR; -+ } -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* -@@ -785,12 +817,31 @@ SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, - SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHENV_data *data = EnvironmentHandle; - -- FIXME("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value, -+ TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value, - StringLength); - -- return ret; -+ if(!data || data->type != SQL_HANDLE_ENV) -+ { -+ WARN("Wrong handle type %d\n", data->type); -+ return SQL_ERROR; -+ } -+ -+ switch(Attribute) -+ { -+ case SQL_ATTR_CONNECTION_POOLING: -+ if (Value) -+ data->pooling = (uintptr_t)Value; -+ else -+ data->pooling = SQL_CP_OFF; -+ break; -+ default: -+ FIXME("Unhandle attribute %d\n", Attribute); -+ return SQL_ERROR; -+ } -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0005-odbc32-Add-initial-tests.patch b/patches/odbc-remove-unixodbc/0005-odbc32-Add-initial-tests.patch deleted file mode 100644 index e6cf2acf..00000000 --- a/patches/odbc-remove-unixodbc/0005-odbc32-Add-initial-tests.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 4e1a78cfdba25f67e93f40ce9d4881cd15abf180 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 3 Feb 2023 14:16:21 +1100 -Subject: [PATCH] odbc32: Add initial tests - ---- - dlls/odbc32/tests/odbc32.c | 52 +++++++++++++++++++++++++++++++++++++- - 1 file changed, 51 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c -index 57bb17ef617..fa877c295d1 100644 ---- a/dlls/odbc32/tests/odbc32.c -+++ b/dlls/odbc32/tests/odbc32.c -@@ -28,7 +28,7 @@ - static void test_SQLAllocHandle( void ) - { - SQLHANDLE handle; -- SQLHENV env; -+ SQLHENV env, env2; - SQLHDBC con; - SQLRETURN ret; - -@@ -46,6 +46,12 @@ static void test_SQLAllocHandle( void ) - ok( ret == SQL_SUCCESS, "got %d\n", ret ); - ok( env != (void *)0xdeadbeef, "env not set\n" ); - -+ env2 = (void *)0xdeadbeef; -+ ret = SQLAllocEnv( &env2 ); -+ ok( ret == SQL_SUCCESS, "got %d\n", ret ); -+ ok( env2 != (void *)0xdeadbeef, "env2 not set\n" ); -+ ok( env2 != env, "environment is the same\n" ); -+ - con = (void *)0xdeadbeef; - ret = SQLAllocConnect( env, &con ); - ok( ret == SQL_SUCCESS, "got %d\n", ret ); -@@ -57,6 +63,8 @@ static void test_SQLAllocHandle( void ) - ok( ret == SQL_INVALID_HANDLE, "got %d\n", ret ); - ret = SQLFreeEnv( env ); - ok( ret == SQL_SUCCESS, "got %d\n", ret ); -+ ret = SQLFreeEnv( env2 ); -+ ok( ret == SQL_SUCCESS, "got %d\n", ret ); - ret = SQLFreeEnv( 0 ); - ok( ret == SQL_INVALID_HANDLE, "got %d\n", ret ); - } -@@ -393,6 +401,47 @@ static void test_SQLExecDirect( void ) - ok( ret == SQL_SUCCESS, "got %d\n", ret ); - } - -+void test_SQLGetEnvAttr(void) -+{ -+ SQLRETURN ret; -+ SQLHENV sqlenv; -+ SQLINTEGER value, length; -+ -+ ret = SQLAllocEnv(&sqlenv); -+ ok(ret == SQL_SUCCESS, "got %d\n", ret); -+ -+ value = 5; -+ length = 12; -+ ret = SQLGetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING, &value, sizeof(SQLINTEGER), &length); -+ ok(ret == SQL_SUCCESS, "got %d\n", ret); -+ ok(value == 0, "got %d\n", value); -+ todo_wine ok(length == 12, "got %d\n", length); -+ -+ value = 5; -+ length = 13; -+ ret = SQLGetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING, &value, 0, &length); -+ ok(ret == SQL_SUCCESS, "got %d\n", ret); -+ ok(value == 0, "got %d\n", value); -+ todo_wine ok(length == 13, "got %d\n", length); -+ -+ value = 5; -+ length = 12; -+ ret = SQLGetEnvAttr(sqlenv, SQL_ATTR_CONNECTION_POOLING, &value, sizeof(SQLINTEGER), &length); -+ ok(ret == SQL_SUCCESS, "got %d\n", ret); -+ ok(value == 0, "got %d\n", value); -+ ok(length == 12, "got %d\n", length); -+ -+ value = 5; -+ length = 12; -+ ret = SQLGetEnvAttr(sqlenv, SQL_ATTR_CONNECTION_POOLING, &value, 2, &length); -+ todo_wine ok(ret == SQL_SUCCESS, "got %d\n", ret); -+ todo_wine ok(value == 0, "got %d\n", value); -+ ok(length == 12, "got %d\n", length); -+ -+ ret = SQLFreeEnv(sqlenv); -+ ok(ret == SQL_SUCCESS, "got %d\n", ret); -+} -+ - START_TEST(odbc32) - { - test_SQLAllocHandle(); -@@ -400,4 +449,5 @@ START_TEST(odbc32) - test_SQLDataSources(); - test_SQLDrivers(); - test_SQLExecDirect(); -+ test_SQLGetEnvAttr(); - } --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0006-odbc32-Implement-SQLAllocConnect.patch b/patches/odbc-remove-unixodbc/0006-odbc32-Implement-SQLAllocConnect.patch deleted file mode 100644 index 3da5db2a..00000000 --- a/patches/odbc-remove-unixodbc/0006-odbc32-Implement-SQLAllocConnect.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0f67768bd11cc1c58d9ad84640260e2ea66ea8ff Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 3 Feb 2023 14:40:03 +1100 -Subject: [PATCH] odbc32: Implement SQLAllocConnect - ---- - dlls/odbc32/proxyodbc.c | 41 +++++++++++++++++++++++++++++++++++------ - 1 file changed, 35 insertions(+), 6 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 89b8663d888..8cc89f2c7ba 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -49,17 +49,35 @@ struct SQLHENV_data - SQLUINTEGER pooling; - }; - -+struct SQLHDBC_data -+{ -+ int type; -+ struct SQLHENV_data *environment; -+}; - - /************************************************************************* - * SQLAllocConnect [ODBC32.001] - */ - SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHDBC_data *hdbc; -+ -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle); - -- FIXME("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle); -+ if(!ConnectionHandle) -+ return SQL_ERROR; - *ConnectionHandle = SQL_NULL_HDBC; -- return ret; -+ -+ hdbc = calloc(1, sizeof(*hdbc)); -+ if (!hdbc) -+ return SQL_ERROR; -+ -+ hdbc->type = SQL_HANDLE_DBC; -+ hdbc->environment = EnvironmentHandle; -+ -+ *ConnectionHandle = hdbc; -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* -@@ -404,11 +422,22 @@ SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrien - */ - SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHDBC_data *hdbc = ConnectionHandle; - -- FIXME("(ConnectionHandle %p)\n", ConnectionHandle); -+ TRACE("(ConnectionHandle %p)\n", ConnectionHandle); - -- return ret; -+ if (!hdbc) -+ return SQL_ERROR; -+ -+ if (hdbc->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", hdbc->type); -+ return SQL_ERROR; -+ } -+ -+ free(hdbc); -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0007-odbc32-SQLGetInfo-W-support-InfoType-SQL_ODBC_VER.patch b/patches/odbc-remove-unixodbc/0007-odbc32-SQLGetInfo-W-support-InfoType-SQL_ODBC_VER.patch deleted file mode 100644 index 2af031f4..00000000 --- a/patches/odbc-remove-unixodbc/0007-odbc32-SQLGetInfo-W-support-InfoType-SQL_ODBC_VER.patch +++ /dev/null @@ -1,72 +0,0 @@ -From cb3c9bd4e9eae60f11dc97f3a1fd2cd76e430ed7 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 3 Feb 2023 14:46:44 +1100 -Subject: [PATCH] odbc32: SQLGetInfo/W support InfoType SQL_ODBC_VER - ---- - dlls/odbc32/proxyodbc.c | 36 ++++++++++++++++++++++++++++++------ - 1 file changed, 30 insertions(+), 6 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 8cc89f2c7ba..7d654f1131b 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -658,12 +658,24 @@ SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT Function - SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) - { -- SQLRETURN ret = SQL_ERROR; -+ char *ptr = InfoValue; - -- FIXME("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - InfoType, InfoValue, BufferLength, StringLength); - -- return ret; -+ switch(InfoType) -+ { -+ case SQL_ODBC_VER: -+ lstrcpynA(ptr, "03.80.0000", BufferLength); -+ if (StringLength) -+ *StringLength = strlen(ptr); -+ break; -+ default: -+ FIXME("Unsupported type %d\n", InfoType); -+ return SQL_ERROR; -+ } -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* -@@ -1597,12 +1609,24 @@ SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Opt - SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) - { -- SQLRETURN ret = SQL_ERROR; -+ WCHAR *ptr = InfoValue; - -- FIXME("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - InfoType, InfoValue, BufferLength, StringLength); - -- return ret; -+ switch(InfoType) -+ { -+ case SQL_ODBC_VER: -+ lstrcpynW(ptr, L"03.80.0000", BufferLength); -+ if (StringLength) -+ *StringLength = wcslen(ptr); -+ break; -+ default: -+ FIXME("Unsupported type %d\n", InfoType); -+ return SQL_ERROR; -+ } -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0008-odbc32-Support-SQL_ATTR_LOGIN_TIMEOUT-in-SQLSetConne.patch b/patches/odbc-remove-unixodbc/0008-odbc32-Support-SQL_ATTR_LOGIN_TIMEOUT-in-SQLSetConne.patch deleted file mode 100644 index 4a4b9a98..00000000 --- a/patches/odbc-remove-unixodbc/0008-odbc32-Support-SQL_ATTR_LOGIN_TIMEOUT-in-SQLSetConne.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 7f9ebc7aec32bd0a6a53c94dbf96b39fe4cdd2ce Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 3 Feb 2023 15:18:21 +1100 -Subject: [PATCH] odbc32: Support SQL_ATTR_LOGIN_TIMEOUT in SQLSetConnectAttrW - ---- - dlls/odbc32/proxyodbc.c | 28 +++++++++++++++++++++++++--- - 1 file changed, 25 insertions(+), 3 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 7d654f1131b..070f0197742 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -53,6 +53,8 @@ struct SQLHDBC_data - { - int type; - struct SQLHENV_data *environment; -+ -+ SQLUINTEGER login_timeout; - }; - - /************************************************************************* -@@ -74,6 +76,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH - - hdbc->type = SQL_HANDLE_DBC; - hdbc->environment = EnvironmentHandle; -+ hdbc->login_timeout = 0; - - *ConnectionHandle = hdbc; - -@@ -1548,12 +1551,31 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHDBC_data *hdbc = ConnectionHandle; - -- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, - StringLength); - -- return ret; -+ if (hdbc->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", hdbc->type); -+ return SQL_ERROR; -+ } -+ -+ switch(Attribute) -+ { -+ case SQL_ATTR_LOGIN_TIMEOUT: -+ if (Value) -+ hdbc->login_timeout = (intptr_t)Value; -+ else -+ hdbc->login_timeout = 0; -+ break; -+ default: -+ FIXME("Unhandle attribute %d\n", Attribute); -+ return SQL_ERROR; -+ } -+ -+ return SQL_SUCCESS; - } - - /************************************************************************* --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0009-odbc32-Implement-SQLDriverConnectW.patch b/patches/odbc-remove-unixodbc/0009-odbc32-Implement-SQLDriverConnectW.patch deleted file mode 100644 index 6235a26a..00000000 --- a/patches/odbc-remove-unixodbc/0009-odbc32-Implement-SQLDriverConnectW.patch +++ /dev/null @@ -1,427 +0,0 @@ -From 63629981578a8ed97d1498b8c2e69484f3d85828 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Sat, 4 Feb 2023 09:16:29 +1100 -Subject: [PATCH] odbc32: Implement SQLDriverConnectW - ---- - dlls/odbc32/proxyodbc.c | 367 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 365 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 070f0197742..30baf1866a4 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -53,10 +53,248 @@ struct SQLHDBC_data - { - int type; - struct SQLHENV_data *environment; -+ HMODULE module; -+ SQLHENV driver_env; -+ SQLINTEGER driver_ver; /* ODBC version supported by driver */ -+ SQLHDBC driver_hdbc; -+ -+ SQLRETURN (WINAPI *pSQLAllocConnect)(SQLHENV,SQLHDBC*); -+ SQLRETURN (WINAPI *pSQLAllocEnv)(SQLHENV*); -+ SQLRETURN (WINAPI *pSQLAllocHandle)(SQLSMALLINT,SQLHANDLE,SQLHANDLE*); -+ SQLRETURN (WINAPI *pSQLAllocHandleStd)(SQLSMALLINT,SQLHANDLE,SQLHANDLE*); -+ SQLRETURN (WINAPI *pSQLAllocStmt)(SQLHDBC,SQLHSTMT*); -+ SQLRETURN (WINAPI *pSQLBindCol)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLBindParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLBindParameter)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLBrowseConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLBrowseConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLBulkOperations)(SQLHSTMT,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLCancel)(SQLHSTMT); -+ SQLRETURN (WINAPI *pSQLCloseCursor)(SQLHSTMT); -+ SQLRETURN (WINAPI *pSQLColAttribute)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLColAttributeW)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLColAttributes)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLColAttributesW)(SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLColumnPrivileges)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLColumnPrivilegesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLColumns)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLColumnsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLCopyDesc)(SQLHDESC,SQLHDESC); -+ SQLRETURN (WINAPI *pSQLDescribeCol)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLDescribeColW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLDescribeParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLDisconnect)(SQLHDBC); -+ SQLRETURN (WINAPI *pSQLDriverConnect)(SQLHDBC,SQLHWND,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLDriverConnectW)(SQLHDBC,SQLHWND,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLEndTran)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLError)(SQLHENV,SQLHDBC,SQLHSTMT,SQLCHAR*,SQLINTEGER*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLErrorW)(SQLHENV,SQLHDBC,SQLHSTMT,SQLWCHAR*,SQLINTEGER*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLExecDirect)(SQLHSTMT,SQLCHAR*,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLExecDirectW)(SQLHSTMT,SQLWCHAR*,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLExecute)(SQLHSTMT); -+ SQLRETURN (WINAPI *pSQLExtendedFetch)(SQLHSTMT,SQLUSMALLINT,SQLLEN,SQLULEN*,SQLUSMALLINT*); -+ SQLRETURN (WINAPI *pSQLFetch)(SQLHSTMT); -+ SQLRETURN (WINAPI *pSQLFetchScroll)(SQLHSTMT,SQLSMALLINT,SQLLEN); -+ SQLRETURN (WINAPI *pSQLForeignKeys)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLForeignKeysW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLFreeConnect)(SQLHDBC); -+ SQLRETURN (WINAPI *pSQLFreeEnv)(SQLHENV); -+ SQLRETURN (WINAPI *pSQLFreeHandle)(SQLSMALLINT,SQLHANDLE); -+ SQLRETURN (WINAPI *pSQLFreeStmt)(SQLHSTMT,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLGetConnectAttr)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLGetConnectAttrW)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLGetConnectOption)(SQLHDBC,SQLUSMALLINT,SQLPOINTER); -+ SQLRETURN (WINAPI *pSQLGetConnectOptionW)(SQLHDBC,SQLUSMALLINT,SQLPOINTER); -+ SQLRETURN (WINAPI *pSQLGetCursorName)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetCursorNameW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetData)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLGetDescField)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLGetDescFieldW)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLGetDescRec)(SQLHDESC,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*,SQLLEN*,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetDescRecW)(SQLHDESC,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*,SQLLEN*,SQLSMALLINT*,SQLSMALLINT*,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetDiagField)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetDiagFieldW)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetDiagRec)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLCHAR*,SQLINTEGER*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetDiagRecA)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLCHAR*,SQLINTEGER*, SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetDiagRecW)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLWCHAR*,SQLINTEGER*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetEnvAttr)(SQLHENV,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLGetFunctions)(SQLHDBC,SQLUSMALLINT,SQLUSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetInfo)(SQLHDBC,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetInfoW)(SQLHDBC,SQLUSMALLINT,SQLPOINTER,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLGetStmtAttr)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLGetStmtAttrW)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLGetStmtOption)(SQLHSTMT,SQLUSMALLINT,SQLPOINTER); -+ SQLRETURN (WINAPI *pSQLGetTypeInfo)(SQLHSTMT,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLGetTypeInfoW)(SQLHSTMT,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLMoreResults)(SQLHSTMT); -+ SQLRETURN (WINAPI *pSQLNativeSql)(SQLHDBC,SQLCHAR*,SQLINTEGER,SQLCHAR*,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLNativeSqlW)(SQLHDBC,SQLWCHAR*,SQLINTEGER,SQLWCHAR*,SQLINTEGER,SQLINTEGER*); -+ SQLRETURN (WINAPI *pSQLNumParams)(SQLHSTMT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLNumResultCols)(SQLHSTMT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLParamData)(SQLHSTMT,SQLPOINTER*); -+ SQLRETURN (WINAPI *pSQLParamOptions)(SQLHSTMT,SQLULEN,SQLULEN*); -+ SQLRETURN (WINAPI *pSQLPrepare)(SQLHSTMT,SQLCHAR*,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLPrepareW)(SQLHSTMT,SQLWCHAR*,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLPrimaryKeys)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLPrimaryKeysW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLProcedureColumns)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLProcedureColumnsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLProcedures)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLProceduresW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLPutData)(SQLHSTMT,SQLPOINTER,SQLLEN); -+ SQLRETURN (WINAPI *pSQLRowCount)(SQLHSTMT,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLSetConnectAttr)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLSetConnectAttrW)(SQLHDBC,SQLINTEGER,SQLPOINTER,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLSetConnectOption)(SQLHDBC,SQLUSMALLINT,SQLULEN); -+ SQLRETURN (WINAPI *pSQLSetConnectOptionW)(SQLHDBC,SQLUSMALLINT,SQLULEN); -+ SQLRETURN (WINAPI *pSQLSetCursorName)(SQLHSTMT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLSetCursorNameW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLSetDescField)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLSetDescFieldW)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLSetDescRec)(SQLHDESC,SQLSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLLEN,SQLSMALLINT,SQLSMALLINT,SQLPOINTER,SQLLEN*,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLSetEnvAttr)(SQLHENV,SQLINTEGER,SQLPOINTER,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLSetParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLSMALLINT,SQLULEN,SQLSMALLINT,SQLPOINTER,SQLLEN*); -+ SQLRETURN (WINAPI *pSQLSetPos)(SQLHSTMT,SQLSETPOSIROW,SQLUSMALLINT,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLSetScrollOptions)(SQLHSTMT,SQLUSMALLINT,SQLLEN,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLSetStmtAttr)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLSetStmtAttrW)(SQLHSTMT,SQLINTEGER,SQLPOINTER,SQLINTEGER); -+ SQLRETURN (WINAPI *pSQLSetStmtOption)(SQLHSTMT,SQLUSMALLINT,SQLULEN); -+ SQLRETURN (WINAPI *pSQLSpecialColumns)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLSpecialColumnsW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLStatistics)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLStatisticsW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLTablePrivileges)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLTablePrivilegesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLTables)(SQLHSTMT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLTablesW)(SQLHSTMT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); -+ SQLRETURN (WINAPI *pSQLTransact)(SQLHENV,SQLHDBC,SQLUSMALLINT); - - SQLUINTEGER login_timeout; - }; - -+static void connection_bind_sql_funcs(struct SQLHDBC_data *connection) -+{ -+#define LOAD_FUNCPTR(f) if((connection->p##f = (void*)GetProcAddress(connection->module, #f)) == NULL) \ -+ { \ -+ WARN( "function '%s' not found in driver.\n", #f ); \ -+ } -+ -+ LOAD_FUNCPTR(SQLAllocConnect); -+ LOAD_FUNCPTR(SQLAllocEnv); -+ LOAD_FUNCPTR(SQLAllocHandle); -+ LOAD_FUNCPTR(SQLAllocHandleStd) -+ LOAD_FUNCPTR(SQLAllocStmt); -+ LOAD_FUNCPTR(SQLBindCol); -+ LOAD_FUNCPTR(SQLBindParam); -+ LOAD_FUNCPTR(SQLBindParameter); -+ LOAD_FUNCPTR(SQLBrowseConnect); -+ LOAD_FUNCPTR(SQLBrowseConnectW); -+ LOAD_FUNCPTR(SQLBulkOperations); -+ LOAD_FUNCPTR(SQLCancel); -+ LOAD_FUNCPTR(SQLCloseCursor); -+ LOAD_FUNCPTR(SQLColAttribute); -+ LOAD_FUNCPTR(SQLColAttributeW); -+ LOAD_FUNCPTR(SQLColAttributes); -+ LOAD_FUNCPTR(SQLColAttributesW); -+ LOAD_FUNCPTR(SQLColumnPrivileges); -+ LOAD_FUNCPTR(SQLColumnPrivilegesW) -+ LOAD_FUNCPTR(SQLColumns); -+ LOAD_FUNCPTR(SQLColumnsW); -+ LOAD_FUNCPTR(SQLConnect); -+ LOAD_FUNCPTR(SQLConnectW); -+ LOAD_FUNCPTR(SQLCopyDesc); -+ LOAD_FUNCPTR(SQLDescribeCol); -+ LOAD_FUNCPTR(SQLDescribeColW); -+ LOAD_FUNCPTR(SQLDescribeParam); -+ LOAD_FUNCPTR(SQLDisconnect); -+ LOAD_FUNCPTR(SQLDriverConnect); -+ LOAD_FUNCPTR(SQLDriverConnectW); -+ LOAD_FUNCPTR(SQLEndTran); -+ LOAD_FUNCPTR(SQLError); -+ LOAD_FUNCPTR(SQLErrorW); -+ LOAD_FUNCPTR(SQLExecDirect); -+ LOAD_FUNCPTR(SQLExecDirectW); -+ LOAD_FUNCPTR(SQLExecute); -+ LOAD_FUNCPTR(SQLExtendedFetch); -+ LOAD_FUNCPTR(SQLFetch); -+ LOAD_FUNCPTR(SQLFetchScroll); -+ LOAD_FUNCPTR(SQLForeignKeys); -+ LOAD_FUNCPTR(SQLForeignKeysW); -+ LOAD_FUNCPTR(SQLFreeConnect); -+ LOAD_FUNCPTR(SQLFreeEnv); -+ LOAD_FUNCPTR(SQLFreeHandle); -+ LOAD_FUNCPTR(SQLFreeStmt); -+ LOAD_FUNCPTR(SQLGetConnectAttr); -+ LOAD_FUNCPTR(SQLGetConnectAttrW); -+ LOAD_FUNCPTR(SQLGetConnectOption); -+ LOAD_FUNCPTR(SQLGetConnectOptionW); -+ LOAD_FUNCPTR(SQLGetCursorName); -+ LOAD_FUNCPTR(SQLGetCursorNameW); -+ LOAD_FUNCPTR(SQLGetData); -+ LOAD_FUNCPTR(SQLGetDescField); -+ LOAD_FUNCPTR(SQLGetDescFieldW); -+ LOAD_FUNCPTR(SQLGetDescRec); -+ LOAD_FUNCPTR(SQLGetDescRecW); -+ LOAD_FUNCPTR(SQLGetDiagField); -+ LOAD_FUNCPTR(SQLGetDiagFieldW); -+ LOAD_FUNCPTR(SQLGetDiagRec); -+ LOAD_FUNCPTR(SQLGetDiagRecA); -+ LOAD_FUNCPTR(SQLGetDiagRecW); -+ LOAD_FUNCPTR(SQLGetEnvAttr); -+ LOAD_FUNCPTR(SQLGetFunctions); -+ LOAD_FUNCPTR(SQLGetInfo); -+ LOAD_FUNCPTR(SQLGetInfoW); -+ LOAD_FUNCPTR(SQLGetStmtAttr); -+ LOAD_FUNCPTR(SQLGetStmtAttrW); -+ LOAD_FUNCPTR(SQLGetStmtOption); -+ LOAD_FUNCPTR(SQLGetTypeInfo); -+ LOAD_FUNCPTR(SQLGetTypeInfoW); -+ LOAD_FUNCPTR(SQLMoreResults); -+ LOAD_FUNCPTR(SQLNativeSql); -+ LOAD_FUNCPTR(SQLNativeSqlW); -+ LOAD_FUNCPTR(SQLNumParams); -+ LOAD_FUNCPTR(SQLNumResultCols); -+ LOAD_FUNCPTR(SQLParamData); -+ LOAD_FUNCPTR(SQLParamOptions); -+ LOAD_FUNCPTR(SQLPrepare); -+ LOAD_FUNCPTR(SQLPrepareW); -+ LOAD_FUNCPTR(SQLPrimaryKeys); -+ LOAD_FUNCPTR(SQLPrimaryKeysW); -+ LOAD_FUNCPTR(SQLProcedureColumns); -+ LOAD_FUNCPTR(SQLProcedureColumnsW); -+ LOAD_FUNCPTR(SQLProcedures); -+ LOAD_FUNCPTR(SQLProceduresW); -+ LOAD_FUNCPTR(SQLPutData); -+ LOAD_FUNCPTR(SQLRowCount); -+ LOAD_FUNCPTR(SQLSetConnectAttr); -+ LOAD_FUNCPTR(SQLSetConnectAttrW); -+ LOAD_FUNCPTR(SQLSetConnectOption); -+ LOAD_FUNCPTR(SQLSetConnectOptionW); -+ LOAD_FUNCPTR(SQLSetCursorName); -+ LOAD_FUNCPTR(SQLSetCursorNameW); -+ LOAD_FUNCPTR(SQLSetDescField); -+ LOAD_FUNCPTR(SQLSetDescFieldW); -+ LOAD_FUNCPTR(SQLSetDescRec); -+ LOAD_FUNCPTR(SQLSetEnvAttr); -+ LOAD_FUNCPTR(SQLSetParam); -+ LOAD_FUNCPTR(SQLSetPos); -+ LOAD_FUNCPTR(SQLSetScrollOptions); -+ LOAD_FUNCPTR(SQLSetStmtAttr); -+ LOAD_FUNCPTR(SQLSetStmtAttrW); -+ LOAD_FUNCPTR(SQLSetStmtOption); -+ LOAD_FUNCPTR(SQLSpecialColumns); -+ LOAD_FUNCPTR(SQLSpecialColumnsW); -+ LOAD_FUNCPTR(SQLStatistics); -+ LOAD_FUNCPTR(SQLStatisticsW); -+ LOAD_FUNCPTR(SQLTablePrivileges); -+ LOAD_FUNCPTR(SQLTablePrivilegesW); -+ LOAD_FUNCPTR(SQLTables); -+ LOAD_FUNCPTR(SQLTablesW); -+ LOAD_FUNCPTR(SQLTransact); -+} -+ - /************************************************************************* - * SQLAllocConnect [ODBC32.001] - */ -@@ -77,6 +315,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH - hdbc->type = SQL_HANDLE_DBC; - hdbc->environment = EnvironmentHandle; - hdbc->login_timeout = 0; -+ hdbc->module = NULL; - - *ConnectionHandle = hdbc; - -@@ -438,6 +677,8 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) - return SQL_ERROR; - } - -+ FreeLibrary(hdbc->module); -+ - free(hdbc); - - return SQL_SUCCESS; -@@ -1596,6 +1837,65 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM - return ret; - } - -+static HMODULE load_odbc_driver(const WCHAR *driver, BOOL use_dsn) -+{ -+ long ret; -+ HMODULE hmod; -+ WCHAR *filename = NULL; -+ HKEY hkey; -+ WCHAR regpath[256]; -+ -+ if (use_dsn) -+ wcscpy(regpath, L"Software\\ODBC\\ODBC.INI\\"); -+ else -+ wcscpy(regpath, L"Software\\ODBC\\ODBCINST.INI\\"); -+ wcscat(regpath, driver); -+ -+ if ((ret = RegOpenKeyW(HKEY_CURRENT_USER, regpath, &hkey)) != ERROR_SUCCESS) -+ { -+ ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, regpath, &hkey); -+ } -+ -+ if (ret == ERROR_SUCCESS) -+ { -+ DWORD size = 0, type; -+ ret = RegGetValueW(hkey, NULL, L"Driver", RRF_RT_REG_SZ, &type, NULL, &size); -+ if(ret != ERROR_SUCCESS || type != REG_SZ) -+ { -+ RegCloseKey(hkey); -+ WARN("Invalid DSN %s\n", debugstr_w(driver)); -+ -+ return NULL; -+ } -+ -+ filename = malloc(size); -+ if(!filename) -+ { -+ RegCloseKey(hkey); -+ ERR("Out of memory\n"); -+ -+ return NULL; -+ } -+ ret = RegGetValueW(hkey, NULL, L"Driver", RRF_RT_REG_SZ, &type, filename, &size); -+ -+ RegCloseKey(hkey); -+ } -+ -+ if(ret != ERROR_SUCCESS) -+ { -+ free(filename); -+ ERR("Failed to open Registry Key\n"); -+ return NULL; -+ } -+ -+ hmod = LoadLibraryExW(filename, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); -+ free(filename); -+ -+ if(!hmod) -+ ERR("Failed to load driver\n"); -+ -+ return hmod; -+} - /************************************************************************* - * SQLDriverConnectW [ODBC32.141] - */ -@@ -1603,13 +1903,76 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl - SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength, - SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; -+ HMODULE driver; - SQLRETURN ret = SQL_ERROR; -+ WCHAR dsn[128]; -+ WCHAR *p; -+ BOOL is_dsn = TRUE; - -- FIXME("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," -+ TRACE("(ConnectionHandle %p, WindowHandle %p, InConnectionString %s, Length %d, OutConnectionString %p," - " BufferLength %d, Length2 %p, DriverCompletion %d)\n", ConnectionHandle, WindowHandle, -- debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2, -+ Length == SQL_NTS ? debugstr_w(InConnectionString) : debugstr_wn(InConnectionString, Length), Length, OutConnectionString, BufferLength, Length2, - DriverCompletion); - -+ p = wcsstr(InConnectionString, L"DSN="); -+ if (p) -+ { -+ WCHAR *end = wcsstr(p, L";"); -+ -+ lstrcpynW(dsn, p+4, end - (p + 3)); -+ } -+ else -+ { -+ p = wcsstr(InConnectionString, L"Driver="); -+ if (p) -+ { -+ WCHAR *end = wcsstr(p, L";"); -+ -+ lstrcpynW(dsn, p+7, end - (p + 6)); -+ is_dsn = FALSE; -+ } -+ } -+ -+ driver = load_odbc_driver(dsn, is_dsn); -+ if (!driver) -+ return SQL_ERROR; -+ -+ connection->module = driver; -+ connection->driver_ver = SQL_OV_ODBC2; -+ connection_bind_sql_funcs(connection); -+ -+ /* ODBC 3.x */ -+ if (connection->pSQLAllocHandle) -+ { -+ connection->pSQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &connection->driver_env); -+ connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc); -+ -+ if (connection->pSQLGetEnvAttr) -+ connection->pSQLGetEnvAttr(connection->driver_env, SQL_ATTR_ODBC_VERSION, &connection->driver_ver, 0, NULL); -+ -+ } -+ /* ODBC 2.x */ -+ else if(connection->pSQLAllocConnect && connection->pSQLAllocEnv) -+ { -+ connection->pSQLAllocEnv(&connection->driver_env); -+ -+ connection->pSQLAllocConnect(connection->driver_env, &connection->driver_hdbc); -+ } -+ else -+ ERR("No functions to allocated Environment handles found.\n"); -+ -+ if(!connection->pSQLDriverConnectW) -+ { -+ ERR("Failed to find pSQLDriverConnectW\n"); -+ return SQL_ERROR; -+ } -+ -+ ret = connection->pSQLDriverConnectW(connection->driver_hdbc, WindowHandle, InConnectionString, Length, -+ OutConnectionString, BufferLength, Length2, DriverCompletion); -+ -+ TRACE("Driver returned %d\n", ret); -+ - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0010-odbc32-Foward-SQLGetInfo-W-requests-onto-the-driver.patch b/patches/odbc-remove-unixodbc/0010-odbc32-Foward-SQLGetInfo-W-requests-onto-the-driver.patch deleted file mode 100644 index c5aa64dc..00000000 --- a/patches/odbc-remove-unixodbc/0010-odbc32-Foward-SQLGetInfo-W-requests-onto-the-driver.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 55674ad31123cfdcf664d8f1c28710185aa0388d Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 08:47:46 +1100 -Subject: [PATCH] odbc32: Foward SQLGetInfo/W requests onto the driver - ---- - dlls/odbc32/proxyodbc.c | 32 ++++++++++++++++++++++++++------ - 1 file changed, 26 insertions(+), 6 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 30baf1866a4..50083a23e25 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -902,7 +902,9 @@ SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT Function - SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - char *ptr = InfoValue; -+ SQLRETURN ret = SQL_SUCCESS; - - TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - InfoType, InfoValue, BufferLength, StringLength); -@@ -915,11 +917,19 @@ SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQL - *StringLength = strlen(ptr); - break; - default: -- FIXME("Unsupported type %d\n", InfoType); -- return SQL_ERROR; -+ if (connection->pSQLGetInfo) -+ ret = connection->pSQLGetInfo(connection->driver_hdbc, InfoType, InfoValue, -+ BufferLength, StringLength); -+ else -+ { -+ FIXME("Unsupported type %d\n", InfoType); -+ ret = SQL_ERROR; -+ } - } - -- return SQL_SUCCESS; -+ TRACE("ret %d\n", ret); -+ -+ return ret; - } - - /************************************************************************* -@@ -1994,7 +2004,9 @@ SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Opt - SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - WCHAR *ptr = InfoValue; -+ SQLRETURN ret = SQL_SUCCESS; - - TRACE("(ConnectionHandle, %p, InfoType %d, InfoValue %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - InfoType, InfoValue, BufferLength, StringLength); -@@ -2007,11 +2019,19 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ - *StringLength = wcslen(ptr); - break; - default: -- FIXME("Unsupported type %d\n", InfoType); -- return SQL_ERROR; -+ if (connection->pSQLGetInfoW) -+ ret = connection->pSQLGetInfoW(connection->driver_hdbc, InfoType, InfoValue, -+ BufferLength, StringLength); -+ else -+ { -+ FIXME("Unsupported type %d\n", InfoType); -+ ret = SQL_ERROR; -+ } - } - -- return SQL_SUCCESS; -+ TRACE("ret %d\n", ret); -+ -+ return ret; - } - - /************************************************************************* --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0011-odbc32-Foward-SQLSetConnectAttr-requets-onto-the-dri.patch b/patches/odbc-remove-unixodbc/0011-odbc32-Foward-SQLSetConnectAttr-requets-onto-the-dri.patch deleted file mode 100644 index 1e0191b6..00000000 --- a/patches/odbc-remove-unixodbc/0011-odbc32-Foward-SQLSetConnectAttr-requets-onto-the-dri.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 7db07cc12c6e62ab86b429d0c0b0f88426ddb681 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 08:55:12 +1100 -Subject: [PATCH] odbc32: Foward SQLSetConnectAttr requets onto the driver - ---- - dlls/odbc32/proxyodbc.c | 49 ++++++++++++++++++++++++++++++++++++----- - 1 file changed, 44 insertions(+), 5 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 50083a23e25..f817b3b524c 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1043,11 +1043,40 @@ SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount) - SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -- SQLRETURN ret = SQL_ERROR; -+ struct SQLHDBC_data *hdbc = ConnectionHandle; -+ SQLRETURN ret = SQL_SUCCESS; - -- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, - StringLength); - -+ if (hdbc->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", hdbc->type); -+ return SQL_ERROR; -+ } -+ -+ switch(Attribute) -+ { -+ case SQL_ATTR_LOGIN_TIMEOUT: -+ if (Value) -+ hdbc->login_timeout = (intptr_t)Value; -+ else -+ hdbc->login_timeout = 0; -+ break; -+ default: -+ if (hdbc->pSQLSetConnectAttr) -+ ret = hdbc->pSQLSetConnectAttr(hdbc->driver_hdbc, Attribute, Value, StringLength); -+ else if(hdbc->pSQLSetConnectOption) -+ ret = hdbc->pSQLSetConnectOption(hdbc->driver_hdbc, Attribute, (SQLULEN)Value); -+ else -+ { -+ FIXME("Unsupported Attribute %d\n", Attribute); -+ ret = SQL_ERROR; -+ } -+ } -+ -+ TRACE("ret %d\n", ret); -+ - return ret; - } - -@@ -1803,6 +1832,7 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu - SQLINTEGER StringLength) - { - struct SQLHDBC_data *hdbc = ConnectionHandle; -+ SQLRETURN ret = SQL_SUCCESS; - - TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, - StringLength); -@@ -1822,11 +1852,20 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu - hdbc->login_timeout = 0; - break; - default: -- FIXME("Unhandle attribute %d\n", Attribute); -- return SQL_ERROR; -+ if (hdbc->pSQLSetConnectAttrW) -+ ret = hdbc->pSQLSetConnectAttrW(hdbc->driver_hdbc, Attribute, Value, StringLength); -+ else if(hdbc->pSQLSetConnectOptionW) -+ ret = hdbc->pSQLSetConnectOptionW(hdbc->driver_hdbc, Attribute, (SQLULEN)Value); -+ else -+ { -+ FIXME("Unsupported Attribute %d\n", Attribute); -+ ret = SQL_ERROR; -+ } - } - -- return SQL_SUCCESS; -+ TRACE("ret %d\n", ret); -+ -+ return ret; - } - - /************************************************************************* --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0012-odbc32-Forward-SQLGetFunctions-requets-onto-the-driv.patch b/patches/odbc-remove-unixodbc/0012-odbc32-Forward-SQLGetFunctions-requets-onto-the-driv.patch deleted file mode 100644 index bde01214..00000000 --- a/patches/odbc-remove-unixodbc/0012-odbc32-Forward-SQLGetFunctions-requets-onto-the-driv.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 25b167b0027c64be079c7203b994dac1b5627446 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 09:02:34 +1100 -Subject: [PATCH] odbc32: Forward SQLGetFunctions requets onto the driver - ---- - dlls/odbc32/proxyodbc.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index f817b3b524c..3ed0a484972 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -889,9 +889,15 @@ SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, - */ - SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported); -+ TRACE("(ConnectionHandle %p, FunctionId %d, Supported %p)\n", ConnectionHandle, FunctionId, Supported); -+ -+ if (connection->pSQLGetFunctions) -+ { -+ ret = connection->pSQLGetFunctions(connection->driver_hdbc, FunctionId, Supported); -+ } - - return ret; - } --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0013-odbc32-Forward-SQLGetConnectAttr-W-requets-onto-the-.patch b/patches/odbc-remove-unixodbc/0013-odbc32-Forward-SQLGetConnectAttr-W-requets-onto-the-.patch deleted file mode 100644 index 1ff941b0..00000000 --- a/patches/odbc-remove-unixodbc/0013-odbc32-Forward-SQLGetConnectAttr-W-requets-onto-the-.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 53e0846f51522be5a2f7574f12ff35d16c44d1de Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 09:08:27 +1100 -Subject: [PATCH] odbc32: Forward SQLGetConnectAttr/W requets onto the driver - ---- - dlls/odbc32/proxyodbc.c | 42 +++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 40 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 3ed0a484972..886fe07efb9 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -730,11 +730,30 @@ SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) - SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - Attribute, Value, BufferLength, StringLength); - -+ if (connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", connection->type); -+ return SQL_ERROR; -+ } -+ -+ if (connection->pSQLGetConnectAttr) -+ { -+ ret = connection->pSQLGetConnectAttr(connection->driver_hdbc, Attribute, Value, -+ BufferLength, StringLength); -+ } -+ else if (connection->pSQLGetConnectOption) -+ { -+ ret = connection->pSQLGetConnectOption(connection->driver_hdbc, Attribute, Value); -+ } -+ -+ TRACE("ret %d\n", ret); -+ - return ret; - } - -@@ -1741,11 +1760,30 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN - SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, -+ TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, - Attribute, Value, BufferLength, StringLength); - -+ if (connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", connection->type); -+ return SQL_ERROR; -+ } -+ -+ if (connection->pSQLGetConnectAttrW) -+ { -+ ret = connection->pSQLGetConnectAttrW(connection->driver_hdbc, Attribute, Value, -+ BufferLength, StringLength); -+ } -+ else if (connection->pSQLGetConnectOptionW) -+ { -+ ret = connection->pSQLGetConnectOptionW(connection->driver_hdbc, Attribute, Value); -+ } -+ -+ TRACE("ret %d\n", ret); -+ - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0014-odbc32-Foward-SQLDisconnect-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0014-odbc32-Foward-SQLDisconnect-request-onto-driver.patch deleted file mode 100644 index 7485c90a..00000000 --- a/patches/odbc-remove-unixodbc/0014-odbc32-Foward-SQLDisconnect-request-onto-driver.patch +++ /dev/null @@ -1,41 +0,0 @@ -From fc34342d52977928717c0b9f45bff99613461201 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 09:26:57 +1100 -Subject: [PATCH] odbc32: Foward SQLDisconnect request onto driver - ---- - dlls/odbc32/proxyodbc.c | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 886fe07efb9..eb274c5da5b 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -574,9 +574,23 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum - */ - SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(ConnectionHandle %p)\n", ConnectionHandle); -+ TRACE("(ConnectionHandle %p)\n", ConnectionHandle); -+ -+ if (connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", connection->type); -+ return SQL_ERROR; -+ } -+ -+ if (connection->pSQLDisconnect) -+ { -+ ret = connection->pSQLDisconnect(connection->driver_hdbc); -+ } -+ -+ TRACE("ret %d\n", ret); - - return ret; - } --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0015-odbc32-Implement-SQLAllocStmt.patch b/patches/odbc-remove-unixodbc/0015-odbc32-Implement-SQLAllocStmt.patch deleted file mode 100644 index e26f557e..00000000 --- a/patches/odbc-remove-unixodbc/0015-odbc32-Implement-SQLAllocStmt.patch +++ /dev/null @@ -1,73 +0,0 @@ -From a09926caf2fd91460ab75d75c3aba98a153f97fa Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 09:53:34 +1100 -Subject: [PATCH] odbc32: Implement SQLAllocStmt - ---- - dlls/odbc32/proxyodbc.c | 39 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 38 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index eb274c5da5b..1e6ee80c03d 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -174,6 +174,13 @@ struct SQLHDBC_data - SQLUINTEGER login_timeout; - }; - -+struct SQLHSTMT_data -+{ -+ int type; -+ struct SQLHDBC_data *connection; -+ SQLHSTMT driver_stmt; -+}; -+ - static void connection_bind_sql_funcs(struct SQLHDBC_data *connection) - { - #define LOAD_FUNCPTR(f) if((connection->p##f = (void*)GetProcAddress(connection->module, #f)) == NULL) \ -@@ -365,11 +372,41 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S - */ - SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; -+ struct SQLHSTMT_data *stmt; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle); -+ TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle); - - *StatementHandle = SQL_NULL_HSTMT; -+ if (connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", connection->type); -+ return SQL_ERROR; -+ } -+ -+ stmt = malloc(sizeof(*stmt)); -+ if (!stmt) -+ { -+ return SQL_ERROR; -+ } -+ -+ stmt->type = SQL_HANDLE_STMT; -+ stmt->connection = connection; -+ -+ /* Default to ODBC v3 function */ -+ if(connection->pSQLAllocHandle) -+ { -+ ret = connection->pSQLAllocHandle(SQL_HANDLE_STMT, connection->driver_hdbc, &stmt->driver_stmt); -+ } -+ else if (connection->pSQLAllocStmt) -+ { -+ ret = connection->pSQLAllocStmt(connection->driver_hdbc, &stmt->driver_stmt); -+ } -+ -+ *StatementHandle = stmt; -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0016-odbc32-Forward-SQLSetStmtAttr-W-request-to-driver.patch b/patches/odbc-remove-unixodbc/0016-odbc32-Forward-SQLSetStmtAttr-W-request-to-driver.patch deleted file mode 100644 index cef496c6..00000000 --- a/patches/odbc-remove-unixodbc/0016-odbc32-Forward-SQLSetStmtAttr-W-request-to-driver.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 2f3d8481978439bdc657f5f020e255c9c2c634d1 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 09:59:14 +1100 -Subject: [PATCH] odbc32: Forward SQLSetStmtAttr/W request to driver - ---- - dlls/odbc32/proxyodbc.c | 38 ++++++++++++++++++++++++++++++++++++-- - 1 file changed, 36 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 1e6ee80c03d..999d1e64916 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1266,11 +1266,28 @@ SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNum - SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, - StringLength); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLSetStmtAttr) -+ { -+ ret = statement->connection->pSQLSetStmtAttr(statement->driver_stmt, Attribute, Value, StringLength); -+ } -+ else if (statement->connection->pSQLSetStmtOption) -+ { -+ ret = statement->connection->pSQLSetStmtOption( statement->driver_stmt, Attribute, (SQLULEN) Value ); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -2438,11 +2455,28 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb - SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER StringLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, StringLength %d)\n", StatementHandle, Attribute, Value, - StringLength); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLSetStmtAttrW) -+ { -+ ret = statement->connection->pSQLSetStmtAttrW(statement->driver_stmt, Attribute, Value, StringLength); -+ } -+ else if (statement->connection->pSQLSetStmtOption) -+ { -+ ret = statement->connection->pSQLSetStmtOption( statement->driver_stmt, Attribute, (SQLULEN) Value ); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0017-odbc32-Forward-SQLParamOptions-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0017-odbc32-Forward-SQLParamOptions-request-onto-driver.patch deleted file mode 100644 index 43b7caf0..00000000 --- a/patches/odbc-remove-unixodbc/0017-odbc32-Forward-SQLParamOptions-request-onto-driver.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e2dcd4d6536d1ad99549920cdda96b4ce23b7b05 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 10:50:26 +1100 -Subject: [PATCH] odbc32: Forward SQLParamOptions request onto driver - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 999d1e64916..2b1db217467 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1529,10 +1529,23 @@ SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar) - */ - SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow) - { -+ struct SQLHSTMT_data *statement = hstmt; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow); -+ TRACE("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLParamOptions) -+ { -+ ret = statement->connection->pSQLParamOptions(statement->driver_stmt, crow, pirow); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0018-odbc32-Forward-SQLExecDirect-W-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0018-odbc32-Forward-SQLExecDirect-W-request-onto-driver.patch deleted file mode 100644 index f8701d91..00000000 --- a/patches/odbc-remove-unixodbc/0018-odbc32-Forward-SQLExecDirect-W-request-onto-driver.patch +++ /dev/null @@ -1,72 +0,0 @@ -From c7285c3ce19b3e5ff0d6a90ff84fa3c497776511 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 10:53:29 +1100 -Subject: [PATCH] odbc32: Forward SQLExecDirect/W request onto driver - ---- - dlls/odbc32/proxyodbc.c | 36 ++++++++++++++++++++++++++++++++---- - 1 file changed, 32 insertions(+), 4 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 2b1db217467..6508c9b1d73 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -665,11 +665,25 @@ SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, S - */ - SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -- debugstr_an((const char *)StatementText, TextLength), TextLength); -+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ TextLength > 0 ? debugstr_an((char*)StatementText, TextLength) : debugstr_a((char*)StatementText), -+ TextLength); -+ -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } - -+ if (statement->connection->pSQLExecDirect) -+ { -+ ret = statement->connection->pSQLExecDirect(statement->driver_stmt, StatementText, TextLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -1770,11 +1784,25 @@ SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, - */ - SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -- debugstr_wn(StatementText, TextLength), TextLength); -+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ TextLength > 0 ? debugstr_wn(StatementText, TextLength) : debugstr_w(StatementText), -+ TextLength); -+ -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } - -+ if (statement->connection->pSQLExecDirectW) -+ { -+ ret = statement->connection->pSQLExecDirectW(statement->driver_stmt, StatementText, TextLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0019-odbc32-Forward-SQLGetStmtAttr-W-onto-driver.patch b/patches/odbc-remove-unixodbc/0019-odbc32-Forward-SQLGetStmtAttr-W-onto-driver.patch deleted file mode 100644 index 2e701e03..00000000 --- a/patches/odbc-remove-unixodbc/0019-odbc32-Forward-SQLGetStmtAttr-W-onto-driver.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 2f915fc78edc974c6ef926ec3b3b4da81b64b72a Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:04:32 +1100 -Subject: [PATCH] odbc32: Forward SQLGetStmtAttr/W onto driver - ---- - dlls/odbc32/proxyodbc.c | 32 ++++++++++++++++++++++++++++++-- - 1 file changed, 30 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 6508c9b1d73..ecc208ac21b 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1028,17 +1028,31 @@ SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQL - SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, - Attribute, Value, BufferLength, StringLength); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ - if (!Value) - { - WARN("Unexpected NULL Value return address\n"); - return SQL_ERROR; - } - -+ if (statement->connection->pSQLGetStmtAttr) -+ { -+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, Value, -+ BufferLength, StringLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -1964,17 +1978,31 @@ SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA - SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, - SQLINTEGER BufferLength, SQLINTEGER *StringLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, -+ TRACE("(StatementHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", StatementHandle, - Attribute, Value, BufferLength, StringLength); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ - if (!Value) - { - WARN("Unexpected NULL Value return address\n"); - return SQL_ERROR; - } - -+ if (statement->connection->pSQLGetStmtAttrW) -+ { -+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, Value, -+ BufferLength, StringLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0020-odbc32-Forward-SQLRowCount-onto-driver.patch b/patches/odbc-remove-unixodbc/0020-odbc32-Forward-SQLRowCount-onto-driver.patch deleted file mode 100644 index 4a4dc0a7..00000000 --- a/patches/odbc-remove-unixodbc/0020-odbc32-Forward-SQLRowCount-onto-driver.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 711377cb7cad345eda0432fdf035b6f5466ef1c4 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:08:41 +1100 -Subject: [PATCH] odbc32: Forward SQLRowCount onto driver - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index ecc208ac21b..c76b8ff3c2a 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1134,10 +1134,23 @@ SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN St - */ - SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount); -+ TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLRowCount) -+ { -+ ret = statement->connection->pSQLRowCount(statement->driver_stmt, RowCount); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0021-odbc32-Forward-SQLNumResultCols-onto-driver.patch b/patches/odbc-remove-unixodbc/0021-odbc32-Forward-SQLNumResultCols-onto-driver.patch deleted file mode 100644 index dc9636f8..00000000 --- a/patches/odbc-remove-unixodbc/0021-odbc32-Forward-SQLNumResultCols-onto-driver.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1a21b4f8c22e0b8911a9ebd43cc4a5f665192494 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:10:54 +1100 -Subject: [PATCH] odbc32: Forward SQLNumResultCols onto driver - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index c76b8ff3c2a..12b6e9e113b 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1085,10 +1085,23 @@ SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) - */ - SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount); -+ TRACE("(StatementHandle %p, ColumnCount %p)\n", StatementHandle, ColumnCount); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLNumResultCols) -+ { -+ ret = statement->connection->pSQLNumResultCols(statement->driver_stmt, ColumnCount); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0022-odbc32-Forward-SQLMoreResults-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0022-odbc32-Forward-SQLMoreResults-request-onto-driver.patch deleted file mode 100644 index ed4b9ded..00000000 --- a/patches/odbc-remove-unixodbc/0022-odbc32-Forward-SQLMoreResults-request-onto-driver.patch +++ /dev/null @@ -1,41 +0,0 @@ -From cdebd6c62d542e1c4a3e6edd3885e7a14bb796cc Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:12:20 +1100 -Subject: [PATCH] odbc32: Forward SQLMoreResults request onto driver - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 12b6e9e113b..61877bfb4a7 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1545,10 +1545,23 @@ SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMA - */ - SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(%p)\n", StatementHandle); -+ TRACE("(%p)\n", StatementHandle); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLMoreResults) -+ { -+ ret = statement->connection->pSQLMoreResults(statement->driver_stmt); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0023-odbc32-Forward-SQLDescribeCol-w-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0023-odbc32-Forward-SQLDescribeCol-w-request-onto-driver.patch deleted file mode 100644 index 505abb40..00000000 --- a/patches/odbc-remove-unixodbc/0023-odbc32-Forward-SQLDescribeCol-w-request-onto-driver.patch +++ /dev/null @@ -1,78 +0,0 @@ -From af020a2a8380fc6640ae91385840d624842a428e Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:17:59 +1100 -Subject: [PATCH] odbc32: Forward SQLDescribeCol/w request onto driver - ---- - dlls/odbc32/proxyodbc.c | 35 +++++++++++++++++++++++++++++++++-- - 1 file changed, 33 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 61877bfb4a7..ae7794917f3 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -597,12 +597,29 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum - SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, - SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) - { -+ struct SQLHSTMT_data *statement = StatementHandle; -+ SQLSMALLINT dummy; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," -+ TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," - " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName, - BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); - -+ if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ -+ -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLDescribeCol) -+ { -+ ret = statement->connection->pSQLDescribeCol(statement->driver_stmt, ColumnNumber, ColumnName, -+ BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -1804,15 +1821,29 @@ SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu - SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, - SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLSMALLINT dummy; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," -+ TRACE("(StatementHandle %p, ColumnNumber %d, ColumnName %p, BufferLength %d, NameLength %p, DataType %p," - " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName, - BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); - - if (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLDescribeColW) -+ { -+ ret = statement->connection->pSQLDescribeColW(statement->driver_stmt, ColumnNumber, ColumnName, -+ BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0024-odbc32-Forward-SQLColAttributes-W-request-onto-drive.patch b/patches/odbc-remove-unixodbc/0024-odbc32-Forward-SQLColAttributes-W-request-onto-drive.patch deleted file mode 100644 index 100b842f..00000000 --- a/patches/odbc-remove-unixodbc/0024-odbc32-Forward-SQLColAttributes-W-request-onto-drive.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 575797d61cb119102a9db030ee57e20e0ce466c6 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:30:58 +1100 -Subject: [PATCH] odbc32: Forward SQLColAttributes/W request onto driver - ---- - dlls/odbc32/proxyodbc.c | 55 +++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 53 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index ae7794917f3..b4f143dab45 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1478,11 +1478,26 @@ SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLIN - SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, - SQLLEN *pfDesc) - { -+ struct SQLHSTMT_data *statement = hstmt; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, -+ TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, - fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLColAttributes) -+ { -+ ret = statement->connection->pSQLColAttributes(statement->driver_stmt, icol, fDescType, -+ rgbDesc, cbDescMax, pcbDesc, pfDesc); -+ } -+ -+ TRACE("ret %d\n", ret); -+ - return ret; - } - -@@ -1783,6 +1798,21 @@ SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_c - return ret; - } - -+static SQLINTEGER map_odbc2_to_3(SQLINTEGER fieldid) -+{ -+ switch( fieldid ) -+ { -+ case SQL_COLUMN_COUNT: -+ return SQL_DESC_COUNT; -+ case SQL_COLUMN_NULLABLE: -+ return SQL_DESC_NULLABLE; -+ case SQL_COLUMN_NAME: -+ return SQL_DESC_NAME; -+ default: -+ return fieldid; -+ } -+} -+ - /************************************************************************* - * SQLColAttributesW [ODBC32.106] - */ -@@ -1790,11 +1820,32 @@ SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLI - SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, - SQLLEN *pfDesc) - { -+ struct SQLHSTMT_data *statement = hstmt; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, -+ TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, - fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ /* Default to ODBC 3.x */ -+ if (statement->connection->pSQLColAttributeW) -+ { -+ fDescType = map_odbc2_to_3(fDescType); -+ ret = statement->connection->pSQLColAttributeW(statement->driver_stmt, icol, fDescType, -+ rgbDesc, cbDescMax, pcbDesc, pfDesc); -+ } -+ else if (statement->connection->pSQLColAttributesW) -+ { -+ ret = statement->connection->pSQLColAttributesW(statement->driver_stmt, icol, fDescType, -+ rgbDesc, cbDescMax, pcbDesc, pfDesc); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0025-odbc32-Forward-SQLNativeSql-W-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0025-odbc32-Forward-SQLNativeSql-W-request-onto-driver.patch deleted file mode 100644 index b23a0737..00000000 --- a/patches/odbc-remove-unixodbc/0025-odbc32-Forward-SQLNativeSql-W-request-onto-driver.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 3bd355283d087071c17eab5f4799f092dd42d8d1 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:36:33 +1100 -Subject: [PATCH] odbc32: Forward SQLNativeSql/W request onto driver - ---- - dlls/odbc32/proxyodbc.c | 32 ++++++++++++++++++++++++++++++-- - 1 file changed, 30 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index b4f143dab45..6e599a385a1 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1603,11 +1603,25 @@ SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle) - SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr, - SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr) - { -+ struct SQLHDBC_data *connection = hdbc; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc, -+ TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc, - debugstr_an((const char *)szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); - -+ if (connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", connection->type); -+ return SQL_ERROR; -+ } -+ -+ if (connection->pSQLNativeSql) -+ { -+ ret = connection->pSQLNativeSql(connection->driver_hdbc, szSqlStrIn, cbSqlStrIn, -+ szSqlStr, cbSqlStrMax, pcbSqlStr); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -2531,11 +2545,25 @@ SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLS - SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr, - SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr) - { -+ struct SQLHDBC_data *connection = hdbc; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc, -+ TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc, - debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); - -+ if (connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", connection->type); -+ return SQL_ERROR; -+ } -+ -+ if (connection->pSQLNativeSqlW) -+ { -+ ret = connection->pSQLNativeSqlW(connection->driver_hdbc, szSqlStrIn, cbSqlStrIn, -+ szSqlStr, cbSqlStrMax, pcbSqlStr); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0026-odbc32-Forward-SQLPrepare-W-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0026-odbc32-Forward-SQLPrepare-W-request-onto-driver.patch deleted file mode 100644 index f67e0294..00000000 --- a/patches/odbc-remove-unixodbc/0026-odbc32-Forward-SQLPrepare-W-request-onto-driver.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 69dc39b9dbf854da2f2b21069ca6407de8fc77e0 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:44:00 +1100 -Subject: [PATCH] odbc32: Forward SQLPrepare/W request onto driver - ---- - dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++--- - 1 file changed, 31 insertions(+), 3 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 6e599a385a1..12d75fd1fcc 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1139,11 +1139,25 @@ SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) - */ - SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - - FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -- debugstr_an((const char *)StatementText, TextLength), TextLength); -+ TextLength > 0 ? debugstr_an((const char *)StatementText, TextLength) : debugstr_a((const char *)StatementText), -+ TextLength); -+ -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLPrepare) -+ { -+ ret = statement->connection->pSQLPrepare(statement->driver_stmt, StatementText, TextLength); -+ } - -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -1974,11 +1988,25 @@ SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, - */ - SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -- debugstr_wn(StatementText, TextLength), TextLength); -+ TRACE("(StatementHandle %p, StatementText %s, TextLength %d)\n", StatementHandle, -+ TextLength > 0 ? debugstr_wn(StatementText, TextLength) : debugstr_w(StatementText), -+ TextLength); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLPrepareW) -+ { -+ ret = statement->connection->pSQLPrepareW(statement->driver_stmt, StatementText, TextLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0027-odbc32-Implement-SQLFreeStmt.patch b/patches/odbc-remove-unixodbc/0027-odbc32-Implement-SQLFreeStmt.patch deleted file mode 100644 index 3b9dd817..00000000 --- a/patches/odbc-remove-unixodbc/0027-odbc32-Implement-SQLFreeStmt.patch +++ /dev/null @@ -1,41 +0,0 @@ -From bf680aa668ce942e0f7d37333c3680561ec45b84 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:47:40 +1100 -Subject: [PATCH] odbc32: Implement SQLFreeStmt - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 12d75fd1fcc..c457c4ac203 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -799,10 +799,23 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) - */ - SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, Option %d)\n", StatementHandle, Option); -+ TRACE("(StatementHandle %p, Option %d)\n", StatementHandle, Option); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLFreeStmt) -+ { -+ ret = statement->connection->pSQLFreeStmt(statement->driver_stmt, Option); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0028-odbc32-Forward-SQLBindCol-requets-onto-driver.patch b/patches/odbc-remove-unixodbc/0028-odbc32-Forward-SQLBindCol-requets-onto-driver.patch deleted file mode 100644 index 45ee076d..00000000 --- a/patches/odbc-remove-unixodbc/0028-odbc32-Forward-SQLBindCol-requets-onto-driver.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 3a2481213f3f96ab6befa4b052d1c7266cb82af6 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 11:57:00 +1100 -Subject: [PATCH] odbc32: Forward SQLBindCol requets onto driver - ---- - dlls/odbc32/proxyodbc.c | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index c457c4ac203..257375f568a 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -438,11 +438,25 @@ static const char *debugstr_sqllen( SQLLEN len ) - SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, - SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", -+ TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", - StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLBindCol) -+ { -+ ret = statement->connection->pSQLBindCol(statement->driver_stmt, ColumnNumber, TargetType, -+ TargetValue, BufferLength, StrLen_or_Ind); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0029-odbc32-Forward-SQLExtendedFetch-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0029-odbc32-Forward-SQLExtendedFetch-request-onto-driver.patch deleted file mode 100644 index a016d0c7..00000000 --- a/patches/odbc-remove-unixodbc/0029-odbc32-Forward-SQLExtendedFetch-request-onto-driver.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 4b29416728af78c52d707adacc3d8ca7ffa01cd6 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 12:35:26 +1100 -Subject: [PATCH] odbc32: Forward SQLExtendedFetch request onto driver - ---- - dlls/odbc32/proxyodbc.c | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 257375f568a..de63be77ce2 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1581,11 +1581,25 @@ SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT - SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow, - SQLUSMALLINT *rgfRowStatus) - { -+ struct SQLHSTMT_data *statement = hstmt; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow), -+ TRACE("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow), - pcrow, rgfRowStatus); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLExtendedFetch) -+ { -+ ret = statement->connection->pSQLExtendedFetch(statement->driver_stmt, fFetchType, irow, -+ pcrow, rgfRowStatus); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0030-odbc32-Forward-SQLExecute-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0030-odbc32-Forward-SQLExecute-request-onto-driver.patch deleted file mode 100644 index 95c98924..00000000 --- a/patches/odbc-remove-unixodbc/0030-odbc32-Forward-SQLExecute-request-onto-driver.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 3af824cbff508603882029571b0799fa61c6526f Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 13:14:19 +1100 -Subject: [PATCH] odbc32: Forward SQLExecute request onto driver - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index de63be77ce2..6dd8f9ac0fb 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -735,10 +735,23 @@ SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle) - */ - SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p)\n", StatementHandle); -+ TRACE("(StatementHandle %p)\n", StatementHandle); -+ -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLFetch) -+ { -+ ret = statement->connection->pSQLFetch(statement->driver_stmt); -+ } - -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0031-odbc32-Forward-SQLGetDiagField-W-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0031-odbc32-Forward-SQLGetDiagField-W-request-onto-driver.patch deleted file mode 100644 index 2d267949..00000000 --- a/patches/odbc-remove-unixodbc/0031-odbc32-Forward-SQLGetDiagField-W-request-onto-driver.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 3c2a0b102b6525589dfc58a481a9b769f2d40c57 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 13:15:48 +1100 -Subject: [PATCH] odbc32: Forward SQLGetDiagField/W request onto driver - ---- - dlls/odbc32/proxyodbc.c | 48 +++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 46 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 6dd8f9ac0fb..ac30e8aed81 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -959,9 +959,31 @@ SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSM - { - SQLRETURN ret = SQL_NO_DATA; - -- FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," - " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); - -+ if (HandleType == SQL_HANDLE_ENV) -+ { -+ FIXME("Unhandled SQL_HANDLE_ENV records\n"); -+ } -+ else if (HandleType == SQL_HANDLE_DBC) -+ { -+ struct SQLHDBC_data *hdbc = Handle; -+ -+ if (hdbc->pSQLGetDiagField) -+ ret = hdbc->pSQLGetDiagField(HandleType, hdbc->driver_hdbc, RecNumber, DiagIdentifier, -+ DiagInfo, BufferLength, StringLength); -+ } -+ else if (HandleType == SQL_HANDLE_STMT) -+ { -+ struct SQLHSTMT_data *statement = Handle; -+ -+ if (statement->connection->pSQLGetDiagField) -+ ret = statement->connection->pSQLGetDiagField(HandleType, statement->driver_stmt, RecNumber, -+ DiagIdentifier, DiagInfo, BufferLength, StringLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -2167,9 +2189,31 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS - { - SQLRETURN ret = SQL_NO_DATA; - -- FIXME("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, DiagIdentifier %d, DiagInfo %p, BufferLength %d," - " StringLength %p)\n", HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); - -+ if (HandleType == SQL_HANDLE_ENV) -+ { -+ FIXME("Unhandled SQL_HANDLE_ENV records\n"); -+ } -+ else if (HandleType == SQL_HANDLE_DBC) -+ { -+ struct SQLHDBC_data *hdbc = Handle; -+ -+ if (hdbc->pSQLGetDiagFieldW) -+ ret = hdbc->pSQLGetDiagFieldW(HandleType, hdbc->driver_hdbc, RecNumber, DiagIdentifier, -+ DiagInfo, BufferLength, StringLength); -+ } -+ else if (HandleType == SQL_HANDLE_STMT) -+ { -+ struct SQLHSTMT_data *statement = Handle; -+ -+ if (statement->connection->pSQLGetDiagFieldW) -+ ret = statement->connection->pSQLGetDiagFieldW(HandleType, statement->driver_stmt, RecNumber, -+ DiagIdentifier, DiagInfo, BufferLength, StringLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0032-odbc32-SQLGetStmtAttr-store-some-driver-HDESC-values.patch b/patches/odbc-remove-unixodbc/0032-odbc32-SQLGetStmtAttr-store-some-driver-HDESC-values.patch deleted file mode 100644 index 0e9137ef..00000000 --- a/patches/odbc-remove-unixodbc/0032-odbc32-SQLGetStmtAttr-store-some-driver-HDESC-values.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 9da2063aee1a4ffc92b76e204392bad4fcb63431 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 14:00:41 +1100 -Subject: [PATCH] odbc32: SQLGetStmtAttr store some driver HDESC values - ---- - dlls/odbc32/proxyodbc.c | 81 +++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 78 insertions(+), 3 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index ac30e8aed81..62f8fdc40a5 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -174,11 +174,22 @@ struct SQLHDBC_data - SQLUINTEGER login_timeout; - }; - -+struct SQLHDESC_data -+{ -+ struct SQLHSTMT_data *parent; -+ SQLHDESC driver_hdesc; -+}; -+ - struct SQLHSTMT_data - { - int type; - struct SQLHDBC_data *connection; - SQLHSTMT driver_stmt; -+ -+ struct SQLHDESC_data app_row_desc; -+ struct SQLHDESC_data imp_row_desc; -+ struct SQLHDESC_data app_param_desc; -+ struct SQLHDESC_data imp_param_desc; - }; - - static void connection_bind_sql_funcs(struct SQLHDBC_data *connection) -@@ -1127,8 +1138,40 @@ SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - - if (statement->connection->pSQLGetStmtAttr) - { -- ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, Value, -+ switch(Attribute) -+ { -+ case SQL_ATTR_APP_ROW_DESC: -+ statement->app_row_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, -+ &statement->app_row_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->app_row_desc; -+ break; -+ case SQL_ATTR_IMP_ROW_DESC: -+ statement->imp_row_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, -+ &statement->imp_row_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->imp_row_desc; -+ break; -+ case SQL_ATTR_APP_PARAM_DESC: -+ statement->app_param_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, -+ &statement->app_param_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->app_param_desc; -+ break; -+ case SQL_ATTR_IMP_PARAM_DESC: -+ statement->imp_param_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, -+ &statement->imp_param_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->imp_param_desc; -+ break; -+ default: -+ ret = statement->connection->pSQLGetStmtAttr(statement->driver_stmt, Attribute, Value, - BufferLength, StringLength); -+ } - } - - TRACE("ret %d\n", ret); -@@ -2259,8 +2302,40 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, - - if (statement->connection->pSQLGetStmtAttrW) - { -- ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, Value, -- BufferLength, StringLength); -+ switch(Attribute) -+ { -+ case SQL_ATTR_APP_ROW_DESC: -+ statement->app_row_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, -+ &statement->app_row_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->app_row_desc; -+ break; -+ case SQL_ATTR_IMP_ROW_DESC: -+ statement->imp_row_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, -+ &statement->imp_row_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->imp_row_desc; -+ break; -+ case SQL_ATTR_APP_PARAM_DESC: -+ statement->app_param_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, -+ &statement->app_param_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->app_param_desc; -+ break; -+ case SQL_ATTR_IMP_PARAM_DESC: -+ statement->imp_param_desc.parent = statement; -+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, -+ &statement->imp_param_desc.driver_hdesc, -+ BufferLength, StringLength); -+ *((SQLHDESC*)Value) = &statement->imp_param_desc; -+ break; -+ default: -+ ret = statement->connection->pSQLGetStmtAttrW(statement->driver_stmt, Attribute, Value, -+ BufferLength, StringLength); -+ } - } - - TRACE("ret %d\n", ret); --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0033-odbc32-Forward-SQLSetDescFieldW-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0033-odbc32-Forward-SQLSetDescFieldW-request-onto-driver.patch deleted file mode 100644 index 4ff00d8e..00000000 --- a/patches/odbc-remove-unixodbc/0033-odbc32-Forward-SQLSetDescFieldW-request-onto-driver.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 2a12908474e8cbd6c032d0af426f66b0c3ac2f7f Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 14:11:44 +1100 -Subject: [PATCH] odbc32: Forward SQLSetDescFieldW request onto driver - ---- - dlls/odbc32/proxyodbc.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 62f8fdc40a5..f7032a66ca6 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -2186,6 +2186,7 @@ SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu - { - ret = connection->pSQLGetConnectOptionW(connection->driver_hdbc, Attribute, Value); - } -+ TRACE("ret %d\n", ret); - - TRACE("ret %d\n", ret); - -@@ -2860,11 +2861,17 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, - SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, - SQLPOINTER Value, SQLINTEGER BufferLength) - { -+ struct SQLHDESC_data *hdesc = DescriptorHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, -+ TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, - RecNumber, FieldIdentifier, Value, BufferLength); - -+ if (hdesc->parent->connection->pSQLSetDescFieldW) -+ ret = hdesc->parent->connection->pSQLSetDescFieldW(hdesc->driver_hdesc, RecNumber, FieldIdentifier, -+ Value, BufferLength); -+ TRACE("ret %d\n", ret); -+ - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0034-odbc32-Forward-SQLGetData-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0034-odbc32-Forward-SQLGetData-request-onto-driver.patch deleted file mode 100644 index ce92f73d..00000000 --- a/patches/odbc-remove-unixodbc/0034-odbc32-Forward-SQLGetData-request-onto-driver.patch +++ /dev/null @@ -1,53 +0,0 @@ -From cd89d8e94f385756bc6c5505c44401cf2e69abb1 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 15:13:09 +1100 -Subject: [PATCH] odbc32: Forward SQLGetData request onto driver - ---- - dlls/odbc32/proxyodbc.c | 26 +++++++++++++++++++++++++- - 1 file changed, 25 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index f7032a66ca6..c8e715bdd67 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -922,11 +922,35 @@ SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, - SQLRETURN WINAPI SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, - SQLPOINTER TargetValue, SQLLEN BufferLength, SQLLEN *StrLen_or_Ind) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", -+ TRACE("(StatementHandle %p, ColumnNumber %d, TargetType %d, TargetValue %p, BufferLength %s, StrLen_or_Ind %p)\n", - StatementHandle, ColumnNumber, TargetType, TargetValue, debugstr_sqllen(BufferLength), StrLen_or_Ind); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLGetData) -+ { -+ if(statement->connection->driver_ver == SQL_OV_ODBC2 && -+ statement->connection->environment->version == SQL_OV_ODBC3) -+ { -+ if (TargetType == SQL_C_TYPE_TIME) -+ TargetType = SQL_C_TIME; -+ else if (TargetType == SQL_C_TYPE_DATE) -+ TargetType = SQL_C_DATE; -+ else if (TargetType == SQL_C_TYPE_TIMESTAMP) -+ TargetType = SQL_C_TIMESTAMP; -+ } -+ ret = statement->connection->pSQLGetData(statement->driver_stmt, ColumnNumber, TargetType, -+ TargetValue, BufferLength, StrLen_or_Ind); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0035-odbc32-Forward-SQLGetTypeInfo-W-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0035-odbc32-Forward-SQLGetTypeInfo-W-request-onto-driver.patch deleted file mode 100644 index 222a22cf..00000000 --- a/patches/odbc-remove-unixodbc/0035-odbc32-Forward-SQLGetTypeInfo-W-request-onto-driver.patch +++ /dev/null @@ -1,66 +0,0 @@ -From d84771b086426a52b39dff76e07530eda7096072 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 15:23:30 +1100 -Subject: [PATCH] odbc32: Forward SQLGetTypeInfo/W request onto driver - ---- - dlls/odbc32/proxyodbc.c | 30 ++++++++++++++++++++++++++++-- - 1 file changed, 28 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index c8e715bdd67..fd8e78f451b 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1219,10 +1219,23 @@ SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, - */ - SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); -+ TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLGetTypeInfo) -+ { -+ ret = statement->connection->pSQLGetTypeInfo(statement->driver_stmt, DataType); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -2620,10 +2633,23 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ - */ - SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); -+ TRACE("(StatementHandle %p, DataType %d)\n", StatementHandle, DataType); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLGetTypeInfoW) -+ { -+ ret = statement->connection->pSQLGetTypeInfoW(statement->driver_stmt, DataType); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0036-odbc32-Forward-SQLBindParameter-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0036-odbc32-Forward-SQLBindParameter-request-onto-driver.patch deleted file mode 100644 index 449b0741..00000000 --- a/patches/odbc-remove-unixodbc/0036-odbc32-Forward-SQLBindParameter-request-onto-driver.patch +++ /dev/null @@ -1,65 +0,0 @@ -From dc9fe6444cb0c42d70cf78032cdb4808fed5eb68 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 15:40:24 +1100 -Subject: [PATCH] odbc32: Forward SQLBindParameter request onto driver - ---- - dlls/odbc32/proxyodbc.c | 37 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 36 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index fd8e78f451b..f2ece198084 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1942,12 +1942,47 @@ SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT - SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax, - SQLLEN *pcbValue) - { -+ struct SQLHSTMT_data *statement = hstmt; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p," -+ TRACE("(hstmt %p, ipar %d, fParamType %d, fCType %d, fSqlType %d, cbColDef %s, ibScale %d, rgbValue %p," - " cbValueMax %s, pcbValue %p)\n", hstmt, ipar, fParamType, fCType, fSqlType, debugstr_sqlulen(cbColDef), - ibScale, rgbValue, debugstr_sqllen(cbValueMax), pcbValue); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLBindParameter) -+ { -+ ret = statement->connection->pSQLBindParameter(statement->driver_stmt, ipar, fParamType, -+ fCType, fSqlType, cbColDef, ibScale, rgbValue, cbValueMax, pcbValue); -+ } -+ else if(statement->connection->pSQLBindParam) -+ { -+ /* TODO: Make function */ -+ if(fCType == SQL_C_TYPE_TIME) -+ fCType = SQL_C_TIME; -+ else if(fCType == SQL_C_TYPE_DATE) -+ fCType = SQL_C_DATE; -+ else if(fCType == SQL_C_TYPE_TIMESTAMP) -+ fCType = SQL_C_TIMESTAMP; -+ -+ /* TODO: Make function */ -+ if (fSqlType == SQL_TIME) -+ fSqlType = SQL_TYPE_TIME; -+ else if (fSqlType == SQL_DATE) -+ fSqlType = SQL_TYPE_DATE; -+ else if (fSqlType == SQL_TIMESTAMP) -+ fSqlType = SQL_TYPE_TIMESTAMP; -+ -+ ret = statement->connection->pSQLBindParam(statement->driver_stmt, ipar, fCType, fSqlType, -+ cbColDef, ibScale, rgbValue, pcbValue); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0037-odbc32-Forward-SQLTransact-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0037-odbc32-Forward-SQLTransact-request-onto-driver.patch deleted file mode 100644 index 66e88ea8..00000000 --- a/patches/odbc-remove-unixodbc/0037-odbc32-Forward-SQLTransact-request-onto-driver.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 931936f51db30da1b5d0583a9be3231b0f7678f0 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 6 Feb 2023 16:03:58 +1100 -Subject: [PATCH] odbc32: Forward SQLTransact request onto driver - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index f2ece198084..e78b51d7486 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -1591,11 +1591,24 @@ SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSM - */ - SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle, -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, CompletionType %d)\n", EnvironmentHandle, ConnectionHandle, - CompletionType); - -+ if (connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong connection handle type %d\n", connection->type); -+ return SQL_ERROR; -+ } -+ -+ if (connection->pSQLTransact) -+ { -+ ret = connection->pSQLTransact(connection->driver_env, connection->driver_hdbc, CompletionType); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0038-odbc32-Forward-SQLGetDiagRecW-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0038-odbc32-Forward-SQLGetDiagRecW-request-onto-driver.patch deleted file mode 100644 index 8e059ae7..00000000 --- a/patches/odbc-remove-unixodbc/0038-odbc32-Forward-SQLGetDiagRecW-request-onto-driver.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 76ed07ea89b4375d721fb993e04b4c99b3592996 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Tue, 7 Feb 2023 14:18:20 +1100 -Subject: [PATCH] odbc32: Forward SQLGetDiagRecW request onto driver - ---- - dlls/odbc32/proxyodbc.c | 42 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 41 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index e78b51d7486..b8c2eb43055 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -2355,10 +2355,50 @@ SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA - { - SQLRETURN ret = SQL_ERROR; - -- FIXME("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d," -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d," - " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, - TextLength); - -+ if (HandleType == SQL_HANDLE_ENV) -+ { -+ FIXME("Unhandled SQL_HANDLE_ENV records\n"); -+ } -+ else if (HandleType == SQL_HANDLE_DBC) -+ { -+ struct SQLHDBC_data *hdbc = Handle; -+ -+ if (hdbc->pSQLGetDiagRecW) -+ { -+ ret = hdbc->pSQLGetDiagRecW(HandleType, hdbc->driver_hdbc, RecNumber, Sqlstate, -+ NativeError, MessageText, BufferLength, TextLength); -+ } -+ else if (hdbc->pSQLErrorW) -+ { -+ ret = hdbc->pSQLErrorW(SQL_NULL_HENV, hdbc->driver_hdbc, SQL_NULL_HSTMT, Sqlstate, -+ NativeError, MessageText, BufferLength, TextLength); -+ } -+ } -+ else if (HandleType == SQL_HANDLE_STMT) -+ { -+ struct SQLHSTMT_data *statement = Handle; -+ -+ if (statement->connection->pSQLGetDiagRecW) -+ { -+ ret = statement->connection->pSQLGetDiagRecW(HandleType, statement->driver_stmt, RecNumber, -+ Sqlstate, NativeError, MessageText, BufferLength, TextLength); -+ } -+ else if (statement->connection->pSQLErrorW) -+ { -+ ret = statement->connection->pSQLErrorW(SQL_NULL_HENV, SQL_NULL_HDBC, statement->driver_stmt, -+ Sqlstate, NativeError, MessageText, BufferLength, TextLength); -+ } -+ } -+ -+ if (ret != SQL_ERROR) -+ { -+ TRACE("%d: %s %s\n", RecNumber, debugstr_w(Sqlstate), debugstr_w(MessageText)); -+ } -+ - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0039-odbc32-SQLGetEnvAttr-Support-SQL_ATTR_ODBC_VERSION-a.patch b/patches/odbc-remove-unixodbc/0039-odbc32-SQLGetEnvAttr-Support-SQL_ATTR_ODBC_VERSION-a.patch deleted file mode 100644 index 1aa2d777..00000000 --- a/patches/odbc-remove-unixodbc/0039-odbc32-SQLGetEnvAttr-Support-SQL_ATTR_ODBC_VERSION-a.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 14e00b2574f64b47ee25028cc59476949db6cf84 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 8 Feb 2023 08:39:26 +1100 -Subject: [PATCH] odbc32: SQLGetEnvAttr: Support SQL_ATTR_ODBC_VERSION - attribute - ---- - dlls/odbc32/proxyodbc.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index b8c2eb43055..cf3455c45b4 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -47,6 +47,7 @@ struct SQLHENV_data - { - int type; - SQLUINTEGER pooling; -+ SQLUINTEGER version; - }; - - struct SQLHDBC_data -@@ -359,6 +360,7 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) - - henv->type = SQL_HANDLE_ENV; - henv->pooling = SQL_CP_OFF; -+ henv->version = SQL_OV_ODBC2; - - *EnvironmentHandle = henv; - -@@ -1074,6 +1076,14 @@ SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, - } - *(SQLUINTEGER*)Value = data->pooling; - break; -+ case SQL_ATTR_ODBC_VERSION: -+ if (BufferLength != sizeof(data->version)) -+ { -+ WARN("Invalid buffer size\n"); -+ return SQL_ERROR; -+ } -+ *(SQLUINTEGER*)Value = data->version; -+ break; - default: - FIXME("Unhandle attribute %d\n", Attribute); - return SQL_ERROR; -@@ -1463,6 +1473,12 @@ SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, - else - data->pooling = SQL_CP_OFF; - break; -+ case SQL_ATTR_ODBC_VERSION: -+ if (Value) -+ data->version = (uintptr_t)Value; -+ else -+ data->version = SQL_OV_ODBC2; -+ break; - default: - FIXME("Unhandle attribute %d\n", Attribute); - return SQL_ERROR; --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0040-odbc32-Pass-ODBC-version-when-creating-driver-enviro.patch b/patches/odbc-remove-unixodbc/0040-odbc32-Pass-ODBC-version-when-creating-driver-enviro.patch deleted file mode 100644 index dc544a24..00000000 --- a/patches/odbc-remove-unixodbc/0040-odbc32-Pass-ODBC-version-when-creating-driver-enviro.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 014cadef9d41657c315f140daa0cbed19d43f02a Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 8 Feb 2023 09:03:40 +1100 -Subject: [PATCH] odbc32: Pass ODBC version when creating driver environment - ---- - dlls/odbc32/proxyodbc.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index cf3455c45b4..6e02d37548c 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -2654,11 +2654,15 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl - if (connection->pSQLAllocHandle) - { - connection->pSQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &connection->driver_env); -- connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc); - - if (connection->pSQLGetEnvAttr) - connection->pSQLGetEnvAttr(connection->driver_env, SQL_ATTR_ODBC_VERSION, &connection->driver_ver, 0, NULL); - -+ if (connection->pSQLSetEnvAttr) -+ connection->pSQLSetEnvAttr(connection->driver_env, SQL_ATTR_ODBC_VERSION, -+ (SQLPOINTER)connection->environment->version, 0); -+ -+ connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc); - } - /* ODBC 2.x */ - else if(connection->pSQLAllocConnect && connection->pSQLAllocEnv) --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0041-odbc32-SQLBindCol-convert-to-ODBC2-types-if-required.patch b/patches/odbc-remove-unixodbc/0041-odbc32-SQLBindCol-convert-to-ODBC2-types-if-required.patch deleted file mode 100644 index d0cf7387..00000000 --- a/patches/odbc-remove-unixodbc/0041-odbc32-SQLBindCol-convert-to-ODBC2-types-if-required.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c9f90dfeff20eb7faa55bdc00add8f4d18fbb1b5 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 8 Feb 2023 14:16:24 +1100 -Subject: [PATCH] odbc32: SQLBindCol convert to ODBC2 types if required - ---- - dlls/odbc32/proxyodbc.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 6e02d37548c..d760481fa9b 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -465,6 +465,20 @@ SQLRETURN WINAPI SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, - - if (statement->connection->pSQLBindCol) - { -+ /* -+ * Map ODBC3 Datatype back to ODBC2 types when the application has asked for SQL_OV_ODBC2. -+ * Some drivers rely on this (PostgreSQL odbc driver). -+ */ -+ if (statement->connection->environment->version == SQL_OV_ODBC2) -+ { -+ if(TargetType == SQL_C_TYPE_TIME) -+ TargetType = SQL_C_TIME; -+ else if(TargetType == SQL_C_TYPE_DATE) -+ TargetType = SQL_C_DATE; -+ else if(TargetType == SQL_C_TYPE_TIMESTAMP) -+ TargetType = SQL_C_TIMESTAMP; -+ } -+ - ret = statement->connection->pSQLBindCol(statement->driver_stmt, ColumnNumber, TargetType, - TargetValue, BufferLength, StrLen_or_Ind); - } --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0042-odbc32-Implement-SQLAllocHandle.patch b/patches/odbc-remove-unixodbc/0042-odbc32-Implement-SQLAllocHandle.patch deleted file mode 100644 index c137b700..00000000 --- a/patches/odbc-remove-unixodbc/0042-odbc32-Implement-SQLAllocHandle.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0a67d651b40335e9b8ee09e47c8f54845101c6f7 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 8 Feb 2023 15:22:00 +1100 -Subject: [PATCH] odbc32: Implement SQLAllocHandle - ---- - dlls/odbc32/proxyodbc.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index d760481fa9b..879808add00 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -374,9 +374,22 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S - { - SQLRETURN ret = SQL_ERROR; - -- FIXME("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); -+ TRACE("(HandleType %d, InputHandle %p, OutputHandle %p)\n", HandleType, InputHandle, OutputHandle); - - *OutputHandle = 0; -+ if (HandleType == SQL_HANDLE_ENV) -+ { -+ ret = SQLAllocEnv(OutputHandle); -+ } -+ else if (HandleType == SQL_HANDLE_DBC) -+ { -+ ret = SQLAllocConnect(InputHandle, OutputHandle); -+ } -+ else if (HandleType == SQL_HANDLE_STMT) -+ { -+ ret = SQLAllocStmt(InputHandle, OutputHandle); -+ } -+ - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0043-odbc32-Forward-SQLConnectW-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0043-odbc32-Forward-SQLConnectW-request-onto-driver.patch deleted file mode 100644 index f45d81ae..00000000 --- a/patches/odbc-remove-unixodbc/0043-odbc32-Forward-SQLConnectW-request-onto-driver.patch +++ /dev/null @@ -1,48 +0,0 @@ -From bbad2699c06c230f2fddecfc4a8159b763e6d233 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 8 Feb 2023 15:34:18 +1100 -Subject: [PATCH] odbc32: Forward SQLConnectW request onto driver - ---- - dlls/odbc32/proxyodbc.c | 22 +++++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 879808add00..89ebf0e5141 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -2131,12 +2131,28 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA - WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication, - SQLSMALLINT NameLength3) - { -+ struct SQLHDBC_data *connection = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," -- " NameLength3 %d)\n", ConnectionHandle, debugstr_wn(ServerName, NameLength1), NameLength1, -- debugstr_wn(UserName, NameLength2), NameLength2, debugstr_wn(Authentication, NameLength3), NameLength3); -+ TRACE("(ConnectionHandle %p, ServerName %s, NameLength1 %d, UserName %s, NameLength2 %d, Authentication %s," -+ " NameLength3 %d)\n", ConnectionHandle, -+ NameLength1 > 0 ? debugstr_wn(ServerName, NameLength1) : debugstr_w(ServerName), NameLength1, -+ NameLength2 > 0 ? debugstr_wn(UserName, NameLength2) : debugstr_w(UserName), NameLength2, -+ NameLength3 > 0 ? debugstr_wn(Authentication, NameLength3) : debugstr_w(Authentication), NameLength3); - -+ if (!connection || connection->type != SQL_HANDLE_DBC) -+ { -+ WARN("Wrong handle type %d\n", connection ? connection->type : 0); -+ return SQL_ERROR; -+ } -+ -+ if (connection->pSQLConnectW) -+ { -+ ret = connection->pSQLConnectW(connection->driver_hdbc, ServerName, NameLength1, -+ UserName, NameLength2, Authentication, NameLength3); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0044-odbc32-Forward-SQLColAttribute-W-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0044-odbc32-Forward-SQLColAttribute-W-request-onto-driver.patch deleted file mode 100644 index 1c72aef9..00000000 --- a/patches/odbc-remove-unixodbc/0044-odbc32-Forward-SQLColAttribute-W-request-onto-driver.patch +++ /dev/null @@ -1,173 +0,0 @@ -From 46c661c38a41172cd11430bfa266f7e0cddf1f8d Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 8 Feb 2023 20:19:44 +1100 -Subject: [PATCH] odbc32: Forward SQLColAttribute/W request onto driver - ---- - dlls/odbc32/proxyodbc.c | 119 ++++++++++++++++++++++++++++++++++------ - 1 file changed, 102 insertions(+), 17 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 89ebf0e5141..409bc428230 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -314,6 +314,36 @@ static void connection_bind_sql_funcs(struct SQLHDBC_data *connection) - LOAD_FUNCPTR(SQLTransact); - } - -+static SQLINTEGER map_odbc2_to_3(SQLINTEGER fieldid) -+{ -+ switch( fieldid ) -+ { -+ case SQL_COLUMN_COUNT: -+ return SQL_DESC_COUNT; -+ case SQL_COLUMN_NULLABLE: -+ return SQL_DESC_NULLABLE; -+ case SQL_COLUMN_NAME: -+ return SQL_DESC_NAME; -+ default: -+ return fieldid; -+ } -+} -+static SQLINTEGER map_odbc3_to_2(SQLINTEGER fieldid) -+{ -+ switch( fieldid ) -+ { -+ case SQL_DESC_COUNT: -+ return SQL_COLUMN_COUNT; -+ case SQL_DESC_NULLABLE: -+ return SQL_COLUMN_NULLABLE; -+ case SQL_DESC_NAME: -+ return SQL_COLUMN_NAME; -+ default: -+ return fieldid; -+ } -+} -+ -+ - /************************************************************************* - * SQLAllocConnect [ODBC32.001] - */ -@@ -557,12 +587,47 @@ SQLRETURN WINAPI SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, - SQLLEN *NumericAttribute) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d," -+ TRACE("(StatementHandle %p, ColumnNumber %d, FieldIdentifier %d, CharacterAttribute %p, BufferLength %d," - " StringLength %p, NumericAttribute %p)\n", StatementHandle, ColumnNumber, FieldIdentifier, - CharacterAttribute, BufferLength, StringLength, NumericAttribute); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ /* ODBC 3.0 */ -+ if (statement->connection->pSQLColAttribute) -+ { -+ ret = statement->connection->pSQLColAttribute(statement->driver_stmt, ColumnNumber, FieldIdentifier, -+ CharacterAttribute, BufferLength, StringLength, NumericAttribute); -+ } -+ /* ODBC 2.0 */ -+ else if (statement->connection->pSQLColAttributes) -+ { -+ FieldIdentifier = map_odbc3_to_2(FieldIdentifier); -+ ret = statement->connection->pSQLColAttributes(statement->driver_stmt, ColumnNumber, FieldIdentifier, -+ CharacterAttribute, BufferLength, StringLength, NumericAttribute); -+ -+ /* Convert back for ODBC3 drivers */ -+ if (NumericAttribute && FieldIdentifier == SQL_COLUMN_TYPE && -+ statement->connection->driver_ver == SQL_OV_ODBC2 && -+ statement->connection->environment->version == SQL_OV_ODBC3) -+ { -+ if (*NumericAttribute == SQL_TIME) -+ *NumericAttribute = SQL_TYPE_TIME; -+ else if (*NumericAttribute == SQL_DATETIME) -+ *NumericAttribute = SQL_TYPE_DATE; -+ else if (*NumericAttribute == SQL_TIMESTAMP) -+ *NumericAttribute = SQL_TYPE_TIMESTAMP; -+ } -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -2073,21 +2138,6 @@ SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_c - return ret; - } - --static SQLINTEGER map_odbc2_to_3(SQLINTEGER fieldid) --{ -- switch( fieldid ) -- { -- case SQL_COLUMN_COUNT: -- return SQL_DESC_COUNT; -- case SQL_COLUMN_NULLABLE: -- return SQL_DESC_NULLABLE; -- case SQL_COLUMN_NAME: -- return SQL_DESC_NAME; -- default: -- return fieldid; -- } --} -- - /************************************************************************* - * SQLColAttributesW [ODBC32.106] - */ -@@ -2294,12 +2344,47 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN - SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, - SQLLEN *NumericAttribute) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d" -+ TRACE("StatementHandle %p ColumnNumber %d FieldIdentifier %d CharacterAttribute %p BufferLength %d" - " StringLength %p NumericAttribute %p\n", StatementHandle, ColumnNumber, FieldIdentifier, - CharacterAttribute, BufferLength, StringLength, NumericAttribute); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ /* ODBC 3.0 */ -+ if (statement->connection->pSQLColAttributeW) -+ { -+ ret = statement->connection->pSQLColAttributeW(statement->driver_stmt, ColumnNumber, FieldIdentifier, -+ CharacterAttribute, BufferLength, StringLength, NumericAttribute); -+ } -+ /* ODBC 2.0 */ -+ else if (statement->connection->pSQLColAttributesW) -+ { -+ FieldIdentifier = map_odbc3_to_2(FieldIdentifier); -+ ret = statement->connection->pSQLColAttributesW(statement->driver_stmt, ColumnNumber, FieldIdentifier, -+ CharacterAttribute, BufferLength, StringLength, NumericAttribute); -+ -+ /* Convert back for ODBC3 drivers */ -+ if (NumericAttribute && FieldIdentifier == SQL_COLUMN_TYPE && -+ statement->connection->driver_ver == SQL_OV_ODBC2 && -+ statement->connection->environment->version == SQL_OV_ODBC3) -+ { -+ if (*NumericAttribute == SQL_TIME) -+ *NumericAttribute = SQL_TYPE_TIME; -+ else if (*NumericAttribute == SQL_DATETIME) -+ *NumericAttribute = SQL_TYPE_DATE; -+ else if (*NumericAttribute == SQL_TIMESTAMP) -+ *NumericAttribute = SQL_TYPE_TIMESTAMP; -+ } -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0045-odbc32-Forward-SQLGetDiagRec-request-to-driver.patch b/patches/odbc-remove-unixodbc/0045-odbc32-Forward-SQLGetDiagRec-request-to-driver.patch deleted file mode 100644 index 675979de..00000000 --- a/patches/odbc-remove-unixodbc/0045-odbc32-Forward-SQLGetDiagRec-request-to-driver.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 8e284b4208c85a42e4aa1723876aaba208cea3d3 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 8 Feb 2023 21:03:47 +1100 -Subject: [PATCH] odbc32: Forward SQLGetDiagRec request to driver - ---- - dlls/odbc32/proxyodbc.c | 34 +++++++++++++++++++++++++++++++++- - 1 file changed, 33 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 409bc428230..25e9d5651cd 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -3201,9 +3201,41 @@ SQLRETURN WINAPI SQLGetDiagRecA(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA - { - SQLRETURN ret = SQL_ERROR; - -- FIXME("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d," -+ TRACE("(HandleType %d, Handle %p, RecNumber %d, Sqlstate %p, NativeError %p, MessageText %p, BufferLength %d," - " TextLength %p)\n", HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, - TextLength); - -+ if (HandleType == SQL_HANDLE_ENV) -+ { -+ FIXME("Unhandled SQL_HANDLE_ENV records\n"); -+ } -+ else if (HandleType == SQL_HANDLE_DBC) -+ { -+ struct SQLHDBC_data *hdbc = Handle; -+ -+ if (hdbc->pSQLGetDiagRec) -+ ret = hdbc->pSQLGetDiagRec(HandleType, hdbc->driver_hdbc, RecNumber, Sqlstate, -+ NativeError, MessageText, BufferLength, TextLength); -+ else if (hdbc->pSQLGetDiagRecA) -+ ret = hdbc->pSQLGetDiagRecA(HandleType, hdbc->driver_hdbc, RecNumber, Sqlstate, -+ NativeError, MessageText, BufferLength, TextLength); -+ } -+ else if (HandleType == SQL_HANDLE_STMT) -+ { -+ struct SQLHSTMT_data *statement = Handle; -+ -+ if (statement->connection->pSQLGetDiagRec) -+ ret = statement->connection->pSQLGetDiagRec(HandleType, statement->driver_stmt, RecNumber, -+ Sqlstate, NativeError, MessageText, BufferLength, TextLength); -+ else if (statement->connection->pSQLGetDiagRecA) -+ ret = statement->connection->pSQLGetDiagRecA(HandleType, statement->driver_stmt, RecNumber, -+ Sqlstate, NativeError, MessageText, BufferLength, TextLength); -+ } -+ -+ if (ret != SQL_ERROR) -+ { -+ TRACE("%d: %s %s\n", RecNumber, Sqlstate, MessageText); -+ } -+ - return ret; - } --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0046-odbc32-Forward-SQLPrimaryKeysW-request-to-driver.patch b/patches/odbc-remove-unixodbc/0046-odbc32-Forward-SQLPrimaryKeysW-request-to-driver.patch deleted file mode 100644 index b4aa01ce..00000000 --- a/patches/odbc-remove-unixodbc/0046-odbc32-Forward-SQLPrimaryKeysW-request-to-driver.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0bf2bde719089038889e6001991eaacc93718daa Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 4 Oct 2023 15:09:56 +1100 -Subject: [PATCH] odbc32: Forward SQLPrimaryKeysW request to driver. - ---- - dlls/odbc32/proxyodbc.c | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 25e9d5651cd..b3e4ebfe450 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -3062,14 +3062,28 @@ SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMA - SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, - SQLSMALLINT cbTableName) - { -+ struct SQLHSTMT_data *statement = hstmt; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," -+ TRACE("(hstmt %p, szCatalogName %s, cbCatalogName %d, szSchemaName %s, cbSchemaName %d, szTableName %s," - " cbTableName %d)\n", hstmt, - debugstr_wn(szCatalogName, cbCatalogName), cbCatalogName, - debugstr_wn(szSchemaName, cbSchemaName), cbSchemaName, - debugstr_wn(szTableName, cbTableName), cbTableName); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLPrimaryKeysW) -+ { -+ ret = statement->connection->pSQLPrimaryKeysW(statement->driver_stmt, szCatalogName, -+ cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0047-odbc32-Forward-SQLStatisticsW-request-to-driver.patch b/patches/odbc-remove-unixodbc/0047-odbc32-Forward-SQLStatisticsW-request-to-driver.patch deleted file mode 100644 index 116d7f9a..00000000 --- a/patches/odbc-remove-unixodbc/0047-odbc32-Forward-SQLStatisticsW-request-to-driver.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 4d2d26b889f8ce32d774df667625401eceb9b694 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Wed, 4 Oct 2023 15:30:49 +1100 -Subject: [PATCH] odbc32: Forward SQLStatisticsW request to driver. - ---- - dlls/odbc32/proxyodbc.c | 19 ++++++++++++++++++- - 1 file changed, 18 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index b3e4ebfe450..35ddd14e49f 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -2926,13 +2926,30 @@ SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, - SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, - SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) - { -+ struct SQLHSTMT_data *statement = StatementHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" -+ TRACE("(StatementHandle %p, CatalogName %s, NameLength1 %d SchemaName %s, NameLength2 %d, TableName %s" - " NameLength3 %d, Unique %d, Reserved %d)\n", StatementHandle, - debugstr_wn(CatalogName, NameLength1), NameLength1, debugstr_wn(SchemaName, NameLength2), NameLength2, - debugstr_wn(TableName, NameLength3), NameLength3, Unique, Reserved); - -+ if (statement->type != SQL_HANDLE_STMT) -+ { -+ WARN("Wrong handle type %d\n", statement->type); -+ return SQL_ERROR; -+ } -+ -+ if (statement->connection->pSQLStatisticsW) -+ { -+ ret = statement->connection->pSQLStatisticsW(statement->driver_stmt, CatalogName, -+ NameLength1, SchemaName, NameLength2, TableName, NameLength3, -+ Unique, Reserved); -+ } -+ -+ TRACE("ret %d\n", ret); -+ -+ - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0048-odbc32-Forward-SQLError-W-onto-driver.patch b/patches/odbc-remove-unixodbc/0048-odbc32-Forward-SQLError-W-onto-driver.patch deleted file mode 100644 index 5875b67d..00000000 --- a/patches/odbc-remove-unixodbc/0048-odbc32-Forward-SQLError-W-onto-driver.patch +++ /dev/null @@ -1,60 +0,0 @@ -From d417f9fe271eb9b84e0afb9fd1a9c3950f1fb9b0 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Mon, 10 Jun 2024 08:40:09 +1000 -Subject: [PATCH] odbc32: Forward SQLError/W onto driver - ---- - dlls/odbc32/proxyodbc.c | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 35ddd14e49f..ce2a74310bb 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -787,12 +787,20 @@ SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, S - SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, - SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) - { -+ struct SQLHDBC_data *hdbc = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p," -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p," - " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle, - StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - -+ if (hdbc->pSQLError) -+ { -+ ret = hdbc->pSQLError(hdbc->driver_env, hdbc->driver_hdbc, StatementHandle, Sqlstate, -+ NativeError, MessageText, BufferLength, TextLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - -@@ -2246,12 +2254,20 @@ SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, - WCHAR *Sqlstate, SQLINTEGER *NativeError, WCHAR *MessageText, - SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) - { -+ struct SQLHDBC_data *hdbc = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; - -- FIXME("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p," -+ TRACE("(EnvironmentHandle %p, ConnectionHandle %p, StatementHandle %p, Sqlstate %p, NativeError %p," - " MessageText %p, BufferLength %d, TextLength %p)\n", EnvironmentHandle, ConnectionHandle, - StatementHandle, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - -+ if (hdbc->pSQLErrorW) -+ { -+ ret = hdbc->pSQLErrorW(hdbc->driver_env, hdbc->driver_hdbc, StatementHandle, Sqlstate, -+ NativeError, MessageText, BufferLength, TextLength); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/0049-odbc32-Implement-SQLFreeHandle.patch b/patches/odbc-remove-unixodbc/0049-odbc32-Implement-SQLFreeHandle.patch deleted file mode 100644 index cb56bd6a..00000000 --- a/patches/odbc-remove-unixodbc/0049-odbc32-Implement-SQLFreeHandle.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 506812cfd989ab515dd0c0fd11bc64dc4cdcdae7 Mon Sep 17 00:00:00 2001 -From: Steve Fawcett -Date: Wed, 12 Jun 2024 09:27:31 +1000 -Subject: [PATCH] odbc32: Implement SQLFreeHandle - ---- - dlls/odbc32/proxyodbc.c | 40 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 39 insertions(+), 1 deletion(-) - -diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index ce2a74310bb..a49fb0e82b9 100644 ---- a/dlls/odbc32/proxyodbc.c -+++ b/dlls/odbc32/proxyodbc.c -@@ -929,8 +929,46 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) - { - SQLRETURN ret = SQL_ERROR; - -- FIXME("(HandleType %d, Handle %p)\n", HandleType, Handle); -+ TRACE("HandleType %d, Handle %p\n", HandleType, Handle); - -+ if (HandleType == SQL_HANDLE_ENV) -+ { -+ struct SQLHENV_data *henv = Handle; -+ -+ if (henv && henv->type != SQL_HANDLE_ENV) -+ WARN("EnvironmentHandle isn't of type SQL_HANDLE_ENV\n"); -+ else { -+ henv->type = 0; -+ free(henv); -+ ret = SQL_SUCCESS; -+ } -+ } -+ else if (HandleType == SQL_HANDLE_DBC) -+ { -+ struct SQLHDBC_data *hdbc = Handle; -+ -+ if (hdbc->pSQLFreeHandle) -+ ret = hdbc->pSQLFreeHandle(HandleType, hdbc->driver_hdbc); -+ else if (hdbc->pSQLFreeConnect) -+ ret = hdbc->pSQLFreeConnect(hdbc->driver_hdbc); -+ -+ hdbc->type = 0; -+ free(hdbc); -+ } -+ else if (HandleType == SQL_HANDLE_STMT) -+ { -+ struct SQLHSTMT_data *statement = Handle; -+ -+ if (statement->connection->pSQLFreeHandle) -+ ret = statement->connection->pSQLFreeHandle(HandleType, statement->driver_stmt); -+ else if (statement->connection->pSQLFreeStmt) -+ ret = statement->connection->pSQLFreeStmt(statement->driver_stmt, SQL_CLOSE); -+ -+ statement->type = 0; -+ free(statement); -+ } -+ -+ TRACE("ret %d\n", ret); - return ret; - } - --- -2.43.0 - diff --git a/patches/odbc-remove-unixodbc/definition b/patches/odbc-remove-unixodbc/definition deleted file mode 100644 index adda6cd8..00000000 --- a/patches/odbc-remove-unixodbc/definition +++ /dev/null @@ -1,2 +0,0 @@ -Fixes: [54499] Support native ODBC drivers. -Disabled: True