From: Hans Leidekker hans@codeweavers.com
--- dlls/odbc32/proxyodbc.c | 1464 +++++++++++++++++++++++++++------------ dlls/odbc32/unixlib.c | 472 +++++++------ dlls/odbc32/unixlib.h | 1229 ++++++++++++++++++++++++++++---- 3 files changed, 2379 insertions(+), 786 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 00a7e1d7806..a3195afac5a 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -336,18 +336,30 @@ static void ODBC_ReplicateToRegistry (void) } }
+#define SUCCESS(ret) (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) + /************************************************************************* * SQLAllocConnect [ODBC32.001] */ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle) { - struct SQLAllocConnect_params params = { EnvironmentHandle, ConnectionHandle }; + struct SQLAllocConnect_params params; + struct handle *con, *env = EnvironmentHandle; SQLRETURN ret;
TRACE("(EnvironmentHandle %p, ConnectionHandle %p)\n", EnvironmentHandle, ConnectionHandle);
- *ConnectionHandle = SQL_NULL_HDBC; - ret = ODBC_CALL( SQLAllocConnect, ¶ms ); + *ConnectionHandle = 0; + if (!(con = calloc( 1, sizeof(*con) ))) 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; } @@ -357,13 +369,22 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH */ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) { - struct SQLAllocEnv_params params = { EnvironmentHandle }; + struct SQLAllocEnv_params params; + struct handle *env; SQLRETURN ret;
TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
- *EnvironmentHandle = SQL_NULL_HENV; - ret = ODBC_CALL( SQLAllocEnv, ¶ms ); + *EnvironmentHandle = 0; + if (!(env = calloc( 1, sizeof(*env) ))) 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; } @@ -373,14 +394,25 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) */ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) { - struct SQLAllocHandle_params params = { HandleType, InputHandle, 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; - ret = ODBC_CALL( SQLAllocHandle, ¶ms ); - TRACE("Returning %d, Handle %p\n", ret, *OutputHandle); + if (!(output = calloc( 1, sizeof(*output) ))) 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; }
@@ -389,13 +421,23 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S */ SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle) { - struct SQLAllocStmt_params params = { ConnectionHandle, StatementHandle }; + struct SQLAllocStmt_params params; + struct handle *stmt, *con = ConnectionHandle; SQLRETURN ret;
TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
- *StatementHandle = SQL_NULL_HSTMT; - ret = ODBC_CALL( SQLAllocStmt, ¶ms ); + *StatementHandle = 0; + if (!(stmt = calloc( 1, sizeof(*stmt) ))) 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; } @@ -405,13 +447,24 @@ SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandl */ SQLRETURN WINAPI SQLAllocHandleStd(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) { - struct SQLAllocHandleStd_params params = { HandleType, InputHandle, 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; - ret = ODBC_CALL( SQLAllocHandleStd, ¶ms ); + if (!(output = calloc( 1, sizeof(*output) ))) 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; } @@ -425,20 +478,42 @@ static const char *debugstr_sqllen( SQLLEN len ) #endif }
+static BOOL resize_binding( struct param_binding *binding, UINT32 count ) +{ + struct param *tmp; + UINT32 new_count = max( binding->count, count ); + + if (!(tmp = realloc( binding->param, new_count * sizeof(*tmp) ))) return FALSE; + memset( tmp + binding->count, 0, (new_count - binding->count) * sizeof(*tmp) ); + binding->param = tmp; + binding->count = new_count; + 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 = { StatementHandle, ColumnNumber, TargetType, TargetValue, - BufferLength, 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);
- ret = ODBC_CALL( SQLBindCol, ¶ms ); + if (!handle) return SQL_INVALID_HANDLE; + if (!ColumnNumber) + { + FIXME( "column 0 not handled\n" ); + return SQL_ERROR; + } + if (!resize_binding( &handle->bind_col, ColumnNumber )) return SQL_ERROR; + params.StatementHandle = handle->unix_handle; + 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; } @@ -459,15 +534,27 @@ SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNu SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind) { - struct SQLBindParam_params params = { StatementHandle, ParameterNumber, ValueType, ParameterType, - LengthPrecision, ParameterScale, ParameterValue, 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);
- ret = ODBC_CALL( SQLBindParam, ¶ms ); + if (!handle) return SQL_INVALID_HANDLE; + if (!ParameterNumber) + { + FIXME( "parameter 0 not handled\n" ); + return SQL_ERROR; + } + if (!resize_binding( &handle->bind_param, ParameterNumber )) return SQL_ERROR; + + params.StatementHandle = handle->unix_handle; + params.StrLen_or_Ind = &handle->bind_param.param[i].len; + if (SUCCESS(( ret = ODBC_CALL( SQLBindParam, ¶ms )))) handle->bind_param.param[i].ptr = StrLen_or_Ind; TRACE ("Returning %d\n", ret); return ret; } @@ -477,11 +564,15 @@ SQLRETURN WINAPI SQLBindParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNu */ SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle) { - struct SQLCancel_params params = { 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; @@ -492,11 +583,15 @@ SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle) */ SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle) { - struct SQLCloseCursor_params params = { 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; @@ -505,20 +600,25 @@ SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle) /************************************************************************* * 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 = { StatementHandle, ColumnNumber, FieldIdentifier, - CharacterAttribute, BufferLength, StringLength, 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);
- ret = ODBC_CALL( SQLColAttribute, ¶ms ); + if (!handle) return SQL_INVALID_HANDLE; + + params.StatementHandle = handle->unix_handle; + params.NumericAttribute = &num_attr; + if (SUCCESS(( ret = ODBC_CALL( SQLColAttribute, ¶ms )))) *NumericAttribute = num_attr; TRACE("Returning %d\n", ret); return ret; } @@ -530,8 +630,9 @@ SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLS SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLCHAR *ColumnName, SQLSMALLINT NameLength4) { - struct SQLColumns_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, - TableName, NameLength3, ColumnName, 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," @@ -541,6 +642,9 @@ SQLRETURN WINAPI SQLColumns(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLS 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; @@ -553,8 +657,8 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication, SQLSMALLINT NameLength3) { - struct SQLConnect_params params = { ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, - Authentication, 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," @@ -563,6 +667,9 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM 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; @@ -573,11 +680,16 @@ SQLRETURN WINAPI SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSM */ SQLRETURN WINAPI SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle) { - struct SQLCopyDesc_params params = { SourceDescHandle, 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; @@ -590,16 +702,19 @@ SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, SQLUSMALLINT Directio SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, SQLCHAR *Description, SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) { - struct SQLDataSources_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1, - NameLength1, Description, BufferLength2, 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);
- ret = ODBC_CALL( SQLDataSources, ¶ms ); - if (ret >= 0 && TRACE_ON(odbc)) + 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)); @@ -627,8 +742,10 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) { - struct SQLDescribeCol_params params = { StatementHandle, ColumnNumber, ColumnName, BufferLength, - NameLength, DataType, ColumnSize, DecimalDigits, Nullable }; + struct SQLDescribeCol_params params = { 0, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, + NULL, DecimalDigits, Nullable }; + struct handle *handle = StatementHandle; + UINT64 size; SQLSMALLINT dummy; SQLRETURN ret;
@@ -636,14 +753,20 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum " ColumnSize %p, DecimalDigits %p, Nullable %p)\n", StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
- if (!params.NameLength) params.NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ + if (!handle) return SQL_INVALID_HANDLE;
- ret = ODBC_CALL( SQLDescribeCol, ¶ms ); - if (ret >= 0) + 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) TRACE(" ColumnSize %s\n", debugstr_sqlulen(*ColumnSize)); + 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); } @@ -657,11 +780,15 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNum */ SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle) { - struct SQLDisconnect_params params = { 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; @@ -672,11 +799,15 @@ SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle) */ SQLRETURN WINAPI SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType) { - struct SQLEndTran_params params = { HandleType, Handle, 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; @@ -686,22 +817,23 @@ 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 = { EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate, - NativeError, MessageText, BufferLength, 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," + 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); - - ret = ODBC_CALL( SQLError, ¶ms ); + StatementHandle, SqlState, NativeError, MessageText, BufferLength, TextLength);
- if (ret == SQL_SUCCESS) + 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(" SqlState %s\n", debugstr_an((const char *)SqlState, 5)); TRACE(" Error %d\n", *NativeError); TRACE(" MessageText %s\n", debugstr_an((const char *)MessageText, *TextLength)); } @@ -715,12 +847,16 @@ SQLRETURN WINAPI SQLError(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, S */ SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) { - struct SQLExecDirect_params params = { StatementHandle, StatementText, 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; @@ -731,27 +867,57 @@ SQLRETURN WINAPI SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, */ SQLRETURN WINAPI SQLExecute(SQLHSTMT StatementHandle) { - struct SQLExecute_params params = { 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; ret = ODBC_CALL( SQLExecute, ¶ms ); TRACE("Returning %d\n", ret); return ret; }
+static void update_result_lengths( struct handle *handle ) +{ + UINT i; + for (i = 0; i < handle->bind_col.count; i++) + { + if (handle->bind_col.param[i].ptr) + *(SQLLEN *)handle->bind_col.param[i].ptr = handle->bind_col.param[i].len; + } + for (i = 0; i < handle->bind_param.count; i++) + { + if (handle->bind_param.param[i].ptr) + *(SQLLEN *)handle->bind_param.param[i].ptr = handle->bind_param.param[i].len; + } + for (i = 0; i < handle->bind_parameter.count; i++) + { + if (handle->bind_parameter.param[i].ptr) + { + *(SQLLEN *)handle->bind_parameter.param[i].ptr = handle->bind_parameter.param[i].len; + } + } +} + /************************************************************************* * SQLFetch [ODBC32.013] */ SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle) { - struct SQLFetch_params params = { StatementHandle }; + struct SQLFetch_params params; + struct handle *handle = StatementHandle; SQLRETURN ret;
TRACE("(StatementHandle %p)\n", StatementHandle);
- ret = ODBC_CALL( SQLFetch, ¶ms ); + if (!handle) return SQL_INVALID_HANDLE; + + params.StatementHandle = handle->unix_handle; + if (SUCCESS(( ret = ODBC_CALL( SQLFetch, ¶ms )))) update_result_lengths( handle ); TRACE("Returning %d\n", ret); return ret; } @@ -761,13 +927,17 @@ SQLRETURN WINAPI SQLFetch(SQLHSTMT StatementHandle) */ SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset) { - struct SQLFetchScroll_params params = { StatementHandle, FetchOrientation, 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));
- ret = ODBC_CALL( SQLFetchScroll, ¶ms ); + if (!handle) return SQL_INVALID_HANDLE; + + params.StatementHandle = handle->unix_handle; + if (SUCCESS(( ret = ODBC_CALL( SQLFetchScroll, ¶ms )))) update_result_lengths( handle ); TRACE("Returning %d\n", ret); return ret; } @@ -777,12 +947,17 @@ SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrien */ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) { - struct SQLFreeConnect_params params = { 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; } @@ -792,27 +967,46 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) */ SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) { - struct SQLFreeEnv_params params = { 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 ) +{ + free( handle->bind_col.param ); + free( handle->bind_param.param ); + free( handle->bind_parameter.param ); +} + /************************************************************************* * SQLFreeHandle [ODBC32.031] */ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) { - struct SQLFreeHandle_params params = { HandleType, 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; } @@ -822,12 +1016,19 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) */ SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) { - struct SQLFreeStmt_params params = { StatementHandle, 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; } @@ -838,12 +1039,16 @@ SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { - struct SQLGetConnectAttr_params params = { ConnectionHandle, Attribute, Value, BufferLength, 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; @@ -854,11 +1059,15 @@ SQLRETURN WINAPI SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut */ SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value) { - struct SQLGetConnectOption_params params = { ConnectionHandle, Option, 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; @@ -870,12 +1079,16 @@ SQLRETURN WINAPI SQLGetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Opti SQLRETURN WINAPI SQLGetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength) { - struct SQLGetCursorName_params params = { StatementHandle, CursorName, BufferLength, 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; @@ -887,14 +1100,19 @@ 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 = { StatementHandle, ColumnNumber, TargetType, TargetValue, - BufferLength, 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);
- ret = ODBC_CALL( SQLGetData, ¶ms ); + 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; } @@ -905,13 +1123,16 @@ 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 = { DescriptorHandle, RecNumber, FieldIdentifier, Value, - BufferLength, 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; @@ -925,15 +1146,21 @@ SQLRETURN WINAPI SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision, SQLSMALLINT *Scale, SQLSMALLINT *Nullable) { - struct SQLGetDescRec_params params = { DescriptorHandle, RecNumber, Name, BufferLength, StringLength, - Type, SubType, Length, Precision, Scale, 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);
- ret = ODBC_CALL( SQLGetDescRec, ¶ms ); + 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; } @@ -945,13 +1172,17 @@ SQLRETURN WINAPI SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSM SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) { - struct SQLGetDiagField_params params = { HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, - BufferLength, 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; @@ -961,17 +1192,21 @@ 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, Handle, RecNumber, Sqlstate, NativeError, - MessageText, BufferLength, 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, + 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; @@ -983,12 +1218,16 @@ 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 = { EnvironmentHandle, Attribute, Value, BufferLength, 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; @@ -999,11 +1238,15 @@ SQLRETURN WINAPI SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, */ SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported) { - struct SQLGetFunctions_params params = { ConnectionHandle, FunctionId, 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; @@ -1015,12 +1258,16 @@ SQLRETURN WINAPI SQLGetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT Function SQLRETURN WINAPI SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) { - struct SQLGetInfo_params params = { ConnectionHandle, InfoType, InfoValue, BufferLength, 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; @@ -1032,7 +1279,8 @@ 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 = { StatementHandle, Attribute, Value, BufferLength, 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, @@ -1044,6 +1292,9 @@ 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; @@ -1054,11 +1305,15 @@ SQLRETURN WINAPI SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, */ SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLPOINTER Value) { - struct SQLGetStmtOption_params params = { StatementHandle, Option, 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; @@ -1069,11 +1324,15 @@ SQLRETURN WINAPI SQLGetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, */ SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) { - struct SQLGetTypeInfo_params params = { StatementHandle, 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; @@ -1084,11 +1343,15 @@ SQLRETURN WINAPI SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) */ SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount) { - struct SQLNumResultCols_params params = { StatementHandle, 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; @@ -1099,11 +1362,15 @@ SQLRETURN WINAPI SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnC */ SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) { - struct SQLParamData_params params = { StatementHandle, 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; @@ -1114,12 +1381,16 @@ SQLRETURN WINAPI SQLParamData(SQLHSTMT StatementHandle, SQLPOINTER *Value) */ SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength) { - struct SQLPrepare_params params = { StatementHandle, StatementText, 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; @@ -1130,11 +1401,15 @@ SQLRETURN WINAPI SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQ */ SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN StrLen_or_Ind) { - struct SQLPutData_params params = { StatementHandle, Data, 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; @@ -1145,13 +1420,22 @@ SQLRETURN WINAPI SQLPutData(SQLHSTMT StatementHandle, SQLPOINTER Data, SQLLEN St */ SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount) { - struct SQLRowCount_params params = { StatementHandle, RowCount }; + struct SQLRowCount_params params; + struct handle *handle = StatementHandle; + INT64 count; SQLRETURN ret;
TRACE("(StatementHandle %p, RowCount %p)\n", StatementHandle, RowCount);
- ret = ODBC_CALL( SQLRowCount, ¶ms ); - if (ret == SQL_SUCCESS && RowCount) TRACE(" RowCount %s\n", debugstr_sqllen(*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; } @@ -1162,12 +1446,16 @@ SQLRETURN WINAPI SQLRowCount(SQLHSTMT StatementHandle, SQLLEN *RowCount) SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { - struct SQLSetConnectAttr_params params = { ConnectionHandle, Attribute, Value, 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; @@ -1178,11 +1466,15 @@ SQLRETURN WINAPI SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribut */ SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLULEN Value) { - struct SQLSetConnectOption_params params = { ConnectionHandle, Option, 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; @@ -1193,12 +1485,16 @@ SQLRETURN WINAPI SQLSetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Opti */ SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength) { - struct SQLSetCursorName_params params = { StatementHandle, CursorName, 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; @@ -1210,12 +1506,16 @@ SQLRETURN WINAPI SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLRETURN WINAPI SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLPOINTER Value, SQLINTEGER BufferLength) { - struct SQLSetDescField_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value, 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; @@ -1228,14 +1528,25 @@ 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 = { DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data, StringLength, 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);
- ret = ODBC_CALL( SQLSetDescRec, ¶ms ); + 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; } @@ -1246,12 +1557,16 @@ SQLRETURN WINAPI SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLRETURN WINAPI SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { - struct SQLSetEnvAttr_params params = { EnvironmentHandle, Attribute, Value, 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);
+ if (!handle) return SQL_INVALID_HANDLE; + + params.EnvironmentHandle = handle->unix_handle; ret = ODBC_CALL( SQLSetEnvAttr, ¶ms ); TRACE("Returning %d\n", ret); return ret; @@ -1264,15 +1579,21 @@ SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNum SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, SQLLEN *StrLen_or_Ind) { - struct SQLSetParam_params params = { StatementHandle, ParameterNumber, ValueType, ParameterType, - LengthPrecision, ParameterScale, ParameterValue, 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);
- ret = ODBC_CALL( SQLSetParam, ¶ms ); + 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; } @@ -1283,12 +1604,16 @@ SQLRETURN WINAPI SQLSetParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNum SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { - struct SQLSetStmtAttr_params params = { StatementHandle, Attribute, Value, 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; ret = ODBC_CALL( SQLSetStmtAttr, ¶ms ); TRACE("Returning %d\n", ret); return ret; @@ -1299,11 +1624,15 @@ SQLRETURN WINAPI SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, */ SQLRETURN WINAPI SQLSetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLULEN Value) { - struct SQLSetStmtOption_params params = { StatementHandle, Option, 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; @@ -1317,8 +1646,9 @@ SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT Identi SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope, SQLUSMALLINT Nullable) { - struct SQLSpecialColumns_params params = { StatementHandle, IdentifierType, CatalogName, NameLength1, - SchemaName, NameLength2, TableName, NameLength3, Scope, 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," @@ -1327,6 +1657,9 @@ SQLRETURN WINAPI SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT Identi 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; @@ -1339,8 +1672,9 @@ SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, S SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) { - struct SQLStatistics_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, - NameLength2, TableName, NameLength3, Unique, 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" @@ -1349,6 +1683,9 @@ SQLRETURN WINAPI SQLStatistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, S 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; @@ -1361,8 +1698,9 @@ SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSM SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLCHAR *TableType, SQLSMALLINT NameLength4) { - struct SQLTables_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, - TableName, NameLength3, TableType, 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," @@ -1372,6 +1710,9 @@ SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSM 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; @@ -1382,12 +1723,17 @@ SQLRETURN WINAPI SQLTables(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSM */ SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType) { - struct SQLTransact_params params = { EnvironmentHandle, ConnectionHandle, 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; @@ -1396,18 +1742,21 @@ SQLRETURN WINAPI SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle /************************************************************************* * SQLBrowseConnect [ODBC32.055] */ -SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn, - SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax, - SQLSMALLINT *pcbConnStrOut) +SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC ConnectionHandle, SQLCHAR *InConnectionString, SQLSMALLINT StringLength1, + SQLCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength2) { - struct SQLBrowseConnect_params params = { hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, - cbConnStrOutMax, pcbConnStrOut }; + struct SQLBrowseConnect_params params = { 0, InConnectionString, StringLength1, OutConnectionString, BufferLength, + StringLength2 }; + struct handle *handle = ConnectionHandle; SQLRETURN ret;
- TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n", - hdbc, debugstr_an((const char *)szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, - pcbConnStrOut); + 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; @@ -1418,12 +1767,16 @@ SQLRETURN WINAPI SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR *szConnStrIn, SQLSMALLIN */ SQLRETURN WINAPI SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation) { - struct SQLBulkOperations_params params = { StatementHandle, Operation }; + struct SQLBulkOperations_params params = { 0, Operation }; + struct handle *handle = StatementHandle; SQLRETURN ret;
TRACE("(StatementHandle %p, Operation %d)\n", StatementHandle, Operation);
- ret = ODBC_CALL( SQLBulkOperations, ¶ms ); + if (!handle) return SQL_INVALID_HANDLE; + + params.StatementHandle = handle->unix_handle; + if (SUCCESS(( ret = ODBC_CALL( SQLBulkOperations, ¶ms )))) update_result_lengths( handle ); TRACE("Returning %d\n", ret); return ret; } @@ -1431,17 +1784,25 @@ SQLRETURN WINAPI SQLBulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operati /************************************************************************* * SQLColAttributes [ODBC32.006] */ -SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, - SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, - SQLLEN *pfDesc) +SQLRETURN WINAPI SQLColAttributes(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttributes, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, + SQLLEN *NumericAttributes) { - struct SQLColAttributes_params params = { hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc }; + struct SQLColAttributes_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttributes, BufferLength, + StringLength }; + struct handle *handle = StatementHandle; + INT64 attrs; SQLRETURN ret;
- TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, - fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); + 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;
- ret = ODBC_CALL( SQLColAttributes, ¶ms ); + params.StatementHandle = handle->unix_handle; + params.NumericAttributes = &attrs; + if (SUCCESS((ret = ODBC_CALL( SQLColAttributes, ¶ms )))) *NumericAttributes = attrs; TRACE("Returning %d\n", ret); return ret; } @@ -1449,21 +1810,25 @@ SQLRETURN WINAPI SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLIN /************************************************************************* * SQLColumnPrivileges [ODBC32.056] */ -SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName, - SQLSMALLINT cbTableName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName) +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 = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szTableName, cbTableName, szColumnName, cbColumnName }; + struct SQLColumnPrivileges_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, + TableName, NameLength3, ColumnName, NameLength4 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -1472,16 +1837,22 @@ SQLRETURN WINAPI SQLColumnPrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQL /************************************************************************* * SQLDescribeParam [ODBC32.058] */ -SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType, - SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable) +SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT *DataType, + SQLULEN *ParameterSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) { - struct SQLDescribeParam_params params = { hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable }; + struct SQLDescribeParam_params params = { 0, ParameterNumber, DataType, NULL, DecimalDigits, Nullable }; + struct handle *handle = StatementHandle; + UINT64 size; SQLRETURN ret;
- TRACE("(hstmt %p, ipar %d, pfSqlType %p, pcbParamDef %p, pibScale %p, pfNullable %p)\n", hstmt, ipar, - pfSqlType, pcbParamDef, pibScale, pfNullable); + TRACE("(StatementHandle %p, ParameterNumber %d, DataType %p, ParameterSize %p, DecimalDigits %p, Nullable %p)\n", + StatementHandle, ParameterNumber, DataType, ParameterSize, DecimalDigits, Nullable);
- ret = ODBC_CALL( SQLDescribeParam, ¶ms ); + 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; } @@ -1489,16 +1860,22 @@ SQLRETURN WINAPI SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT /************************************************************************* * SQLExtendedFetch [ODBC32.059] */ -SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow, SQLULEN *pcrow, - SQLUSMALLINT *rgfRowStatus) +SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT StatementHandle, SQLUSMALLINT FetchOrientation, SQLLEN FetchOffset, + SQLULEN *RowCount, SQLUSMALLINT *RowStatusArray) { - struct SQLExtendedFetch_params params = { hstmt, fFetchType, irow, pcrow, rgfRowStatus }; + struct SQLExtendedFetch_params params = { 0, FetchOrientation, FetchOffset, NULL, RowStatusArray }; + struct handle *handle = StatementHandle; + UINT64 count; SQLRETURN ret;
- TRACE("(hstmt %p, fFetchType %d, irow %s, pcrow %p, rgfRowStatus %p)\n", hstmt, fFetchType, debugstr_sqllen(irow), - pcrow, rgfRowStatus); + 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;
- ret = ODBC_CALL( SQLExtendedFetch, ¶ms ); + params.StatementHandle = handle->unix_handle; + params.RowCount = &count; + if (SUCCESS((ret = ODBC_CALL( SQLExtendedFetch, ¶ms )))) *RowCount = count; TRACE("Returning %d\n", ret); return ret; } @@ -1506,28 +1883,31 @@ SQLRETURN WINAPI SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLE /************************************************************************* * SQLForeignKeys [ODBC32.060] */ -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) +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 = { hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, - cbPkSchemaName, szPkTableName, cbPkTableName, szFkCatalogName, - cbFkCatalogName, szFkSchemaName, cbFkSchemaName, - szFkTableName, cbFkTableName }; + struct SQLForeignKeys_params params = { 0, PkCatalogName, NameLength1, PkSchemaName, NameLength2, + PkTableName, NameLength3, FkCatalogName, NameLength4, + FkSchemaName, NameLength5, FkTableName, NameLength6 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -1538,11 +1918,15 @@ SQLRETURN WINAPI SQLForeignKeys(SQLHSTMT hstmt, SQLCHAR *szPkCatalogName, SQLSMA */ SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle) { - struct SQLMoreResults_params params = { 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; @@ -1551,15 +1935,21 @@ SQLRETURN WINAPI SQLMoreResults(SQLHSTMT StatementHandle) /************************************************************************* * SQLNativeSql [ODBC32.062] */ -SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR *szSqlStr, - SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr) +SQLRETURN WINAPI SQLNativeSql(SQLHDBC ConnectionHandle, SQLCHAR *InStatementText, SQLINTEGER TextLength1, + SQLCHAR *OutStatementText, SQLINTEGER BufferLength, SQLINTEGER *TextLength2) { - struct SQLNativeSql_params params = { hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr }; + struct SQLNativeSql_params params = { 0, InStatementText, TextLength1, OutStatementText, BufferLength, + TextLength2 }; + struct handle *handle = ConnectionHandle; SQLRETURN ret;
- 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); + 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; @@ -1568,13 +1958,17 @@ SQLRETURN WINAPI SQLNativeSql(SQLHDBC hdbc, SQLCHAR *szSqlStrIn, SQLINTEGER cbSq /************************************************************************* * SQLNumParams [ODBC32.063] */ -SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar) +SQLRETURN WINAPI SQLNumParams(SQLHSTMT StatementHandle, SQLSMALLINT *ParameterCount) { - struct SQLNumParams_params params = { hstmt, pcpar }; + struct SQLNumParams_params params = { 0, ParameterCount }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(hstmt %p, pcpar %p)\n", hstmt, pcpar); + 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; @@ -1583,14 +1977,21 @@ SQLRETURN WINAPI SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar) /************************************************************************* * SQLParamOptions [ODBC32.064] */ -SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow) +SQLRETURN WINAPI SQLParamOptions(SQLHSTMT StatementHandle, SQLULEN RowCount, SQLULEN *RowNumber) { - struct SQLParamOptions_params params = { hstmt, crow, pirow }; + struct SQLParamOptions_params params = { 0, RowCount }; + struct handle *handle = StatementHandle; + UINT64 row; SQLRETURN ret;
- TRACE("(hstmt %p, crow %s, pirow %p)\n", hstmt, debugstr_sqlulen(crow), pirow); + TRACE("(StatementHandle %p, RowCount %s, RowNumber %p)\n", StatementHandle, debugstr_sqlulen(RowCount), + RowNumber);
- ret = ODBC_CALL( SQLParamOptions, ¶ms ); + 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; } @@ -1598,20 +1999,24 @@ SQLRETURN WINAPI SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow) /************************************************************************* * SQLPrimaryKeys [ODBC32.065] */ -SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName, - SQLSMALLINT cbTableName) +SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, + SQLSMALLINT NameLength3) { - struct SQLPrimaryKeys_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szTableName, cbTableName }; + struct SQLPrimaryKeys_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, + NameLength3 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -1620,22 +2025,25 @@ SQLRETURN WINAPI SQLPrimaryKeys(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALL /************************************************************************* * SQLProcedureColumns [ODBC32.066] */ -SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName, - SQLSMALLINT cbProcName, SQLCHAR *szColumnName, SQLSMALLINT cbColumnName) +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 = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szProcName, cbProcName, - szColumnName, cbColumnName }; + struct SQLProcedureColumns_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, + ProcName, NameLength3, ColumnName, NameLength4 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -1644,20 +2052,24 @@ SQLRETURN WINAPI SQLProcedureColumns(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQL /************************************************************************* * SQLProcedures [ODBC32.067] */ -SQLRETURN WINAPI SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szProcName, - SQLSMALLINT cbProcName) +SQLRETURN WINAPI SQLProcedures(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *ProcName, + SQLSMALLINT NameLength3) { - struct SQLProcedures_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szProcName, cbProcName }; + struct SQLProcedures_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, + NameLength3 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -1666,14 +2078,21 @@ SQLRETURN WINAPI SQLProcedures(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLI /************************************************************************* * SQLSetPos [ODBC32.068] */ -SQLRETURN WINAPI SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock) +SQLRETURN WINAPI SQLSetPos(SQLHSTMT StatementHandle, SQLSETPOSIROW RowNumber, SQLUSMALLINT Operation, + SQLUSMALLINT LockType) { - struct SQLSetPos_params params = { hstmt, irow, fOption, fLock }; + struct SQLSetPos_params params = { 0, RowNumber, Operation, LockType }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(hstmt %p, irow %s, fOption %d, fLock %d)\n", hstmt, debugstr_sqlulen(irow), fOption, fLock); + TRACE("(StatementHandle %p, RowNumber %s, Operation %d, LockType %d)\n", StatementHandle, + debugstr_sqlulen(RowNumber), Operation, LockType); + + if (!handle) return SQL_INVALID_HANDLE;
- ret = ODBC_CALL( SQLSetPos, ¶ms ); + params.StatementHandle = handle->unix_handle; + if (SUCCESS(( ret = ODBC_CALL( SQLSetPos, ¶ms ))) && Operation == SQL_REFRESH) + update_result_lengths( handle ); TRACE("Returning %d\n", ret); return ret; } @@ -1681,20 +2100,24 @@ SQLRETURN WINAPI SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOpt /************************************************************************* * SQLTablePrivileges [ODBC32.070] */ -SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR *szTableName, - SQLSMALLINT cbTableName) +SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, + SQLSMALLINT NameLength3) { - struct SQLTablePrivileges_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szTableName, cbTableName }; + struct SQLTablePrivileges_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, + TableName, NameLength3 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -1703,22 +2126,26 @@ SQLRETURN WINAPI SQLTablePrivileges(SQLHSTMT hstmt, SQLCHAR *szCatalogName, SQLS /************************************************************************* * SQLDrivers [ODBC32.071] */ -SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLCHAR *szDriverDesc, - SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc, - SQLCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax, - SQLSMALLINT *pcbDriverAttr) +SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLCHAR *DriverDescription, + SQLSMALLINT BufferLength1, SQLSMALLINT *DescriptionLength, + SQLCHAR *DriverAttributes, SQLSMALLINT BufferLength2, + SQLSMALLINT *AttributesLength) { - struct SQLDrivers_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, - pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr }; + struct SQLDrivers_params params = { 0, Direction, DriverDescription, BufferLength1, DescriptionLength, + DriverAttributes, BufferLength2, AttributesLength }; + struct handle *handle = EnvironmentHandle; SQLRETURN ret;
- TRACE("(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); + 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 && fDirection == SQL_FETCH_FIRST) + 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); @@ -1728,20 +2155,33 @@ SQLRETURN WINAPI SQLDrivers(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, /************************************************************************* * SQLBindParameter [ODBC32.072] */ -SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType, - SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef, - SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax, - SQLLEN *pcbValue) +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 = { hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, - ibScale, rgbValue, cbValueMax, 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("(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); + 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 (!resize_binding( &handle->bind_parameter, ParameterNumber )) return SQL_ERROR;
- ret = ODBC_CALL( SQLBindParameter, ¶ms ); + params.StatementHandle = handle->unix_handle; + params.StrLen_or_Ind = &handle->bind_parameter.param[i].len; + if (SUCCESS((ret = ODBC_CALL( SQLBindParameter, ¶ms )))) handle->bind_parameter.param[i].ptr = StrLen_or_Ind; TRACE("Returning %d\n", ret); return ret; } @@ -1749,19 +2189,23 @@ SQLRETURN WINAPI SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT /************************************************************************* * SQLDriverConnect [ODBC32.041] */ -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) +SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle, SQLCHAR *ConnectionString, + SQLSMALLINT Length, SQLCHAR *OutConnectionString, SQLSMALLINT BufferLength, + SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) { - struct SQLDriverConnect_params params = { hdbc, hwnd, ConnectionString, Length, conn_str_out, - conn_str_out_max, ptr_conn_str_out, driver_completion }; + struct SQLDriverConnect_params params = { 0, WindowHandle, ConnectionString, Length, OutConnectionString, + BufferLength, Length2, DriverCompletion }; + struct handle *handle = ConnectionHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -1770,15 +2214,19 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *Connectio /************************************************************************* * SQLSetScrollOptions [ODBC32.069] */ -SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset, - SQLUSMALLINT crow_rowset) +SQLRETURN WINAPI SQLSetScrollOptions(SQLHSTMT StatementHandle, SQLUSMALLINT Concurrency, SQLLEN KeySetSize, + SQLUSMALLINT RowSetSize) { - struct SQLSetScrollOptions_params params = { statement_handle, f_concurrency, crow_keyset, crow_rowset }; + struct SQLSetScrollOptions_params params = { 0, Concurrency, KeySetSize, RowSetSize }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(statement_handle %p, f_concurrency %d, crow_keyset %s, crow_rowset %d)\n", statement_handle, - f_concurrency, debugstr_sqllen(crow_keyset), crow_rowset); + 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; @@ -1817,23 +2265,31 @@ static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType) /************************************************************************* * SQLColAttributesW [ODBC32.106] */ -SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, - SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT *pcbDesc, - SQLLEN *pfDesc) +SQLRETURN WINAPI SQLColAttributesW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttributes, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, + SQLLEN *NumericAttributes) { - struct SQLColAttributesW_params params = { hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc }; + struct SQLColAttributesW_params params = { 0, ColumnNumber, FieldIdentifier, CharacterAttributes, BufferLength, + StringLength }; + struct handle *handle = StatementHandle; + INT64 attrs; SQLRETURN ret;
- TRACE("(hstmt %p, icol %d, fDescType %d, rgbDesc %p, cbDescMax %d, pcbDesc %p, pfDesc %p)\n", hstmt, icol, - fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); + 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;
- ret = ODBC_CALL( SQLColAttributesW, ¶ms ); + params.StatementHandle = handle->unix_handle; + params.NumericAttributes = &attrs; + if (SUCCESS((ret = ODBC_CALL( SQLColAttributesW, ¶ms )))) *NumericAttributes = attrs;
- if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(fDescType) && rgbDesc && pcbDesc && - *pcbDesc != lstrlenW(rgbDesc) * 2) + if (ret == SQL_SUCCESS && SQLColAttributes_KnownStringAttribute(FieldIdentifier) && CharacterAttributes && + StringLength && *StringLength != wcslen(CharacterAttributes) * 2) { TRACE("CHEAT: resetting name length for ADO\n"); - *pcbDesc = lstrlenW(rgbDesc) * 2; + *StringLength = wcslen(CharacterAttributes) * 2; }
TRACE("Returning %d\n", ret); @@ -1847,14 +2303,18 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, WCHAR *ServerName, SQLSMA WCHAR *UserName, SQLSMALLINT NameLength2, WCHAR *Authentication, SQLSMALLINT NameLength3) { - struct SQLConnectW_params params = { ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, - Authentication, 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; @@ -1867,23 +2327,31 @@ SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNu SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, SQLSMALLINT *DataType, SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) { - struct SQLDescribeColW_params params = { StatementHandle, ColumnNumber, ColumnName, BufferLength, - NameLength, DataType, ColumnSize, DecimalDigits, 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 (!NameLength) NameLength = &dummy; /* workaround for drivers that don't accept NULL NameLength */ + if (!handle) return SQL_INVALID_HANDLE;
- ret = ODBC_CALL( SQLDescribeColW, ¶ms ); - if (ret >= 0) + 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) TRACE("ColumnSize %s\n", debugstr_sqlulen(*ColumnSize)); + 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); } @@ -1896,22 +2364,23 @@ 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 = { EnvironmentHandle, ConnectionHandle, StatementHandle, Sqlstate, - NativeError, MessageText, BufferLength, 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," + 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); - - ret = ODBC_CALL( SQLErrorW, ¶ms ); + StatementHandle, SqlState, NativeError, MessageText, BufferLength, TextLength);
- if (ret == SQL_SUCCESS) + 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(" SqlState %s\n", debugstr_wn(SqlState, 5)); TRACE(" Error %d\n", *NativeError); TRACE(" MessageText %s\n", debugstr_wn(MessageText, *TextLength)); } @@ -1925,12 +2394,16 @@ SQLRETURN WINAPI SQLErrorW(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, */ SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) { - struct SQLExecDirectW_params params = { StatementHandle, StatementText, 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; @@ -1942,12 +2415,16 @@ SQLRETURN WINAPI SQLExecDirectW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength) { - struct SQLGetCursorNameW_params params = { StatementHandle, CursorName, BufferLength, 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; @@ -1958,12 +2435,16 @@ SQLRETURN WINAPI SQLGetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, */ SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQLINTEGER TextLength) { - struct SQLPrepareW_params params = { StatementHandle, StatementText, 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; @@ -1974,12 +2455,16 @@ SQLRETURN WINAPI SQLPrepareW(SQLHSTMT StatementHandle, WCHAR *StatementText, SQL */ SQLRETURN WINAPI SQLSetCursorNameW(SQLHSTMT StatementHandle, WCHAR *CursorName, SQLSMALLINT NameLength) { - struct SQLSetCursorNameW_params params = { StatementHandle, CursorName, 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; @@ -1993,22 +2478,27 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLLEN *NumericAttribute) { - struct SQLColAttributeW_params params = { StatementHandle, ColumnNumber, FieldIdentifier, - CharacterAttribute, BufferLength, StringLength, - 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);
- ret = ODBC_CALL( SQLColAttributeW, ¶ms ); + if (!handle) return SQL_INVALID_HANDLE; + + params.StatementHandle = handle->unix_handle; + params.NumericAttribute = &attr; + if (SUCCESS((ret = ODBC_CALL( SQLColAttributeW, ¶ms )))) *NumericAttribute = attr;
if (ret == SQL_SUCCESS && CharacterAttribute != NULL && SQLColAttributes_KnownStringAttribute(FieldIdentifier) && - StringLength && *StringLength != lstrlenW(CharacterAttribute) * 2) + StringLength && *StringLength != wcslen(CharacterAttribute) * 2) { TRACE("CHEAT: resetting name length for ADO\n"); - *StringLength = lstrlenW(CharacterAttribute) * 2; + *StringLength = wcslen(CharacterAttribute) * 2; }
TRACE("Returning %d\n", ret); @@ -2021,13 +2511,16 @@ SQLRETURN WINAPI SQLColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnN SQLRETURN WINAPI SQLGetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength) { - struct SQLGetConnectAttrW_params params = { ConnectionHandle, Attribute, Value, - BufferLength, 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; @@ -2039,13 +2532,16 @@ 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 = { DescriptorHandle, RecNumber, FieldIdentifier, Value, - BufferLength, 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; @@ -2059,15 +2555,21 @@ SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber SQLSMALLINT *SubType, SQLLEN *Length, SQLSMALLINT *Precision, SQLSMALLINT *Scale, SQLSMALLINT *Nullable) { - struct SQLGetDescRecW_params params = { DescriptorHandle, RecNumber, Name, BufferLength, StringLength, - Type, SubType, Length, Precision, Scale, 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);
- ret = ODBC_CALL( SQLGetDescRecW, ¶ms ); + 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; } @@ -2079,13 +2581,17 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS SQLSMALLINT DiagIdentifier, SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) { - struct SQLGetDiagFieldW_params params = { HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, - BufferLength, 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; @@ -2094,18 +2600,22 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS /************************************************************************* * 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, Handle, RecNumber, Sqlstate, NativeError, - MessageText, BufferLength, 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, + 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; @@ -2117,7 +2627,8 @@ 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 = { StatementHandle, Attribute, Value, BufferLength, 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, @@ -2129,6 +2640,9 @@ 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; @@ -2140,12 +2654,16 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLRETURN WINAPI SQLSetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { - struct SQLSetConnectAttrW_params params = { ConnectionHandle, Attribute, Value, 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); + 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; @@ -2158,8 +2676,9 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM WCHAR *SchemaName, SQLSMALLINT NameLength2, WCHAR *TableName, SQLSMALLINT NameLength3, WCHAR *ColumnName, SQLSMALLINT NameLength4) { - struct SQLColumnsW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, - NameLength2, TableName, NameLength3, ColumnName, 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," @@ -2167,6 +2686,9 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM 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; @@ -2179,8 +2701,9 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) { - struct SQLDriverConnectW_params params = { ConnectionHandle, WindowHandle, InConnectionString, Length, - OutConnectionString, BufferLength, Length2, 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," @@ -2188,6 +2711,9 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl 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; @@ -2198,11 +2724,15 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl */ SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLPOINTER Value) { - struct SQLGetConnectOptionW_params params = { ConnectionHandle, Option, 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; @@ -2214,12 +2744,16 @@ SQLRETURN WINAPI SQLGetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Opt SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength) { - struct SQLGetInfoW_params params = { ConnectionHandle, InfoType, InfoValue, BufferLength, 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; @@ -2230,11 +2764,15 @@ SQLRETURN WINAPI SQLGetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQ */ SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType) { - struct SQLGetTypeInfoW_params params = { StatementHandle, 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; @@ -2245,11 +2783,15 @@ SQLRETURN WINAPI SQLGetTypeInfoW(SQLHSTMT StatementHandle, SQLSMALLINT DataType) */ SQLRETURN WINAPI SQLSetConnectOptionW(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLLEN Value) { - struct SQLSetConnectOptionW_params params = { ConnectionHandle, Option, 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; @@ -2263,8 +2805,9 @@ SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT Ident SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope, SQLUSMALLINT Nullable) { - struct SQLSpecialColumnsW_params params = { StatementHandle, IdentifierType, CatalogName, NameLength1, - SchemaName, NameLength2, TableName, NameLength3, Scope, 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," @@ -2272,6 +2815,9 @@ SQLRETURN WINAPI SQLSpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT Ident 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; @@ -2284,8 +2830,9 @@ SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved) { - struct SQLStatisticsW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, - NameLength2, TableName, NameLength3, Unique, 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" @@ -2293,6 +2840,9 @@ SQLRETURN WINAPI SQLStatisticsW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, 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; @@ -2305,8 +2855,9 @@ SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQL SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, SQLSMALLINT NameLength3, SQLWCHAR *TableType, SQLSMALLINT NameLength4) { - struct SQLTablesW_params params = { StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, - TableName, NameLength3, TableType, 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," @@ -2314,6 +2865,9 @@ SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQL 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; @@ -2322,17 +2876,21 @@ SQLRETURN WINAPI SQLTablesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQL /************************************************************************* * SQLBrowseConnectW [ODBC32.155] */ -SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn, - SQLWCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax, - SQLSMALLINT *pcbConnStrOut) +SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC ConnectionHandle, SQLWCHAR *InConnectionString, SQLSMALLINT StringLength1, + SQLWCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength2) { - struct SQLBrowseConnectW_params params = { hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, - cbConnStrOutMax, pcbConnStrOut }; + struct SQLBrowseConnectW_params params = { 0, InConnectionString, StringLength1, OutConnectionString, + BufferLength, StringLength2 }; + struct handle *handle = ConnectionHandle; SQLRETURN ret;
- TRACE("(hdbc %p, szConnStrIn %s, cbConnStrIn %d, szConnStrOut %p, cbConnStrOutMax %d, pcbConnStrOut %p)\n", - hdbc, debugstr_wn(szConnStrIn, cbConnStrIn), cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut); + 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; @@ -2341,22 +2899,25 @@ SQLRETURN WINAPI SQLBrowseConnectW(SQLHDBC hdbc, SQLWCHAR *szConnStrIn, SQLSMALL /************************************************************************* * SQLColumnPrivilegesW [ODBC32.156] */ -SQLRETURN WINAPI SQLColumnPrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, - SQLSMALLINT cbTableName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName) +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 = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szTableName, cbTableName, szColumnName, - cbColumnName }; + struct SQLColumnPrivilegesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, + TableName, NameLength3, ColumnName, NameLength4 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -2369,14 +2930,18 @@ SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Directi SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, WCHAR *Description, SQLSMALLINT BufferLength2, SQLSMALLINT *NameLength2) { - struct SQLDataSourcesW_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1, - NameLength1, Description, BufferLength2, 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)) @@ -2395,28 +2960,31 @@ SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, SQLUSMALLINT Directi /************************************************************************* * SQLForeignKeysW [ODBC32.160] */ -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) +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 = { hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, - cbPkSchemaName, szPkTableName, cbPkTableName, szFkCatalogName, - cbFkCatalogName, szFkSchemaName, cbFkSchemaName, szFkTableName, - cbFkTableName }; + struct SQLForeignKeysW_params params = { 0, PkCatalogName, NameLength1, PkSchemaName, NameLength2, + PkTableName, NameLength2, FkCatalogName, NameLength3, + FkSchemaName, NameLength5, FkTableName, NameLength6 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -2425,15 +2993,21 @@ SQLRETURN WINAPI SQLForeignKeysW(SQLHSTMT hstmt, SQLWCHAR *szPkCatalogName, SQLS /************************************************************************* * SQLNativeSqlW [ODBC32.162] */ -SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR *szSqlStr, - SQLINTEGER cbSqlStrMax, SQLINTEGER *pcbSqlStr) +SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC ConnectionHandle, SQLWCHAR *InStatementText, SQLINTEGER TextLength1, + SQLWCHAR *OutStatementText, SQLINTEGER BufferLength, SQLINTEGER *TextLength2) { - struct SQLNativeSqlW_params params = { hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr }; + struct SQLNativeSqlW_params params = { 0, InStatementText, TextLength1, OutStatementText, BufferLength, + TextLength2 }; + struct handle *handle = ConnectionHandle; SQLRETURN ret;
- TRACE("(hdbc %p, szSqlStrIn %s, cbSqlStrIn %d, szSqlStr %p, cbSqlStrMax %d, pcbSqlStr %p)\n", hdbc, - debugstr_wn(szSqlStrIn, cbSqlStrIn), cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); + 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; @@ -2442,20 +3016,24 @@ SQLRETURN WINAPI SQLNativeSqlW(SQLHDBC hdbc, SQLWCHAR *szSqlStrIn, SQLINTEGER cb /************************************************************************* * SQLPrimaryKeysW [ODBC32.165] */ -SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, - SQLSMALLINT cbTableName) +SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, + SQLSMALLINT NameLength3) { - struct SQLPrimaryKeysW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szTableName, cbTableName }; + struct SQLPrimaryKeysW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, + NameLength2 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- 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); + 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; @@ -2464,22 +3042,25 @@ SQLRETURN WINAPI SQLPrimaryKeysW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMA /************************************************************************* * SQLProcedureColumnsW [ODBC32.166] */ -SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName, - SQLSMALLINT cbProcName, SQLWCHAR *szColumnName, SQLSMALLINT cbColumnName) +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 = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szProcName, cbProcName, - szColumnName, cbColumnName }; + struct SQLProcedureColumnsW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, + ProcName, NameLength3, ColumnName, NameLength4 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -2488,18 +3069,22 @@ SQLRETURN WINAPI SQLProcedureColumnsW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, S /************************************************************************* * SQLProceduresW [ODBC32.167] */ -SQLRETURN WINAPI SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szProcName, - SQLSMALLINT cbProcName) +SQLRETURN WINAPI SQLProceduresW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *ProcName, + SQLSMALLINT NameLength3) { - struct SQLProceduresW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szProcName, cbProcName }; + struct SQLProceduresW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, ProcName, + NameLength3 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- TRACE("(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); + 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; @@ -2508,18 +3093,22 @@ SQLRETURN WINAPI SQLProceduresW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMAL /************************************************************************* * SQLTablePrivilegesW [ODBC32.170] */ -SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQLSMALLINT cbCatalogName, - SQLWCHAR *szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR *szTableName, - SQLSMALLINT cbTableName) +SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT StatementHandle, SQLWCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLWCHAR *SchemaName, SQLSMALLINT NameLength2, SQLWCHAR *TableName, + SQLSMALLINT NameLength3) { - struct SQLTablePrivilegesW_params params = { hstmt, szCatalogName, cbCatalogName, szSchemaName, - cbSchemaName, szTableName, cbTableName }; + struct SQLTablePrivilegesW_params params = { 0, CatalogName, NameLength1, SchemaName, NameLength2, TableName, + NameLength3 }; + struct handle *handle = StatementHandle; SQLRETURN ret;
- 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); + 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; @@ -2528,22 +3117,25 @@ SQLRETURN WINAPI SQLTablePrivilegesW(SQLHSTMT hstmt, SQLWCHAR *szCatalogName, SQ /************************************************************************* * SQLDriversW [ODBC32.171] */ -SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLWCHAR *szDriverDesc, - SQLSMALLINT cbDriverDescMax, SQLSMALLINT *pcbDriverDesc, - SQLWCHAR *szDriverAttributes, SQLSMALLINT cbDriverAttrMax, - SQLSMALLINT *pcbDriverAttr) +SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT Direction, SQLWCHAR *DriverDescription, + SQLSMALLINT BufferLength1, SQLSMALLINT *DescriptionLength, SQLWCHAR *DriverAttributes, + SQLSMALLINT BufferLength2, SQLSMALLINT *AttributesLength) { - struct SQLDriversW_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, - pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr }; + struct SQLDriversW_params params = { 0, Direction, DriverDescription, BufferLength1, DescriptionLength, + DriverAttributes, BufferLength2, AttributesLength }; + struct handle *handle = EnvironmentHandle; SQLRETURN ret;
- TRACE("(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); + 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 && fDirection == SQL_FETCH_FIRST) + 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); @@ -2556,12 +3148,16 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLPOINTER Value, SQLINTEGER BufferLength) { - struct SQLSetDescFieldW_params params = { DescriptorHandle, RecNumber, FieldIdentifier, Value, 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; @@ -2573,12 +3169,16 @@ SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumb SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { - struct SQLSetStmtAttrW_params params = { StatementHandle, Attribute, Value, 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); + 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; ret = ODBC_CALL( SQLSetStmtAttrW, ¶ms ); if (ret == SQL_ERROR && (Attribute == SQL_ROWSET_SIZE || Attribute == SQL_ATTR_ROW_ARRAY_SIZE)) { diff --git a/dlls/odbc32/unixlib.c b/dlls/odbc32/unixlib.c index c75f86e1a41..3b94180c5bc 100644 --- a/dlls/odbc32/unixlib.c +++ b/dlls/odbc32/unixlib.c @@ -189,7 +189,7 @@ static NTSTATUS wrap_SQLAllocConnect( void *args ) struct SQLAllocConnect_params *params = args;
if (!pSQLAllocConnect) return SQL_ERROR; - return pSQLAllocConnect(params->EnvironmentHandle, params->ConnectionHandle); + return pSQLAllocConnect( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, (SQLHDBC *)¶ms->ConnectionHandle ); }
static NTSTATUS wrap_SQLAllocEnv( void *args ) @@ -197,7 +197,7 @@ static NTSTATUS wrap_SQLAllocEnv( void *args ) struct SQLAllocEnv_params *params = args;
if (!pSQLAllocEnv) return SQL_ERROR; - return pSQLAllocEnv(params->EnvironmentHandle); + return pSQLAllocEnv( (SQLHENV *)¶ms->EnvironmentHandle ); }
static NTSTATUS wrap_SQLAllocHandle( void *args ) @@ -205,7 +205,8 @@ static NTSTATUS wrap_SQLAllocHandle( void *args ) struct SQLAllocHandle_params *params = args;
if (!pSQLAllocHandle) return SQL_ERROR; - return pSQLAllocHandle(params->HandleType, params->InputHandle, params->OutputHandle); + return pSQLAllocHandle( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->InputHandle, + (SQLHANDLE *)¶ms->OutputHandle ); }
static NTSTATUS wrap_SQLAllocHandleStd( void *args ) @@ -213,7 +214,8 @@ static NTSTATUS wrap_SQLAllocHandleStd( void *args ) struct SQLAllocHandleStd_params *params = args;
if (!pSQLAllocHandleStd) return SQL_ERROR; - return pSQLAllocHandleStd(params->HandleType, params->InputHandle, params->OutputHandle); + return pSQLAllocHandleStd( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->InputHandle, + (SQLHANDLE *)¶ms->OutputHandle ); }
static NTSTATUS wrap_SQLAllocStmt( void *args ) @@ -221,7 +223,7 @@ static NTSTATUS wrap_SQLAllocStmt( void *args ) struct SQLAllocStmt_params *params = args;
if (!pSQLAllocStmt) return SQL_ERROR; - return pSQLAllocStmt(params->ConnectionHandle, params->StatementHandle); + return pSQLAllocStmt( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, (SQLHSTMT *)¶ms->StatementHandle ); }
static NTSTATUS wrap_SQLBindCol( void *args ) @@ -229,8 +231,8 @@ static NTSTATUS wrap_SQLBindCol( void *args ) struct SQLBindCol_params *params = args;
if (!pSQLBindCol) return SQL_ERROR; - return pSQLBindCol(params->StatementHandle, params->ColumnNumber, params->TargetType, - params->TargetValue, params->BufferLength, params->StrLen_or_Ind); + return pSQLBindCol( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, params->TargetType, + params->TargetValue, params->BufferLength, (SQLLEN *)(ULONG_PTR)params->StrLen_or_Ind ); }
static NTSTATUS wrap_SQLBindParam( void *args ) @@ -238,9 +240,9 @@ static NTSTATUS wrap_SQLBindParam( void *args ) struct SQLBindParam_params *params = args;
if (!pSQLBindParam) return SQL_ERROR; - return pSQLBindParam(params->StatementHandle, params->ParameterNumber, params->ValueType, - params->ParameterType, params->LengthPrecision, params->ParameterScale, - params->ParameterValue, params->StrLen_or_Ind); + return pSQLBindParam( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ParameterNumber, params->ValueType, + params->ParameterType, params->LengthPrecision, params->ParameterScale, + params->ParameterValue, (SQLLEN *)(ULONG_PTR)params->StrLen_or_Ind ); }
static NTSTATUS wrap_SQLBindParameter( void *args ) @@ -248,9 +250,10 @@ static NTSTATUS wrap_SQLBindParameter( void *args ) struct SQLBindParameter_params *params = args;
if (!pSQLBindParameter) return SQL_ERROR; - return pSQLBindParameter(params->hstmt, params->ipar, params->fParamType, params->fCType, - params->fSqlType, params->cbColDef, params->ibScale, params->rgbValue, - params->cbValueMax, params->pcbValue); + return pSQLBindParameter( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ParameterNumber, + params->InputOutputType, params->ValueType, params->ParameterType, params->ColumnSize, + params->DecimalDigits, params->ParameterValue, params->BufferLength, + (SQLLEN *)(ULONG_PTR)params->StrLen_or_Ind ); }
static NTSTATUS wrap_SQLBrowseConnect( void *args ) @@ -258,8 +261,9 @@ static NTSTATUS wrap_SQLBrowseConnect( void *args ) struct SQLBrowseConnect_params *params = args;
if (!pSQLBrowseConnect) return SQL_ERROR; - return pSQLBrowseConnect(params->hdbc, params->szConnStrIn, params->cbConnStrIn, params->szConnStrOut, - params->cbConnStrOutMax, params->pcbConnStrOut); + return pSQLBrowseConnect( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->InConnectionString, + params->StringLength1, params->OutConnectionString, params->BufferLength, + params->StringLength2 ); }
static NTSTATUS wrap_SQLBrowseConnectW( void *args ) @@ -267,8 +271,9 @@ static NTSTATUS wrap_SQLBrowseConnectW( void *args ) struct SQLBrowseConnectW_params *params = args;
if (!pSQLBrowseConnectW) return SQL_ERROR; - return pSQLBrowseConnectW(params->hdbc, params->szConnStrIn, params->cbConnStrIn, params->szConnStrOut, - params->cbConnStrOutMax, params->pcbConnStrOut); + return pSQLBrowseConnectW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->InConnectionString, + params->StringLength1, params->OutConnectionString, params->BufferLength, + params->StringLength2 ); }
static NTSTATUS wrap_SQLBulkOperations( void *args ) @@ -276,7 +281,7 @@ static NTSTATUS wrap_SQLBulkOperations( void *args ) struct SQLBulkOperations_params *params = args;
if (!pSQLBulkOperations) return SQL_ERROR; - return pSQLBulkOperations(params->StatementHandle, params->Operation); + return pSQLBulkOperations( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Operation ); }
static NTSTATUS wrap_SQLCancel( void *args ) @@ -284,7 +289,7 @@ static NTSTATUS wrap_SQLCancel( void *args ) struct SQLCancel_params *params = args;
if (!pSQLCancel) return SQL_ERROR; - return pSQLCancel(params->StatementHandle); + return pSQLCancel( (SQLHSTMT)(ULONG_PTR)params->StatementHandle ); }
static NTSTATUS wrap_SQLCloseCursor( void *args ) @@ -292,7 +297,7 @@ static NTSTATUS wrap_SQLCloseCursor( void *args ) struct SQLCloseCursor_params *params = args;
if (!pSQLCloseCursor) return SQL_ERROR; - return pSQLCloseCursor(params->StatementHandle); + return pSQLCloseCursor( (SQLHSTMT)(ULONG_PTR)params->StatementHandle ); }
static NTSTATUS wrap_SQLColAttribute( void *args ) @@ -300,9 +305,9 @@ static NTSTATUS wrap_SQLColAttribute( void *args ) struct SQLColAttribute_params *params = args;
if (!pSQLColAttribute) return SQL_ERROR; - return pSQLColAttribute(params->StatementHandle, params->ColumnNumber, params->FieldIdentifier, - params->CharacterAttribute, params->BufferLength, params->StringLength, - params->NumericAttribute); + return pSQLColAttribute( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, + params->FieldIdentifier, params->CharacterAttribute, params->BufferLength, + params->StringLength, (SQLLEN *)(ULONG_PTR)params->NumericAttribute ); }
static NTSTATUS wrap_SQLColAttributeW( void *args ) @@ -310,9 +315,10 @@ static NTSTATUS wrap_SQLColAttributeW( void *args ) struct SQLColAttributeW_params *params = args;
if (!pSQLColAttributeW) return SQL_ERROR; - return pSQLColAttributeW(params->StatementHandle, params->ColumnNumber, params->FieldIdentifier, - params->CharacterAttribute, params->BufferLength, params->StringLength, - params->NumericAttribute); + return pSQLColAttributeW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, + params->FieldIdentifier, params->CharacterAttribute, + params->BufferLength, params->StringLength, + (SQLLEN *)(ULONG_PTR)params->NumericAttribute ); }
static NTSTATUS wrap_SQLColAttributes( void *args ) @@ -320,8 +326,9 @@ static NTSTATUS wrap_SQLColAttributes( void *args ) struct SQLColAttributes_params *params = args;
if (!pSQLColAttributes) return SQL_ERROR; - return pSQLColAttributes(params->hstmt, params->icol, params->fDescType, params->rgbDesc, - params->cbDescMax, params->pcbDesc, params->pfDesc); + return pSQLColAttributes( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, + params->FieldIdentifier, params->CharacterAttributes, params->BufferLength, + params->StringLength, (SQLLEN *)(ULONG_PTR)params->NumericAttributes ); }
static NTSTATUS wrap_SQLColAttributesW( void *args ) @@ -329,8 +336,9 @@ static NTSTATUS wrap_SQLColAttributesW( void *args ) struct SQLColAttributesW_params *params = args;
if (!pSQLColAttributesW) return SQL_ERROR; - return pSQLColAttributesW(params->hstmt, params->icol, params->fDescType, params->rgbDesc, - params->cbDescMax, params->pcbDesc, params->pfDesc); + return pSQLColAttributesW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, + params->FieldIdentifier, params->CharacterAttributes, params->BufferLength, + params->StringLength, (SQLLEN *)(ULONG_PTR)params->NumericAttributes ); }
static NTSTATUS wrap_SQLColumnPrivileges( void *args ) @@ -338,9 +346,9 @@ static NTSTATUS wrap_SQLColumnPrivileges( void *args ) struct SQLColumnPrivileges_params *params = args;
if (!pSQLColumnPrivileges) return SQL_ERROR; - return pSQLColumnPrivileges(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szTableName, - params->cbTableName, params->szColumnName, params->cbColumnName); + return pSQLColumnPrivileges( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, + params->NameLength1, params->SchemaName, params->NameLength2, + params->TableName, params->NameLength3, params->ColumnName, params->NameLength4 ); }
static NTSTATUS wrap_SQLColumnPrivilegesW( void *args ) @@ -348,9 +356,9 @@ static NTSTATUS wrap_SQLColumnPrivilegesW( void *args ) struct SQLColumnPrivilegesW_params *params = args;
if (!pSQLColumnPrivilegesW) return SQL_ERROR; - return pSQLColumnPrivilegesW(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szTableName, - params->cbTableName, params->szColumnName, params->cbColumnName); + return pSQLColumnPrivilegesW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, + params->NameLength1, params->SchemaName, params->NameLength2, + params->TableName, params->NameLength3, params->ColumnName, params->NameLength4 ); }
static NTSTATUS wrap_SQLColumns( void *args ) @@ -358,9 +366,9 @@ static NTSTATUS wrap_SQLColumns( void *args ) struct SQLColumns_params *params = args;
if (!pSQLColumns) return SQL_ERROR; - return pSQLColumns(params->StatementHandle, params->CatalogName, params->NameLength1, - params->SchemaName, params->NameLength2, params->TableName, params->NameLength3, - params->ColumnName, params->NameLength4); + return pSQLColumns( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, params->NameLength3, + params->ColumnName, params->NameLength4 ); }
static NTSTATUS wrap_SQLColumnsW( void *args ) @@ -368,9 +376,9 @@ static NTSTATUS wrap_SQLColumnsW( void *args ) struct SQLColumnsW_params *params = args;
if (!pSQLColumnsW) return SQL_ERROR; - return pSQLColumnsW(params->StatementHandle, params->CatalogName, params->NameLength1, - params->SchemaName, params->NameLength2, params->TableName, params->NameLength3, - params->ColumnName, params->NameLength4); + return pSQLColumnsW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, params->NameLength3, + params->ColumnName, params->NameLength4 ); }
static NTSTATUS wrap_SQLConnect( void *args ) @@ -378,8 +386,8 @@ static NTSTATUS wrap_SQLConnect( void *args ) struct SQLConnect_params *params = args;
if (!pSQLConnect) return SQL_ERROR; - return pSQLConnect(params->ConnectionHandle, params->ServerName, params->NameLength1, params->UserName, - params->NameLength2, params->Authentication, params->NameLength3); + return pSQLConnect( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->ServerName, params->NameLength1, + params->UserName, params->NameLength2, params->Authentication, params->NameLength3 ); }
static NTSTATUS wrap_SQLConnectW( void *args ) @@ -387,8 +395,8 @@ static NTSTATUS wrap_SQLConnectW( void *args ) struct SQLConnectW_params *params = args;
if (!pSQLConnectW) return SQL_ERROR; - return pSQLConnectW(params->ConnectionHandle, params->ServerName, params->NameLength1, - params->UserName, params->NameLength2, params->Authentication, params->NameLength3); + return pSQLConnectW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->ServerName, params->NameLength1, + params->UserName, params->NameLength2, params->Authentication, params->NameLength3 ); }
static NTSTATUS wrap_SQLCopyDesc( void *args ) @@ -396,7 +404,7 @@ static NTSTATUS wrap_SQLCopyDesc( void *args ) struct SQLCopyDesc_params *params = args;
if (!pSQLCopyDesc) return SQL_ERROR; - return pSQLCopyDesc(params->SourceDescHandle, params->TargetDescHandle); + return pSQLCopyDesc( (SQLHDESC)(ULONG_PTR)params->SourceDescHandle, (SQLHDESC)(ULONG_PTR)params->TargetDescHandle ); }
static NTSTATUS wrap_SQLDataSources( void *args ) @@ -404,9 +412,9 @@ static NTSTATUS wrap_SQLDataSources( void *args ) struct SQLDataSources_params *params = args;
if (!pSQLDataSources) return SQL_ERROR; - return pSQLDataSources(params->EnvironmentHandle, params->Direction, params->ServerName, - params->BufferLength1, params->NameLength1, params->Description, - params->BufferLength2, params->NameLength2); + return pSQLDataSources( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, params->Direction, params->ServerName, + params->BufferLength1, params->NameLength1, params->Description, + params->BufferLength2, params->NameLength2 ); }
static NTSTATUS wrap_SQLDataSourcesW( void *args ) @@ -414,9 +422,9 @@ static NTSTATUS wrap_SQLDataSourcesW( void *args ) struct SQLDataSourcesW_params *params = args;
if (!pSQLDataSourcesW) return SQL_ERROR; - return pSQLDataSourcesW(params->EnvironmentHandle, params->Direction, params->ServerName, - params->BufferLength1, params->NameLength1, params->Description, - params->BufferLength2, params->NameLength2); + return pSQLDataSourcesW( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, params->Direction, params->ServerName, + params->BufferLength1, params->NameLength1, params->Description, + params->BufferLength2, params->NameLength2 ); }
static NTSTATUS wrap_SQLDescribeCol( void *args ) @@ -424,9 +432,9 @@ static NTSTATUS wrap_SQLDescribeCol( void *args ) struct SQLDescribeCol_params *params = args;
if (!pSQLDescribeCol) return SQL_ERROR; - return pSQLDescribeCol(params->StatementHandle, params->ColumnNumber, params->ColumnName, - params->BufferLength, params->NameLength, params->DataType, - params->ColumnSize, params->DecimalDigits, params->Nullable); + return pSQLDescribeCol( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, params->ColumnName, + params->BufferLength, params->NameLength, params->DataType, + (SQLULEN *)(ULONG_PTR)params->ColumnSize, params->DecimalDigits, params->Nullable ); }
static NTSTATUS wrap_SQLDescribeColW( void *args ) @@ -434,9 +442,9 @@ static NTSTATUS wrap_SQLDescribeColW( void *args ) struct SQLDescribeColW_params *params = args;
if (!pSQLDescribeColW) return SQL_ERROR; - return pSQLDescribeColW(params->StatementHandle, params->ColumnNumber, params->ColumnName, - params->BufferLength, params->NameLength, params->DataType, - params->ColumnSize, params->DecimalDigits, params->Nullable); + return pSQLDescribeColW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, params->ColumnName, + params->BufferLength, params->NameLength, params->DataType, + (SQLULEN *)(ULONG_PTR)params->ColumnSize, params->DecimalDigits, params->Nullable ); }
static NTSTATUS wrap_SQLDescribeParam( void *args ) @@ -444,8 +452,8 @@ static NTSTATUS wrap_SQLDescribeParam( void *args ) struct SQLDescribeParam_params *params = args;
if (!pSQLDescribeParam) return SQL_ERROR; - return pSQLDescribeParam(params->hstmt, params->ipar, params->pfSqlType, params->pcbParamDef, - params->pibScale, params->pfNullable); + return pSQLDescribeParam( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ParameterNumber, params->DataType, + (SQLULEN *)(ULONG_PTR)params->ParameterSize, params->DecimalDigits, params->Nullable ); }
static NTSTATUS wrap_SQLDisconnect( void *args ) @@ -453,7 +461,7 @@ static NTSTATUS wrap_SQLDisconnect( void *args ) struct SQLDisconnect_params *params = args;
if (!pSQLDisconnect) return SQL_ERROR; - return pSQLDisconnect(params->ConnectionHandle); + return pSQLDisconnect( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle ); }
static NTSTATUS wrap_SQLDriverConnect( void *args ) @@ -461,9 +469,9 @@ static NTSTATUS wrap_SQLDriverConnect( void *args ) struct SQLDriverConnect_params *params = args;
if (!pSQLDriverConnect) return SQL_ERROR; - return pSQLDriverConnect(params->hdbc, params->hwnd, params->ConnectionString, params->Length, - params->conn_str_out, params->conn_str_out_max, - params->ptr_conn_str_out, params->driver_completion); + return pSQLDriverConnect( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, (SQLHWND)(ULONG_PTR)params->WindowHandle, + params->ConnectionString, params->Length, params->OutConnectionString, + params->BufferLength, params->Length2, params->DriverCompletion ); }
static NTSTATUS wrap_SQLDriverConnectW( void *args ) @@ -471,9 +479,9 @@ static NTSTATUS wrap_SQLDriverConnectW( void *args ) struct SQLDriverConnectW_params *params = args;
if (!pSQLDriverConnectW) return SQL_ERROR; - return pSQLDriverConnectW(params->ConnectionHandle, params->WindowHandle, params->InConnectionString, - params->Length, params->OutConnectionString, params->BufferLength, - params->Length2, params->DriverCompletion); + return pSQLDriverConnectW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, (SQLHWND)(ULONG_PTR)params->WindowHandle, + params->InConnectionString, params->Length, params->OutConnectionString, + params->BufferLength, params->Length2, params->DriverCompletion ); }
static NTSTATUS wrap_SQLDrivers( void *args ) @@ -481,9 +489,9 @@ static NTSTATUS wrap_SQLDrivers( void *args ) struct SQLDrivers_params *params = args;
if (!pSQLDrivers) return SQL_ERROR; - return pSQLDrivers(params->EnvironmentHandle, params->fDirection, params->szDriverDesc, - params->cbDriverDescMax, params->pcbDriverDesc, params->szDriverAttributes, - params->cbDriverAttrMax, params->pcbDriverAttr); + return pSQLDrivers( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, params->Direction, params->DriverDescription, + params->BufferLength1, params->DescriptionLength, params->DriverAttributes, + params->BufferLength2, params->AttributesLength ); }
static NTSTATUS wrap_SQLDriversW( void *args ) @@ -491,9 +499,9 @@ static NTSTATUS wrap_SQLDriversW( void *args ) struct SQLDriversW_params *params = args;
if (!pSQLDriversW) return SQL_ERROR; - return pSQLDriversW(params->EnvironmentHandle, params->fDirection, params->szDriverDesc, - params->cbDriverDescMax, params->pcbDriverDesc, params->szDriverAttributes, - params->cbDriverAttrMax, params->pcbDriverAttr); + return pSQLDriversW( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, params->Direction, params->DriverDescription, + params->BufferLength1, params->DescriptionLength, params->DriverAttributes, + params->BufferLength2, params->AttributesLength ); }
static NTSTATUS wrap_SQLEndTran( void *args ) @@ -501,7 +509,7 @@ static NTSTATUS wrap_SQLEndTran( void *args ) struct SQLEndTran_params *params = args;
if (!pSQLEndTran) return SQL_ERROR; - return pSQLEndTran(params->HandleType, params->Handle, params->CompletionType); + return pSQLEndTran( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->Handle, params->CompletionType ); }
static NTSTATUS wrap_SQLError( void *args ) @@ -509,9 +517,9 @@ static NTSTATUS wrap_SQLError( void *args ) struct SQLError_params *params = args;
if (!pSQLError) return SQL_ERROR; - return pSQLError(params->EnvironmentHandle, params->ConnectionHandle, params->StatementHandle, - params->Sqlstate, params->NativeError, params->MessageText, - params->BufferLength, params->TextLength); + return pSQLError( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, + (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->SqlState, params->NativeError, + params->MessageText, params->BufferLength, params->TextLength ); }
static NTSTATUS wrap_SQLErrorW( void *args ) @@ -519,9 +527,9 @@ static NTSTATUS wrap_SQLErrorW( void *args ) struct SQLErrorW_params *params = args;
if (!pSQLErrorW) return SQL_ERROR; - return pSQLErrorW(params->EnvironmentHandle, params->ConnectionHandle, params->StatementHandle, - params->Sqlstate, params->NativeError, params->MessageText, - params->BufferLength, params->TextLength); + return pSQLErrorW( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, + (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->SqlState, params->NativeError, + params->MessageText, params->BufferLength, params->TextLength ); }
static NTSTATUS wrap_SQLExecDirect( void *args ) @@ -529,7 +537,7 @@ static NTSTATUS wrap_SQLExecDirect( void *args ) struct SQLExecDirect_params *params = args;
if (!pSQLExecDirect) return SQL_ERROR; - return pSQLExecDirect(params->StatementHandle, params->StatementText, params->TextLength); + return pSQLExecDirect( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->StatementText, params->TextLength ); }
static NTSTATUS wrap_SQLExecDirectW( void *args ) @@ -537,7 +545,7 @@ static NTSTATUS wrap_SQLExecDirectW( void *args ) struct SQLExecDirectW_params *params = args;
if (!pSQLExecDirectW) return SQL_ERROR; - return pSQLExecDirectW(params->StatementHandle, params->StatementText, params->TextLength); + return pSQLExecDirectW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->StatementText, params->TextLength ); }
static NTSTATUS wrap_SQLExecute( void *args ) @@ -545,7 +553,7 @@ static NTSTATUS wrap_SQLExecute( void *args ) struct SQLExecute_params *params = args;
if (!pSQLExecute) return SQL_ERROR; - return pSQLExecute(params->StatementHandle); + return pSQLExecute( (SQLHSTMT)(ULONG_PTR)params->StatementHandle ); }
static NTSTATUS wrap_SQLExtendedFetch( void *args ) @@ -553,8 +561,8 @@ static NTSTATUS wrap_SQLExtendedFetch( void *args ) struct SQLExtendedFetch_params *params = args;
if (!pSQLExtendedFetch) return SQL_ERROR; - return pSQLExtendedFetch(params->hstmt, params->fFetchType, params->irow, - params->pcrow, params->rgfRowStatus); + return pSQLExtendedFetch( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->FetchOrientation, + params->FetchOffset, (SQLULEN *)(ULONG_PTR)params->RowCount, params->RowStatusArray ); }
static NTSTATUS wrap_SQLFetch( void *args ) @@ -562,7 +570,7 @@ static NTSTATUS wrap_SQLFetch( void *args ) struct SQLFetch_params *params = args;
if (!pSQLFetch) return SQL_ERROR; - return pSQLFetch(params->StatementHandle); + return pSQLFetch( (SQLHSTMT)(ULONG_PTR)params->StatementHandle ); }
static NTSTATUS wrap_SQLFetchScroll( void *args ) @@ -570,7 +578,8 @@ static NTSTATUS wrap_SQLFetchScroll( void *args ) struct SQLFetchScroll_params *params = args;
if (!pSQLFetchScroll) return SQL_ERROR; - return pSQLFetchScroll(params->StatementHandle, params->FetchOrientation, params->FetchOffset); + return pSQLFetchScroll( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->FetchOrientation, + params->FetchOffset ); }
static NTSTATUS wrap_SQLForeignKeys( void *args ) @@ -578,11 +587,11 @@ static NTSTATUS wrap_SQLForeignKeys( void *args ) struct SQLForeignKeys_params *params = args;
if (!pSQLForeignKeys) return SQL_ERROR; - return pSQLForeignKeys(params->hstmt, params->szPkCatalogName, params->cbPkCatalogName, - params->szPkSchemaName, params->cbPkSchemaName, params->szPkTableName, - params->cbPkTableName, params->szFkCatalogName, params->cbFkCatalogName, - params->szFkSchemaName, params->cbFkSchemaName, params->szFkTableName, - params->cbFkTableName); + return pSQLForeignKeys( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->PkCatalogName, + params->NameLength1, params->PkSchemaName, params->NameLength2, + params->PkTableName, params->NameLength3, params->FkCatalogName, + params->NameLength4, params->FkSchemaName, params->NameLength5, + params->FkTableName, params->NameLength6 ); }
static NTSTATUS wrap_SQLForeignKeysW( void *args ) @@ -590,11 +599,11 @@ static NTSTATUS wrap_SQLForeignKeysW( void *args ) struct SQLForeignKeysW_params *params = args;
if (!pSQLForeignKeysW) return SQL_ERROR; - return pSQLForeignKeysW(params->hstmt, params->szPkCatalogName, params->cbPkCatalogName, - params->szPkSchemaName, params->cbPkSchemaName, params->szPkTableName, - params->cbPkTableName, params->szFkCatalogName, params->cbFkCatalogName, - params->szFkSchemaName, params->cbFkSchemaName, params->szFkTableName, - params->cbFkTableName); + return pSQLForeignKeysW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->PkCatalogName, + params->NameLength1, params->PkSchemaName, params->NameLength2, + params->PkTableName, params->NameLength3, params->FkCatalogName, + params->NameLength4, params->FkSchemaName, params->NameLength5, + params->FkTableName, params->NameLength6 ); }
static NTSTATUS wrap_SQLFreeConnect( void *args ) @@ -602,7 +611,7 @@ static NTSTATUS wrap_SQLFreeConnect( void *args ) struct SQLFreeConnect_params *params = args;
if (!pSQLFreeConnect) return SQL_ERROR; - return pSQLFreeConnect(params->ConnectionHandle); + return pSQLFreeConnect( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle ); }
static NTSTATUS wrap_SQLFreeEnv( void *args ) @@ -610,7 +619,7 @@ static NTSTATUS wrap_SQLFreeEnv( void *args ) struct SQLFreeEnv_params *params = args;
if (!pSQLFreeEnv) return SQL_ERROR; - return pSQLFreeEnv(params->EnvironmentHandle); + return pSQLFreeEnv( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle ); }
static NTSTATUS wrap_SQLFreeHandle( void *args ) @@ -618,7 +627,7 @@ static NTSTATUS wrap_SQLFreeHandle( void *args ) struct SQLFreeHandle_params *params = args;
if (!pSQLFreeHandle) return SQL_ERROR; - return pSQLFreeHandle(params->HandleType, params->Handle); + return pSQLFreeHandle( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->Handle ); }
static NTSTATUS wrap_SQLFreeStmt( void *args ) @@ -626,7 +635,7 @@ static NTSTATUS wrap_SQLFreeStmt( void *args ) struct SQLFreeStmt_params *params = args;
if (!pSQLFreeStmt) return SQL_ERROR; - return pSQLFreeStmt(params->StatementHandle, params->Option); + return pSQLFreeStmt( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Option ); }
static NTSTATUS wrap_SQLGetConnectAttr( void *args ) @@ -634,8 +643,8 @@ static NTSTATUS wrap_SQLGetConnectAttr( void *args ) struct SQLGetConnectAttr_params *params = args;
if (!pSQLGetConnectAttr) return SQL_ERROR; - return pSQLGetConnectAttr(params->ConnectionHandle, params->Attribute, params->Value, - params->BufferLength, params->StringLength); + return pSQLGetConnectAttr( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Attribute, params->Value, + params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetConnectAttrW( void *args ) @@ -643,8 +652,8 @@ static NTSTATUS wrap_SQLGetConnectAttrW( void *args ) struct SQLGetConnectAttrW_params *params = args;
if (!pSQLGetConnectAttrW) return SQL_ERROR; - return pSQLGetConnectAttrW(params->ConnectionHandle, params->Attribute, params->Value, - params->BufferLength, params->StringLength); + return pSQLGetConnectAttrW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Attribute, params->Value, + params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetConnectOption( void *args ) @@ -652,7 +661,7 @@ static NTSTATUS wrap_SQLGetConnectOption( void *args ) struct SQLGetConnectOption_params *params = args;
if (!pSQLGetConnectOption) return SQL_ERROR; - return pSQLGetConnectOption(params->ConnectionHandle, params->Option, params->Value); + return pSQLGetConnectOption( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Option, params->Value ); }
static NTSTATUS wrap_SQLGetConnectOptionW( void *args ) @@ -660,7 +669,7 @@ static NTSTATUS wrap_SQLGetConnectOptionW( void *args ) struct SQLGetConnectOptionW_params *params = args;
if (!pSQLGetConnectOptionW) return SQL_ERROR; - return pSQLGetConnectOptionW(params->ConnectionHandle, params->Option, params->Value); + return pSQLGetConnectOptionW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Option, params->Value ); }
static NTSTATUS wrap_SQLGetCursorName( void *args ) @@ -668,8 +677,8 @@ static NTSTATUS wrap_SQLGetCursorName( void *args ) struct SQLGetCursorName_params *params = args;
if (!pSQLGetCursorName) return SQL_ERROR; - return pSQLGetCursorName(params->StatementHandle, params->CursorName, params->BufferLength, - params->NameLength); + return pSQLGetCursorName( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CursorName, params->BufferLength, + params->NameLength ); }
static NTSTATUS wrap_SQLGetCursorNameW( void *args ) @@ -677,8 +686,8 @@ static NTSTATUS wrap_SQLGetCursorNameW( void *args ) struct SQLGetCursorNameW_params *params = args;
if (!pSQLGetCursorNameW) return SQL_ERROR; - return pSQLGetCursorNameW(params->StatementHandle, params->CursorName, params->BufferLength, - params->NameLength); + return pSQLGetCursorNameW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CursorName, params->BufferLength, + params->NameLength ); }
static NTSTATUS wrap_SQLGetData( void *args ) @@ -686,8 +695,8 @@ static NTSTATUS wrap_SQLGetData( void *args ) struct SQLGetData_params *params = args;
if (!pSQLGetData) return SQL_ERROR; - return pSQLGetData(params->StatementHandle, params->ColumnNumber, params->TargetType, - params->TargetValue, params->BufferLength, params->StrLen_or_Ind); + return pSQLGetData( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnNumber, params->TargetType, + params->TargetValue, params->BufferLength, (SQLLEN *)(ULONG_PTR)params->StrLen_or_Ind ); }
static NTSTATUS wrap_SQLGetDescField( void *args ) @@ -695,8 +704,8 @@ static NTSTATUS wrap_SQLGetDescField( void *args ) struct SQLGetDescField_params *params = args;
if (!pSQLGetDescField) return SQL_ERROR; - return pSQLGetDescField(params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, - params->Value, params->BufferLength, params->StringLength); + return pSQLGetDescField( (SQLHDESC)(ULONG_PTR)params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, + params->Value, params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetDescFieldW( void *args ) @@ -704,8 +713,8 @@ static NTSTATUS wrap_SQLGetDescFieldW( void *args ) struct SQLGetDescFieldW_params *params = args;
if (!pSQLGetDescFieldW) return SQL_ERROR; - return pSQLGetDescFieldW(params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, - params->Value, params->BufferLength, params->StringLength); + return pSQLGetDescFieldW( (SQLHDESC)(ULONG_PTR)params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, + params->Value, params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetDescRec( void *args ) @@ -713,9 +722,9 @@ static NTSTATUS wrap_SQLGetDescRec( void *args ) struct SQLGetDescRec_params *params = args;
if (!pSQLGetDescRec) return SQL_ERROR; - return pSQLGetDescRec(params->DescriptorHandle, params->RecNumber, params->Name, params->BufferLength, - params->StringLength, params->Type, params->SubType, params->Length, - params->Precision, params->Scale, params->Nullable); + return pSQLGetDescRec( (SQLHDESC)(ULONG_PTR)params->DescriptorHandle, params->RecNumber, params->Name, + params->BufferLength, params->StringLength, params->Type, params->SubType, + (SQLLEN *)(ULONG_PTR)params->Length, params->Precision, params->Scale, params->Nullable ); }
static NTSTATUS wrap_SQLGetDescRecW( void *args ) @@ -723,9 +732,9 @@ static NTSTATUS wrap_SQLGetDescRecW( void *args ) struct SQLGetDescRecW_params *params = args;
if (!pSQLGetDescRecW) return SQL_ERROR; - return pSQLGetDescRecW(params->DescriptorHandle, params->RecNumber, params->Name, params->BufferLength, - params->StringLength, params->Type, params->SubType, params->Length, - params->Precision, params->Scale, params->Nullable); + return pSQLGetDescRecW( (SQLHDESC)(ULONG_PTR)params->DescriptorHandle, params->RecNumber, params->Name, + params->BufferLength, params->StringLength, params->Type, params->SubType, + (SQLLEN *)(ULONG_PTR)params->Length, params->Precision, params->Scale, params->Nullable ); }
static NTSTATUS wrap_SQLGetDiagField( void *args ) @@ -733,8 +742,8 @@ static NTSTATUS wrap_SQLGetDiagField( void *args ) struct SQLGetDiagField_params *params = args;
if (!pSQLGetDiagField) return SQL_ERROR; - return pSQLGetDiagField(params->HandleType, params->Handle, params->RecNumber, params->DiagIdentifier, - params->DiagInfo, params->BufferLength, params->StringLength); + return pSQLGetDiagField( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->Handle, params->RecNumber, + params->DiagIdentifier, params->DiagInfo, params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetDiagFieldW( void *args ) @@ -742,8 +751,8 @@ static NTSTATUS wrap_SQLGetDiagFieldW( void *args ) struct SQLGetDiagFieldW_params *params = args;
if (!pSQLGetDiagFieldW) return SQL_ERROR; - return pSQLGetDiagFieldW(params->HandleType, params->Handle, params->RecNumber, params->DiagIdentifier, - params->DiagInfo, params->BufferLength, params->StringLength); + return pSQLGetDiagFieldW( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->Handle, params->RecNumber, + params->DiagIdentifier, params->DiagInfo, params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetDiagRec( void *args ) @@ -751,9 +760,8 @@ static NTSTATUS wrap_SQLGetDiagRec( void *args ) struct SQLGetDiagRec_params *params = args;
if (!pSQLGetDiagRec) return SQL_ERROR; - return pSQLGetDiagRec(params->HandleType, params->Handle, params->RecNumber, params->Sqlstate, - params->NativeError, params->MessageText, params->BufferLength, - params->TextLength); + return pSQLGetDiagRec( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->Handle, params->RecNumber, params->SqlState, + params->NativeError, params->MessageText, params->BufferLength, params->TextLength ); }
static NTSTATUS wrap_SQLGetDiagRecW( void *args ) @@ -761,9 +769,8 @@ static NTSTATUS wrap_SQLGetDiagRecW( void *args ) struct SQLGetDiagRecW_params *params = args;
if (!pSQLGetDiagRecW) return SQL_ERROR; - return pSQLGetDiagRecW(params->HandleType, params->Handle, params->RecNumber, params->Sqlstate, - params->NativeError, params->MessageText, params->BufferLength, - params->TextLength); + return pSQLGetDiagRecW( params->HandleType, (SQLHANDLE)(ULONG_PTR)params->Handle, params->RecNumber, params->SqlState, + params->NativeError, params->MessageText, params->BufferLength, params->TextLength ); }
static NTSTATUS wrap_SQLGetEnvAttr( void *args ) @@ -771,8 +778,8 @@ static NTSTATUS wrap_SQLGetEnvAttr( void *args ) struct SQLGetEnvAttr_params *params = args;
if (!pSQLGetEnvAttr) return SQL_ERROR; - return pSQLGetEnvAttr(params->EnvironmentHandle, params->Attribute, params->Value, - params->BufferLength, params->StringLength); + return pSQLGetEnvAttr( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, params->Attribute, + params->Value, params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetFunctions( void *args ) @@ -780,7 +787,7 @@ static NTSTATUS wrap_SQLGetFunctions( void *args ) struct SQLGetFunctions_params *params = args;
if (!pSQLGetFunctions) return SQL_ERROR; - return pSQLGetFunctions(params->ConnectionHandle, params->FunctionId, params->Supported); + return pSQLGetFunctions( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->FunctionId, params->Supported ); }
static NTSTATUS wrap_SQLGetInfo( void *args ) @@ -788,8 +795,8 @@ static NTSTATUS wrap_SQLGetInfo( void *args ) struct SQLGetInfo_params *params = args;
if (!pSQLGetInfo) return SQL_ERROR; - return pSQLGetInfo(params->ConnectionHandle, params->InfoType, params->InfoValue, - params->BufferLength, params->StringLength); + return pSQLGetInfo( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->InfoType, params->InfoValue, + params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetInfoW( void *args ) @@ -797,8 +804,8 @@ static NTSTATUS wrap_SQLGetInfoW( void *args ) struct SQLGetInfoW_params *params = args;
if (!pSQLGetInfoW) return SQL_ERROR; - return pSQLGetInfoW(params->ConnectionHandle, params->InfoType, params->InfoValue, - params->BufferLength, params->StringLength); + return pSQLGetInfoW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->InfoType, params->InfoValue, + params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetStmtAttr( void *args ) @@ -806,8 +813,8 @@ static NTSTATUS wrap_SQLGetStmtAttr( void *args ) struct SQLGetStmtAttr_params *params = args;
if (!pSQLGetStmtAttr) return SQL_ERROR; - return pSQLGetStmtAttr(params->StatementHandle, params->Attribute, params->Value, - params->BufferLength, params->StringLength); + return pSQLGetStmtAttr( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Attribute, params->Value, + params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetStmtAttrW( void *args ) @@ -815,8 +822,8 @@ static NTSTATUS wrap_SQLGetStmtAttrW( void *args ) struct SQLGetStmtAttrW_params *params = args;
if (!pSQLGetStmtAttrW) return SQL_ERROR; - return pSQLGetStmtAttrW(params->StatementHandle, params->Attribute, params->Value, - params->BufferLength, params->StringLength); + return pSQLGetStmtAttrW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Attribute, params->Value, + params->BufferLength, params->StringLength ); }
static NTSTATUS wrap_SQLGetStmtOption( void *args ) @@ -824,7 +831,7 @@ static NTSTATUS wrap_SQLGetStmtOption( void *args ) struct SQLGetStmtOption_params *params = args;
if (!pSQLGetStmtOption) return SQL_ERROR; - return pSQLGetStmtOption(params->StatementHandle, params->Option, params->Value); + return pSQLGetStmtOption( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Option, params->Value ); }
static NTSTATUS wrap_SQLGetTypeInfo( void *args ) @@ -832,7 +839,7 @@ static NTSTATUS wrap_SQLGetTypeInfo( void *args ) struct SQLGetTypeInfo_params *params = args;
if (!pSQLGetTypeInfo) return SQL_ERROR; - return pSQLGetTypeInfo(params->StatementHandle, params->DataType); + return pSQLGetTypeInfo( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->DataType ); }
static NTSTATUS wrap_SQLGetTypeInfoW( void *args ) @@ -840,7 +847,7 @@ static NTSTATUS wrap_SQLGetTypeInfoW( void *args ) struct SQLGetTypeInfoW_params *params = args;
if (!pSQLGetTypeInfoW) return SQL_ERROR; - return pSQLGetTypeInfoW(params->StatementHandle, params->DataType); + return pSQLGetTypeInfoW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->DataType ); }
static NTSTATUS wrap_SQLMoreResults( void *args ) @@ -848,7 +855,7 @@ static NTSTATUS wrap_SQLMoreResults( void *args ) struct SQLMoreResults_params *params = args;
if (!pSQLMoreResults) return SQL_ERROR; - return pSQLMoreResults(params->StatementHandle); + return pSQLMoreResults( (SQLHSTMT)(ULONG_PTR)params->StatementHandle ); }
static NTSTATUS wrap_SQLNativeSql( void *args ) @@ -856,8 +863,8 @@ static NTSTATUS wrap_SQLNativeSql( void *args ) struct SQLNativeSql_params *params = args;
if (!pSQLNativeSql) return SQL_ERROR; - return pSQLNativeSql(params->hdbc, params->szSqlStrIn, params->cbSqlStrIn, params->szSqlStr, - params->cbSqlStrMax, params->pcbSqlStr); + return pSQLNativeSql( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->InStatementText, params->TextLength1, + params->OutStatementText, params->BufferLength, params->TextLength2 ); }
static NTSTATUS wrap_SQLNativeSqlW( void *args ) @@ -865,8 +872,8 @@ static NTSTATUS wrap_SQLNativeSqlW( void *args ) struct SQLNativeSqlW_params *params = args;
if (!pSQLNativeSqlW) return SQL_ERROR; - return pSQLNativeSqlW(params->hdbc, params->szSqlStrIn, params->cbSqlStrIn, params->szSqlStr, - params->cbSqlStrMax, params->pcbSqlStr); + return pSQLNativeSqlW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->InStatementText, params->TextLength1, + params->OutStatementText, params->BufferLength, params->TextLength2 ); }
static NTSTATUS wrap_SQLNumParams( void *args ) @@ -874,7 +881,7 @@ static NTSTATUS wrap_SQLNumParams( void *args ) struct SQLNumParams_params *params = args;
if (!pSQLNumParams) return SQL_ERROR; - return pSQLNumParams(params->hstmt, params->pcpar); + return pSQLNumParams( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ParameterCount ); }
static NTSTATUS wrap_SQLNumResultCols( void *args ) @@ -882,7 +889,7 @@ static NTSTATUS wrap_SQLNumResultCols( void *args ) struct SQLNumResultCols_params *params = args;
if (!pSQLNumResultCols) return SQL_ERROR; - return pSQLNumResultCols(params->StatementHandle, params->ColumnCount); + return pSQLNumResultCols( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ColumnCount ); }
static NTSTATUS wrap_SQLParamData( void *args ) @@ -890,7 +897,7 @@ static NTSTATUS wrap_SQLParamData( void *args ) struct SQLParamData_params *params = args;
if (!pSQLParamData) return SQL_ERROR; - return pSQLParamData(params->StatementHandle, params->Value); + return pSQLParamData( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Value ); }
static NTSTATUS wrap_SQLParamOptions( void *args ) @@ -898,7 +905,8 @@ static NTSTATUS wrap_SQLParamOptions( void *args ) struct SQLParamOptions_params *params = args;
if (!pSQLParamOptions) return SQL_ERROR; - return pSQLParamOptions(params->hstmt, params->crow, params->pirow); + return pSQLParamOptions( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->RowCount, + (SQLULEN *)(ULONG_PTR)params->RowNumber ); }
static NTSTATUS wrap_SQLPrepare( void *args ) @@ -906,7 +914,7 @@ static NTSTATUS wrap_SQLPrepare( void *args ) struct SQLPrepare_params *params = args;
if (!pSQLPrepare) return SQL_ERROR; - return pSQLPrepare(params->StatementHandle, params->StatementText, params->TextLength); + return pSQLPrepare( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->StatementText, params->TextLength ); }
static NTSTATUS wrap_SQLPrepareW( void *args ) @@ -914,7 +922,7 @@ static NTSTATUS wrap_SQLPrepareW( void *args ) struct SQLPrepareW_params *params = args;
if (!pSQLPrepareW) return SQL_ERROR; - return pSQLPrepareW(params->StatementHandle, params->StatementText, params->TextLength); + return pSQLPrepareW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->StatementText, params->TextLength ); }
static NTSTATUS wrap_SQLPrimaryKeys( void *args ) @@ -922,9 +930,8 @@ static NTSTATUS wrap_SQLPrimaryKeys( void *args ) struct SQLPrimaryKeys_params *params = args;
if (!pSQLPrimaryKeys) return SQL_ERROR; - return pSQLPrimaryKeys(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, - params->szTableName, params->cbTableName); + return pSQLPrimaryKeys( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, params->NameLength3 ); }
static NTSTATUS wrap_SQLPrimaryKeysW( void *args ) @@ -932,9 +939,8 @@ static NTSTATUS wrap_SQLPrimaryKeysW( void *args ) struct SQLPrimaryKeysW_params *params = args;
if (!pSQLPrimaryKeysW) return SQL_ERROR; - return pSQLPrimaryKeysW(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, - params->szTableName, params->cbTableName); + return pSQLPrimaryKeysW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, params->NameLength3 ); }
static NTSTATUS wrap_SQLProcedureColumns( void *args ) @@ -942,9 +948,9 @@ static NTSTATUS wrap_SQLProcedureColumns( void *args ) struct SQLProcedureColumns_params *params = args;
if (!pSQLProcedureColumns) return SQL_ERROR; - return pSQLProcedureColumns(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szProcName, - params->cbProcName, params->szColumnName, params->cbColumnName); + return pSQLProcedureColumns( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, + params->NameLength1, params->SchemaName, params->NameLength2, params->ProcName, + params->NameLength3, params->ColumnName, params->NameLength4 ); }
static NTSTATUS wrap_SQLProcedureColumnsW( void *args ) @@ -952,9 +958,9 @@ static NTSTATUS wrap_SQLProcedureColumnsW( void *args ) struct SQLProcedureColumnsW_params *params = args;
if (!pSQLProcedureColumnsW) return SQL_ERROR; - return pSQLProcedureColumnsW(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szProcName, - params->cbProcName, params->szColumnName, params->cbColumnName); + return pSQLProcedureColumnsW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, + params->NameLength1, params->SchemaName, params->NameLength2, params->ProcName, + params->NameLength3, params->ColumnName, params->NameLength4 ); }
static NTSTATUS wrap_SQLProcedures( void *args ) @@ -962,9 +968,8 @@ static NTSTATUS wrap_SQLProcedures( void *args ) struct SQLProcedures_params *params = args;
if (!pSQLProcedures) return SQL_ERROR; - return pSQLProcedures(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szProcName, - params->cbProcName); + return pSQLProcedures( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->ProcName, params->NameLength3 ); }
static NTSTATUS wrap_SQLProceduresW( void *args ) @@ -972,9 +977,8 @@ static NTSTATUS wrap_SQLProceduresW( void *args ) struct SQLProceduresW_params *params = args;
if (!pSQLProceduresW) return SQL_ERROR; - return pSQLProceduresW(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szProcName, - params->cbProcName); + return pSQLProceduresW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->ProcName, params->NameLength3 ); }
static NTSTATUS wrap_SQLPutData( void *args ) @@ -982,7 +986,7 @@ static NTSTATUS wrap_SQLPutData( void *args ) struct SQLPutData_params *params = args;
if (!pSQLPutData) return SQL_ERROR; - return pSQLPutData(params->StatementHandle, params->Data, params->StrLen_or_Ind); + return pSQLPutData( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Data, params->StrLen_or_Ind ); }
static NTSTATUS wrap_SQLRowCount( void *args ) @@ -990,7 +994,7 @@ static NTSTATUS wrap_SQLRowCount( void *args ) struct SQLRowCount_params *params = args;
if (!pSQLRowCount) return SQL_ERROR; - return pSQLRowCount(params->StatementHandle, params->RowCount); + return pSQLRowCount( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, (SQLLEN *)(ULONG_PTR)params->RowCount ); }
static NTSTATUS wrap_SQLSetConnectAttr( void *args ) @@ -998,8 +1002,8 @@ static NTSTATUS wrap_SQLSetConnectAttr( void *args ) struct SQLSetConnectAttr_params *params = args;
if (!pSQLSetConnectAttr) return SQL_ERROR; - return pSQLSetConnectAttr(params->ConnectionHandle, params->Attribute, params->Value, - params->StringLength); + return pSQLSetConnectAttr( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Attribute, params->Value, + params->StringLength ); }
static NTSTATUS wrap_SQLSetConnectAttrW( void *args ) @@ -1007,8 +1011,8 @@ static NTSTATUS wrap_SQLSetConnectAttrW( void *args ) struct SQLSetConnectAttrW_params *params = args;
if (!pSQLSetConnectAttrW) return SQL_ERROR; - return pSQLSetConnectAttrW(params->ConnectionHandle, params->Attribute, params->Value, - params->StringLength); + return pSQLSetConnectAttrW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Attribute, params->Value, + params->StringLength ); }
static NTSTATUS wrap_SQLSetConnectOption( void *args ) @@ -1016,7 +1020,7 @@ static NTSTATUS wrap_SQLSetConnectOption( void *args ) struct SQLSetConnectOption_params *params = args;
if (!pSQLSetConnectOption) return SQL_ERROR; - return pSQLSetConnectOption(params->ConnectionHandle, params->Option, params->Value); + return pSQLSetConnectOption( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Option, params->Value ); }
static NTSTATUS wrap_SQLSetConnectOptionW( void *args ) @@ -1024,7 +1028,7 @@ static NTSTATUS wrap_SQLSetConnectOptionW( void *args ) struct SQLSetConnectOptionW_params *params = args;
if (!pSQLSetConnectOptionW) return SQL_ERROR; - return pSQLSetConnectOptionW(params->ConnectionHandle, params->Option, params->Value); + return pSQLSetConnectOptionW( (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, params->Option, params->Value ); }
static NTSTATUS wrap_SQLSetCursorName( void *args ) @@ -1032,7 +1036,7 @@ static NTSTATUS wrap_SQLSetCursorName( void *args ) struct SQLSetCursorName_params *params = args;
if (!pSQLSetCursorName) return SQL_ERROR; - return pSQLSetCursorName(params->StatementHandle, params->CursorName, params->NameLength); + return pSQLSetCursorName( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CursorName, params->NameLength ); }
static NTSTATUS wrap_SQLSetCursorNameW( void *args ) @@ -1040,7 +1044,7 @@ static NTSTATUS wrap_SQLSetCursorNameW( void *args ) struct SQLSetCursorNameW_params *params = args;
if (!pSQLSetCursorNameW) return SQL_ERROR; - return pSQLSetCursorNameW(params->StatementHandle, params->CursorName, params->NameLength); + return pSQLSetCursorNameW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CursorName, params->NameLength ); }
static NTSTATUS wrap_SQLSetDescField( void *args ) @@ -1048,8 +1052,8 @@ static NTSTATUS wrap_SQLSetDescField( void *args ) struct SQLSetDescField_params *params = args;
if (!pSQLSetDescField) return SQL_ERROR; - return pSQLSetDescField(params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, - params->Value, params->BufferLength); + return pSQLSetDescField( (SQLHDESC)(ULONG_PTR)params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, + params->Value, params->BufferLength ); }
static NTSTATUS wrap_SQLSetDescFieldW( void *args ) @@ -1057,8 +1061,8 @@ static NTSTATUS wrap_SQLSetDescFieldW( void *args ) struct SQLSetDescFieldW_params *params = args;
if (!pSQLSetDescFieldW) return SQL_ERROR; - return pSQLSetDescFieldW(params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, - params->Value, params->BufferLength); + return pSQLSetDescFieldW( (SQLHDESC)(ULONG_PTR)params->DescriptorHandle, params->RecNumber, params->FieldIdentifier, + params->Value, params->BufferLength ); }
static NTSTATUS wrap_SQLSetDescRec( void *args ) @@ -1066,9 +1070,10 @@ static NTSTATUS wrap_SQLSetDescRec( void *args ) struct SQLSetDescRec_params *params = args;
if (!pSQLSetDescRec) return SQL_ERROR; - return pSQLSetDescRec(params->DescriptorHandle, params->RecNumber, params->Type, params->SubType, - params->Length, params->Precision, params->Scale, params->Data, - params->StringLength, params->Indicator); + return pSQLSetDescRec( (SQLHDESC)(ULONG_PTR)params->DescriptorHandle, params->RecNumber, params->Type, + params->SubType, params->Length, params->Precision, params->Scale, + params->Data, (SQLLEN *)(ULONG_PTR)params->StringLength, + (SQLLEN *)(ULONG_PTR)params->Indicator ); }
static NTSTATUS wrap_SQLSetEnvAttr( void *args ) @@ -1076,7 +1081,8 @@ static NTSTATUS wrap_SQLSetEnvAttr( void *args ) struct SQLSetEnvAttr_params *params = args;
if (!pSQLSetEnvAttr) return SQL_ERROR; - return pSQLSetEnvAttr(params->EnvironmentHandle, params->Attribute, params->Value, params->StringLength); + return pSQLSetEnvAttr( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, params->Attribute, params->Value, + params->StringLength ); }
static NTSTATUS wrap_SQLSetParam( void *args ) @@ -1084,9 +1090,9 @@ static NTSTATUS wrap_SQLSetParam( void *args ) struct SQLSetParam_params *params = args;
if (!pSQLSetParam) return SQL_ERROR; - return pSQLSetParam(params->StatementHandle, params->ParameterNumber, params->ValueType, - params->ParameterType, params->LengthPrecision, params->ParameterScale, - params->ParameterValue, params->StrLen_or_Ind); + return pSQLSetParam( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->ParameterNumber, params->ValueType, + params->ParameterType, params->LengthPrecision, params->ParameterScale, + params->ParameterValue, (SQLLEN *)(ULONG_PTR)params->StrLen_or_Ind ); }
static NTSTATUS wrap_SQLSetPos( void *args ) @@ -1094,7 +1100,8 @@ static NTSTATUS wrap_SQLSetPos( void *args ) struct SQLSetPos_params *params = args;
if (!pSQLSetPos) return SQL_ERROR; - return pSQLSetPos(params->hstmt, params->irow, params->fOption, params->fLock); + return pSQLSetPos( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->RowNumber, params->Operation, + params->LockType ); }
static NTSTATUS wrap_SQLSetScrollOptions( void *args ) @@ -1102,8 +1109,8 @@ static NTSTATUS wrap_SQLSetScrollOptions( void *args ) struct SQLSetScrollOptions_params *params = args;
if (!pSQLSetScrollOptions) return SQL_ERROR; - return pSQLSetScrollOptions(params->statement_handle, params->f_concurrency, - params->crow_keyset, params->crow_rowset); + return pSQLSetScrollOptions( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Concurrency, + params->KeySetSize, params->RowSetSize ); }
static NTSTATUS wrap_SQLSetStmtAttr( void *args ) @@ -1111,7 +1118,8 @@ static NTSTATUS wrap_SQLSetStmtAttr( void *args ) struct SQLSetStmtAttr_params *params = args;
if (!pSQLSetStmtAttr) return SQL_ERROR; - return pSQLSetStmtAttr(params->StatementHandle, params->Attribute, params->Value, params->StringLength); + return pSQLSetStmtAttr( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Attribute, params->Value, + params->StringLength ); }
static NTSTATUS wrap_SQLSetStmtAttrW( void *args ) @@ -1119,7 +1127,8 @@ static NTSTATUS wrap_SQLSetStmtAttrW( void *args ) struct SQLSetStmtAttrW_params *params = args;
if (!pSQLSetStmtAttrW) return SQL_ERROR; - return pSQLSetStmtAttrW(params->StatementHandle, params->Attribute, params->Value, params->StringLength); + return pSQLSetStmtAttrW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Attribute, params->Value, + params->StringLength ); }
static NTSTATUS wrap_SQLSetStmtOption( void *args ) @@ -1127,7 +1136,7 @@ static NTSTATUS wrap_SQLSetStmtOption( void *args ) struct SQLSetStmtOption_params *params = args;
if (!pSQLSetStmtOption) return SQL_ERROR; - return pSQLSetStmtOption(params->StatementHandle, params->Option, params->Value); + return pSQLSetStmtOption( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->Option, params->Value ); }
static NTSTATUS wrap_SQLSpecialColumns( void *args ) @@ -1135,9 +1144,9 @@ static NTSTATUS wrap_SQLSpecialColumns( void *args ) struct SQLSpecialColumns_params *params = args;
if (!pSQLSpecialColumns) return SQL_ERROR; - return pSQLSpecialColumns(params->StatementHandle, params->IdentifierType, params->CatalogName, - params->NameLength1, params->SchemaName, params->NameLength2, - params->TableName, params->NameLength3, params->Scope, params->Nullable); + return pSQLSpecialColumns( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->IdentifierType, + params->CatalogName, params->NameLength1, params->SchemaName, params->NameLength2, + params->TableName, params->NameLength3, params->Scope, params->Nullable ); }
static NTSTATUS wrap_SQLSpecialColumnsW( void *args ) @@ -1145,9 +1154,9 @@ static NTSTATUS wrap_SQLSpecialColumnsW( void *args ) struct SQLSpecialColumnsW_params *params = args;
if (!pSQLSpecialColumnsW) return SQL_ERROR; - return pSQLSpecialColumnsW(params->StatementHandle, params->IdentifierType, params->CatalogName, - params->NameLength1, params->SchemaName, params->NameLength2, - params->TableName, params->NameLength3, params->Scope, params->Nullable); + return pSQLSpecialColumnsW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->IdentifierType, + params->CatalogName, params->NameLength1, params->SchemaName, params->NameLength2, + params->TableName, params->NameLength3, params->Scope, params->Nullable ); }
static NTSTATUS wrap_SQLStatistics( void *args ) @@ -1155,9 +1164,9 @@ static NTSTATUS wrap_SQLStatistics( void *args ) struct SQLStatistics_params *params = args;
if (!pSQLStatistics) return SQL_ERROR; - return pSQLStatistics(params->StatementHandle, params->CatalogName, params->NameLength1, - params->SchemaName, params->NameLength2, params->TableName, - params->NameLength3, params->Unique, params->Reserved); + return pSQLStatistics( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, + params->NameLength3, params->Unique, params->Reserved ); }
static NTSTATUS wrap_SQLStatisticsW( void *args ) @@ -1165,9 +1174,9 @@ static NTSTATUS wrap_SQLStatisticsW( void *args ) struct SQLStatisticsW_params *params = args;
if (!pSQLStatisticsW) return SQL_ERROR; - return pSQLStatisticsW(params->StatementHandle, params->CatalogName, params->NameLength1, - params->SchemaName, params->NameLength2, params->TableName, - params->NameLength3, params->Unique, params->Reserved); + return pSQLStatisticsW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, + params->NameLength3, params->Unique, params->Reserved ); }
static NTSTATUS wrap_SQLTablePrivileges( void *args ) @@ -1175,9 +1184,9 @@ static NTSTATUS wrap_SQLTablePrivileges( void *args ) struct SQLTablePrivileges_params *params = args;
if (!pSQLTablePrivileges) return SQL_ERROR; - return pSQLTablePrivileges(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szTableName, - params->cbTableName); + return pSQLTablePrivileges( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, + params->NameLength1, params->SchemaName, params->NameLength2, params->TableName, + params->NameLength3 ); }
static NTSTATUS wrap_SQLTablePrivilegesW( void *args ) @@ -1185,9 +1194,9 @@ static NTSTATUS wrap_SQLTablePrivilegesW( void *args ) struct SQLTablePrivilegesW_params *params = args;
if (!pSQLTablePrivilegesW) return SQL_ERROR; - return pSQLTablePrivilegesW(params->hstmt, params->szCatalogName, params->cbCatalogName, - params->szSchemaName, params->cbSchemaName, params->szTableName, - params->cbTableName); + return pSQLTablePrivilegesW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, + params->NameLength1, params->SchemaName, params->NameLength2, params->TableName, + params->NameLength3 ); }
static NTSTATUS wrap_SQLTables( void *args ) @@ -1195,9 +1204,9 @@ static NTSTATUS wrap_SQLTables( void *args ) struct SQLTables_params *params = args;
if (!pSQLTables) return SQL_ERROR; - return pSQLTables(params->StatementHandle, params->CatalogName, params->NameLength1, - params->SchemaName, params->NameLength2, params->TableName, - params->NameLength3, params->TableType, params->NameLength4); + return pSQLTables( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, + params->NameLength3, params->TableType, params->NameLength4 ); }
static NTSTATUS wrap_SQLTablesW( void *args ) @@ -1205,9 +1214,9 @@ static NTSTATUS wrap_SQLTablesW( void *args ) struct SQLTablesW_params *params = args;
if (!pSQLTablesW) return SQL_ERROR; - return pSQLTablesW(params->StatementHandle, params->CatalogName, params->NameLength1, - params->SchemaName, params->NameLength2, params->TableName, - params->NameLength3, params->TableType, params->NameLength4); + return pSQLTablesW( (SQLHSTMT)(ULONG_PTR)params->StatementHandle, params->CatalogName, params->NameLength1, + params->SchemaName, params->NameLength2, params->TableName, + params->NameLength3, params->TableType, params->NameLength4 ); }
static NTSTATUS wrap_SQLTransact( void *args ) @@ -1215,10 +1224,11 @@ static NTSTATUS wrap_SQLTransact( void *args ) struct SQLTransact_params *params = args;
if (!pSQLTransact) return SQL_ERROR; - return pSQLTransact(params->EnvironmentHandle, params->ConnectionHandle, params->CompletionType); + return pSQLTransact( (SQLHENV)(ULONG_PTR)params->EnvironmentHandle, (SQLHDBC)(ULONG_PTR)params->ConnectionHandle, + params->CompletionType ); }
-const unixlib_entry_t __wine_unix_call_funcs[NB_ODBC_FUNCS] = +const unixlib_entry_t __wine_unix_call_funcs[] = { odbc_process_attach, odbc_process_detach, @@ -1339,6 +1349,8 @@ const unixlib_entry_t __wine_unix_call_funcs[NB_ODBC_FUNCS] = wrap_SQLTransact, };
+C_ASSERT( ARRAYSIZE( __wine_unix_call_funcs) == unix_funcs_count ); + static NTSTATUS load_odbc(void) { const char *s = getenv("LIB_ODBC_DRIVER_MANAGER"); diff --git a/dlls/odbc32/unixlib.h b/dlls/odbc32/unixlib.h index f1a6a17634e..f2e6f00284f 100644 --- a/dlls/odbc32/unixlib.h +++ b/dlls/odbc32/unixlib.h @@ -25,14 +25,8 @@ */
#include <stdarg.h> - #include "windef.h" #include "winbase.h" - -#include "sql.h" -#include "sqltypes.h" -#include "sqlext.h" - #include "wine/unixlib.h"
enum sql_funcs @@ -154,121 +148,1108 @@ enum sql_funcs unix_SQLTables, unix_SQLTablesW, unix_SQLTransact, - NB_ODBC_FUNCS -}; - -struct SQLAllocConnect_params { SQLHENV EnvironmentHandle; SQLHDBC *ConnectionHandle; }; -struct SQLAllocEnv_params { SQLHENV *EnvironmentHandle; }; -struct SQLAllocHandle_params { SQLSMALLINT HandleType; SQLHANDLE InputHandle; SQLHANDLE *OutputHandle; }; -struct SQLAllocHandleStd_params { SQLSMALLINT HandleType; SQLHANDLE InputHandle; SQLHANDLE *OutputHandle; }; -struct SQLAllocStmt_params { SQLHDBC ConnectionHandle; SQLHSTMT *StatementHandle; }; -struct SQLBindCol_params { SQLHSTMT StatementHandle; SQLUSMALLINT ColumnNumber; SQLSMALLINT TargetType; SQLPOINTER TargetValue; SQLLEN BufferLength; SQLLEN *StrLen_or_Ind; }; -struct SQLBindParam_params { SQLHSTMT StatementHandle; SQLUSMALLINT ParameterNumber; SQLSMALLINT ValueType; SQLSMALLINT ParameterType; SQLULEN LengthPrecision; SQLSMALLINT ParameterScale; SQLPOINTER ParameterValue; SQLLEN *StrLen_or_Ind; }; -struct SQLBindParameter_params { SQLHSTMT hstmt; SQLUSMALLINT ipar; SQLSMALLINT fParamType; SQLSMALLINT fCType; SQLSMALLINT fSqlType; SQLULEN cbColDef; SQLSMALLINT ibScale; SQLPOINTER rgbValue; SQLLEN cbValueMax; SQLLEN *pcbValue; }; -struct SQLBrowseConnect_params { SQLHDBC hdbc; SQLCHAR *szConnStrIn; SQLSMALLINT cbConnStrIn; SQLCHAR *szConnStrOut; SQLSMALLINT cbConnStrOutMax; SQLSMALLINT *pcbConnStrOut; }; -struct SQLBrowseConnectW_params { SQLHDBC hdbc; SQLWCHAR *szConnStrIn; SQLSMALLINT cbConnStrIn; SQLWCHAR *szConnStrOut; SQLSMALLINT cbConnStrOutMax; SQLSMALLINT *pcbConnStrOut; }; -struct SQLBulkOperations_params { SQLHSTMT StatementHandle; SQLSMALLINT Operation; }; -struct SQLCancel_params { SQLHSTMT StatementHandle; }; -struct SQLCloseCursor_params { SQLHSTMT StatementHandle; }; -struct SQLColAttribute_params { SQLHSTMT StatementHandle; SQLUSMALLINT ColumnNumber; SQLUSMALLINT FieldIdentifier; SQLPOINTER CharacterAttribute; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; SQLLEN *NumericAttribute; }; -struct SQLColAttributeW_params { SQLHSTMT StatementHandle; SQLUSMALLINT ColumnNumber; SQLUSMALLINT FieldIdentifier; SQLPOINTER CharacterAttribute; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; SQLLEN *NumericAttribute; }; -struct SQLColAttributes_params { SQLHSTMT hstmt; SQLUSMALLINT icol; SQLUSMALLINT fDescType; SQLPOINTER rgbDesc; SQLSMALLINT cbDescMax; SQLSMALLINT *pcbDesc; SQLLEN *pfDesc; }; -struct SQLColAttributesW_params { SQLHSTMT hstmt; SQLUSMALLINT icol; SQLUSMALLINT fDescType; SQLPOINTER rgbDesc; SQLSMALLINT cbDescMax; SQLSMALLINT *pcbDesc; SQLLEN *pfDesc; }; -struct SQLColumnPrivileges_params { SQLHSTMT hstmt; SQLCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLCHAR *szTableName; SQLSMALLINT cbTableName; SQLCHAR *szColumnName; SQLSMALLINT cbColumnName; }; -struct SQLColumnPrivilegesW_params { SQLHSTMT hstmt; SQLWCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLWCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLWCHAR *szTableName; SQLSMALLINT cbTableName; SQLWCHAR *szColumnName; SQLSMALLINT cbColumnName; }; -struct SQLColumns_params { SQLHSTMT StatementHandle; SQLCHAR *CatalogName; SQLSMALLINT NameLength1; SQLCHAR *SchemaName; SQLSMALLINT NameLength2; SQLCHAR *TableName; SQLSMALLINT NameLength3; SQLCHAR *ColumnName; SQLSMALLINT NameLength4; }; -struct SQLColumnsW_params { SQLHSTMT StatementHandle; WCHAR *CatalogName; SQLSMALLINT NameLength1; WCHAR *SchemaName; SQLSMALLINT NameLength2; WCHAR *TableName; SQLSMALLINT NameLength3; WCHAR *ColumnName; SQLSMALLINT NameLength4; }; -struct SQLConnect_params { SQLHDBC ConnectionHandle; SQLCHAR *ServerName; SQLSMALLINT NameLength1; SQLCHAR *UserName; SQLSMALLINT NameLength2; SQLCHAR *Authentication; SQLSMALLINT NameLength3; }; -struct SQLConnectW_params { SQLHDBC ConnectionHandle; WCHAR *ServerName; SQLSMALLINT NameLength1; WCHAR *UserName; SQLSMALLINT NameLength2; WCHAR *Authentication; SQLSMALLINT NameLength3; }; -struct SQLCopyDesc_params { SQLHDESC SourceDescHandle; SQLHDESC TargetDescHandle; }; -struct SQLDataSources_params { SQLHENV EnvironmentHandle; SQLUSMALLINT Direction; SQLCHAR *ServerName; SQLSMALLINT BufferLength1; SQLSMALLINT *NameLength1; SQLCHAR *Description; SQLSMALLINT BufferLength2; SQLSMALLINT *NameLength2; }; -struct SQLDataSourcesW_params { SQLHENV EnvironmentHandle; SQLUSMALLINT Direction; WCHAR *ServerName; SQLSMALLINT BufferLength1; SQLSMALLINT *NameLength1; WCHAR *Description; SQLSMALLINT BufferLength2; SQLSMALLINT *NameLength2; }; -struct SQLDescribeCol_params { SQLHSTMT StatementHandle; SQLUSMALLINT ColumnNumber; SQLCHAR *ColumnName; SQLSMALLINT BufferLength; SQLSMALLINT *NameLength; SQLSMALLINT *DataType; SQLULEN *ColumnSize; SQLSMALLINT *DecimalDigits; SQLSMALLINT *Nullable; }; -struct SQLDescribeColW_params { SQLHSTMT StatementHandle; SQLUSMALLINT ColumnNumber; WCHAR *ColumnName; SQLSMALLINT BufferLength; SQLSMALLINT *NameLength; SQLSMALLINT *DataType; SQLULEN *ColumnSize; SQLSMALLINT *DecimalDigits; SQLSMALLINT *Nullable; }; -struct SQLDescribeParam_params { SQLHSTMT hstmt; SQLUSMALLINT ipar; SQLSMALLINT *pfSqlType; SQLULEN *pcbParamDef; SQLSMALLINT *pibScale; SQLSMALLINT *pfNullable; }; -struct SQLDisconnect_params { SQLHDBC ConnectionHandle; }; -struct SQLDriverConnect_params { 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 SQLDriverConnectW_params { SQLHDBC ConnectionHandle; SQLHWND WindowHandle; WCHAR *InConnectionString; SQLSMALLINT Length; WCHAR *OutConnectionString; SQLSMALLINT BufferLength; SQLSMALLINT *Length2; SQLUSMALLINT DriverCompletion; }; -struct SQLDrivers_params { SQLHENV EnvironmentHandle; SQLUSMALLINT fDirection; SQLCHAR *szDriverDesc; SQLSMALLINT cbDriverDescMax; SQLSMALLINT *pcbDriverDesc; SQLCHAR *szDriverAttributes; SQLSMALLINT cbDriverAttrMax; SQLSMALLINT *pcbDriverAttr; }; -struct SQLDriversW_params { SQLHENV EnvironmentHandle; SQLUSMALLINT fDirection; SQLWCHAR *szDriverDesc; SQLSMALLINT cbDriverDescMax; SQLSMALLINT *pcbDriverDesc; SQLWCHAR *szDriverAttributes; SQLSMALLINT cbDriverAttrMax; SQLSMALLINT *pcbDriverAttr; }; -struct SQLEndTran_params { SQLSMALLINT HandleType; SQLHANDLE Handle; SQLSMALLINT CompletionType; }; -struct SQLError_params { SQLHENV EnvironmentHandle; SQLHDBC ConnectionHandle; SQLHSTMT StatementHandle; SQLCHAR *Sqlstate; SQLINTEGER *NativeError; SQLCHAR *MessageText; SQLSMALLINT BufferLength; SQLSMALLINT *TextLength; }; -struct SQLErrorW_params { SQLHENV EnvironmentHandle; SQLHDBC ConnectionHandle; SQLHSTMT StatementHandle; WCHAR *Sqlstate; SQLINTEGER *NativeError; WCHAR *MessageText; SQLSMALLINT BufferLength; SQLSMALLINT *TextLength; }; -struct SQLExecDirect_params { SQLHSTMT StatementHandle; SQLCHAR *StatementText; SQLINTEGER TextLength; }; -struct SQLExecDirectW_params { SQLHSTMT StatementHandle; WCHAR *StatementText; SQLINTEGER TextLength; }; -struct SQLExecute_params { SQLHSTMT StatementHandle; }; -struct SQLExtendedFetch_params { SQLHSTMT hstmt; SQLUSMALLINT fFetchType; SQLLEN irow; SQLULEN *pcrow; SQLUSMALLINT *rgfRowStatus; }; -struct SQLFetch_params { SQLHSTMT StatementHandle; }; -struct SQLFetchScroll_params { SQLHSTMT StatementHandle; SQLSMALLINT FetchOrientation; SQLLEN FetchOffset; }; -struct SQLForeignKeys_params { 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 SQLForeignKeysW_params { 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 SQLFreeConnect_params { SQLHDBC ConnectionHandle; }; -struct SQLFreeEnv_params { SQLHENV EnvironmentHandle; }; -struct SQLFreeHandle_params { SQLSMALLINT HandleType; SQLHANDLE Handle; }; -struct SQLFreeStmt_params { SQLHSTMT StatementHandle; SQLUSMALLINT Option; }; -struct SQLGetConnectAttr_params { SQLHDBC ConnectionHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER BufferLength; SQLINTEGER *StringLength; }; -struct SQLGetConnectAttrW_params { SQLHDBC ConnectionHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER BufferLength; SQLINTEGER *StringLength; }; -struct SQLGetConnectOption_params { SQLHDBC ConnectionHandle; SQLUSMALLINT Option; SQLPOINTER Value; }; -struct SQLGetConnectOptionW_params { SQLHDBC ConnectionHandle; SQLUSMALLINT Option; SQLPOINTER Value; }; -struct SQLGetCursorName_params { SQLHSTMT StatementHandle; SQLCHAR *CursorName; SQLSMALLINT BufferLength; SQLSMALLINT *NameLength; }; -struct SQLGetCursorNameW_params { SQLHSTMT StatementHandle; WCHAR *CursorName; SQLSMALLINT BufferLength; SQLSMALLINT *NameLength; }; -struct SQLGetData_params { SQLHSTMT StatementHandle; SQLUSMALLINT ColumnNumber; SQLSMALLINT TargetType; SQLPOINTER TargetValue; SQLLEN BufferLength; SQLLEN *StrLen_or_Ind; }; -struct SQLGetDescField_params { SQLHDESC DescriptorHandle; SQLSMALLINT RecNumber; SQLSMALLINT FieldIdentifier; SQLPOINTER Value; SQLINTEGER BufferLength; SQLINTEGER *StringLength; }; -struct SQLGetDescFieldW_params { SQLHDESC DescriptorHandle; SQLSMALLINT RecNumber; SQLSMALLINT FieldIdentifier; SQLPOINTER Value; SQLINTEGER BufferLength; SQLINTEGER *StringLength; }; -struct SQLGetDescRec_params { SQLHDESC DescriptorHandle; SQLSMALLINT RecNumber; SQLCHAR *Name; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; SQLSMALLINT *Type; SQLSMALLINT *SubType; SQLLEN *Length; SQLSMALLINT *Precision; SQLSMALLINT *Scale; SQLSMALLINT *Nullable; }; -struct SQLGetDescRecW_params { SQLHDESC DescriptorHandle; SQLSMALLINT RecNumber; WCHAR *Name; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; SQLSMALLINT *Type; SQLSMALLINT *SubType; SQLLEN *Length; SQLSMALLINT *Precision; SQLSMALLINT *Scale; SQLSMALLINT *Nullable; }; -struct SQLGetDiagField_params { SQLSMALLINT HandleType; SQLHANDLE Handle; SQLSMALLINT RecNumber; SQLSMALLINT DiagIdentifier; SQLPOINTER DiagInfo; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; }; -struct SQLGetDiagFieldW_params { SQLSMALLINT HandleType; SQLHANDLE Handle; SQLSMALLINT RecNumber; SQLSMALLINT DiagIdentifier; SQLPOINTER DiagInfo; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; }; -struct SQLGetDiagRec_params { SQLSMALLINT HandleType; SQLHANDLE Handle; SQLSMALLINT RecNumber; SQLCHAR *Sqlstate; SQLINTEGER *NativeError; SQLCHAR *MessageText; SQLSMALLINT BufferLength; SQLSMALLINT *TextLength; }; -struct SQLGetDiagRecW_params { SQLSMALLINT HandleType; SQLHANDLE Handle; SQLSMALLINT RecNumber; WCHAR *Sqlstate; SQLINTEGER *NativeError; WCHAR *MessageText; SQLSMALLINT BufferLength; SQLSMALLINT *TextLength; }; -struct SQLGetEnvAttr_params { SQLHENV EnvironmentHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER BufferLength; SQLINTEGER *StringLength; }; -struct SQLGetFunctions_params { SQLHDBC ConnectionHandle; SQLUSMALLINT FunctionId; SQLUSMALLINT *Supported; }; -struct SQLGetInfo_params { SQLHDBC ConnectionHandle; SQLUSMALLINT InfoType; SQLPOINTER InfoValue; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; }; -struct SQLGetInfoW_params { SQLHDBC ConnectionHandle; SQLUSMALLINT InfoType; SQLPOINTER InfoValue; SQLSMALLINT BufferLength; SQLSMALLINT *StringLength; }; -struct SQLGetStmtAttr_params { SQLHSTMT StatementHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER BufferLength; SQLINTEGER *StringLength; }; -struct SQLGetStmtAttrW_params { SQLHSTMT StatementHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER BufferLength; SQLINTEGER *StringLength; }; -struct SQLGetStmtOption_params { SQLHSTMT StatementHandle; SQLUSMALLINT Option; SQLPOINTER Value; }; -struct SQLGetTypeInfo_params { SQLHSTMT StatementHandle; SQLSMALLINT DataType; }; -struct SQLGetTypeInfoW_params { SQLHSTMT StatementHandle; SQLSMALLINT DataType; }; -struct SQLMoreResults_params { SQLHSTMT StatementHandle; }; -struct SQLNativeSql_params { SQLHDBC hdbc; SQLCHAR *szSqlStrIn; SQLINTEGER cbSqlStrIn; SQLCHAR *szSqlStr; SQLINTEGER cbSqlStrMax; SQLINTEGER *pcbSqlStr; }; -struct SQLNativeSqlW_params { SQLHDBC hdbc; SQLWCHAR *szSqlStrIn; SQLINTEGER cbSqlStrIn; SQLWCHAR *szSqlStr; SQLINTEGER cbSqlStrMax; SQLINTEGER *pcbSqlStr; }; -struct SQLNumParams_params { SQLHSTMT hstmt; SQLSMALLINT *pcpar; }; -struct SQLNumResultCols_params { SQLHSTMT StatementHandle; SQLSMALLINT *ColumnCount; }; -struct SQLParamData_params { SQLHSTMT StatementHandle; SQLPOINTER *Value; }; -struct SQLParamOptions_params { SQLHSTMT hstmt; SQLULEN crow; SQLULEN *pirow; }; -struct SQLPrepare_params { SQLHSTMT StatementHandle; SQLCHAR *StatementText; SQLINTEGER TextLength; }; -struct SQLPrepareW_params { SQLHSTMT StatementHandle; WCHAR *StatementText; SQLINTEGER TextLength; }; -struct SQLPrimaryKeys_params { SQLHSTMT hstmt; SQLCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLCHAR *szTableName; SQLSMALLINT cbTableName; }; -struct SQLPrimaryKeysW_params { SQLHSTMT hstmt; SQLWCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLWCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLWCHAR *szTableName; SQLSMALLINT cbTableName; }; -struct SQLProcedureColumns_params { SQLHSTMT hstmt; SQLCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLCHAR *szProcName; SQLSMALLINT cbProcName; SQLCHAR *szColumnName; SQLSMALLINT cbColumnName; }; -struct SQLProcedureColumnsW_params { SQLHSTMT hstmt; SQLWCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLWCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLWCHAR *szProcName; SQLSMALLINT cbProcName; SQLWCHAR *szColumnName; SQLSMALLINT cbColumnName; }; -struct SQLProcedures_params { SQLHSTMT hstmt; SQLCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLCHAR *szProcName; SQLSMALLINT cbProcName; }; -struct SQLProceduresW_params { SQLHSTMT hstmt; SQLWCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLWCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLWCHAR *szProcName; SQLSMALLINT cbProcName; }; -struct SQLPutData_params { SQLHSTMT StatementHandle; SQLPOINTER Data; SQLLEN StrLen_or_Ind; }; -struct SQLRowCount_params { SQLHSTMT StatementHandle; SQLLEN *RowCount; }; -struct SQLSetConnectAttr_params { SQLHDBC ConnectionHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER StringLength; }; -struct SQLSetConnectAttrW_params { SQLHDBC ConnectionHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER StringLength; }; -struct SQLSetConnectOption_params { SQLHDBC ConnectionHandle; SQLUSMALLINT Option; SQLULEN Value; }; -struct SQLSetConnectOptionW_params { SQLHDBC ConnectionHandle; SQLUSMALLINT Option; SQLULEN Value; }; -struct SQLSetCursorName_params { SQLHSTMT StatementHandle; SQLCHAR *CursorName; SQLSMALLINT NameLength; }; -struct SQLSetCursorNameW_params { SQLHSTMT StatementHandle; WCHAR *CursorName; SQLSMALLINT NameLength; }; -struct SQLSetDescField_params { SQLHDESC DescriptorHandle; SQLSMALLINT RecNumber; SQLSMALLINT FieldIdentifier; SQLPOINTER Value; SQLINTEGER BufferLength; }; -struct SQLSetDescFieldW_params { SQLHDESC DescriptorHandle; SQLSMALLINT RecNumber; SQLSMALLINT FieldIdentifier; SQLPOINTER Value; SQLINTEGER BufferLength; }; -struct SQLSetDescRec_params { SQLHDESC DescriptorHandle; SQLSMALLINT RecNumber; SQLSMALLINT Type; SQLSMALLINT SubType; SQLLEN Length; SQLSMALLINT Precision; SQLSMALLINT Scale; SQLPOINTER Data; SQLLEN *StringLength; SQLLEN *Indicator; }; -struct SQLSetEnvAttr_params { SQLHENV EnvironmentHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER StringLength; }; -struct SQLSetParam_params { SQLHSTMT StatementHandle; SQLUSMALLINT ParameterNumber; SQLSMALLINT ValueType; SQLSMALLINT ParameterType; SQLULEN LengthPrecision; SQLSMALLINT ParameterScale; SQLPOINTER ParameterValue; SQLLEN *StrLen_or_Ind; }; -struct SQLSetPos_params { SQLHSTMT hstmt; SQLSETPOSIROW irow; SQLUSMALLINT fOption; SQLUSMALLINT fLock; }; -struct SQLSetScrollOptions_params { SQLHSTMT statement_handle; SQLUSMALLINT f_concurrency; SQLLEN crow_keyset; SQLUSMALLINT crow_rowset; }; -struct SQLSetStmtAttr_params { SQLHSTMT StatementHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER StringLength; }; -struct SQLSetStmtAttrW_params { SQLHSTMT StatementHandle; SQLINTEGER Attribute; SQLPOINTER Value; SQLINTEGER StringLength; }; -struct SQLSetStmtOption_params { SQLHSTMT StatementHandle; SQLUSMALLINT Option; SQLULEN Value; }; -struct SQLSpecialColumns_params { SQLHSTMT StatementHandle; SQLUSMALLINT IdentifierType; SQLCHAR *CatalogName; SQLSMALLINT NameLength1; SQLCHAR *SchemaName; SQLSMALLINT NameLength2; SQLCHAR *TableName; SQLSMALLINT NameLength3; SQLUSMALLINT Scope; SQLUSMALLINT Nullable; }; -struct SQLSpecialColumnsW_params { SQLHSTMT StatementHandle; SQLUSMALLINT IdentifierType; SQLWCHAR *CatalogName; SQLSMALLINT NameLength1; SQLWCHAR *SchemaName; SQLSMALLINT NameLength2; SQLWCHAR *TableName; SQLSMALLINT NameLength3; SQLUSMALLINT Scope; SQLUSMALLINT Nullable; }; -struct SQLStatistics_params { SQLHSTMT StatementHandle; SQLCHAR *CatalogName; SQLSMALLINT NameLength1; SQLCHAR *SchemaName; SQLSMALLINT NameLength2; SQLCHAR *TableName; SQLSMALLINT NameLength3; SQLUSMALLINT Unique; SQLUSMALLINT Reserved; }; -struct SQLStatisticsW_params { SQLHSTMT StatementHandle; SQLWCHAR *CatalogName; SQLSMALLINT NameLength1; SQLWCHAR *SchemaName; SQLSMALLINT NameLength2; SQLWCHAR *TableName; SQLSMALLINT NameLength3; SQLUSMALLINT Unique; SQLUSMALLINT Reserved; }; -struct SQLTablePrivileges_params { SQLHSTMT hstmt; SQLCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLCHAR *szTableName; SQLSMALLINT cbTableName; }; -struct SQLTablePrivilegesW_params { SQLHSTMT hstmt; SQLWCHAR *szCatalogName; SQLSMALLINT cbCatalogName; SQLWCHAR *szSchemaName; SQLSMALLINT cbSchemaName; SQLWCHAR *szTableName; SQLSMALLINT cbTableName; }; -struct SQLTables_params { SQLHSTMT StatementHandle; SQLCHAR *CatalogName; SQLSMALLINT NameLength1; SQLCHAR *SchemaName; SQLSMALLINT NameLength2; SQLCHAR *TableName; SQLSMALLINT NameLength3; SQLCHAR *TableType; SQLSMALLINT NameLength4; }; -struct SQLTablesW_params { SQLHSTMT StatementHandle; SQLWCHAR *CatalogName; SQLSMALLINT NameLength1; SQLWCHAR *SchemaName; SQLSMALLINT NameLength2; SQLWCHAR *TableName; SQLSMALLINT NameLength3; SQLWCHAR *TableType; SQLSMALLINT NameLength4; }; -struct SQLTransact_params { SQLHENV EnvironmentHandle; SQLHDBC ConnectionHandle; SQLUSMALLINT CompletionType; }; + unix_funcs_count +}; + +struct param +{ + INT64 len; /* result length 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; +}; + +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; + INT64 *StrLen_or_Ind; +}; + +struct SQLBindParam_params +{ + UINT64 StatementHandle; + UINT16 ParameterNumber; + INT16 ValueType; + INT16 ParameterType; + UINT64 LengthPrecision; + INT16 ParameterScale; + void *ParameterValue; + INT64 *StrLen_or_Ind; +}; + +struct SQLBindParameter_params +{ + UINT64 StatementHandle; + UINT16 ParameterNumber; + INT16 InputOutputType; + INT16 ValueType; + INT16 ParameterType; + UINT64 ColumnSize; + INT16 DecimalDigits; + void *ParameterValue; + INT64 BufferLength; + INT64 *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; +};