diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-19 13:42:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-19 13:42:18 +0200 |
commit | 73c98a67ef4ed605cf69e0d212934c4dc1f3eb8e (patch) | |
tree | 8645cd8d06f218ff5d945b1b3b94a58a127753c4 /odb/relational/pgsql | |
parent | 12d0d9bbd0f5b7295c50fd5b223e538afe1abbf7 (diff) |
New design for NULL semantics
Now, instead of being specified as part of the SQL type with the type
pragma, there are separate null and not_null pragmas. The not_null
pragma was used to control NULL-ness of object pointers. Now the two
pragmas are used consistently for object pointers and simple values
(and in the future will work for composite values and containers).
Diffstat (limited to 'odb/relational/pgsql')
-rw-r--r-- | odb/relational/pgsql/context.cxx | 12 | ||||
-rw-r--r-- | odb/relational/pgsql/context.hxx | 5 | ||||
-rw-r--r-- | odb/relational/pgsql/source.cxx | 4 |
3 files changed, 5 insertions, 16 deletions
diff --git a/odb/relational/pgsql/context.cxx b/odb/relational/pgsql/context.cxx index 5a6b158..6c6c5a0 100644 --- a/odb/relational/pgsql/context.cxx +++ b/odb/relational/pgsql/context.cxx @@ -211,12 +211,9 @@ namespace relational } string context:: - database_type_impl (semantics::type& t, - semantics::names* hint, - semantics::context& ctx, - column_type_flags f) + database_type_impl (semantics::type& t, semantics::names* hint, bool id) { - string r (base_context::database_type_impl (t, hint, ctx, f)); + string r (base_context::database_type_impl (t, hint, id)); if (!r.empty ()) return r; @@ -224,13 +221,8 @@ namespace relational using semantics::enum_; if (t.is_a<semantics::enum_> ()) - { r = "INTEGER"; - if ((f & ctf_default_null) == 0) - r += " NOT NULL"; - } - return r; } diff --git a/odb/relational/pgsql/context.hxx b/odb/relational/pgsql/context.hxx index 66d9318..a4fbc00 100644 --- a/odb/relational/pgsql/context.hxx +++ b/odb/relational/pgsql/context.hxx @@ -85,10 +85,7 @@ namespace relational protected: virtual string - database_type_impl (semantics::type& t, - semantics::names* hint, - semantics::context& ctx, - column_type_flags f); + database_type_impl (semantics::type& t, semantics::names* hint, bool); public: virtual diff --git a/odb/relational/pgsql/source.cxx b/odb/relational/pgsql/source.cxx index 0ed6890..3b7664d 100644 --- a/odb/relational/pgsql/source.cxx +++ b/odb/relational/pgsql/source.cxx @@ -502,7 +502,7 @@ namespace relational { os << "}"; - if (!null_pointer (mi.m, key_prefix_)) + if (!null (mi.m, key_prefix_)) os << "else" << endl << "throw null_pointer ();"; } @@ -674,7 +674,7 @@ namespace relational << endl << "if (i." << mi.var << "null)" << endl; - if (null_pointer (mi.m, key_prefix_)) + if (null (mi.m, key_prefix_)) os << member << " = ptr_traits::pointer_type ();"; else os << "throw null_pointer ();"; |