diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-10-20 10:30:16 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-10-21 11:47:14 +0200 |
commit | 7191726588c8ac90294e22fdc6a1a13b472919cd (patch) | |
tree | e01b36cceb3b53c9ebad72b39df24888366d6965 | |
parent | 794541ef3899a614f1d3ecdcd20204073ab9ae03 (diff) |
Specify all VARCHAR2 and NVARCHAR2 columns as nullable
Oracle interprets empty VARCHAR2 and NVARCHAR2 strings as NULL. As an empty
string is always valid within the C++ context, VARCHAR2 and NVARCHAR2 columns
are always specified as nullable.
-rw-r--r-- | odb/relational/oracle/schema.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/odb/relational/oracle/schema.cxx b/odb/relational/oracle/schema.cxx index 8115f2f..045084a 100644 --- a/odb/relational/oracle/schema.cxx +++ b/odb/relational/oracle/schema.cxx @@ -112,6 +112,19 @@ namespace relational object_columns (base const& x): base (x) {} virtual void + null (semantics::data_member& m) + { + sql_type::core_type t (column_sql_type (m, prefix_).type); + + // Oracle interprets empty VARCHAR2 and NVARCHAR2 strings as NULL. As + // an empty string is always valid within the C++ context, VARCHAR2 + // and NVARCHAR2 columns are always specified as nullable. + // + if (t != sql_type::VARCHAR2 && t != sql_type::NVARCHAR2) + base::null (m); + } + + virtual void default_enum (semantics::data_member& m, tree en, string const&) { // Make sure the column is mapped to Oracle NUMBER. |