diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-09-04 11:22:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-09-04 11:22:07 +0200 |
commit | c1877f84f3596f67245abe6658b08c050bd1e686 (patch) | |
tree | 57ae8ba5818a752abc763b1510b296a4a46d1ad4 /odb/context.hxx | |
parent | e288ee241317773c77d954c8c286f53a963e7c19 (diff) |
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.
Diffstat (limited to 'odb/context.hxx')
-rw-r--r-- | odb/context.hxx | 26 |
1 files changed, 17 insertions, 9 deletions
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<string, db_type_type> + { + typedef std::map<string, db_type_type> base; + + const_iterator + find (semantics::type&, semantics::names* hint); }; - typedef std::map<string, db_type_type> type_map_type; protected: struct data |