aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-05-21 18:12:57 -0400
committerBoris Kolpackov <boris@codesynthesis.com>2013-05-21 18:12:57 -0400
commit4964bf912004c9190421ef573df6d1df4897e64c (patch)
treeb517b39ffc657fd79a37834eac4e9639da7fceae
parent5ad792c3b4ee4d2cc558f320c0c26210e4fa31bf (diff)
Handle no rows case in returning UPDATE statement
-rw-r--r--mssql/types/driver.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/mssql/types/driver.cxx b/mssql/types/driver.cxx
index 1c2d7d8..33b606e 100644
--- a/mssql/types/driver.cxx
+++ b/mssql/types/driver.cxx
@@ -9,6 +9,7 @@
#include <cassert>
#include <iostream>
+#include <odb/exceptions.hxx>
#include <odb/mssql/database.hxx>
#include <odb/mssql/transaction.hxx>
@@ -285,8 +286,17 @@ main (int argc, char* argv[])
p->str += 'd';
db->update (*p);
assert (p->version > o.version);
+ o.str += 'D';
+ try
+ {
+ db->update (o);
+ assert (false);
+ }
+ catch (const odb::object_changed&) {}
db->reload (o);
assert (o.version == p->version);
+ o.str += 'D';
+ db->update (o);
t.commit ();
}
}