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 | c77b0419f08708a205acab088b7c95c839b38cfc (patch) | |
tree | 1114cbad0fc7152437c7dd5a3ff2b65364b5823d /oracle | |
parent | bb48c54f1080874f5a10907714f5fbae0b985ce9 (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 'oracle')
-rw-r--r-- | oracle/types/driver.cxx | 2 | ||||
-rw-r--r-- | oracle/types/test.hxx | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/oracle/types/driver.cxx b/oracle/types/driver.cxx index b1ca3ad..554c506 100644 --- a/oracle/types/driver.cxx +++ b/oracle/types/driver.cxx @@ -63,6 +63,8 @@ main (int argc, char* argv[]) o.nvarchar2_ = medium_str; o.nclob_.assign (vlong_str.data (), vlong_str.data () + vlong_str.size ()); + o.empty_c_.push_back (""); + o.raw_.assign (long_str.data (), long_str.data () + long_str.size ()); o.blob_.assign (vlong_str.data (), vlong_str.data () + vlong_str.size ()); diff --git a/oracle/types/test.hxx b/oracle/types/test.hxx index f745a1e..0543598 100644 --- a/oracle/types/test.hxx +++ b/oracle/types/test.hxx @@ -175,6 +175,12 @@ struct object #pragma db type ("NVARCHAR2(512)") std::string nvarchar2_; + // Oracle treats empty and NULL VARCHAR2 the same. Test that we + // handle this. + // + std::string empty_; + std::vector<std::string> empty_c_; + #pragma db type ("RAW(1024)") std::vector<char> raw_; @@ -222,6 +228,8 @@ struct object varchar2_ == y.varchar2_ && nchar_ == y.nchar_ && nvarchar2_ == y.nvarchar2_ && + empty_ == y.empty_ && + empty_c_ == y.empty_c_ && raw_ == y.raw_ && blob_ == y.blob_ && clob_ == y.clob_ && |