diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-11-10 16:23:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-11-10 16:23:24 +0200 |
commit | 8fcd54e0011cf336b9e11a8c1264e19fcad861d9 (patch) | |
tree | 69905050cd7e159d587f492444676a317f7d422c | |
parent | 5aee82f8d634739d8b1af602d804e76d962a2d56 (diff) |
Add descriptor management flags for TIMESTAMP and INTERVAL image types
For a query expression that has only by-value parameters, we guarantee
that it can be used by multiple threads. However, the way we handle
TIMESTAMP and INTERVAL types now requires the modification of the image
during query execution. To resolve this, the datetime, interval_ym,
and interval_ds image types now have flags that allow the query
implementation to avoid the modification.
-rw-r--r-- | oracle/types/driver.cxx | 25 | ||||
-rw-r--r-- | oracle/types/makefile | 3 |
2 files changed, 27 insertions, 1 deletions
diff --git a/oracle/types/driver.cxx b/oracle/types/driver.cxx index 371388c..994885f 100644 --- a/oracle/types/driver.cxx +++ b/oracle/types/driver.cxx @@ -168,6 +168,31 @@ main (int argc, char* argv[]) assert (bui2 == *buil2); assert (bui3 == *buil3); } + + // Test descriptor management in TIMESTAMP and INTERVAL images. + // + { + typedef odb::query<object> query; + typedef odb::result<object> result; + + query q (query::timestamp == o.timestamp_ && + query::interval_ym == o.interval_ym_ && + query::interval_ds == o.interval_ds_); + + transaction t (db->begin ()); + + { + result r (db->query<object> (q)); + assert (size (r) == 1); + } + + { + result r (db->query<object> (q)); + assert (size (r) == 1); + } + + t.commit (); + } } catch (const odb::exception& e) { diff --git a/oracle/types/makefile b/oracle/types/makefile index 7f01dd6..69b3b66 100644 --- a/oracle/types/makefile +++ b/oracle/types/makefile @@ -36,7 +36,8 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database oracle --generate-schema \ ---table-prefix oracle_types_ --hxx-prologue '\#include "traits.hxx"' +--generate-query --hxx-prologue '\#include "traits.hxx"' \ +--table-prefix oracle_types_ $(gen): cpp_options := -I$(src_base) $(gen): $(common.l.cpp-options) |