From 9342cafc3348730d47e2e14be05a9e7628aebe4c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 11 Nov 2014 10:19:23 +0200 Subject: Complete initial bulk erase() implementation --- bulk/driver.cxx | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'bulk') diff --git a/bulk/driver.cxx b/bulk/driver.cxx index b0b259a..77d71e9 100644 --- a/bulk/driver.cxx +++ b/bulk/driver.cxx @@ -99,6 +99,9 @@ main (int argc, char* argv[]) t.commit (); } + // Erase via id. + // +#if 0 { transaction t (db->begin ()); @@ -106,15 +109,67 @@ main (int argc, char* argv[]) pp[0]->id, pp[1]->id, pp[2]->id, + /* pp[3]->id, pp[4]->id, + */ 123 + + /* + 123, + pp[4]->id, + 125, + + 126, + pp[3]->id, + 127 + */ }; db->erase (ids, ids + sizeof (ids)/sizeof (ids[0])); t.commit (); } +#endif + + + // Erase via references/pointers. + // + { + transaction t (db->begin ()); + + //db->erase (p.begin (), p.end ()); + + /* + { + const std::vector& cp (p); + db->erase (cp.begin (), cp.end ()); + } + */ + + //db->erase (pp.begin (), pp.end ()); + + /* + { + const std::vector& cpp (pp); + db->erase (cpp.begin (), cpp.end ()); + } + */ + + { + auto_ptr a[2]; + a[0].reset (new person); + a[1].reset (new person); + + a[0]->id = 1; + a[1]->id = 2; + + db->erase (a, a + sizeof (a) / sizeof (a[0])); + } + + t.commit (); + } + } catch (const odb::exception& e) { -- cgit v1.1