aboutsummaryrefslogtreecommitdiff
path: root/bulk
diff options
context:
space:
mode:
Diffstat (limited to 'bulk')
-rw-r--r--bulk/driver.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/bulk/driver.cxx b/bulk/driver.cxx
index 6a4957f..b88f614 100644
--- a/bulk/driver.cxx
+++ b/bulk/driver.cxx
@@ -22,6 +22,8 @@ main (int argc, char* argv[])
{
auto_ptr<database> db (create_database (argc, argv));
+ //@@ Run all the tests with and without auto id (templatize)
+
//person p[3];
std::vector<person> p (5, person ());
@@ -78,6 +80,30 @@ main (int argc, char* argv[])
<< pp[3]->id << endl
<< pp[4]->id << endl;
+
+ // Test error detection in batch of 1.
+ //
+ try
+ {
+ //p[0].num += 100;
+ db->persist (p.begin (), p.begin () + 1);
+ }
+ catch (const odb::multiple_exceptions& e)
+ {
+ cerr << e.what () << endl;
+ }
+
+ try
+ {
+ p[0].num += 200;
+ p[1].num += 200;
+ db->persist (p.begin (), p.begin () + 2);
+ }
+ catch (const odb::multiple_exceptions& e)
+ {
+ cerr << e.what () << endl;
+ }
+
t.commit ();
}