From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/odbc32/proxyodbc.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index d035ddbcccc..2b307c22793 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -3761,6 +3761,12 @@ SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, TRACE("(EnvironmentHandle %p, Attribute %d, Value %p, StringLength %d)\n", EnvironmentHandle, Attribute, Value, StringLength);
+ if (!env && Attribute == SQL_ATTR_CONNECTION_POOLING) + { + FIXME("Ignoring SQL_ATTR_CONNECTION_POOLING attribute.\n"); + return SQL_SUCCESS; + } + if (env->hdr.unix_handle) { ret = set_env_attr_unix( env, Attribute, Value, StringLength );
From: Nikolay Sivov nsivov@codeweavers.com
None of ODBC standard statement attributes are specified to use string values. Currently passing user pointer such as SQL_ATTR_ROW_ARRAY_SIZE could get "converted", providing driver with unrelated pointer, which is also immediately freed on return.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/odbc32/proxyodbc.c | 20 ++++++++++++++------ include/sql.h | 2 +- include/sqlext.h | 4 ++++ 3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 2b307c22793..b8967d4cd0d 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -3940,14 +3940,22 @@ static SQLRETURN set_stmt_attr_win32_a( struct statement *stmt, SQLINTEGER attr,
if (stmt->hdr.win32_funcs->SQLSetStmtAttrW) { + BOOL stringvalue = !(len < SQL_LEN_BINARY_ATTR_OFFSET /* Binary buffer */ + || (len == SQL_IS_POINTER) /* Other pointer */ + || (len == SQL_IS_INTEGER || len == SQL_IS_UINTEGER)); /* Fixed-length */ WCHAR *strW;
- if (len == SQL_IS_POINTER || len < SQL_LEN_BINARY_ATTR_OFFSET) - return stmt->hdr.win32_funcs->SQLSetStmtAttrW( stmt->hdr.win32_handle, attr, value, len ); - - if (!(strW = strnAtoW( value, len ))) return SQL_ERROR; - ret = stmt->hdr.win32_funcs->SQLSetStmtAttrW( stmt->hdr.win32_handle, attr, strW, len ); - free( strW ); + /* Driver-defined attribute range */ + if (stringvalue && attr >= SQL_DRIVER_STMT_ATTR_BASE && attr <= 0x7fff) + { + if (!(strW = strnAtoW( value, len ))) return SQL_ERROR; + ret = stmt->hdr.win32_funcs->SQLSetStmtAttrW( stmt->hdr.win32_handle, attr, strW, len ); + free( strW ); + } + else + { + ret = stmt->hdr.win32_funcs->SQLSetStmtAttrW( stmt->hdr.win32_handle, attr, value, len ); + } } return ret; } diff --git a/include/sql.h b/include/sql.h index ed47380c8a3..c9a85faf9c5 100644 --- a/include/sql.h +++ b/include/sql.h @@ -22,7 +22,7 @@ #define __SQL_H
#ifndef ODBCVER -#define ODBCVER 0x0351 +#define ODBCVER 0x0380 #endif
#include <sqltypes.h> diff --git a/include/sqlext.h b/include/sqlext.h index 6a707f8e162..7f43c86da37 100644 --- a/include/sqlext.h +++ b/include/sqlext.h @@ -448,6 +448,10 @@ extern "C" { #define SQL_TYPE_MAX SQL_VARCHAR #endif
+#if (ODBCVER >= 0x0380) +#define SQL_DRIVER_STMT_ATTR_BASE 0x00004000 +#endif + #if (ODBCVER >= 0x0300) #define SQL_C_VARBOOKMARK SQL_C_BINARY #endif
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/odbc32/proxyodbc.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index b8967d4cd0d..6efa8248751 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -2930,6 +2930,7 @@ static SQLRETURN get_info_win32_a( struct connection *con, SQLUSMALLINT type, SQ SQLRETURN ret = SQL_ERROR; WCHAR *strW = NULL; SQLPOINTER buf = value; + BOOL strvalue = FALSE;
if (con->hdr.win32_funcs->SQLGetInfo) return con->hdr.win32_funcs->SQLGetInfo( con->hdr.win32_handle, type, value, buflen, retlen ); @@ -2976,18 +2977,30 @@ static SQLRETURN get_info_win32_a( struct connection *con, SQLUSMALLINT type, SQ case SQL_TABLE_TERM: case SQL_USER_NAME: case SQL_XOPEN_CLI_YEAR: - if (!(strW = malloc( buflen * sizeof(WCHAR) ))) return SQL_ERROR; - buf = strW; + if (buf) + { + if (!(strW = malloc( buflen * sizeof(WCHAR) ))) return SQL_ERROR; + buf = strW; + buflen *= sizeof(WCHAR); + } + strvalue = TRUE; break;
default: break; }
ret = con->hdr.win32_funcs->SQLGetInfoW( con->hdr.win32_handle, type, buf, buflen, retlen ); - if (SUCCESS( ret ) && strW) + if (SUCCESS( ret )) { - int len = WideCharToMultiByte( CP_ACP, 0, strW, -1, (char *)value, buflen, NULL, NULL ); - if (retlen) *retlen = len - 1; + if (strW) + { + int len = WideCharToMultiByte( CP_ACP, 0, strW, -1, (char *)value, buflen / sizeof(WCHAR), NULL, NULL ); + if (retlen) *retlen = len - 1; + } + else if (strvalue && retlen) + { + *retlen /= sizeof(WCHAR); + } } free( strW ); }
This merge request was approved by Hans Leidekker.