diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-26 10:58:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-26 10:58:50 +0200 |
commit | 76a03fd7964b85cdc1a903df79bfd47711c720e9 (patch) | |
tree | 4c73f15b891746990b62e9a33b75c7feb2989b8d /odb/oracle/oracle-types.hxx | |
parent | 7a3b76479162e3e3fe6c425f7bb20eaea8f41e17 (diff) |
Reimplement image copying for Oracle
Now we no longer "steal" descriptors (destructive copy). Instead, for
LOBs, we clone the locator using OCILobAssign(). For date-time types we
extract the data during copying. As a result of this change we no longer
need to track image changes and rebind the statements.
Diffstat (limited to 'odb/oracle/oracle-types.hxx')
-rw-r--r-- | odb/oracle/oracle-types.hxx | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx index ffc974a..30e514b 100644 --- a/odb/oracle/oracle-types.hxx +++ b/odb/oracle/oracle-types.hxx @@ -111,9 +111,7 @@ namespace odb buffer_type type; // The type stored by buffer. void* buffer; // Data buffer pointer. For LOB type bindings, this is // interpreted as an oracle::lob*. - ub2* size; // The number of bytes in buffer. For LOB result - // bindings, this is interpreted as the OCIDefine - // handle associated with the LOB result parameter. + ub2* size; // The number of bytes in buffer. ub4 capacity; // The maximum number of bytes that can be stored in // the buffer. For LOBs, it used to store array skip // size. @@ -133,7 +131,7 @@ namespace odb { change_callback (): callback (0), context (0) {}; - void (*callback) (void*, binding*); + void (*callback) (void*); void* context; }; @@ -142,15 +140,21 @@ namespace odb // struct LIBODB_ORACLE_EXPORT lob { + ~lob (); lob (): locator (0), buffer (0), position (0) {} - lob (lob&); - lob& operator= (lob&); + lob (const lob&); + lob& operator= (const lob&); - ~lob (); + private: + void + clone (const lob&); public: + OCIEnv* environment; + OCIError* error; OCILobLocator* locator; + details::buffer* buffer; ub4 position; }; @@ -192,6 +196,16 @@ namespace odb ub1 second, ub4 nanosecond); + ~datetime (); + datetime (unsigned short f = descriptor_cache | descriptor_free) + : descriptor (0), flags (f) {} + + datetime (const datetime&); + datetime& operator= (const datetime&); + + // Use the get() and set() functions above unless you know what you + // are doing and understand how copying of datetime works. + // public: OCIEnv* environment; OCIError* error; @@ -200,17 +214,6 @@ namespace odb unsigned short flags; public: - datetime (unsigned short f = descriptor_cache | descriptor_free) - : descriptor (0), flags (f) - { - } - - datetime (datetime&); - datetime& operator= (datetime&); - - ~datetime (); - - public: sb2 year_; ub1 month_; ub1 day_; @@ -228,6 +231,16 @@ namespace odb void set (sb4 year, sb4 month); + ~interval_ym (); + interval_ym (unsigned short f = descriptor_cache | descriptor_free) + : descriptor (0), flags (f) {} + + interval_ym (const interval_ym&); + interval_ym& operator= (const interval_ym&); + + // Use the get() and set() functions above unless you know what you + // are doing and understand how copying of interval_ym works. + // public: OCIEnv* environment; OCIError* error; @@ -236,17 +249,6 @@ namespace odb 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 (); - - public: sb4 year_; sb4 month_; }; @@ -267,6 +269,16 @@ namespace odb sb4 second, sb4 nanosecond); + ~interval_ds (); + interval_ds (unsigned short f = descriptor_cache | descriptor_free) + : descriptor (0), flags (f) {} + + interval_ds (const interval_ds&); + interval_ds& operator= (const interval_ds&); + + // Use the get() and set() functions above unless you know what you + // are doing and understand how copying of interval_ds works. + // public: OCIEnv* environment; OCIError* error; @@ -275,17 +287,6 @@ namespace odb unsigned short flags; public: - interval_ds (unsigned short f = descriptor_cache | descriptor_free) - : descriptor (0), flags (f) - { - } - - interval_ds (interval_ds&); - interval_ds& operator= (interval_ds&); - - ~interval_ds (); - - public: sb4 day_; sb4 hour_; sb4 minute_; |