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/relational/oracle/schema.cxx | |
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/relational/oracle/schema.cxx')
-rw-r--r-- | odb/relational/oracle/schema.cxx | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/odb/relational/oracle/schema.cxx b/odb/relational/oracle/schema.cxx index 29c1130..f07e0d6 100644 --- a/odb/relational/oracle/schema.cxx +++ b/odb/relational/oracle/schema.cxx @@ -159,50 +159,6 @@ namespace relational }; entry<create_table> create_table_; - struct create_column: relational::create_column, context - { - create_column (base const& x): base (x) {} - - virtual void - null (sema_rel::column& c) - { - // Oracle interprets empty VARCHAR2 and NVARCHAR2 strings as - // NULL. As an empty string is valid within the C++ context, - // VARCHAR2 and NVARCHAR2 columns are always specified as - // nullable, except when are a part of a primary key. - // - if (!c.null ()) - { - // This should never fail since we have already parsed this. - // - sql_type const& t (parse_sql_type (c.type ())); - - if (t.type == sql_type::VARCHAR2 || t.type == sql_type::NVARCHAR2) - { - // See if this column is a part of a primary key. - // - bool pk (false); - - for (sema_rel::column::contained_iterator i ( - c.contained_begin ()); i != c.contained_end (); ++i) - { - if (i->key ().is_a<sema_rel::primary_key> ()) - { - pk = true; - break; - } - } - - if (!pk) - return; - } - } - - base::null (c); - } - }; - entry<create_column> create_column_; - struct create_foreign_key: relational::create_foreign_key, context { create_foreign_key (schema_format f, relational::create_table& ct) |