aboutsummaryrefslogtreecommitdiff
path: root/common/relationship/on-delete/test.hxx
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
commit4f22837bda784e29f17750c8f1d623b40c1093d4 (patch)
tree136b42d29c180fb52a1327ea61894025770d0f90 /common/relationship/on-delete/test.hxx
parent33a8e17efb8c622413a861047c5c4589a9828f62 (diff)
Implement on_delete pragma for object pointers
Translates to the ON DELETE SQL clause.
Diffstat (limited to 'common/relationship/on-delete/test.hxx')
-rw-r--r--common/relationship/on-delete/test.hxx59
1 files changed, 59 insertions, 0 deletions
diff --git a/common/relationship/on-delete/test.hxx b/common/relationship/on-delete/test.hxx
new file mode 100644
index 0000000..dba04c3
--- /dev/null
+++ b/common/relationship/on-delete/test.hxx
@@ -0,0 +1,59 @@
+// file : common/relationship/on-delete/test.hxx
+// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <vector>
+
+#include <odb/core.hxx>
+
+#pragma db object
+struct object
+{
+ #pragma db id auto
+ unsigned long id;
+};
+
+#pragma db object
+struct cascade
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(cascade)
+ object* p;
+};
+
+#pragma db object
+struct cascade_cont
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(cascade)
+ std::vector<object*> p;
+};
+
+#pragma db object
+struct set_null
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(set_null)
+ object* p;
+};
+
+#pragma db object
+struct set_null_cont
+{
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db on_delete(set_null)
+ std::vector<object*> p;
+};
+
+#endif // TEST_HXX