From d6518580059c6a0d34d7a1683fabc3bfcc4b5e27 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Mon, 5 Sep 2011 11:58:14 +0200 Subject: Add RAII handle management for OCI handles and descriptors --- odb/oracle/auto-handle.cxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 odb/oracle/auto-handle.cxx (limited to 'odb/oracle/auto-handle.cxx') diff --git a/odb/oracle/auto-handle.cxx b/odb/oracle/auto-handle.cxx new file mode 100644 index 0000000..fea92bd --- /dev/null +++ b/odb/oracle/auto-handle.cxx @@ -0,0 +1,39 @@ +// file : odb/oracle/auto-handle.cxx +// author : Constantin Michael +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : ODB NCUEL; see accompanying LICENSE file + +#include + +#include + +namespace odb +{ + namespace oracle + { + void + oci_handle_free (void* h, ub4 t) + { + OCIHandleFree (h, t); + } + + void handle_traits:: + release (OCISvcCtx* h, OCIError* e) + { + OCISessionRelease (h, e, 0, 0, OCI_DEFAULT); + } + + void handle_traits:: + release (OCIStmt* h, ub4 m, OCIError* e) + { + OCIStmtRelease (h, e, 0, 0, m); + } + + const ub4 handle_type_traits::htype = OCI_HTYPE_ENV; + const ub4 handle_type_traits::htype = OCI_HTYPE_ERROR; + const ub4 handle_type_traits::htype = OCI_HTYPE_SVCCTX; + const ub4 handle_type_traits::htype = OCI_HTYPE_STMT; + const ub4 handle_type_traits::htype = OCI_HTYPE_AUTHINFO; + const ub4 handle_type_traits::htype = OCI_HTYPE_TRANS; + } +} -- cgit v1.1