summaryrefslogtreecommitdiff
path: root/odb/relational/mssql/schema.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-09-15 12:46:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-09-15 12:46:09 +0200
commit51956f409ec7ebea8b6790b0c5d4f0b51513d683 (patch)
tree66f30e68fa3c8080d0d3d8d50c30e11914fc82b9 /odb/relational/mssql/schema.cxx
parentd9ea777539b166c7347c44a6b7784626405bc029 (diff)
Cleanup polymorphic base tables when dropping derived one
Diffstat (limited to 'odb/relational/mssql/schema.cxx')
-rw-r--r--odb/relational/mssql/schema.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/odb/relational/mssql/schema.cxx b/odb/relational/mssql/schema.cxx
index 18c1f87..2480e75 100644
--- a/odb/relational/mssql/schema.cxx
+++ b/odb/relational/mssql/schema.cxx
@@ -183,20 +183,22 @@ namespace relational
drop_table (base const& x): base (x) {}
virtual void
- drop (sema_rel::qname const& table, bool migration)
+ drop (sema_rel::table& t, bool migration)
{
// SQL Server has no IF EXISTS conditional for dropping tables.
// The following approach appears to be the recommended way to
// drop a table if it exists.
//
+ sema_rel::qname const& name (t.name ());
+
pre_statement ();
if (!migration)
- os << "IF OBJECT_ID(" << quote_string (table.string ()) <<
+ os << "IF OBJECT_ID(" << quote_string (name.string ()) <<
", " << quote_string ("U") << ") IS NOT NULL" << endl
<< " ";
- os << "DROP TABLE " << quote_id (table) << endl;
+ os << "DROP TABLE " << quote_id (name) << endl;
post_statement ();
}