diff options
author | randomdan <randomdan@localhost> | 2011-02-16 11:08:15 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2011-02-16 11:08:15 +0000 |
commit | c39b0b6fcd769403397af247b3ccdbe3df1a60f2 (patch) | |
tree | b4df627645a2f6eaf51fe46912b7960ef225b2b4 /libodbcpp/selectcommand.cpp | |
parent | Fixes to compile with all gcc warnings as errors (diff) | |
download | libdbpp-odbc-c39b0b6fcd769403397af247b3ccdbe3df1a60f2.tar.bz2 libdbpp-odbc-c39b0b6fcd769403397af247b3ccdbe3df1a60f2.tar.xz libdbpp-odbc-c39b0b6fcd769403397af247b3ccdbe3df1a60f2.zip |
Fix the case when a bound buffer is too small and it's reported as success with info, not error (when did this start happening?)
Diffstat (limited to 'libodbcpp/selectcommand.cpp')
-rw-r--r-- | libodbcpp/selectcommand.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libodbcpp/selectcommand.cpp b/libodbcpp/selectcommand.cpp index 2153862..32978a4 100644 --- a/libodbcpp/selectcommand.cpp +++ b/libodbcpp/selectcommand.cpp @@ -41,14 +41,7 @@ ODBC::SelectCommand::fetch(SQLSMALLINT orientation, SQLLEN offset) } RETCODE rc = SQLFetchScroll(hStmt, orientation, offset); switch (rc) { - case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO: - for (Columns::iterator i = columns.begin(); i != columns.end(); i++) { - (*i)->onScroll(); - } - return true; - case SQL_NO_DATA: - return false; default: { SQLCHAR sqlstatus[6]; @@ -61,8 +54,17 @@ ODBC::SelectCommand::fetch(SQLSMALLINT orientation, SQLLEN offset) return fetch(SQL_FETCH_RELATIVE, 0); } } + if (rc != SQL_SUCCESS_WITH_INFO) { + throw Error(rc, SQL_HANDLE_STMT, hStmt, "ODBC::SelectCommand::fetch SQLFetch"); + } } - throw Error(rc, SQL_HANDLE_STMT, hStmt, "ODBC::SelectCommand::fetch SQLFetch"); + case SQL_SUCCESS: + for (Columns::iterator i = columns.begin(); i != columns.end(); i++) { + (*i)->onScroll(); + } + return true; + case SQL_NO_DATA: + return false; } } |