From be97326d67365e16175cc599e23348feaf80e0fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 8 Oct 2012 16:09:07 +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. --- odb/schema-catalog.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'odb/schema-catalog.cxx') diff --git a/odb/schema-catalog.cxx b/odb/schema-catalog.cxx index 7f00c3c..cd1ded4 100644 --- a/odb/schema-catalog.cxx +++ b/odb/schema-catalog.cxx @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -19,8 +20,9 @@ namespace odb // for example, for foreign key generation. // typedef bool (*create_function) (database&, unsigned short pass, bool drop); + typedef pair key; typedef vector create_functions; - struct schema_catalog_impl: map {}; + struct schema_catalog_impl: map {}; schema_catalog_impl* schema_catalog_init::catalog = 0; size_t schema_catalog_init::count = 0; @@ -29,8 +31,7 @@ namespace odb create_schema (database& db, const string& name) { const schema_catalog_impl& c (*schema_catalog_init::catalog); - - schema_catalog_impl::const_iterator i (c.find (name)); + schema_catalog_impl::const_iterator i (c.find (key (db.id (), name))); if (i == c.end ()) throw unknown_schema (name); @@ -94,9 +95,9 @@ namespace odb // schema_catalog_entry // schema_catalog_entry:: - schema_catalog_entry (const char* name, create_function entry) + schema_catalog_entry (database_id id, const char* name, create_function cf) { schema_catalog_impl& c (*schema_catalog_init::catalog); - c[name].push_back (entry); + c[key(id, name)].push_back (cf); } } -- cgit v1.1