aboutsummaryrefslogtreecommitdiff
path: root/libcommon
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-05-12 11:11:45 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-07-06 09:52:33 +0200
commit5a33e95f54200e5a2cfbfd0f1584b45aa0a44105 (patch)
treebb697a26894154f07b1d56dce4cbc3dbf4e8c3db /libcommon
parentbc54b4bd56c757ec1279896b8b0639a4a9a7e0cd (diff)
Add pgsql section to create_database
Diffstat (limited to 'libcommon')
-rw-r--r--libcommon/common/common.cxx14
-rw-r--r--libcommon/common/makefile3
2 files changed, 17 insertions, 0 deletions
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 <odb/schema-catalog.hxx>
# include <odb/sqlite/database.hxx>
# include <odb/sqlite/connection-factory.hxx>
+#elif defined(DATABASE_PGSQL)
+# include <odb/pgsql/database.hxx>
+# include <odb/pgsql/connection-factory.hxx>
#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<database>
@@ -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<pgsql::connection_factory> 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 */' >>$@