From 3d1969a43fce72dd50044c5eada38557f3f200bd Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Mon, 8 Oct 2012 16:09:08 +0200
Subject: 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.
---
 libcommon/common/common.hxx | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'libcommon')

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.
 //
-- 
cgit v1.1