summaryrefslogtreecommitdiff
path: root/odb/relational/mssql/schema.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-12-04 11:30:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-12-04 11:30:33 +0200
commit3417fc7c0df3b1b01750874587c4f3bb2ef02f45 (patch)
treea35f2439f7f72212d8ad05d3b8175e992d9a917f /odb/relational/mssql/schema.cxx
parenta0bf13c2522cc9c029af53f40970a3d0c19e178f (diff)
Implement on_delete pragma for object pointers
Translates to the ON DELETE SQL clause.
Diffstat (limited to 'odb/relational/mssql/schema.cxx')
-rw-r--r--odb/relational/mssql/schema.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/odb/relational/mssql/schema.cxx b/odb/relational/mssql/schema.cxx
index 2480e75..7b6c7ca 100644
--- a/odb/relational/mssql/schema.cxx
+++ b/odb/relational/mssql/schema.cxx
@@ -237,6 +237,20 @@ namespace relational
{
create_foreign_key (base const& x): base (x) {}
+ void
+ diagnose (sema_rel::foreign_key& fk)
+ {
+ if (fk.on_delete () != sema_rel::foreign_key::no_action)
+ {
+ cerr << "warning: foreign key '" << fk.name () << "' has " <<
+ "ON DELETE clause but is disabled in SQL Server due to lack "
+ "of deferrable constraint support" << endl;
+
+ cerr << "info: consider using non-deferrable foreign keys (" <<
+ "--fkeys-deferrable-mode)" << endl;
+ }
+ }
+
virtual void
traverse_create (sema_rel::foreign_key& fk)
{
@@ -248,6 +262,8 @@ namespace relational
base::traverse_create (fk);
else
{
+ diagnose (fk);
+
// Don't bloat C++ code with comment strings if we are
// generating embedded schema.
//
@@ -268,6 +284,9 @@ namespace relational
{
bool c (!fk.not_deferrable () && !in_comment);
+ if (c)
+ diagnose (fk);
+
if (c && format_ != schema_format::sql)
return;