Skip to content

Commit

Permalink
Added statement unbinding before statement handle cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Chapligin committed Feb 5, 2013
1 parent 14e7f09 commit 368f2ad
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/backends/db2/statement.cpp
Expand Up @@ -34,7 +34,20 @@ void db2_statement_backend::alloc()

void db2_statement_backend::clean_up()
{
SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
SQLRETURN cliRC = SQL_SUCCESS;

cliRC=SQLFreeStmt(hStmt,SQL_CLOSE);
if (cliRC != SQL_SUCCESS) {
throw db2_soci_error(db2_soci_error::sqlState("Statement handle close error",SQL_HANDLE_STMT,hStmt),cliRC);
}
cliRC=SQLFreeStmt(hStmt,SQL_UNBIND);
if (cliRC != SQL_SUCCESS) {
throw db2_soci_error(db2_soci_error::sqlState("Statement handle unbind error",SQL_HANDLE_STMT,hStmt),cliRC);
}
cliRC=SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
if (cliRC != SQL_SUCCESS) {
throw db2_soci_error(db2_soci_error::sqlState("Statement handle clean-up error",SQL_HANDLE_STMT,hStmt),cliRC);
}
}

void db2_statement_backend::prepare(std::string const & query ,
Expand Down

0 comments on commit 368f2ad

Please sign in to comment.