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/mssql/context.cxx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'odb/relational/mssql/context.cxx') diff --git a/odb/relational/mssql/context.cxx b/odb/relational/mssql/context.cxx index 7832c24..c426d2e 100644 --- a/odb/relational/mssql/context.cxx +++ b/odb/relational/mssql/context.cxx @@ -108,13 +108,26 @@ namespace relational } string context:: - quote_id_impl (string const& id) const + quote_id_impl (qname const& id) const { string r; - r.reserve (130); // Max MSSQL identifier length is 128. - r += '['; - r.append (id, 0, 128); - r += ']'; + + bool f (true); + for (qname::iterator i (id.begin ()); i < id.end (); ++i) + { + if (i->empty ()) + continue; + + if (f) + f = false; + else + r += '.'; + + r += '['; + r.append (*i, 0, 128); // Max identifier length is 128. + r += ']'; + } + return r; } -- cgit v1.1