summaryrefslogtreecommitdiff
path: root/libodbcpp/selectcommand.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-02-18 12:58:59 +0000
committerrandomdan <randomdan@localhost>2011-02-18 12:58:59 +0000
commitc3f2a299a734494a61a49709a8e4cc335570b3d3 (patch)
treeb5bf5bb8e01ad1e41ff5957c17fb60e3c353cfd9 /libodbcpp/selectcommand.cpp
parentAdd check function for when a connection is finished with, but you don't want... (diff)
downloadlibdbpp-odbc-c3f2a299a734494a61a49709a8e4cc335570b3d3.tar.bz2
libdbpp-odbc-c3f2a299a734494a61a49709a8e4cc335570b3d3.tar.xz
libdbpp-odbc-c3f2a299a734494a61a49709a8e4cc335570b3d3.zip
Handle the case when the driver tries to save more data than the buffer is big enough, and doesn't bother to mention it
Use the driver's bindSize as a hint as to how much buffer to allocate up front
Diffstat (limited to 'libodbcpp/selectcommand.cpp')
-rw-r--r--libodbcpp/selectcommand.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/libodbcpp/selectcommand.cpp b/libodbcpp/selectcommand.cpp
index 32978a4..f44472f 100644
--- a/libodbcpp/selectcommand.cpp
+++ b/libodbcpp/selectcommand.cpp
@@ -49,7 +49,7 @@ ODBC::SelectCommand::fetch(SQLSMALLINT orientation, SQLLEN offset)
if (SQL_SUCCEEDED(diagrc)) {
if (!strncmp((const char*)sqlstatus, "01004", 5)) {
for (Columns::iterator i = columns.begin(); i != columns.end(); i++) {
- (*i)->resize(hStmt);
+ (*i)->resize();
}
return fetch(SQL_FETCH_RELATIVE, 0);
}
@@ -59,10 +59,16 @@ ODBC::SelectCommand::fetch(SQLSMALLINT orientation, SQLLEN offset)
}
}
case SQL_SUCCESS:
- for (Columns::iterator i = columns.begin(); i != columns.end(); i++) {
- (*i)->onScroll();
+ {
+ bool resized = false;
+ for (Columns::iterator i = columns.begin(); i != columns.end(); i++) {
+ resized |= (*i)->resize();
+ }
+ if (resized) {
+ return fetch(SQL_FETCH_RELATIVE, 0);
+ }
+ return true;
}
- return true;
case SQL_NO_DATA:
return false;
}
@@ -115,7 +121,7 @@ ODBC::SelectCommand::execute()
columns[col] = new TimeStampColumn(this, colName, col);
break;
default:
- columns[col] = new CharArrayColumn(this, colName, col);
+ columns[col] = new CharArrayColumn(this, colName, col, bindSize);
break;
};
columns[col]->bind();