aboutsummaryrefslogtreecommitdiff
path: root/libcommon/common/common.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-08 16:09:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-08 16:09:08 +0200
commit3d1969a43fce72dd50044c5eada38557f3f200bd (patch)
tree8515c6a535117d4f53bc8fe59feab8129563ebb4 /libcommon/common/common.hxx
parent6b76715e63d2c265a4c51c73f9019bc578f874cb (diff)
Ground work for multi-database support
All generated code now includes database id. The database-specific database class interface has been updated to include all the database operations. The database-specific tests now use this interface.
Diffstat (limited to 'libcommon/common/common.hxx')
-rw-r--r--libcommon/common/common.hxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/libcommon/common/common.hxx b/libcommon/common/common.hxx
index 8ff02d3..2b79a5a 100644
--- a/libcommon/common/common.hxx
+++ b/libcommon/common/common.hxx
@@ -25,6 +25,18 @@ create_database (int& argc,
bool create_schema = true,
std::size_t max_connections = 0);
+template <typename T>
+std::auto_ptr<T>
+create_specific_database (int& argc,
+ char* argv[],
+ bool create_schema = true,
+ std::size_t max_connections = 0)
+{
+ std::auto_ptr<odb::database> r (
+ create_database (argc, argv, create_schema, max_connections));
+ return std::auto_ptr<T> (&dynamic_cast<T&> (*r.release ()));
+}
+
// This function returns an accurate result only if the result iterator
// hasn't been advanced.
//