aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-05-21 18:12:57 -0400
committerBoris Kolpackov <boris@codesynthesis.com>2013-06-21 11:15:13 +0200
commit860e8a62ad439faef0d28bee669a3f8943f78fec (patch)
treef7e0e3e46fb7704c21eeb22d09e123e73ab6b517
parentc3c82a4c2ed3d82bb23eef9cd1aee181756d7015 (diff)
Handle no rows case in returning UPDATE statement
-rw-r--r--odb/mssql/statement.cxx7
1 files 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,
"?????",