diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-06-21 10:39:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-06-21 10:39:59 +0200 |
commit | 6cd8b9f561b912f264ba4f723845935c40a3cb95 (patch) | |
tree | 5983e0af3d2ee621242ca6707a58c89b9914d8f0 /common/circular/multiple/driver.cxx | |
parent | 236cd9bb1dd022e64d690c9b0080d1a15c5f61c7 (diff) |
Add support for running tests in dynamic multi-database mode
Only possible in the development build system at this stage.
Diffstat (limited to 'common/circular/multiple/driver.cxx')
-rw-r--r-- | common/circular/multiple/driver.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/common/circular/multiple/driver.cxx b/common/circular/multiple/driver.cxx index cc730be..09a34e7 100644 --- a/common/circular/multiple/driver.cxx +++ b/common/circular/multiple/driver.cxx @@ -15,7 +15,6 @@ #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX #include <common/common.hxx> #include "test1.hxx" @@ -43,21 +42,19 @@ main (int argc, char* argv[]) // For these databases this is the only way to drop circularly- // dependant tables. // -#if defined(DATABASE_MYSQL) - c->execute ("SET FOREIGN_KEY_CHECKS=0"); -#elif defined(DATABASE_SQLITE) - c->execute ("PRAGMA foreign_keys=OFF"); -#endif + if (db->id () == odb::id_mysql) + c->execute ("SET FOREIGN_KEY_CHECKS=0"); + else if (db->id () == odb::id_sqlite) + c->execute ("PRAGMA foreign_keys=OFF"); transaction t (c->begin ()); schema_catalog::create_schema (*db); t.commit (); -#if defined(DATABASE_MYSQL) - c->execute ("SET FOREIGN_KEY_CHECKS=1"); -#elif defined(DATABASE_SQLITE) - c->execute ("PRAGMA foreign_keys=ON"); -#endif + if (db->id () == odb::id_mysql) + c->execute ("SET FOREIGN_KEY_CHECKS=1"); + else if (db->id () == odb::id_sqlite) + c->execute ("PRAGMA foreign_keys=ON"); } query<base> bq (query<base>::d->id != 0); |