Changeset: 1962142fc6d2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1962142fc6d2 Modified Files: clients/odbc/driver/SQLError.c sql/odbc/tests/Tests/ODBCconnect.py Branch: Aug2024 Log Message:
Fix SQLErrorW: odbc errors start at 1, not 0 diffs (51 lines): diff --git a/clients/odbc/driver/SQLError.c b/clients/odbc/driver/SQLError.c --- a/clients/odbc/driver/SQLError.c +++ b/clients/odbc/driver/SQLError.c @@ -125,19 +125,19 @@ SQLErrorW(SQLHENV EnvironmentHandle, if (StatementHandle) rc = MNDBGetDiagRec(SQL_HANDLE_STMT, StatementHandle, - ((ODBCStmt *) StatementHandle)->RetrievedErrors, + ++((ODBCStmt *) StatementHandle)->RetrievedErrors, state, NativeErrorPtr, errmsg, (SQLSMALLINT) sizeof(errmsg), &n); else if (ConnectionHandle) rc = MNDBGetDiagRec(SQL_HANDLE_DBC, ConnectionHandle, - ((ODBCDbc *) ConnectionHandle)->RetrievedErrors, + ++((ODBCDbc *) ConnectionHandle)->RetrievedErrors, state, NativeErrorPtr, errmsg, (SQLSMALLINT) sizeof(errmsg), &n); else if (EnvironmentHandle) rc = MNDBGetDiagRec(SQL_HANDLE_ENV, EnvironmentHandle, - ((ODBCEnv *) EnvironmentHandle)->RetrievedErrors, + ++((ODBCEnv *) EnvironmentHandle)->RetrievedErrors, state, NativeErrorPtr, errmsg, (SQLSMALLINT) sizeof(errmsg), &n); else diff --git a/sql/odbc/tests/Tests/ODBCconnect.py b/sql/odbc/tests/Tests/ODBCconnect.py --- a/sql/odbc/tests/Tests/ODBCconnect.py +++ b/sql/odbc/tests/Tests/ODBCconnect.py @@ -254,6 +254,21 @@ ex.expect('RESULT') ex.expect('- ;') # the second connection does not have a Client Remark ex.end() +# test error handling when -w is given + +# first without the -w to demonstrate the expected behavior +ex = Execution('-d', f'Driver={{MonetDB}};User={user};Password={password};Database={dbname + "-Wrong"}') +ex.expect_fail() +ex.expect('Error') +ex.expect('08001') # something wrong with the database +ex.end() +# then with the -w +ex = Execution('-w', '-d', f'Driver={{MonetDB}};User={user};Password={password};Database={dbname + "-Wrong"}') +ex.expect_fail() +ex.expect('Error') +ex.expect('08001') # something wrong with the database +ex.end() + # test wide characters ex = Execution('-w', '-d', f'DSN={dsn};Client Remark={unicode_text}') # expect OK followed by connection string containing the rainbow _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org