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/mssql/schema.cxx | |
parent | 2ad2e5500dd075db421a516502c9e522fdc34ee0 (diff) |
Add support for SQL name transformations
Diffstat (limited to 'odb/relational/mssql/schema.cxx')
-rw-r--r-- | odb/relational/mssql/schema.cxx | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/odb/relational/mssql/schema.cxx b/odb/relational/mssql/schema.cxx index 47cb250..20f9faf 100644 --- a/odb/relational/mssql/schema.cxx +++ b/odb/relational/mssql/schema.cxx @@ -80,18 +80,11 @@ namespace relational if (dt_.tables_.find (rt) != dt_.tables_.end () || m.find (rt) == m.names_end ()) { - - // In SQL Server, foreign key names are schema-global. Make them - // unique by prefixing the key name with table name. Note, however, - // that they cannot have a schema. - // - string n (t.name ().uname () + "_" + fk.name ()); - pre_statement (); - os << "IF OBJECT_ID(" << quote_string (n) << ", " << + os << "IF OBJECT_ID(" << quote_string (fk.name ()) << ", " << quote_string ("F") << ") IS NOT NULL" << endl << " ALTER TABLE " << quote_id (t.name ()) << " DROP" << endl - << " CONSTRAINT " << quote_id (n) << endl; + << " CONSTRAINT " << quote_id (fk.name ()) << endl; post_statement (); } } @@ -208,18 +201,6 @@ namespace relational } } - virtual string - name (sema_rel::foreign_key& fk) - { - // In SQL Server, foreign key names are schema-global. Make them - // unique by prefixing the key name with table name. Note, however, - // that they cannot have a schema. - // - return quote_id ( - static_cast<sema_rel::table&> (fk.scope ()).name ().uname () - + "_" + fk.name ()); - } - virtual void deferred () { |