From 016533505b79290b43bb89b3beee569c7fb033f5 Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 11 Jun 2010 12:30:06 +0000 Subject: Fix odbc select destructor when cursor not opened Add support for subqueries --- libodbcpp/selectcommand.cpp | 10 ++++++---- 1 file 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__); + } } } -- cgit v1.2.3