From e440e73a889c8929730632d62ebc84e32475b549 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Wed, 13 Jul 2011 11:03:13 +0200 Subject: Add PostgreSQL --- schema/custom/database.hxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'schema/custom/database.hxx') diff --git a/schema/custom/database.hxx b/schema/custom/database.hxx index 932e6c4..82441b7 100644 --- a/schema/custom/database.hxx +++ b/schema/custom/database.hxx @@ -1,4 +1,4 @@ -// file : schema/custom/database.hxx +// file : template/database.hxx // author : Boris Kolpackov // copyright : not copyrighted - public domain @@ -20,6 +20,8 @@ # include #elif defined(DATABASE_SQLITE) # include +#elif defined(DATABASE_PGSQL) +# include #endif inline std::auto_ptr @@ -37,6 +39,8 @@ create_database (int& argc, char* argv[]) odb::mysql::database::print_usage (cerr); #elif defined(DATABASE_SQLITE) odb::sqlite::database::print_usage (cerr); +#elif defined(DATABASE_PGSQL) + odb::pgsql::database::print_usage (cerr); #endif exit (0); @@ -48,6 +52,16 @@ create_database (int& argc, char* argv[]) auto_ptr db ( new odb::sqlite::database ( argc, argv, false, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); + + // Create the database schema. + // + { + transaction t (db->begin ()); + schema_catalog::create_schema (*db); + t.commit (); + } +#elif defined(DATABASE_PGSQL) + auto_ptr db (new odb::pgsql::database (argc, argv)); #endif return db; -- cgit v1.1