From 8fcd54e0011cf336b9e11a8c1264e19fcad861d9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Nov 2011 16:23:24 +0200 Subject: 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. --- oracle/types/driver.cxx | 25 +++++++++++++++++++++++++ oracle/types/makefile | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'oracle') 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 query; + typedef odb::result 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 (q)); + assert (size (r) == 1); + } + + { + result r (db->query (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) -- cgit v1.1