aboutsummaryrefslogtreecommitdiff
path: root/odb/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-24 17:11:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-24 17:11:43 +0200
commitaaf47c94726ed05ca8c6790f0946e341125e7eb4 (patch)
treea31f162f2e4007069e5bec84e267f02d7f8eb923 /odb/context.cxx
parente799a139472a76234ccbdedd5c423ced4c478a86 (diff)
Don't append table prefix to names that already have it (container tables)
Diffstat (limited to 'odb/context.cxx')
-rw-r--r--odb/context.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/odb/context.cxx b/odb/context.cxx
index 68e3f65..9d89879 100644
--- a/odb/context.cxx
+++ b/odb/context.cxx
@@ -372,7 +372,13 @@ table_name (semantics::class_& t) const
string context::
table_name (semantics::data_member& m, table_prefix const& p) const
{
- string name (options.table_prefix ());
+ // The table prefix passed as the second argument must include
+ // the table prefix specified with the --table-prefix option.
+ //
+ string const& gp (options.table_prefix ());
+ assert (p.prefix.compare (0, gp.size (), gp) == 0);
+
+ string name;
// If a custom table name was specified, then ignore the top-level
// table prefix.
@@ -380,13 +386,15 @@ table_name (semantics::data_member& m, table_prefix const& p) const
if (m.count ("table"))
{
if (p.level != 1)
- name += p.prefix;
+ name = p.prefix;
+ else
+ name = gp;
name += m.get<string> ("table");
}
else
{
- name += p.prefix;
+ name = p.prefix;
name += public_name_db (m);
}