From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 98 ++++++++++++++++++++++++++++++++++++-- dlls/odbc32/tests/odbc32.c | 30 ++++++++++++ dlls/odbc32/unixlib.h | 1 + 3 files changed, 126 insertions(+), 3 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 57930e59ad4..1e2bd0db2f6 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -824,6 +824,30 @@ static SQLRETURN prepare_env( struct handle *handle ) return SQL_SUCCESS; }
+static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) +{ + SQLRETURN ret = SQL_ERROR; + + if (handle->unix_handle) + { + struct SQLSetConnectAttr_params params = { handle->unix_handle, attr, value, len }; + ret = ODBC_CALL( SQLSetConnectAttr, ¶ms ); + } + else if (handle->win32_handle) + { + ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, attr, value, len ); + } + return ret; +} + +static SQLRETURN prepare_con( struct handle *handle ) +{ + SQLRETURN ret; + if ((ret = set_con_attr( handle, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)(ULONG_PTR)handle->con_attr_login_timeout, 0 ))) + return ret; + return SQL_SUCCESS; +} + /************************************************************************* * SQLConnect [ODBC32.007] */ @@ -865,6 +889,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM handle->parent->win32_funcs = handle->win32_funcs; if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, &handle->win32_handle )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
ret = handle->win32_funcs->SQLConnect( handle->win32_handle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3 ); @@ -882,6 +907,7 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM
params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
params_connect.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLConnect, ¶ms_connect ); @@ -1430,7 +1456,7 @@ SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut SQLINTEGER BufferLength, SQLINTEGER *StringLength) { struct handle *handle = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; + SQLRETURN ret = SQL_SUCCESS;
TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, Attribute, Value, BufferLength, StringLength); @@ -1448,6 +1474,20 @@ SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut ret = handle->win32_funcs->SQLGetConnectAttr( handle->win32_handle, Attribute, Value, BufferLength, StringLength ); } + else + { + switch (Attribute) + { + case SQL_ATTR_LOGIN_TIMEOUT: + *(SQLINTEGER *)Value = handle->con_attr_login_timeout; + break; + + default: + FIXME( "unhandled attribute %d\n", Attribute ); + ret = SQL_ERROR; + break; + } + }
TRACE("Returning %d\n", ret); return ret; @@ -1990,7 +2030,7 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut SQLINTEGER StringLength) { struct handle *handle = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; + SQLRETURN ret = SQL_SUCCESS;
TRACE("(ConnectionHandle %p, Attribute %d, Value %p, StringLength %d)\n", ConnectionHandle, Attribute, Value, StringLength); @@ -2006,6 +2046,20 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut { ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, Attribute, Value, StringLength ); } + else + { + switch (Attribute) + { + case SQL_ATTR_LOGIN_TIMEOUT: + handle->con_attr_login_timeout = (UINT32)(ULONG_PTR)Value; + break; + + default: + FIXME( "unhandled attribute %d\n", Attribute ); + ret = SQL_ERROR; + break; + } + }
TRACE("Returning %d\n", ret); return ret; @@ -2523,6 +2577,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio handle->parent->win32_funcs = handle->win32_funcs; if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, &handle->win32_handle )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
ret = handle->win32_funcs->SQLBrowseConnect( handle->win32_handle, InConnectionString, StringLength1, OutConnectionString, BufferLength, StringLength2 ); @@ -2540,6 +2595,7 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio
params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLBrowseConnect, ¶ms ); @@ -3194,6 +3250,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle handle->parent->win32_funcs = handle->win32_funcs; if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, &handle->win32_handle )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
ret = handle->win32_funcs->SQLDriverConnect( handle->win32_handle, WindowHandle, InConnectionString, Length, OutConnectionString, BufferLength, Length2, DriverCompletion ); @@ -3211,6 +3268,7 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLDriverConnect, ¶ms ); @@ -3361,6 +3419,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA handle->parent->win32_funcs = handle->win32_funcs; if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, &handle->win32_handle )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
ret = handle->win32_funcs->SQLConnectW( handle->win32_handle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3 ); @@ -3378,6 +3437,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA
params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
params_connect.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLConnectW, ¶ms_connect ); @@ -3624,7 +3684,7 @@ SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu SQLINTEGER BufferLength, SQLINTEGER *StringLength) { struct handle *handle = ConnectionHandle; - SQLRETURN ret = SQL_ERROR; + SQLRETURN ret = SQL_SUCCESS;
TRACE("(ConnectionHandle %p, Attribute %d, Value %p, BufferLength %d, StringLength %p)\n", ConnectionHandle, Attribute, Value, BufferLength, StringLength); @@ -3642,6 +3702,20 @@ SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu ret = handle->win32_funcs->SQLGetConnectAttrW( handle->win32_handle, Attribute, Value, BufferLength, StringLength ); } + else + { + switch (Attribute) + { + case SQL_ATTR_LOGIN_TIMEOUT: + *(SQLINTEGER *)Value = handle->con_attr_login_timeout; + break; + + default: + FIXME( "unhandled attribute %d\n", Attribute ); + ret = SQL_ERROR; + break; + } + }
TRACE("Returning %d\n", ret); return ret; @@ -3831,6 +3905,20 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu { ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, Attribute, Value, StringLength ); } + else + { + switch (Attribute) + { + case SQL_ATTR_LOGIN_TIMEOUT: + handle->con_attr_login_timeout = (UINT32)(ULONG_PTR)Value; + break; + + default: + FIXME( "unhandled attribute %d\n", Attribute ); + ret = SQL_ERROR; + break; + } + }
TRACE("Returning %d\n", ret); return ret; @@ -3915,6 +4003,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl handle->parent->win32_funcs = handle->win32_funcs; if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, &handle->win32_handle )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
ret = handle->win32_funcs->SQLDriverConnectW( handle->win32_handle, WindowHandle, InConnectionString, Length, OutConnectionString, BufferLength, Length2, DriverCompletion ); @@ -3932,6 +4021,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLDriverConnectW, ¶ms ); @@ -4195,6 +4285,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect handle->parent->win32_funcs = handle->win32_funcs; if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, &handle->win32_handle )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
ret = handle->win32_funcs->SQLBrowseConnectW( handle->win32_handle, InConnectionString, StringLength1, OutConnectionString, BufferLength, StringLength2 ); @@ -4212,6 +4303,7 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect
params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; + if (!SUCCESS((ret = prepare_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLBrowseConnectW, ¶ms ); diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c index 950b86ba036..0288260d3d3 100644 --- a/dlls/odbc32/tests/odbc32.c +++ b/dlls/odbc32/tests/odbc32.c @@ -478,6 +478,35 @@ static void test_SQLSetEnvAttr(void) ok( ret == SQL_SUCCESS, "got %d\n", ret ); }
+static void test_SQLSetConnectAttr(void) +{ + SQLUINTEGER timeout; + SQLHENV env; + SQLHDBC con; + SQLRETURN ret; + + ret = SQLAllocEnv( &env ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + + ret = SQLAllocConnect( env, &con ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + + timeout = 10; + ret = SQLSetConnectAttr( con, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)(ULONG_PTR)timeout, sizeof(timeout) ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + + timeout = 0; + ret = SQLGetConnectAttr( con, SQL_ATTR_LOGIN_TIMEOUT, &timeout, sizeof(timeout), NULL ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + ok( timeout == 10, "wrong timeout %d\n", timeout ); + + ret = SQLFreeConnect( con ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + + ret = SQLFreeEnv( env ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); +} + START_TEST(odbc32) { test_SQLAllocHandle(); @@ -488,4 +517,5 @@ START_TEST(odbc32) test_SQLDrivers(); test_SQLExecDirect(); test_SQLSetEnvAttr(); + test_SQLSetConnectAttr(); } diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h index 966ade5ad72..c26317012b5 100644 --- a/dlls/odbc32/unixlib.h +++ b/dlls/odbc32/unixlib.h @@ -192,6 +192,7 @@ struct handle struct handle *parent; /* attributes */ UINT32 env_attr_version; + UINT32 con_attr_login_timeout; /* drivers and data sources */ UINT32 drivers_idx; void *drivers_key;
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 24 +++++++++++++++++++++--- dlls/odbc32/unixlib.h | 1 + 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 1e2bd0db2f6..c9db219c203 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -816,10 +816,11 @@ static SQLRETURN set_env_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE return ret; }
+#define INT_PTR(val) (SQLPOINTER)(ULONG_PTR)val static SQLRETURN prepare_env( struct handle *handle ) { SQLRETURN ret; - if ((ret = set_env_attr( handle, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)(ULONG_PTR)handle->env_attr_version, 0 ))) + if ((ret = set_env_attr( handle, SQL_ATTR_ODBC_VERSION, INT_PTR(handle->env_attr_version), 0 ))) return ret; return SQL_SUCCESS; } @@ -843,8 +844,9 @@ static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTE static SQLRETURN prepare_con( struct handle *handle ) { SQLRETURN ret; - if ((ret = set_con_attr( handle, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)(ULONG_PTR)handle->con_attr_login_timeout, 0 ))) - return ret; + + if ((ret = set_con_attr( handle, SQL_ATTR_CONNECTION_TIMEOUT, INT_PTR(handle->con_attr_con_timeout), 0 ))) return ret; + if ((ret = set_con_attr( handle, SQL_ATTR_LOGIN_TIMEOUT, INT_PTR(handle->con_attr_login_timeout), 0 ))) return ret; return SQL_SUCCESS; }
@@ -1478,6 +1480,10 @@ SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut { switch (Attribute) { + case SQL_ATTR_CONNECTION_TIMEOUT: + *(SQLINTEGER *)Value = handle->con_attr_con_timeout; + break; + case SQL_ATTR_LOGIN_TIMEOUT: *(SQLINTEGER *)Value = handle->con_attr_login_timeout; break; @@ -2050,6 +2056,10 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut { switch (Attribute) { + case SQL_ATTR_CONNECTION_TIMEOUT: + handle->con_attr_con_timeout = (UINT32)(ULONG_PTR)Value; + break; + case SQL_ATTR_LOGIN_TIMEOUT: handle->con_attr_login_timeout = (UINT32)(ULONG_PTR)Value; break; @@ -3706,6 +3716,10 @@ SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu { switch (Attribute) { + case SQL_ATTR_CONNECTION_TIMEOUT: + *(SQLINTEGER *)Value = handle->con_attr_con_timeout; + break; + case SQL_ATTR_LOGIN_TIMEOUT: *(SQLINTEGER *)Value = handle->con_attr_login_timeout; break; @@ -3909,6 +3923,10 @@ SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribu { switch (Attribute) { + case SQL_ATTR_CONNECTION_TIMEOUT: + handle->con_attr_con_timeout = (UINT32)(ULONG_PTR)Value; + break; + case SQL_ATTR_LOGIN_TIMEOUT: handle->con_attr_login_timeout = (UINT32)(ULONG_PTR)Value; break; diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h index c26317012b5..4241d06c892 100644 --- a/dlls/odbc32/unixlib.h +++ b/dlls/odbc32/unixlib.h @@ -192,6 +192,7 @@ struct handle struct handle *parent; /* attributes */ UINT32 env_attr_version; + UINT32 con_attr_con_timeout; UINT32 con_attr_login_timeout; /* drivers and data sources */ UINT32 drivers_idx;
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 4 ++++ dlls/odbc32/tests/odbc32.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index c9db219c203..d1c1a7cfadd 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -1738,6 +1738,10 @@ SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, { switch (Attribute) { + case SQL_ATTR_CONNECTION_POOLING: + *(SQLINTEGER *)Value = SQL_CP_OFF; + break; + case SQL_ATTR_ODBC_VERSION: *(SQLINTEGER *)Value = handle->env_attr_version; break; diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c index 0288260d3d3..01b8795e86e 100644 --- a/dlls/odbc32/tests/odbc32.c +++ b/dlls/odbc32/tests/odbc32.c @@ -82,7 +82,7 @@ static void test_SQLConnect( void ) SQLHENV env; SQLHDBC con; SQLRETURN ret; - SQLINTEGER size, version; + SQLINTEGER size, version, pooling; SQLUINTEGER timeout; SQLSMALLINT len; char str[32]; @@ -99,6 +99,11 @@ static void test_SQLConnect( void ) ok( size == -1, "size set\n" ); trace( "ODBC version %d\n", version );
+ pooling = -1; + ret = SQLGetEnvAttr( env, SQL_ATTR_CONNECTION_POOLING, &pooling, sizeof(pooling), NULL ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + ok( !pooling, "got %d\n", pooling ); + ret = SQLAllocConnect( env, &con ); ok( ret == SQL_SUCCESS, "got %d\n", ret );
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index d1c1a7cfadd..5dc8e8649ce 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -1377,17 +1377,23 @@ SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) return ret; }
-static void free_bindings( struct handle *handle ) +static void free_col_bindings( struct handle *handle ) { if (handle->bind_col.param) { free( handle->bind_col.param->len ); free( handle->bind_col.param ); + handle->bind_col.param = NULL; } +} + +static void free_param_bindings( struct handle *handle ) +{ if (handle->bind_parameter.param) { free( handle->bind_parameter.param->len ); free( handle->bind_parameter.param ); + handle->bind_parameter.param = NULL; } }
@@ -1407,7 +1413,6 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) { struct SQLFreeHandle_params params = { HandleType, handle->unix_handle }; ret = ODBC_CALL( SQLFreeHandle, ¶ms ); - free_bindings( handle ); } else if (handle->win32_handle) { @@ -1416,6 +1421,8 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
RegCloseKey( handle->drivers_key ); RegCloseKey( handle->sources_key ); + free_col_bindings( handle ); + free_param_bindings( handle ); free( handle );
TRACE("Returning %d\n", ret); @@ -1438,14 +1445,32 @@ SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) { struct SQLFreeStmt_params params = { handle->unix_handle, Option }; ret = ODBC_CALL( SQLFreeStmt, ¶ms ); - free_bindings( handle ); } else if (handle->win32_handle) { ret = handle->win32_funcs->SQLFreeStmt( handle->win32_handle, Option ); }
- free( handle ); + switch (Option) + { + case SQL_CLOSE: + break; + + case SQL_UNBIND: + free_col_bindings( handle ); + break; + + case SQL_RESET_PARAMS: + free_param_bindings( handle ); + break; + + case SQL_DROP: + default: + free_col_bindings( handle ); + free_param_bindings( handle ); + free( handle ); + break; + }
TRACE("Returning %d\n", ret); return ret;
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 5dc8e8649ce..925abcfc063 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -385,6 +385,7 @@ static struct handle *create_handle( struct handle *parent ) struct handle *ret; if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL; ret->parent = parent; + ret->env_attr_version = SQL_OV_ODBC2; ret->row_count = 1; return ret; }
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 38 ++++++++++++++++++++++++++++++++++++++ dlls/odbc32/tests/odbc32.c | 22 ++++++++++++---------- 2 files changed, 50 insertions(+), 10 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 925abcfc063..c48e9c60917 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -1823,6 +1823,25 @@ SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQL
if (!handle) return SQL_INVALID_HANDLE;
+ switch (InfoType) + { + case SQL_ODBC_VER: + { + const char version[] = "03.80.0000"; + int len = sizeof(version); + char *value = InfoValue; + + if (StringLength) *StringLength = len; + if (value && BufferLength >= len) + { + strcpy( value, version ); + if (StringLength) *StringLength = len - 1; + } + return SQL_SUCCESS; + } + default: break; + } + if (handle->unix_handle) { struct SQLGetInfo_params params = { handle->unix_handle, InfoType, InfoValue, BufferLength, StringLength }; @@ -4122,6 +4141,25 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ
if (!handle) return SQL_INVALID_HANDLE;
+ switch (InfoType) + { + case SQL_ODBC_VER: + { + const WCHAR version[] = L"03.80.0000"; + int len = ARRAY_SIZE(version); + WCHAR *value = InfoValue; + + if (StringLength) *StringLength = len; + if (value && BufferLength >= len) + { + wcscpy( value, version ); + if (StringLength) *StringLength = len - 1; + } + return SQL_SUCCESS; + } + default: break; + } + if (handle->unix_handle) { struct SQLGetInfoW_params params = { handle->unix_handle, InfoType, InfoValue, BufferLength, StringLength }; diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c index 01b8795e86e..8282e5a47ea 100644 --- a/dlls/odbc32/tests/odbc32.c +++ b/dlls/odbc32/tests/odbc32.c @@ -107,6 +107,18 @@ static void test_SQLConnect( void ) ret = SQLAllocConnect( env, &con ); ok( ret == SQL_SUCCESS, "got %d\n", ret );
+ len = -1; + ret = SQLGetInfo( con, SQL_ODBC_VER, NULL, 0, &len ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + ok( len != -1, "len not set\n" ); + + memset( str, 0, sizeof(str) ); + ret = SQLGetInfo( con, SQL_ODBC_VER, str, sizeof(str), &len ); + ok( ret == SQL_SUCCESS, "got %d\n", ret ); + ok( str[0], "empty string\n" ); + ok( len == strlen(str), "got %d\n", len ); + trace( "version %s\n", str ); + ret = SQLConnect( con, (SQLCHAR *)"winetest", 8, (SQLCHAR *)"winetest", 8, (SQLCHAR *)"winetest", 8 ); if (ret == SQL_ERROR) diag( con, SQL_HANDLE_DBC ); if (ret != SQL_SUCCESS) @@ -124,16 +136,6 @@ static void test_SQLConnect( void ) ok( timeout != 0xdeadbeef, "timeout not set\n" ); ok( size == -1, "size set\n" );
- len = -1; - memset( str, 0, sizeof(str) ); - ret = SQLGetInfo( con, SQL_ODBC_VER, str, sizeof(str), &len ); - if (ret == SQL_SUCCESS) - { - ok( str[0], "empty string\n" ); - ok( len != -1, "len not set\n" ); - trace( "version %s\n", str ); - } - ret = SQLDisconnect( con ); ok( ret == SQL_SUCCESS, "got %d\n", ret );
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 166 ++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 98 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index c48e9c60917..410f79649e1 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -826,6 +826,23 @@ static SQLRETURN prepare_env( struct handle *handle ) return SQL_SUCCESS; }
+static SQLRETURN create_env( struct handle *handle, BOOL unix ) +{ + SQLRETURN ret; + + if (unix) + { + struct SQLAllocEnv_params params = { &handle->unix_handle }; + if ((ret = ODBC_CALL( SQLAllocEnv, ¶ms ))) return ret; + } + else + { + if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, &handle->win32_handle ))) return ret; + } + + return prepare_env( handle ); +} + static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) { SQLRETURN ret = SQL_ERROR; @@ -851,6 +868,25 @@ static SQLRETURN prepare_con( struct handle *handle ) return SQL_SUCCESS; }
+static SQLRETURN create_con( struct handle *handle ) +{ + struct handle *parent = handle->parent; + SQLRETURN ret; + + if (parent->unix_handle) + { + struct SQLAllocConnect_params params = { parent->unix_handle, &handle->unix_handle }; + if ((ret = ODBC_CALL( SQLAllocConnect, ¶ms ))) return ret; + } + else + { + if ((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, parent->win32_handle, &handle->win32_handle ))) + return ret; + } + + return prepare_con( handle ); +} + /************************************************************************* * SQLConnect [ODBC32.007] */ @@ -885,35 +921,24 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM } TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, - &handle->parent->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - + if (!SUCCESS((ret = create_env( handle->parent, FALSE )))) goto done; handle->parent->win32_funcs = handle->win32_funcs; - if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, - &handle->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
ret = handle->win32_funcs->SQLConnect( handle->win32_handle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3 ); } else { - struct SQLAllocEnv_params params_alloc_env = { &handle->parent->unix_handle }; - struct SQLAllocConnect_params params_alloc_connect = { 0, &handle->unix_handle }; - struct SQLConnect_params params_connect = { 0, ServerName, NameLength1, UserName, NameLength2, - Authentication, NameLength3 }; + struct SQLConnect_params params = { 0, ServerName, NameLength1, UserName, NameLength2, Authentication, + NameLength3 };
TRACE( "using Unix driver %s\n", debugstr_w(filename) ); - if (!SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms_alloc_env )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; + if (!SUCCESS((ret = create_env( handle->parent, TRUE )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
- params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; - if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; - - params_connect.ConnectionHandle = handle->unix_handle; - ret = ODBC_CALL( SQLConnect, ¶ms_connect ); + params.ConnectionHandle = handle->unix_handle; + ret = ODBC_CALL( SQLConnect, ¶ms ); }
done: @@ -2629,32 +2654,21 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectio } TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, - &handle->parent->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - + if (!SUCCESS((ret = create_env( handle->parent, FALSE )))) goto done; handle->parent->win32_funcs = handle->win32_funcs; - if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, - &handle->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
ret = handle->win32_funcs->SQLBrowseConnect( handle->win32_handle, InConnectionString, StringLength1, OutConnectionString, BufferLength, StringLength2 ); } else { - struct SQLAllocEnv_params params_alloc_env = { &handle->parent->unix_handle }; - struct SQLAllocConnect_params params_alloc_connect = { 0, &handle->unix_handle }; struct SQLBrowseConnect_params params = { 0, InConnectionString, StringLength1, OutConnectionString, BufferLength, StringLength2 };
TRACE( "using Unix driver %s\n", debugstr_w(filename) ); - if (!SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms_alloc_env )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - - params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; - if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_env( handle->parent, TRUE )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLBrowseConnect, ¶ms ); @@ -3302,32 +3316,21 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle } TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, - &handle->parent->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - + if (!SUCCESS((ret = create_env( handle->parent, FALSE )))) goto done; handle->parent->win32_funcs = handle->win32_funcs; - if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, - &handle->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
ret = handle->win32_funcs->SQLDriverConnect( handle->win32_handle, WindowHandle, InConnectionString, Length, OutConnectionString, BufferLength, Length2, DriverCompletion ); } else { - struct SQLAllocEnv_params params_alloc_env = { &handle->parent->unix_handle }; - struct SQLAllocConnect_params params_alloc_connect = { 0, &handle->unix_handle }; struct SQLDriverConnect_params params = { 0, WindowHandle, InConnectionString, Length, OutConnectionString, BufferLength, Length2, DriverCompletion };
TRACE( "using Unix driver %s\n", debugstr_w(filename) ); - if (!SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms_alloc_env )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - - params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; - if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_env( handle->parent, TRUE )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLDriverConnect, ¶ms ); @@ -3471,35 +3474,24 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA } TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, - &handle->parent->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - + if (!SUCCESS((ret = create_env( handle->parent, FALSE )))) goto done; handle->parent->win32_funcs = handle->win32_funcs; - if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, - &handle->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
ret = handle->win32_funcs->SQLConnectW( handle->win32_handle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3 ); } else { - struct SQLAllocEnv_params params_alloc_env = { &handle->parent->unix_handle }; - struct SQLAllocConnect_params params_alloc_connect = { 0, &handle->unix_handle }; - struct SQLConnectW_params params_connect = { 0, ServerName, NameLength1, UserName, NameLength2, - Authentication, NameLength3 }; + struct SQLConnectW_params params = { 0, ServerName, NameLength1, UserName, NameLength2, Authentication, + NameLength3 };
TRACE( "using Unix driver %s\n", debugstr_w(filename) ); - if (!SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms_alloc_env )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; + if (!SUCCESS((ret = create_env( handle->parent, TRUE )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
- params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; - if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; - - params_connect.ConnectionHandle = handle->unix_handle; - ret = ODBC_CALL( SQLConnectW, ¶ms_connect ); + params.ConnectionHandle = handle->unix_handle; + ret = ODBC_CALL( SQLConnectW, ¶ms ); }
done: @@ -4063,32 +4055,21 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl } TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, - &handle->parent->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - + if (!SUCCESS((ret = create_env( handle->parent, FALSE )))) goto done; handle->parent->win32_funcs = handle->win32_funcs; - if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, - &handle->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
ret = handle->win32_funcs->SQLDriverConnectW( handle->win32_handle, WindowHandle, InConnectionString, Length, OutConnectionString, BufferLength, Length2, DriverCompletion ); } else { - struct SQLAllocEnv_params params_alloc_env = { &handle->parent->unix_handle }; - struct SQLAllocConnect_params params_alloc_connect = { 0, &handle->unix_handle }; struct SQLDriverConnectW_params params = { 0, WindowHandle, InConnectionString, Length, OutConnectionString, BufferLength, Length2, DriverCompletion };
TRACE( "using Unix driver %s\n", debugstr_w(filename) ); - if (!SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms_alloc_env )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - - params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; - if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_env( handle->parent, TRUE )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLDriverConnectW, ¶ms ); @@ -4364,32 +4345,21 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnect } TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_ENV, NULL, - &handle->parent->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - + if (!SUCCESS((ret = create_env( handle->parent, FALSE )))) goto done; handle->parent->win32_funcs = handle->win32_funcs; - if (!SUCCESS((ret = handle->win32_funcs->SQLAllocHandle( SQL_HANDLE_DBC, handle->parent->win32_handle, - &handle->win32_handle )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
ret = handle->win32_funcs->SQLBrowseConnectW( handle->win32_handle, InConnectionString, StringLength1, OutConnectionString, BufferLength, StringLength2 ); } else { - struct SQLAllocEnv_params params_alloc_env = { &handle->parent->unix_handle }; - struct SQLAllocConnect_params params_alloc_connect = { 0, &handle->unix_handle }; struct SQLBrowseConnectW_params params = { 0, InConnectionString, StringLength1, OutConnectionString, BufferLength, StringLength2 };
TRACE( "using Unix driver %s\n", debugstr_w(filename) ); - if (!SUCCESS((ret = ODBC_CALL( SQLAllocEnv, ¶ms_alloc_env )))) goto done; - if (!SUCCESS((ret = prepare_env( handle->parent )))) goto done; - - params_alloc_connect.EnvironmentHandle = handle->parent->unix_handle; - if (!SUCCESS((ret = ODBC_CALL( SQLAllocConnect, ¶ms_alloc_connect )))) goto done; - if (!SUCCESS((ret = prepare_con( handle )))) goto done; + if (!SUCCESS((ret = create_env( handle->parent, TRUE )))) goto done; + if (!SUCCESS((ret = create_con( handle )))) goto done;
params.ConnectionHandle = handle->unix_handle; ret = ODBC_CALL( SQLBrowseConnectW, ¶ms );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147005
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000007700DE, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
Alistair Leslie-Hughes (@alesliehughes) commented about dlls/odbc32/proxyodbc.c:
return SQL_SUCCESS;
}
+static SQLRETURN set_con_attr( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER len ) +{
- SQLRETURN ret = SQL_ERROR;
- if (handle->unix_handle)
- {
struct SQLSetConnectAttr_params params = { handle->unix_handle, attr, value, len };
ret = ODBC_CALL( SQLSetConnectAttr, ¶ms );
- }
- else if (handle->win32_handle)
- {
ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, attr, value, len );
You cannot assume for a native window driver that this function will exist. For example, the MySQL ODBC driver has two DLL's (ASCII and Unicode), so in this case only the ascii version will work. Suggestion. ``` - ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, attr, value, len ); + if (handle->win32_funcs->SQLSetConnectAttr) + ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, attr, value, len ); + else if (handle->win32_funcs->SQLSetConnectAttrW) + ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, attr, value, len ); ```
On Thu Jul 11 07:18:07 2024 +0000, Alistair Leslie-Hughes wrote:
You cannot assume for a native window driver that this function will exist. For example, the MySQL ODBC driver has two DLL's (ASCII and Unicode), so in this case only the ascii version will work. Suggestion.
- ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, attr, value, len ); + if (handle->win32_funcs->SQLSetConnectAttr) + ret = handle->win32_funcs->SQLSetConnectAttr( handle->win32_handle, attr, value, len ); + else if (handle->win32_funcs->SQLSetConnectAttrW) + ret = handle->win32_funcs->SQLSetConnectAttrW( handle->win32_handle, attr, value, len );
That will not work without conversion of string attributes. If the app uses a data source configured for the Unicode driver but calls ANSI functions then we should probably convert. I don't expect this to be common though. If it's the other around then the conversion would be lossy. This would need some tests.
On Thu Jul 11 07:26:20 2024 +0000, Hans Leidekker wrote:
That will not work without conversion of string attributes. If the app uses a data source configured for the Unicode driver but calls ANSI functions then we should probably convert. I don't expect this to be common though. If it's the other around then the conversion would be lossy. This would need some tests.
Currently this causes an fault in my testing, since the driver doesn't have this function.
From my experience, I'm calling ODBC32.SQLSetConnectAttrW to set values, so the driver should call the same function or handle the case where SQLSetConnectAttrW doesn't exist,eg call the ascii version.
unixODBC will return an error, if a ascii function is called and only the unicode function exist.
Maybe the default should be to call the SQLSetConnectAttrW.
On Thu Jul 11 07:45:44 2024 +0000, Alistair Leslie-Hughes wrote:
Currently this causes an fault in my testing, since the driver doesn't have this function. From my experience, I'm calling ODBC32.SQLSetConnectAttrW to set values, so the driver should call the same function or handle the case where SQLSetConnectAttrW doesn't exist,eg call the ascii version. unixODBC will return an error, if a ascii function is called and only the unicode function exist. Maybe the default should be to call the SQLSetConnectAttrW.
Are you using the ANSI or Unicode driver? (Also, shall we address this at a later point? I don't think it's relevant to this MR).
On Thu Jul 11 08:07:45 2024 +0000, Hans Leidekker wrote:
Are you using the ANSI or Unicode driver? (Also, shall we address this at a later point? I don't think it's relevant to this MR).
I'm using the unicode driver.
Making the default SQLSetConnectAttrW, then we can handle the fallback later. Plus unixODBC will already handle the conversion (strings) if we pass them as unicode. Not that we are going that yet.
Changing to use the ascii driver, returns values as expected (assuming text is latin based text) though none of the unicode functions are available.
On Thu Jul 11 22:33:35 2024 +0000, Alistair Leslie-Hughes wrote:
I'm using the unicode driver. Making the default SQLSetConnectAttrW, then we can handle the fallback later. Plus unixODBC will already handle the conversion (strings) if we pass them as unicode. Not that we are going that yet. Changing to use the ascii driver, returns values as expected (assuming text is latin based text) though none of the unicode functions are available.
The function pointer for native drivers needs to be tested before being used as it might not exist.