From 95bc5ac789c2f29220f76c94fc93d6379dcd00c6 Mon Sep 17 00:00:00 2001 From: randomdan Date: Mon, 13 Sep 2010 19:57:25 +0000 Subject: 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) --- libodbcpp/command.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libodbcpp/command.cpp') 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); -- cgit v1.2.3