aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-12-01 14:36:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-12-01 14:36:39 +0200
commit16ebe8f2b2464c682848cb3d8ef7168586779700 (patch)
tree242ede30b299b6473eb9c9bb144d14c9ba4f9cb4 /odb/mysql
parentce46e20efba053e914986f20e578d90ab2e42751 (diff)
Implement not_null pointer pragma
New exception: null_pointer.
Diffstat (limited to 'odb/mysql')
-rw-r--r--odb/mysql/source.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/odb/mysql/source.cxx b/odb/mysql/source.cxx
index 60b1296..6f159c2 100644
--- a/odb/mysql/source.cxx
+++ b/odb/mysql/source.cxx
@@ -796,8 +796,14 @@ namespace mysql
if (!comp_value (mi.t))
{
if (object_pointer (mi.m, key_prefix_))
+ {
os << "}";
+ if (!null_pointer (mi.m, key_prefix_))
+ os << "else" << endl
+ << "throw null_pointer ();";
+ }
+
os << "i." << mi.var << "null = is_null;"
<< "}";
}
@@ -1022,9 +1028,14 @@ namespace mysql
<< "typedef pointer_traits< " << mi.fq_type () <<
" > ptr_traits;"
<< endl
- << "if (i." << mi.var << "null)" << endl
- << member << " = ptr_traits::pointer_type ();"
- << "else"
+ << "if (i." << mi.var << "null)" << endl;
+
+ if (null_pointer (mi.m, key_prefix_))
+ os << member << " = ptr_traits::pointer_type ();";
+ else
+ os << "throw null_pointer ();";
+
+ os << "else"
<< "{"
<< type << " id;";