From c1877f84f3596f67245abe6658b08c050bd1e686 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 4 Sep 2012 11:22:07 +0200 Subject: NULL handling improvements Add support for specifying NULL-ness for types with built-in mapping. Handle Oracle [N]VARCHAR2 and SQLite FLOAT oddities using this mechanism instead of overriding it at the schema generation level. Also use the is_null argument that is passed to value_traits::init_image() to indicate whether the value can be NULL. --- odb/relational/source.hxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'odb/relational/source.hxx') diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index 3ad463b..21954e0 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -1298,7 +1298,11 @@ namespace relational else { type = mi.fq_type (); - os << "bool is_null;"; + + // Indicate to the value_traits whether this column can be NULL. + // + os << "bool is_null (" << + (null (mi.m, key_prefix_) ? "true" : "false") << ");"; } if (comp) -- cgit v1.1