diff options
Diffstat (limited to 'evolution/drop-table/driver.cxx')
-rw-r--r-- | evolution/drop-table/driver.cxx | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/evolution/drop-table/driver.cxx b/evolution/drop-table/driver.cxx index 0a005b5..9f60214 100644 --- a/evolution/drop-table/driver.cxx +++ b/evolution/drop-table/driver.cxx @@ -41,8 +41,6 @@ main (int argc, char* argv[]) { case 1: { - using namespace v2; - if (embedded) { transaction t (db->begin ()); @@ -53,19 +51,45 @@ main (int argc, char* argv[]) t.commit (); } - object1 o1; - o1.o = new object (1); - o1.o->str = "abc"; - o1.nums.push_back (1); - o1.nums.push_back (2); - o1.nums.push_back (3); + { + using namespace v2; + + object1 o1; + o1.o = new object (1); + o1.o->str = "abc"; + o1.nums.push_back (1); + o1.nums.push_back (2); + o1.nums.push_back (3); + + { + transaction t (db->begin ()); + db->persist (o1.o); + db->persist (o1); + t.commit (); + } + } + // Polymorphism test. + // { - transaction t (db->begin ()); - db->persist (o1.o); - db->persist (o1); - t.commit (); + // We have to use v3 here because the discriminator includes + // the namespace. + // + using namespace v3; + + base b (123, "abc"); + derived d1 (234, "bcd"); + derived d2 (345, "cde"); + + { + transaction t (db->begin ()); + db->persist (b); + db->persist (d1); + db->persist (d2); + t.commit (); + } } + break; } case 2: @@ -104,6 +128,7 @@ main (int argc, char* argv[]) schema_catalog::migrate_schema_post (*db, 3); t.commit (); } + break; } case 3: @@ -119,6 +144,15 @@ main (int argc, char* argv[]) t.commit (); } + // Polymorphism test. + // + { + transaction t (db->begin ()); + assert (size (db->query<root> ()) == 1); + assert (size (db->query<base> ()) == 1); + t.commit (); + } + break; } default: |