From 16ebe8f2b2464c682848cb3d8ef7168586779700 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 1 Dec 2010 14:36:39 +0200 Subject: Implement not_null pointer pragma New exception: null_pointer. --- odb/mysql/source.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'odb/mysql') 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;"; -- cgit v1.1