From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 62 +++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 8 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 4c8471e0537..a7c95c6faa7 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -1204,10 +1204,8 @@ static SQLRETURN describe_col_win32_a( struct handle *handle, SQLUSMALLINT col_n SQLRETURN ret = SQL_ERROR;
if (handle->win32_funcs->SQLDescribeCol) - { return handle->win32_funcs->SQLDescribeCol( handle->win32_handle, col_number, col_name, buflen, retlen, data_type, col_size, decimal_digits, nullable ); - } if (handle->win32_funcs->SQLDescribeColW) { SQLWCHAR *nameW; @@ -2436,6 +2434,40 @@ SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQL return ret; }
+static SQLRETURN get_stmt_attr_unix_a( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER buflen, + SQLINTEGER *retlen ) +{ + struct SQLGetStmtAttr_params params = { handle->unix_handle, attr, value, buflen, retlen }; + return ODBC_CALL( SQLGetStmtAttr, ¶ms ); +} + +static SQLRETURN get_stmt_attr_win32_a( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER buflen, + SQLINTEGER *retlen ) +{ + if (handle->win32_funcs->SQLGetStmtAttr) + return handle->win32_funcs->SQLGetStmtAttr( handle->win32_handle, attr, value, buflen, retlen ); + + if (handle->win32_funcs->SQLGetStmtAttrW) + { + SQLRETURN ret; + WCHAR *strW; + + if (buflen == SQL_IS_POINTER || buflen < SQL_LEN_BINARY_ATTR_OFFSET) + return handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, attr, value, buflen, retlen ); + + if (!(strW = malloc( buflen * sizeof(WCHAR) ))) return SQL_ERROR; + ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, attr, strW, buflen, retlen ); + if (SUCCESS( ret )) + { + int len = WideCharToMultiByte( CP_ACP, 0, strW, -1, (char *)value, buflen, NULL, NULL ); + if (retlen) *retlen = len - 1; + } + free( strW ); + } + + return SQL_ERROR; +} + /************************************************************************* * SQLGetStmtAttr [ODBC32.038] */ @@ -2458,12 +2490,11 @@ SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute,
if (handle->unix_handle) { - struct SQLGetStmtAttr_params params = { handle->unix_handle, Attribute, Value, BufferLength, StringLength }; - ret = ODBC_CALL( SQLGetStmtAttr, ¶ms ); + ret = get_stmt_attr_unix_a( handle, Attribute, Value, BufferLength, StringLength ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLGetStmtAttr( handle->win32_handle, Attribute, Value, BufferLength, StringLength ); + ret = get_stmt_attr_win32_a( handle, Attribute, Value, BufferLength, StringLength ); }
TRACE("Returning %d\n", ret); @@ -4860,6 +4891,22 @@ SQLRETURN WINAPI SQLGetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMA return ret; }
+static SQLRETURN get_stmt_attr_unix_w( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER buflen, + SQLINTEGER *retlen ) +{ + struct SQLGetStmtAttrW_params params = { handle->unix_handle, attr, value, buflen, retlen }; + return ODBC_CALL( SQLGetStmtAttrW, ¶ms ); +} + +static SQLRETURN get_stmt_attr_win32_w( struct handle *handle, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER buflen, + SQLINTEGER *retlen ) +{ + if (handle->win32_funcs->SQLGetStmtAttrW) + return handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, attr, value, buflen, retlen ); + if (handle->win32_funcs->SQLGetStmtAttr) FIXME( "Unicode to ANSI conversion not handled\n" ); + return SQL_ERROR; +} + /************************************************************************* * SQLGetStmtAttrW [ODBC32.138] */ @@ -4882,12 +4929,11 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute,
if (handle->unix_handle) { - struct SQLGetStmtAttrW_params params = { handle->unix_handle, Attribute, Value, BufferLength, StringLength }; - ret = ODBC_CALL( SQLGetStmtAttrW, ¶ms ); + ret = get_stmt_attr_unix_w( handle, Attribute, Value, BufferLength, StringLength ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLGetStmtAttrW( handle->win32_handle, Attribute, Value, BufferLength, StringLength ); + ret = get_stmt_attr_win32_w( handle, Attribute, Value, BufferLength, StringLength ); }
TRACE("Returning %d\n", ret);
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index a7c95c6faa7..d94c1c9cb22 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -2527,6 +2527,21 @@ SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, return ret; }
+static SQLRETURN get_type_info_unix_a( struct handle *handle, SQLSMALLINT type ) +{ + struct SQLGetTypeInfo_params params = { handle->unix_handle, type }; + return ODBC_CALL( SQLGetTypeInfo, ¶ms ); +} + +static SQLRETURN get_type_info_win32_a( struct handle *handle, SQLSMALLINT type ) +{ + if (handle->win32_funcs->SQLGetTypeInfo) + return handle->win32_funcs->SQLGetTypeInfo( handle->win32_handle, type ); + if (handle->win32_funcs->SQLGetTypeInfoW) + return handle->win32_funcs->SQLGetTypeInfoW( handle->win32_handle, type ); + return SQL_ERROR; +} + /************************************************************************* * SQLGetTypeInfo [ODBC32.047] */ @@ -2541,12 +2556,11 @@ SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
if (handle->unix_handle) { - struct SQLGetTypeInfo_params params = { handle->unix_handle, DataType }; - ret = ODBC_CALL( SQLGetTypeInfo, ¶ms ); + ret = get_type_info_unix_a( handle, DataType ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLGetTypeInfo( handle->win32_handle, DataType ); + ret = get_type_info_win32_a( handle, DataType ); }
TRACE("Returning %d\n", ret); @@ -5222,6 +5236,21 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ return ret; }
+static SQLRETURN get_type_info_unix_w( struct handle *handle, SQLSMALLINT type ) +{ + struct SQLGetTypeInfoW_params params = { handle->unix_handle, type }; + return ODBC_CALL( SQLGetTypeInfoW, ¶ms ); +} + +static SQLRETURN get_type_info_win32_w( struct handle *handle, SQLSMALLINT type ) +{ + if (handle->win32_funcs->SQLGetTypeInfoW) + return handle->win32_funcs->SQLGetTypeInfoW( handle->win32_handle, type ); + if (handle->win32_funcs->SQLGetTypeInfo) + return handle->win32_funcs->SQLGetTypeInfo( handle->win32_handle, type ); + return SQL_ERROR; +} + /************************************************************************* * SQLGetTypeInfoW [ODBC32.147] */ @@ -5236,12 +5265,11 @@ SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
if (handle->unix_handle) { - struct SQLGetTypeInfoW_params params = { handle->unix_handle, DataType }; - ret = ODBC_CALL( SQLGetTypeInfoW, ¶ms ); + ret = get_type_info_unix_w( handle, DataType ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLGetTypeInfoW( handle->win32_handle, DataType ); + ret = get_type_info_win32_w( handle, DataType ); }
TRACE("Returning %d\n", ret);
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 75 +++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 14 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index d94c1c9cb22..99543c9ad0e 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -3438,10 +3438,9 @@ static SQLRETURN column_privs_win32_a( struct handle *handle, SQLCHAR *catalog, SQLRETURN ret = SQL_ERROR;
if (handle->win32_funcs->SQLColumnPrivileges) - { return handle->win32_funcs->SQLColumnPrivileges( handle->win32_handle, catalog, len1, schema, len2, table, len3, column, len4 ); - } + if (handle->win32_funcs->SQLColumnPrivilegesW) { if (!(catalogW = strnAtoW( catalog, len1 ))) return SQL_ERROR; @@ -3574,11 +3573,9 @@ static SQLRETURN foreign_keys_win32_a( struct handle *handle, SQLCHAR *pk_catalo SQLRETURN ret = SQL_ERROR;
if (handle->win32_funcs->SQLForeignKeys) - { return handle->win32_funcs->SQLForeignKeys( handle->win32_handle, pk_catalog, len1, pk_schema, len2, pk_table, len3, fk_catalog, len4, fk_schema, len5, fk_table, len6 ); - } if (handle->win32_funcs->SQLForeignKeysW) { if (!(pk_catalogW = strnAtoW( pk_catalog, len1 ))) return SQL_ERROR; @@ -3666,6 +3663,45 @@ SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle) return ret; }
+static SQLRETURN native_sql_unix_a( struct handle *handle, SQLCHAR *in_statement, SQLINTEGER len, + SQLCHAR *out_statement, SQLINTEGER buflen, SQLINTEGER *retlen ) +{ + struct SQLNativeSql_params params = { handle->unix_handle, in_statement, len, out_statement, buflen, retlen }; + return ODBC_CALL( SQLNativeSql, ¶ms ); +} + +static SQLRETURN native_sql_win32_a( struct handle *handle, SQLCHAR *in_statement, SQLINTEGER in_len, + SQLCHAR *out_statement, SQLINTEGER buflen, SQLINTEGER *retlen ) +{ + SQLRETURN ret = SQL_ERROR; + + if (handle->win32_funcs->SQLNativeSql) + return handle->win32_funcs->SQLNativeSql( handle->win32_handle, in_statement, in_len, out_statement, buflen, + retlen ); + + if (handle->win32_funcs->SQLNativeSqlW) + { + SQLWCHAR *inW, *outW; + + if (!(inW = malloc( in_len * sizeof(WCHAR) ))) return SQL_ERROR; + if (!(outW = malloc( buflen * sizeof(WCHAR) ))) + { + free( inW ); + return SQL_ERROR; + } + ret = handle->win32_funcs->SQLNativeSqlW( handle->win32_handle, inW, in_len, outW, buflen, retlen ); + if (SUCCESS( ret )) + { + int len = WideCharToMultiByte( CP_ACP, 0, outW, -1, (char *)out_statement, buflen, NULL, NULL ); + if (retlen) *retlen = len - 1; + } + free( inW ); + free( outW ); + } + + return ret; +} + /************************************************************************* * SQLNativeSql [ODBC32.062] */ @@ -3683,14 +3719,11 @@ SQLRETURN WINAPI SQLNativeSql(SQLHDBC ConnectionHandle, SQLCHAR *InStatementText
if (handle->unix_handle) { - struct SQLNativeSql_params params = { handle->unix_handle, InStatementText, TextLength1, OutStatementText, - BufferLength, TextLength2 }; - ret = ODBC_CALL( SQLNativeSql, ¶ms ); + ret = native_sql_unix_a( handle, InStatementText, TextLength1, OutStatementText, BufferLength, TextLength2 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLNativeSql( handle->win32_handle, InStatementText, TextLength1, OutStatementText, - BufferLength, TextLength2 ); + ret = native_sql_win32_a( handle, InStatementText, TextLength1, OutStatementText, BufferLength, TextLength2 ); }
TRACE("Returning %d\n", ret); @@ -5664,6 +5697,23 @@ SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT StatementHandle, SQLWCHAR *PkCatalogNa return ret; }
+static SQLRETURN native_sql_unix_w( struct handle *handle, SQLWCHAR *in_statement, SQLINTEGER len, + SQLWCHAR *out_statement, SQLINTEGER buflen, SQLINTEGER *retlen ) +{ + struct SQLNativeSqlW_params params = { handle->unix_handle, in_statement, len, out_statement, buflen, retlen }; + return ODBC_CALL( SQLNativeSqlW, ¶ms ); +} + +static SQLRETURN native_sql_win32_w( struct handle *handle, SQLWCHAR *in_statement, SQLINTEGER len, + SQLWCHAR *out_statement, SQLINTEGER buflen, SQLINTEGER *retlen ) +{ + if (handle->win32_funcs->SQLNativeSqlW) + return handle->win32_funcs->SQLNativeSqlW( handle->win32_handle, in_statement, len, out_statement, buflen, + retlen ); + if (handle->win32_funcs->SQLNativeSql) FIXME( "Unicode to ANSI conversion not handled\n" ); + return SQL_ERROR; +} + /************************************************************************* * SQLNativeSqlW [ODBC32.162] */ @@ -5681,14 +5731,11 @@ SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC ConnectionHandle, SQLWCHAR *InStatementTe
if (handle->unix_handle) { - struct SQLNativeSqlW_params params = { handle->unix_handle, InStatementText, TextLength1, OutStatementText, - BufferLength, TextLength2 }; - ret = ODBC_CALL( SQLNativeSqlW, ¶ms ); + ret = native_sql_unix_w( handle, InStatementText, TextLength1, OutStatementText, BufferLength, TextLength2 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLNativeSqlW( handle->win32_handle, InStatementText, TextLength1, OutStatementText, - BufferLength, TextLength2 ); + ret = native_sql_win32_w( handle, InStatementText, TextLength1, OutStatementText, BufferLength, TextLength2 ); }
TRACE("Returning %d\n", ret);
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 48 +++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 99543c9ad0e..3d89687e5f7 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -2619,6 +2619,30 @@ SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) return ret; }
+static SQLRETURN prepare_unix_a( struct handle *handle, SQLCHAR *statement, SQLINTEGER len ) +{ + struct SQLPrepare_params params = { handle->unix_handle, statement, len }; + return ODBC_CALL( SQLPrepare, ¶ms ); +} + +static SQLRETURN prepare_win32_a( struct handle *handle, SQLCHAR *statement, SQLINTEGER len ) +{ + SQLRETURN ret = SQL_ERROR; + + if (handle->win32_funcs->SQLPrepare) + return handle->win32_funcs->SQLPrepare( handle->win32_handle, statement, len ); + + if (handle->win32_funcs->SQLPrepareW) + { + WCHAR *strW; + if (!(strW = strnAtoW( statement, len ))) return SQL_ERROR; + ret = handle->win32_funcs->SQLPrepareW( handle->win32_handle, strW, len ); + free( strW ); + } + + return ret; +} + /************************************************************************* * SQLPrepare [ODBC32.019] */ @@ -2634,12 +2658,11 @@ SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQ
if (handle->unix_handle) { - struct SQLPrepare_params params = { handle->unix_handle, StatementText, TextLength }; - ret = ODBC_CALL( SQLPrepare, ¶ms ); + ret = prepare_unix_a( handle, StatementText, TextLength ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLPrepare( handle->win32_handle, StatementText, TextLength ); + ret = prepare_win32_a( handle, StatementText, TextLength ); }
TRACE("Returning %d\n", ret); @@ -4562,6 +4585,20 @@ SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, SQLWCHAR *CursorNam return ret; }
+static SQLRETURN prepare_unix_w( struct handle *handle, SQLWCHAR *statement, SQLINTEGER len ) +{ + struct SQLPrepareW_params params = { handle->unix_handle, statement, len }; + return ODBC_CALL( SQLPrepareW, ¶ms ); +} + +static SQLRETURN prepare_win32_w( struct handle *handle, SQLWCHAR *statement, SQLINTEGER len ) +{ + if (handle->win32_funcs->SQLPrepareW) + return handle->win32_funcs->SQLPrepareW( handle->win32_handle, statement, len ); + if (handle->win32_funcs->SQLPrepare) FIXME( "Unicode to ANSI conversion not handled\n" ); + return SQL_ERROR; +} + /************************************************************************* * SQLPrepareW [ODBC32.119] */ @@ -4577,12 +4614,11 @@ SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, SQLWCHAR *StatementText,
if (handle->unix_handle) { - struct SQLPrepareW_params params = { handle->unix_handle, StatementText, TextLength }; - ret = ODBC_CALL( SQLPrepareW, ¶ms ); + ret = prepare_unix_w( handle, StatementText, TextLength ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLPrepareW( handle->win32_handle, StatementText, TextLength ); + ret = prepare_win32_w( handle, StatementText, TextLength ); }
TRACE("Returning %d\n", ret);
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 61 ++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 10 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 3d89687e5f7..16539130663 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -3807,6 +3807,37 @@ SQLRETURN WINAPI SQLParamOptions(SQLHSTMT StatementHandle, SQLULEN RowCount, SQL return ret; }
+static SQLRETURN primary_keys_unix_a( struct handle *handle, SQLCHAR *catalog, SQLSMALLINT len1, SQLCHAR *schema, + SQLSMALLINT len2, SQLCHAR *table, SQLSMALLINT len3 ) +{ + struct SQLPrimaryKeys_params params = { handle->unix_handle, catalog, len1, schema, len2, table, len3 }; + return ODBC_CALL( SQLPrimaryKeys, ¶ms ); +} + +static SQLRETURN primary_keys_win32_a( struct handle *handle, SQLCHAR *catalog, SQLSMALLINT len1, SQLCHAR *schema, + SQLSMALLINT len2, SQLCHAR *table, SQLSMALLINT len3 ) +{ + WCHAR *catalogW = NULL, *schemaW = NULL, *tableW = NULL; + SQLRETURN ret = SQL_ERROR; + + if (handle->win32_funcs->SQLPrimaryKeys) + return handle->win32_funcs->SQLPrimaryKeys( handle->win32_handle, catalog, len1, schema, len2, table, len3 ); + + if (handle->win32_funcs->SQLPrimaryKeysW) + { + if (!(catalogW = strnAtoW( catalog, len1 ))) goto done; + if (!(schemaW = strnAtoW( schema, len2 ))) goto done; + if (!(tableW = strnAtoW( table, len3 ))) goto done; + ret = handle->win32_funcs->SQLPrimaryKeysW( handle->win32_handle, catalogW, len1, schemaW, len2, tableW, len3 ); + } + +done: + free( catalogW ); + free( schemaW ); + free( tableW ); + return ret; +} + /************************************************************************* * SQLPrimaryKeys [ODBC32.065] */ @@ -3826,14 +3857,11 @@ SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT StatementHandle, SQLCHAR *CatalogName,
if (handle->unix_handle) { - struct SQLPrimaryKeys_params params = { handle->unix_handle, CatalogName, NameLength1, SchemaName, - NameLength2, TableName, NameLength3 }; - ret = ODBC_CALL( SQLPrimaryKeys, ¶ms ); + ret = primary_keys_unix_a( handle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLPrimaryKeys( handle->win32_handle, CatalogName, NameLength1, SchemaName, - NameLength2, TableName, NameLength3 ); + ret = primary_keys_win32_a( handle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3 ); }
TRACE("Returning %d\n", ret); @@ -5778,6 +5806,22 @@ SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC ConnectionHandle, SQLWCHAR *InStatementTe return ret; }
+static SQLRETURN primary_keys_unix_w( struct handle *handle, SQLWCHAR *catalog, SQLSMALLINT len1, SQLWCHAR *schema, + SQLSMALLINT len2, SQLWCHAR *table, SQLSMALLINT len3 ) +{ + struct SQLPrimaryKeysW_params params = { handle->unix_handle, catalog, len1, schema, len2, table, len3 }; + return ODBC_CALL( SQLPrimaryKeysW, ¶ms ); +} + +static SQLRETURN primary_keys_win32_w( struct handle *handle, SQLWCHAR *catalog, SQLSMALLINT len1, SQLWCHAR *schema, + SQLSMALLINT len2, SQLWCHAR *table, SQLSMALLINT len3 ) +{ + if (handle->win32_funcs->SQLPrimaryKeysW) + return handle->win32_funcs->SQLPrimaryKeysW( handle->win32_handle, catalog, len1, schema, len2, table, len3 ); + if (handle->win32_funcs->SQLPrimaryKeys) FIXME( "Unicode to ANSI conversion not handled\n" ); + return SQL_ERROR; +} + /************************************************************************* * SQLPrimaryKeysW [ODBC32.165] */ @@ -5797,14 +5841,11 @@ SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName
if (handle->unix_handle) { - struct SQLPrimaryKeysW_params params = { handle->unix_handle, CatalogName, NameLength1, SchemaName, - NameLength2, TableName, NameLength2 }; - ret = ODBC_CALL( SQLPrimaryKeysW, ¶ms ); + ret = primary_keys_unix_w( handle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength2 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLPrimaryKeysW( handle->win32_handle, CatalogName, NameLength1, SchemaName, - NameLength2, TableName, NameLength2 ); + ret = primary_keys_win32_w( handle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength2 ); }
TRACE("Returning %d\n", ret);
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 76 +++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 10 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 16539130663..d4c218e8e04 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -3868,6 +3868,44 @@ SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, return ret; }
+static SQLRETURN procedure_columns_unix_a( struct handle *handle, SQLCHAR *catalog, SQLSMALLINT len1, + SQLCHAR *schema, SQLSMALLINT len2, SQLCHAR *proc, SQLSMALLINT len3, + SQLCHAR *column, SQLSMALLINT len4 ) +{ + struct SQLProcedureColumns_params params = { handle->unix_handle, catalog, len1, schema, len2, proc, len3, + column, len4 }; + return ODBC_CALL( SQLProcedureColumns, ¶ms ); +} + +static SQLRETURN procedure_columns_win32_a( struct handle *handle, SQLCHAR *catalog, SQLSMALLINT len1, + SQLCHAR *schema, SQLSMALLINT len2, SQLCHAR *proc, SQLSMALLINT len3, + SQLCHAR *column, SQLSMALLINT len4 ) +{ + WCHAR *catalogW = NULL, *schemaW = NULL, *procW = NULL, *columnW = NULL; + SQLRETURN ret = SQL_ERROR; + + if (handle->win32_funcs->SQLProcedureColumns) + return handle->win32_funcs->SQLProcedureColumns( handle->win32_handle, catalog, len1, schema, len2, proc, + len3, column, len4 ); + + if (handle->win32_funcs->SQLProcedureColumnsW) + { + if (!(catalogW = strnAtoW( catalog, len1 ))) goto done; + if (!(schemaW = strnAtoW( schema, len2 ))) goto done; + if (!(procW = strnAtoW( proc, len3 ))) goto done; + if (!(columnW = strnAtoW( column, len4 ))) goto done; + ret = handle->win32_funcs->SQLProcedureColumnsW( handle->win32_handle, catalogW, len1, schemaW, len2, procW, + len3, columnW, len4 ); + } + +done: + free( catalogW ); + free( schemaW ); + free( procW ); + free( columnW ); + return ret; +} + /************************************************************************* * SQLProcedureColumns [ODBC32.066] */ @@ -3888,14 +3926,13 @@ SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogN
if (handle->unix_handle) { - struct SQLProcedureColumns_params params = { handle->unix_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3, ColumnName, NameLength4 }; - ret = ODBC_CALL( SQLProcedureColumns, ¶ms ); + ret = procedure_columns_unix_a( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, + NameLength3, ColumnName, NameLength4 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLProcedureColumns( handle->win32_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3, ColumnName, NameLength4 ); + ret = procedure_columns_win32_a( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, + NameLength3, ColumnName, NameLength4 ); }
TRACE("Returning %d\n", ret); @@ -5852,6 +5889,26 @@ SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName return ret; }
+static SQLRETURN procedure_columns_unix_w( struct handle *handle, SQLWCHAR *catalog, SQLSMALLINT len1, + SQLWCHAR *schema, SQLSMALLINT len2, SQLWCHAR *proc, SQLSMALLINT len3, + SQLWCHAR *column, SQLSMALLINT len4 ) +{ + struct SQLProcedureColumnsW_params params = { handle->unix_handle, catalog, len1, schema, len2, proc, len3, + column, len4 }; + return ODBC_CALL( SQLProcedureColumnsW, ¶ms ); +} + +static SQLRETURN procedure_columns_win32_w( struct handle *handle, SQLWCHAR *catalog, SQLSMALLINT len1, + SQLWCHAR *schema, SQLSMALLINT len2, SQLWCHAR *proc, SQLSMALLINT len3, + SQLWCHAR *column, SQLSMALLINT len4 ) +{ + if (handle->win32_funcs->SQLProcedureColumnsW) + return handle->win32_funcs->SQLProcedureColumnsW( handle->win32_handle, catalog, len1, schema, len2, proc, + len3, column, len4 ); + if (handle->win32_funcs->SQLProcedureColumns) FIXME( "Unicode to ANSI conversion not handled\n" ); + return SQL_ERROR; +} + /************************************************************************* * SQLProcedureColumnsW [ODBC32.166] */ @@ -5872,14 +5929,13 @@ SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT StatementHandle, SQLWCHAR *Catalo
if (handle->unix_handle) { - struct SQLProcedureColumnsW_params params = { handle->unix_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3, ColumnName, NameLength4 }; - ret = ODBC_CALL( SQLProcedureColumnsW, ¶ms ); + ret = procedure_columns_unix_w( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, + NameLength3, ColumnName, NameLength4 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLProcedureColumnsW( handle->win32_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3, ColumnName, NameLength4 ); + ret = procedure_columns_win32_w( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, + NameLength3, ColumnName, NameLength4 ); }
TRACE("Returning %d\n", ret);
From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 61 ++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 10 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index d4c218e8e04..efae5d3bf84 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -3939,6 +3939,37 @@ SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogN return ret; }
+static SQLRETURN procedures_unix_a( struct handle *handle, SQLCHAR *catalog, SQLSMALLINT len1, SQLCHAR *schema, + SQLSMALLINT len2, SQLCHAR *proc, SQLSMALLINT len3 ) +{ + struct SQLProcedures_params params = { handle->unix_handle, catalog, len1, schema, len2, proc, len3 }; + return ODBC_CALL( SQLProcedures, ¶ms ); +} + +static SQLRETURN procedures_win32_a( struct handle *handle, SQLCHAR *catalog, SQLSMALLINT len1, SQLCHAR *schema, + SQLSMALLINT len2, SQLCHAR *proc, SQLSMALLINT len3 ) +{ + WCHAR *catalogW = NULL, *schemaW = NULL, *procW = NULL; + SQLRETURN ret = SQL_ERROR; + + if (handle->win32_funcs->SQLProcedures) + return handle->win32_funcs->SQLProcedures( handle->win32_handle, catalog, len1, schema, len2, proc, len3 ); + + if (handle->win32_funcs->SQLProceduresW) + { + if (!(catalogW = strnAtoW( catalog, len1 ))) goto done; + if (!(schemaW = strnAtoW( schema, len2 ))) goto done; + if (!(procW = strnAtoW( proc, len3 ))) goto done; + ret = handle->win32_funcs->SQLProceduresW( handle->win32_handle, catalogW, len1, schemaW, len2, procW, len3 ); + } + +done: + free( catalogW ); + free( schemaW ); + free( procW ); + return ret; +} + /************************************************************************* * SQLProcedures [ODBC32.067] */ @@ -3958,14 +3989,11 @@ SQLRETURN WINAPI SQLProcedures(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, S
if (handle->unix_handle) { - struct SQLProcedures_params params = { handle->unix_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3 }; - ret = ODBC_CALL( SQLProcedures, ¶ms ); + ret = procedures_unix_a( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, NameLength3 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLProcedures( handle->win32_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3 ); + ret = procedures_win32_a( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, NameLength3 ); }
TRACE("Returning %d\n", ret); @@ -5942,6 +5970,22 @@ SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT StatementHandle, SQLWCHAR *Catalo return ret; }
+static SQLRETURN procedures_unix_w( struct handle *handle, SQLWCHAR *catalog, SQLSMALLINT len1, SQLWCHAR *schema, + SQLSMALLINT len2, SQLWCHAR *proc, SQLSMALLINT len3 ) +{ + struct SQLProceduresW_params params = { handle->unix_handle, catalog, len1, schema, len2, proc, len3 }; + return ODBC_CALL( SQLProceduresW, ¶ms ); +} + +static SQLRETURN procedures_win32_w( struct handle *handle, SQLWCHAR *catalog, SQLSMALLINT len1, SQLWCHAR *schema, + SQLSMALLINT len2, SQLWCHAR *proc, SQLSMALLINT len3 ) +{ + if (handle->win32_funcs->SQLProceduresW) + return handle->win32_funcs->SQLProceduresW( handle->win32_handle, catalog, len1, schema, len2, proc, len3 ); + if (handle->win32_funcs->SQLProcedures) FIXME( "Unicode to ANSI conversion not handled\n" ); + return SQL_ERROR; +} + /************************************************************************* * SQLProceduresW [ODBC32.167] */ @@ -5961,14 +6005,11 @@ SQLRETURN WINAPI SQLProceduresW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName,
if (handle->unix_handle) { - struct SQLProceduresW_params params = { handle->unix_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3 }; - ret = ODBC_CALL( SQLProceduresW, ¶ms ); + ret = procedures_unix_w( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, NameLength3 ); } else if (handle->win32_handle) { - ret = handle->win32_funcs->SQLProceduresW( handle->win32_handle, CatalogName, NameLength1, SchemaName, - NameLength2, ProcName, NameLength3 ); + ret = procedures_win32_w( handle, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, NameLength3 ); }
TRACE("Returning %d\n", ret);