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/context.hxx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'odb/context.hxx') diff --git a/odb/context.hxx b/odb/context.hxx index 3651344..dc5eb05 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -502,14 +502,14 @@ public: // Null-able. // - static bool - null (data_member_path const&); + bool + null (data_member_path const&) const; - static bool - null (semantics::data_member&); + bool + null (semantics::data_member&) const; - static bool - null (semantics::data_member&, string const& key_prefix); + bool + null (semantics::data_member&, string const& key_prefix) const; // Optimistic concurrency. // @@ -911,15 +911,23 @@ public: struct db_type_type { db_type_type () {} - db_type_type (string const& t, string const& it) - : type (t), id_type (it) + db_type_type (string const& t, string const& it, bool n) + : type (t), id_type (it), null (n) { } string type; string id_type; + bool null; + }; + + struct type_map_type: std::map + { + typedef std::map base; + + const_iterator + find (semantics::type&, semantics::names* hint); }; - typedef std::map type_map_type; protected: struct data -- cgit v1.1