aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/oracle-types.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-10 16:23:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-10 16:28:29 +0200
commit0fb66e3e85ccb096cb625bf4664fdbbf3b8a29f9 (patch)
tree6ee6a9fce07ecc686afefd7aa8f83b5e57fd2a30 /odb/oracle/oracle-types.hxx
parentf5f1489bed3bddd424981bbe84898832fb0e7414 (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.
Diffstat (limited to 'odb/oracle/oracle-types.hxx')
-rw-r--r--odb/oracle/oracle-types.hxx146
1 files changed, 47 insertions, 99 deletions
diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx
index a4500d3..5e08a87 100644
--- a/odb/oracle/oracle-types.hxx
+++ b/odb/oracle/oracle-types.hxx
@@ -169,90 +169,6 @@ namespace odb
}
};
- class LIBODB_ORACLE_EXPORT datetime_auto_descriptor:
- public auto_descriptor<OCIDateTime, dt_timestamp>
- {
- typedef auto_descriptor<OCIDateTime, dt_timestamp> base;
-
- public:
- datetime_auto_descriptor (OCIDateTime* d = 0):
- base (d)
- {
- }
-
- datetime_auto_descriptor (datetime_auto_descriptor& x):
- base (x.d_)
- {
- x.d_ = 0;
- }
-
- datetime_auto_descriptor&
- operator= (datetime_auto_descriptor& x)
- {
- OCIDateTime* l (x.d_);
- x.d_ = 0;
- reset (l);
-
- return *this;
- }
- };
-
- class LIBODB_ORACLE_EXPORT interval_ym_auto_descriptor:
- public auto_descriptor<OCIInterval, dt_interval_ym>
- {
- typedef auto_descriptor<OCIInterval, dt_interval_ym> base;
-
- public:
- interval_ym_auto_descriptor (OCIInterval* d = 0):
- base (d)
- {
- }
-
- interval_ym_auto_descriptor (interval_ym_auto_descriptor& x):
- base (x.d_)
- {
- x.d_ = 0;
- }
-
- interval_ym_auto_descriptor&
- operator= (interval_ym_auto_descriptor& x)
- {
- OCIInterval* l (x.d_);
- x.d_ = 0;
- reset (l);
-
- return *this;
- }
- };
-
- class LIBODB_ORACLE_EXPORT interval_ds_auto_descriptor:
- public auto_descriptor<OCIInterval, dt_interval_ds>
- {
- typedef auto_descriptor<OCIInterval, dt_interval_ds> base;
-
- public:
- interval_ds_auto_descriptor (OCIInterval* d = 0):
- base (d)
- {
- }
-
- interval_ds_auto_descriptor (interval_ds_auto_descriptor& x):
- base (x.d_)
- {
- x.d_ = 0;
- }
-
- interval_ds_auto_descriptor&
- operator= (interval_ds_auto_descriptor& x)
- {
- OCIInterval* l (x.d_);
- x.d_ = 0;
- reset (l);
-
- return *this;
- }
- };
-
//
// The OCIDateTime and OCIInterval APIs require that an environment and
// error handle be passed to any function that manipulates an OCIDateTime
@@ -265,6 +181,11 @@ namespace odb
// consistency.
//
+ // Descriptor management flags.
+ //
+ const unsigned short descriptor_cache = 0x01;
+ const unsigned short descriptor_free = 0x02;
+
struct LIBODB_ORACLE_EXPORT datetime
{
void
@@ -285,16 +206,25 @@ namespace odb
ub1 second,
ub4 nanosecond);
- void
- set ();
-
public:
OCIEnv* environment;
OCIError* error;
+ OCIDateTime* descriptor;
+
+ unsigned short flags;
+
+ public:
+ datetime (unsigned short f = descriptor_cache | descriptor_free)
+ : descriptor (0), flags (f)
+ {
+ }
- datetime_auto_descriptor descriptor;
+ datetime (datetime&);
+ datetime& operator= (datetime&);
- private:
+ ~datetime ();
+
+ public:
sb2 year_;
ub1 month_;
ub1 day_;
@@ -312,16 +242,25 @@ namespace odb
void
set (sb4 year, sb4 month);
- void
- set ();
-
public:
OCIEnv* environment;
OCIError* error;
+ OCIInterval* descriptor;
+
+ unsigned short flags;
+
+ public:
+ interval_ym (unsigned short f = descriptor_cache | descriptor_free)
+ : descriptor (0), flags (f)
+ {
+ }
+
+ interval_ym (interval_ym&);
+ interval_ym& operator= (interval_ym&);
- interval_ym_auto_descriptor descriptor;
+ ~interval_ym ();
- private:
+ public:
sb4 year_;
sb4 month_;
};
@@ -342,16 +281,25 @@ namespace odb
sb4 second,
sb4 nanosecond);
- void
- set ();
-
public:
OCIEnv* environment;
OCIError* error;
+ OCIInterval* descriptor;
+
+ unsigned short flags;
+
+ public:
+ interval_ds (unsigned short f = descriptor_cache | descriptor_free)
+ : descriptor (0), flags (f)
+ {
+ }
- interval_ds_auto_descriptor descriptor;
+ interval_ds (interval_ds&);
+ interval_ds& operator= (interval_ds&);
- private:
+ ~interval_ds ();
+
+ public:
sb4 day_;
sb4 hour_;
sb4 minute_;