From 5a33e95f54200e5a2cfbfd0f1584b45aa0a44105 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Thu, 12 May 2011 11:11:45 +0200 Subject: Add pgsql section to create_database --- libcommon/common/common.cxx | 14 ++++++++++++++ libcommon/common/makefile | 3 +++ 2 files changed, 17 insertions(+) diff --git a/libcommon/common/common.cxx b/libcommon/common/common.cxx index a6fa4e1..37f8424 100644 --- a/libcommon/common/common.cxx +++ b/libcommon/common/common.cxx @@ -18,6 +18,9 @@ # include # include # include +#elif defined(DATABASE_PGSQL) +# include +# include #else # error unknown database #endif @@ -31,6 +34,8 @@ using namespace odb::core; namespace mysql = odb::mysql; #elif defined(DATABASE_SQLITE) namespace sqlite = odb::sqlite; +#elif defined(DATABASE_PGSQL) +namespace pgsql = odb::pgsql; #endif auto_ptr @@ -52,6 +57,8 @@ create_database (int& argc, mysql::database::print_usage (cerr); #elif defined(DATABASE_SQLITE) sqlite::database::print_usage (cerr); +#elif defined(DATABASE_PGSQL) + pgsql::database::print_usage (cerr); #endif exit (0); @@ -84,6 +91,13 @@ create_database (int& argc, schema_catalog::create_schema (*db); t.commit (); } +#elif defined(DATABASE_PGSQL) + auto_ptr f; + + if (max_connections != 0) + f.reset (new pgsql::connection_pool_factory (max_connections)); + + db.reset (new pgsql::database (argc, argv, false, "", f)); #endif return db; diff --git a/libcommon/common/makefile b/libcommon/common/makefile index ae7d2ce..326f1f6 100644 --- a/libcommon/common/makefile +++ b/libcommon/common/makefile @@ -55,6 +55,9 @@ endif ifeq ($(db_id),sqlite) @echo '#define DATABASE_SQLITE 1' >>$@ endif +ifeq ($(db_id),pgsql) + @echo '#define DATABASE_PGSQL 1' >>$@ +endif @echo '#define HAVE_TR1_MEMORY 1' >>$@ @echo '' >>$@ @echo '#endif /* LIBCOMMON_COMMON_CONFIG_H */' >>$@ -- cgit v1.1