aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/context.cxx16
-rw-r--r--odb/context.hxx7
-rw-r--r--odb/processor.cxx6
-rw-r--r--odb/relational/processor.cxx2
4 files changed, 23 insertions, 8 deletions
diff --git a/odb/context.cxx b/odb/context.cxx
index ef6ef9c..dfd75f6 100644
--- a/odb/context.cxx
+++ b/odb/context.cxx
@@ -1051,6 +1051,14 @@ class_fq_name (semantics::class_& c)
: c.fq_name ();
}
+semantics::scope& context::
+class_scope (semantics::class_& c)
+{
+ return c.is_a<semantics::class_instantiation> ()
+ ? c.get<semantics::names*> ("tree-hint")->scope ()
+ : c.scope ();
+}
+
semantics::path context::
class_file (semantics::class_& c)
{
@@ -1310,8 +1318,8 @@ table_prefix (semantics::class_& c)
{
context& ctx (context::current ());
- ns_schema = ctx.schema (c.scope ());
- ns_prefix = ctx.table_name_prefix (c.scope ());
+ ns_schema = ctx.schema (class_scope (c));
+ ns_prefix = ctx.table_name_prefix (class_scope (c));
prefix = ctx.table_name (c, &derived);
prefix += "_";
}
@@ -1530,14 +1538,14 @@ table_name (semantics::class_& c, bool* pd) const
//
if (!r.fully_qualified ())
{
- qname n (schema (c.scope ()));
+ qname n (schema (class_scope (c)));
n.append (r);
n.swap (r);
}
// Add the table prefix if any.
//
- r.uname () = table_name_prefix (c.scope ()) + r.uname ();
+ r.uname () = table_name_prefix (class_scope (c)) + r.uname ();
if (derived)
r.uname () = transform_name (r.uname (), sql_name_table);
diff --git a/odb/context.hxx b/odb/context.hxx
index 41428d0..0af3b3c 100644
--- a/odb/context.hxx
+++ b/odb/context.hxx
@@ -1049,6 +1049,13 @@ public:
static string
class_fq_name (semantics::class_&);
+ // Return class scope. For ordinary classes, this will be the scope
+ // where the class is defined. For class template instantiations this
+ // will be the scope of the typedef name used in the pragma.
+ //
+ static semantics::scope&
+ class_scope (semantics::class_&);
+
// Return the class file. For ordinary classes, this will be the file
// where the class is defined. For class template instantiations this
// will be the file containing the pragma.
diff --git a/odb/processor.cxx b/odb/processor.cxx
index a08d986..cdfd883 100644
--- a/odb/processor.cxx
+++ b/odb/processor.cxx
@@ -2184,7 +2184,7 @@ namespace
// the session value.
//
bool found (false);
- for (semantics::scope* s (&c.scope ());; s = &s->scope_ ())
+ for (semantics::scope* s (&class_scope (c));; s = &s->scope_ ())
{
using semantics::namespace_;
@@ -2667,7 +2667,7 @@ namespace
// See if any of the namespaces containing this class specify
// a pointer.
//
- for (semantics::scope* s (&c.scope ());; s = &s->scope_ ())
+ for (semantics::scope* s (&class_scope (c));; s = &s->scope_ ())
{
using semantics::namespace_;
@@ -2754,7 +2754,7 @@ namespace
// Resolve scope is the scope of the class.
//
- resolve_scope = c.scope ().tree_node ();
+ resolve_scope = class_scope (c).tree_node ();
}
}
diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx
index 633f4b0..d32f8e5 100644
--- a/odb/relational/processor.cxx
+++ b/odb/relational/processor.cxx
@@ -1136,7 +1136,7 @@ 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;
+ in.name = table_name_prefix (class_scope (c)) + in.name;
// Handle container indexes.
//