From 1cc4eb4d11c08f986408c9b671840b6e077b42ff Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Fri, 28 Oct 2011 14:10:36 +0200 Subject: Implement lob_auto_descriptor --- odb/oracle/auto-descriptor.hxx | 4 ++-- odb/oracle/oracle-types.hxx | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/odb/oracle/auto-descriptor.hxx b/odb/oracle/auto-descriptor.hxx index a6c82a3..cd537ef 100644 --- a/odb/oracle/auto-descriptor.hxx +++ b/odb/oracle/auto-descriptor.hxx @@ -85,11 +85,11 @@ namespace odb d_ = d; } - private: + protected: auto_descriptor (const auto_descriptor&); auto_descriptor& operator= (const auto_descriptor&); - private: + protected: D* d_; }; } diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx index 7f2c46d..1e94894 100644 --- a/odb/oracle/oracle-types.hxx +++ b/odb/oracle/oracle-types.hxx @@ -98,8 +98,7 @@ namespace odb buffer_type type; // The type stored by buffer. void* buffer; // Data buffer pointer. When result callbacks are in - // use, this is interpreted as an - // auto_descriptor*. + // use, this is interpreted as an lob_auto_descriptor*. ub2* size; // The number of bytes in buffer. When parameter // callbacks are in use, this is interpreted as a ub4* // indicating the current position. @@ -117,7 +116,7 @@ namespace odb // An instance of this structure specifies the function to invoke and // the context to pass just prior to the image associated with a query - // is modified. + // being modified. // struct change_callback { @@ -126,6 +125,39 @@ namespace odb void (*callback) (void*); void* context; }; + + // The LOB specialization of auto_descriptor allows for transparent + // transferal of LOB descriptors between auto_descriptor instances. This + // simplifies the implementation of a private copy of the shared image + // associated with queries. + // + class LIBODB_ORACLE_EXPORT lob_auto_descriptor + : auto_descriptor + { + public: + lob_auto_descriptor (OCILobLocator* l = 0) + : auto_descriptor (l) + { + } + + lob_auto_descriptor (lob_auto_descriptor& x) + : auto_descriptor (0) + { + OCILobLocator* l (x.d_); + x.d_ = 0; + reset (l); + } + + lob_auto_descriptor& + operator= (lob_auto_descriptor& x) + { + OCILobLocator* l (x.d_); + x.d_ = 0; + reset (l); + + return *this; + } + }; } } -- cgit v1.1