aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-04-07 10:13:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-04-10 18:46:44 +0200
commit2fa6a4d00945866e62d980270d5807f3abca75ab (patch)
treef8eaf6760c2b18ff39962f4145df57b6fe5d9afa
parentbb111ac2fdff909ed0f91d6f1f65c05aaf984936 (diff)
Don't throw null_pointer on load operations
This can be useful during migration. Plus this should be enforced by the database.
-rw-r--r--doc/manual.xhtml3
-rw-r--r--odb/relational/source.hxx9
2 files changed, 7 insertions, 5 deletions
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index 52c4f02..e9471fd 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -6082,7 +6082,8 @@ class employee
};
</pre>
- <p>In this case, if we perform a database operation on the
+ <p>In this case, if we call either <code>persist()</code> or
+ <code>update()</code> database function on the
<code>employee</code> object and the <code>current_employer_</code>
pointer or one of the pointers stored in the
<code>previous_employers_</code> container is <code>NULL</code>,
diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx
index 0b50788..22f78a7 100644
--- a/odb/relational/source.hxx
+++ b/odb/relational/source.hxx
@@ -1653,10 +1653,11 @@ namespace relational
os << ")" << endl;
- if (!null (mi.m, key_prefix_) )
- os << "throw null_pointer ();";
- else
- os << member << " = ptr_traits::pointer_type ();";
+ // Don't throw null_pointer if we can't have NULLs and the pointer
+ // is NULL since this can be useful during migration. Instead, we
+ // rely on the database enforcing this.
+ //
+ os << member << " = ptr_traits::pointer_type ();";
os << "else"
<< "{";