summaryrefslogtreecommitdiff
path: root/odb/relational/mssql
diff options
context:
space:
mode:
Diffstat (limited to 'odb/relational/mssql')
-rw-r--r--odb/relational/mssql/context.cxx2
-rw-r--r--odb/relational/mssql/schema.cxx23
-rw-r--r--odb/relational/mssql/source.cxx10
3 files changed, 12 insertions, 23 deletions
diff --git a/odb/relational/mssql/context.cxx b/odb/relational/mssql/context.cxx
index 7e11564..c64ae57 100644
--- a/odb/relational/mssql/context.cxx
+++ b/odb/relational/mssql/context.cxx
@@ -88,6 +88,8 @@ namespace relational
insert_send_auto_id = false;
delay_freeing_statement_result = true;
need_image_clone = true;
+ global_index = false;
+ global_fkey = true;
data_->bind_vector_ = "mssql::bind*";
// Populate the C++ type to DB type map.
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 ()
{
diff --git a/odb/relational/mssql/source.cxx b/odb/relational/mssql/source.cxx
index 7fce155..5d0c594 100644
--- a/odb/relational/mssql/source.cxx
+++ b/odb/relational/mssql/source.cxx
@@ -909,8 +909,14 @@ namespace relational
}
if (p == persist_after_columns)
- os << strlit (" OUTPUT " + convert_from (
- "INSERTED." + column_qname (*id), *id)) << endl;
+ {
+ // Top-level auto id.
+ //
+ os << strlit (
+ " OUTPUT " + convert_from (
+ "INSERTED." + column_qname (
+ *id, column_prefix ()), *id)) << endl;
+ }
}
virtual void