diff options
-rw-r--r-- | libodbcpp/selectcommand.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libodbcpp/selectcommand.cpp b/libodbcpp/selectcommand.cpp index 26b6b45..a1a5531 100644 --- a/libodbcpp/selectcommand.cpp +++ b/libodbcpp/selectcommand.cpp @@ -16,10 +16,12 @@ ODBC::SelectCommand::~SelectCommand() delete *i; } } - RETCODE rc; - if ((rc = SQLCloseCursor(hStmt)) != SQL_SUCCESS) { - throw Error(rc, SQL_HANDLE_STMT, hStmt, "%s: SQLCloseCursor", - __FUNCTION__); + if (columns.size()) { + RETCODE rc; + if ((rc = SQLCloseCursor(hStmt)) != SQL_SUCCESS) { + throw Error(rc, SQL_HANDLE_STMT, hStmt, "%s: SQLCloseCursor", + __FUNCTION__); + } } } |