From c77b0419f08708a205acab088b7c95c839b38cfc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 4 Sep 2012 11:22:07 +0200 Subject: 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. --- oracle/types/driver.cxx | 2 ++ oracle/types/test.hxx | 8 ++++++++ 2 files changed, 10 insertions(+) (limited to 'oracle') 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 empty_c_; + #pragma db type ("RAW(1024)") std::vector 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_ && -- cgit v1.1