summaryrefslogtreecommitdiff
path: root/libodbcpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-02-16 11:08:15 +0000
committerrandomdan <randomdan@localhost>2011-02-16 11:08:15 +0000
commitc39b0b6fcd769403397af247b3ccdbe3df1a60f2 (patch)
treeb4df627645a2f6eaf51fe46912b7960ef225b2b4 /libodbcpp
parentFixes to compile with all gcc warnings as errors (diff)
downloadlibdbpp-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')
-rw-r--r--libodbcpp/selectcommand.cpp18
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;
}
}