summaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-10-21 11:22:40 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-10-21 11:47:15 +0200
commit2043035eee4f8c0f3f896082651d3a5799e90ab8 (patch)
tree35a409efec4131b1d96abdf7be6a5328e989d54c /odb
parent050822b74f51a339501970f21f00916f4deb8836 (diff)
Add schema_file implementation to support schema file header and footer hooks
Diffstat (limited to 'odb')
-rw-r--r--odb/relational/oracle/schema.cxx25
-rw-r--r--odb/relational/schema.cxx5
-rw-r--r--odb/relational/schema.hxx19
3 files changed, 49 insertions, 0 deletions
diff --git a/odb/relational/oracle/schema.cxx b/odb/relational/oracle/schema.cxx
index 8a10d2e..2eb44d6 100644
--- a/odb/relational/oracle/schema.cxx
+++ b/odb/relational/oracle/schema.cxx
@@ -53,6 +53,31 @@ namespace relational
entry<schema_emitter> schema_emitter_;
//
+ // File.
+ //
+
+ struct schema_file: relational::schema_file, context
+ {
+ schema_file (const base& x): base (x) {}
+
+ virtual void
+ pre ()
+ {
+ os << "SET FEEDBACK OFF;" << endl
+ << "WHENEVER SQLERROR EXIT FAILURE;" << endl
+ << "WHENEVER OSERROR EXIT FAILURE;" << endl
+ << endl;
+ }
+
+ virtual void
+ post ()
+ {
+ os << "EXIT;" << endl;
+ }
+ };
+ entry<schema_file> schema_file_;
+
+ //
// Drop.
//
diff --git a/odb/relational/schema.cxx b/odb/relational/schema.cxx
index 4c3bfd0..0e64408 100644
--- a/odb/relational/schema.cxx
+++ b/odb/relational/schema.cxx
@@ -130,6 +130,9 @@ namespace relational
instance<schema_emitter> emitter;
+ instance<schema_file> file;
+ file->pre ();
+
// Drop.
//
{
@@ -181,6 +184,8 @@ namespace relational
unit.dispatch (ctx.unit);
}
}
+
+ file->post ();
}
}
}
diff --git a/odb/relational/schema.hxx b/odb/relational/schema.hxx
index 6c4cdee..29d4ff9 100644
--- a/odb/relational/schema.hxx
+++ b/odb/relational/schema.hxx
@@ -78,6 +78,25 @@ namespace relational
};
//
+ // File.
+ //
+
+ struct schema_file: virtual context
+ {
+ typedef schema_file base;
+
+ virtual void
+ pre ()
+ {
+ }
+
+ virtual void
+ post ()
+ {
+ }
+ };
+
+ //
// Drop.
//