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);