summaryrefslogtreecommitdiff
path: root/odb/context.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-19 13:42:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-19 13:42:18 +0200
commit73c98a67ef4ed605cf69e0d212934c4dc1f3eb8e (patch)
tree8645cd8d06f218ff5d945b1b3b94a58a127753c4 /odb/context.hxx
parent12d0d9bbd0f5b7295c50fd5b223e538afe1abbf7 (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/context.hxx')
-rw-r--r--odb/context.hxx43
1 files changed, 9 insertions, 34 deletions
diff --git a/odb/context.hxx b/odb/context.hxx
index 54f6832..a256866 100644
--- a/odb/context.hxx
+++ b/odb/context.hxx
@@ -123,6 +123,12 @@ public:
return c.abstract () || c.count ("abstract");
}
+ bool
+ null (semantics::data_member&);
+
+ bool
+ null (semantics::data_member&, string const& key_prefix);
+
// Database names and types.
//
public:
@@ -225,23 +231,6 @@ public:
return pointer_kind (p) == pk_weak;
}
- bool
- null_pointer (semantics::data_member& m)
- {
- return !(m.count ("not-null") || m.type ().count ("not-null"));
- }
-
- bool
- null_pointer (semantics::data_member& m, string const& key_prefix)
- {
- if (key_prefix.empty ())
- return null_pointer (m);
-
- return !(m.count (key_prefix + "-not-null") ||
- m.type ().count ("not-null") ||
- member_type (m, key_prefix).count ("not-null"));
- }
-
semantics::data_member*
inverse (semantics::data_member& m)
{
@@ -441,33 +430,19 @@ public:
// Per-database customizable functionality.
//
protected:
- typedef unsigned short column_type_flags;
-
- static column_type_flags const ctf_none = 0;
-
- // Default type should be NULL-able.
- //
- static column_type_flags const ctf_default_null = 0x01;
-
// Return empty string if there is no mapping.
//
string
- database_type (semantics::type& t,
- semantics::names* hint,
- semantics::context& c,
- column_type_flags f)
+ database_type (semantics::type& t, semantics::names* hint, bool id)
{
- return current ().database_type_impl (t, hint, c, f);
+ return current ().database_type_impl (t, hint, id);
}
// The default implementation uses the type map (populated by the database-
// specific context implementation) to come up with a mapping.
//
virtual string
- database_type_impl (semantics::type&,
- semantics::names*,
- semantics::context&,
- column_type_flags);
+ database_type_impl (semantics::type&, semantics::names*, bool);
public:
typedef context root_context;