From af12ffe836de09ec84f666effa4df347eeb07a43 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 26 Jan 2012 12:43:16 +0200 Subject: 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. --- odb/relational/pgsql/schema.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'odb/relational/pgsql') 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 tables_; // Set of tables we have already defined. + set tables_; // Set of tables we have already defined. }; entry create_table_; @@ -163,9 +163,23 @@ namespace relational // Add foreign keys. // instance 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_; } } } -- cgit v1.1