diff options
author | randomdan <randomdan@localhost> | 2010-09-13 19:57:25 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2010-09-13 19:57:25 +0000 |
commit | 95bc5ac789c2f29220f76c94fc93d6379dcd00c6 (patch) | |
tree | 2af19c25a48dfb13b2db681544ad6fa82407c567 /libodbcpp/command.cpp | |
parent | Use the right header for BUFSIZ (diff) | |
download | libdbpp-odbc-95bc5ac789c2f29220f76c94fc93d6379dcd00c6.tar.bz2 libdbpp-odbc-95bc5ac789c2f29220f76c94fc93d6379dcd00c6.tar.xz libdbpp-odbc-95bc5ac789c2f29220f76c94fc93d6379dcd00c6.zip |
Remove duplication in ODBC::Connection constructors
Remove pointless specialisation on _Column for strings
Set cursor type to scrollable (required to refetch a row)
Resize binds if fetched data is truncated
Support scrolling fetch (default is old 'next record' behaviour)
Diffstat (limited to 'libodbcpp/command.cpp')
-rw-r--r-- | libodbcpp/command.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libodbcpp/command.cpp b/libodbcpp/command.cpp index 4ceb825..50dd679 100644 --- a/libodbcpp/command.cpp +++ b/libodbcpp/command.cpp @@ -11,6 +11,10 @@ ODBC::Command::Command(const Connection & c, const std::string & s) : if (rc != SQL_SUCCESS) { throw Error(rc, SQL_HANDLE_STMT, hStmt, "Allocate statement handle"); } + rc = SQLSetStmtAttr(hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_CURSOR_DYNAMIC, 0); + if ((rc != SQL_SUCCESS)) { + throw ConnectionError(rc, SQL_HANDLE_STMT, hStmt, "Set scrollable cursor"); + } rc = SQLPrepare(hStmt, (SQLCHAR*)sql.c_str(), sql.length()); if (rc != SQL_SUCCESS) { SQLFreeHandle(SQL_HANDLE_STMT, hStmt); |