From 255473612bbf9e753fa83fd7ccfd6e498175f83a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 31 Oct 2012 07:59:17 +0200 Subject: Add dynamic multi-database support excluding query --- odb/forward.hxx | 5 +++-- odb/function-table.hxx | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 odb/function-table.hxx diff --git a/odb/forward.hxx b/odb/forward.hxx index 653bdbb..18e0340 100644 --- a/odb/forward.hxx +++ b/odb/forward.hxx @@ -45,7 +45,7 @@ namespace odb // // Keep real databases first since their enumerators are used as array - // indexes + // indexes. // enum database_id { @@ -57,7 +57,8 @@ namespace odb id_default }; - // Number of real databases in the database_id enum. + // Number of real databases (i.e., excluding default) in the database_id + // enum. // const std::size_t database_count = id_default; diff --git a/odb/function-table.hxx b/odb/function-table.hxx new file mode 100644 index 0000000..b1e5987 --- /dev/null +++ b/odb/function-table.hxx @@ -0,0 +1,34 @@ +// file : odb/function-table.hxx +// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_FUNCTION_TABLE_HXX +#define ODB_FUNCTION_TABLE_HXX + +#include + +#include + +namespace odb +{ + template + struct function_table_entry + { + typedef access::object_traits_impl default_traits; + + function_table_entry ( + const typename default_traits::function_table_type* t) + { + default_traits::function_table[DB] = t; + } + + ~function_table_entry () + { + default_traits::function_table[DB] = 0; + } + }; +} + +#include + +#endif // ODB_FUNCTION_TABLE_HXX -- cgit v1.1