OCILIB (C and C++ Driver for Oracle)  4.7.6
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
HandleDeleter.hpp
1 /*
2  * OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI)
3  *
4  * Website: http://www.ocilib.net
5  *
6  * Copyright (c) 2007-2023 Vincent ROGIER <vince.rogier@ocilib.net>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #pragma once
22 
23 #include "ocilibcpp/config.hpp"
24 #include "ocilibcpp/core.hpp"
25 
26 namespace ocilib
27 {
28  namespace support
29  {
34  template<class T>
36  {
37  bool operator()(T handle) const { return true; }
38  };
39 
40  template<> struct HandleDeleter<OCI_Connection*>
41  {
42  bool operator()(OCI_Connection* handle) const { return OCI_ConnectionFree(handle); }
43  };
44 
45  template<> struct HandleDeleter<OCI_Pool*>
46  {
47  bool operator()(OCI_Pool* handle) const { return OCI_PoolFree(handle); }
48  };
49 
50  template<> struct HandleDeleter<OCI_Transaction*>
51  {
52  bool operator()(OCI_Transaction* handle) const { return OCI_TransactionFree(handle); }
53  };
54 
55  template<> struct HandleDeleter<OCI_Number*>
56  {
57  bool operator()(OCI_Number* handle) const { return OCI_NumberFree(handle); }
58  };
59 
60  template<> struct HandleDeleter<OCI_Date*>
61  {
62  bool operator()(OCI_Date* handle) const { return OCI_DateFree(handle); }
63  };
64 
65  template<> struct HandleDeleter<OCI_Interval*>
66  {
67  bool operator()(OCI_Interval* handle) const { return OCI_IntervalFree(handle); }
68  };
69 
70  template<> struct HandleDeleter<OCI_Timestamp*>
71  {
72  bool operator()(OCI_Timestamp* handle) const { return OCI_TimestampFree(handle); }
73  };
74 
75  template<> struct HandleDeleter<OCI_Lob*>
76  {
77  bool operator()(OCI_Lob* handle) const { return OCI_LobFree(handle); }
78  };
79 
80  template<> struct HandleDeleter<OCI_Long*>
81  {
82  bool operator()(OCI_Long* handle) const { return OCI_LongFree(handle); }
83  };
84 
85  template<> struct HandleDeleter<OCI_File*>
86  {
87  bool operator()(OCI_File* handle) const { return OCI_FileFree(handle); }
88  };
89 
90  template<> struct HandleDeleter<OCI_Coll*>
91  {
92  bool operator()(OCI_Coll* handle) const { return OCI_CollFree(handle); }
93  };
94 
95  template<> struct HandleDeleter<OCI_Object*>
96  {
97  bool operator()(OCI_Object* handle) const { return OCI_ObjectFree(handle); }
98  };
99 
100  template<> struct HandleDeleter<OCI_Ref*>
101  {
102  bool operator()(OCI_Ref* handle) const { return OCI_RefFree(handle); }
103  };
104 
105  template<> struct HandleDeleter<OCI_Statement*>
106  {
107  bool operator()(OCI_Statement* handle) const { return OCI_StatementFree(handle); }
108  };
109 
110  template<> struct HandleDeleter<OCI_Subscription*>
111  {
112  bool operator()(OCI_Subscription* handle) const { return OCI_SubscriptionUnregister(handle); }
113  };
114 
115  template<> struct HandleDeleter<OCI_Agent*>
116  {
117  bool operator()(OCI_Agent* handle) const { return OCI_AgentFree(handle); }
118  };
119 
120  template<> struct HandleDeleter<OCI_Msg*>
121  {
122  bool operator()(OCI_Msg* handle) const { return OCI_MsgFree(handle); }
123  };
124 
125  template<> struct HandleDeleter<OCI_Enqueue*>
126  {
127  bool operator()(OCI_Enqueue* handle) const { return OCI_EnqueueFree(handle); }
128  };
129 
130  template<> struct HandleDeleter<OCI_Dequeue*>
131  {
132  bool operator()(OCI_Dequeue* handle) const { return OCI_DequeueFree(handle); }
133  };
134 
135  template<> struct HandleDeleter<OCI_DirPath*>
136  {
137  bool operator()(OCI_DirPath* handle) const { return OCI_DirPathFree(handle); }
138  };
139  }
140 }
OCI_SYM_PUBLIC boolean OCI_API OCI_DequeueFree(OCI_Dequeue *dequeue)
Free a Dequeue object.
OCI_SYM_PUBLIC boolean OCI_API OCI_MsgFree(OCI_Msg *msg)
Free a message object.
OCI_SYM_PUBLIC boolean OCI_API OCI_AgentFree(OCI_Agent *agent)
Free an AQ agent object.
OCI_SYM_PUBLIC boolean OCI_API OCI_EnqueueFree(OCI_Enqueue *enqueue)
Free a Enqueue object.
OCI_SYM_PUBLIC boolean OCI_API OCI_CollFree(OCI_Coll *coll)
Free a local collection.
OCI_SYM_PUBLIC boolean OCI_API OCI_ConnectionFree(OCI_Connection *con)
Close a physical connection to an Oracle database server.
struct OCI_Pool OCI_Pool
Pool object (session or connection)
Definition: types.h:107
struct OCI_Enqueue OCI_Enqueue
OCILIB encapsulation of A/Q enqueuing operations.
Definition: types.h:480
struct OCI_Ref OCI_Ref
Oracle REF type representation.
Definition: types.h:356
struct OCI_Dequeue OCI_Dequeue
OCILIB encapsulation of A/Q dequeuing operations.
Definition: types.h:470
struct OCI_Connection OCI_Connection
Oracle physical connection.
Definition: types.h:124
struct OCI_Object OCI_Object
Oracle Named types representation.
Definition: types.h:309
struct OCI_Statement OCI_Statement
Oracle SQL or PL/SQL statement.
Definition: types.h:136
struct OCI_Timestamp OCI_Timestamp
Oracle internal timestamp representation.
Definition: types.h:289
struct OCI_Date OCI_Date
Oracle internal date representation.
Definition: types.h:279
struct OCI_Coll OCI_Coll
Oracle Collections (VARRAYs and Nested Tables) representation.
Definition: types.h:319
struct OCI_DirPath OCI_DirPath
OCILIB encapsulation of OCI Direct Path handle.
Definition: types.h:420
struct OCI_Lob OCI_Lob
Oracle Internal Large objects:
Definition: types.h:198
struct OCI_Long OCI_Long
Oracle Long data type.
Definition: types.h:260
struct OCI_Interval OCI_Interval
Oracle internal interval representation.
Definition: types.h:299
struct OCI_Transaction OCI_Transaction
Oracle Transaction.
Definition: types.h:238
struct OCI_Msg OCI_Msg
OCILIB encapsulation of A/Q message.
Definition: types.h:450
struct OCI_Number OCI_Number
Oracle NUMBER representation.
Definition: types.h:269
struct OCI_File OCI_File
Oracle External Large objects:
Definition: types.h:223
struct OCI_Subscription OCI_Subscription
OCILIB encapsulation of Oracle DCN notification.
Definition: types.h:430
struct OCI_Agent OCI_Agent
OCILIB encapsulation of A/Q Agent.
Definition: types.h:460
OCI_SYM_PUBLIC boolean OCI_API OCI_DateFree(OCI_Date *date)
Free a date object.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathFree(OCI_DirPath *dp)
Free an OCI_DirPath handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_FileFree(OCI_File *file)
Free a local File object.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobFree(OCI_Lob *lob)
Free a local temporary lob.
OCI_SYM_PUBLIC boolean OCI_API OCI_LongFree(OCI_Long *lg)
Free a local temporary long.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberFree(OCI_Number *number)
Free a number object.
OCI_SYM_PUBLIC boolean OCI_API OCI_PoolFree(OCI_Pool *pool)
Destroy a pool object.
OCI_SYM_PUBLIC boolean OCI_API OCI_StatementFree(OCI_Statement *stmt)
Free a statement and all resources associated to it (resultsets ...)
OCI_SYM_PUBLIC boolean OCI_API OCI_SubscriptionUnregister(OCI_Subscription *sub)
Unregister a previously registered notification.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFree(OCI_Interval *itv)
Free an OCI_Interval handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFree(OCI_Timestamp *tmsp)
Free an OCI_Timestamp handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_TransactionFree(OCI_Transaction *trans)
Free current transaction.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectFree(OCI_Object *obj)
Free a local object.
OCI_SYM_PUBLIC boolean OCI_API OCI_RefFree(OCI_Ref *ref)
Free a local Ref.
OCILIB ++ Namespace.
Internal usage. Allow resolving a deleter for C handles.