aboutsummaryrefslogtreecommitdiff
path: root/odb/relational/pgsql
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-01-26 12:43:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-01-26 12:43:16 +0200
commitaf12ffe836de09ec84f666effa4df347eeb07a43 (patch)
treedc0aec9f8fee545c84be098414772cf2b277c30d /odb/relational/pgsql
parentc1d2ec5bbd5969332f3278f39d2a7a8f0abc0493 (diff)
Implement support for database schema
New pragma qualifier: namespace. New pragma specifier: schema. The table specifier was extended to accept a schema prefix. New option: --default- schema. The common/schema test was extended to cover the new functionality.
Diffstat (limited to 'odb/relational/pgsql')
-rw-r--r--odb/relational/pgsql/schema.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/odb/relational/pgsql/schema.cxx b/odb/relational/pgsql/schema.cxx
index c723818..fc79c00 100644
--- a/odb/relational/pgsql/schema.cxx
+++ b/odb/relational/pgsql/schema.cxx
@@ -29,7 +29,7 @@ namespace relational
drop_table (base const& x): base (x) {}
virtual void
- drop (string const& table)
+ drop (sema_rel::qname const& table)
{
os << "DROP TABLE IF EXISTS " << quote_id (table) <<
" CASCADE" << endl;
@@ -52,7 +52,7 @@ namespace relational
private:
friend class create_foreign_key;
- set<string> tables_; // Set of tables we have already defined.
+ set<qname> tables_; // Set of tables we have already defined.
};
entry<create_table> create_table_;
@@ -163,9 +163,23 @@ namespace relational
// Add foreign keys.
//
instance<add_foreign_key> fk (format_, *this);
- trav_rel::names n (*fk);
+ trav_rel::unames n (*fk);
names (t, n);
}
+
+ struct create_index: relational::create_index, context
+ {
+ create_index (base const& x): base (x) {}
+
+ virtual string
+ name (sema_rel::index& in)
+ {
+ // In PostgreSQL indexes cannot have a schema.
+ //
+ return quote_id (in.name ().uname ());
+ }
+ };
+ entry<create_index> create_index_;
}
}
}