diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-12-12 11:26:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-12-12 11:26:44 +0200 |
commit | a5f24411433aeb61ad015129354a664820affab0 (patch) | |
tree | 25fb5a97c0c070b78c9318f1da3dcbc484785918 /odb/relational/processor.cxx | |
parent | 2ad2e5500dd075db421a516502c9e522fdc34ee0 (diff) |
Add support for SQL name transformations
Diffstat (limited to 'odb/relational/processor.cxx')
-rw-r--r-- | odb/relational/processor.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx index 88e86fc..3e969be 100644 --- a/odb/relational/processor.cxx +++ b/odb/relational/processor.cxx @@ -1106,6 +1106,11 @@ namespace relational } } + // Add the table prefix if this database has global index names. + // + if (!in.name.empty () && global_index) + in.name = table_name_prefix (c.scope ()) + in.name; + // Handle container indexes. // if (j != in.members.end ()) @@ -1164,12 +1169,14 @@ namespace relational // be empty, in which case we will just fall back on the // member's public name. // - in.name = column_name (in.members.front ().path); + string n (column_prefix (in.members.front ().path, true).prefix); - if (in.name.empty ()) - in.name = public_name_db (*in.members.front ().path.back ()); + if (n.empty ()) + n = public_name_db (*in.members.front ().path.back ()); + else if (n[n.size () - 1] == '_') + n.resize (n.size () - 1); // Remove trailing underscore. - in.name = compose_name (in.name, "i"); + in.name = index_name (table_name (c), n); } ++i; |