From 860e8a62ad439faef0d28bee669a3f8943f78fec Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 21 May 2013 18:12:57 -0400 Subject: Handle no rows case in returning UPDATE statement --- odb/mssql/statement.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/odb/mssql/statement.cxx b/odb/mssql/statement.cxx index 960a61a..4283b55 100644 --- a/odb/mssql/statement.cxx +++ b/odb/mssql/statement.cxx @@ -1042,8 +1042,9 @@ namespace odb if (!SQL_SUCCEEDED (r)) translate_error (r, conn_, stmt_); - // Fetch the row containing the id/version if this statement is - // returning. + // Fetch the row containing the version if this statement is + // returning. We still need to close the cursor even if we + // haven't updated any rows. // if (returning_version_) { @@ -1059,7 +1060,7 @@ namespace odb translate_error (r, conn_, stmt_); } - if (r == SQL_NO_DATA) + if (rows != 0 && r == SQL_NO_DATA) throw database_exception ( 0, "?????", -- cgit v1.1