38 #define CPP_98 199711L 39 #define CPP_11 201103L 40 #define CPP_14 201402L 42 #if __cplusplus < CPP_11 44 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 46 #define HAVE_MOVE_SEMANTICS 50 #elif defined(_MSC_VER) 53 #define HAVE_MOVE_SEMANTICS 60 #define HAVE_MOVE_SEMANTICS 70 #define ARG_NOT_USED(a) (a) = (a) 125 static T
Check(T result);
163 operator unsigned int ()
const;
165 bool operator == (
const Enum& other)
const;
166 bool operator != (
const Enum& other)
const;
168 bool operator == (
const T& other)
const;
169 bool operator != (
const T& other)
const;
190 Flags operator~ ()
const;
192 Flags operator | (T other)
const;
193 Flags operator & (T other)
const;
194 Flags operator ^ (T other)
const;
200 Flags& operator |= (T other);
201 Flags& operator &= (T other);
202 Flags& operator ^= (T other);
208 bool operator == (T other)
const;
209 bool operator == (
const Flags& other)
const;
211 unsigned int GetValues()
const;
213 bool IsSet(T other)
const;
217 Flags(
unsigned int flags);
222 template<
typename T>
227 ManagedBuffer(
size_t size);
228 ManagedBuffer(T *buffer,
size_t size);
232 operator T* ()
const;
233 operator const T* ()
const;
251 void SetAccessMode(
bool threaded);
265 void SetLocker(Locker *locker);
275 template<
class K,
class V>
276 class ConcurrentMap :
public Lockable
281 virtual ~ConcurrentMap();
285 void Set(K key, V value);
296 class ConcurrentList :
public Lockable
301 virtual ~ConcurrentList();
304 void Remove(T value);
307 bool Exists(
const T &value);
310 bool FindIf(P predicate, T &value);
313 void ForEach(A action);
325 virtual ConcurrentList<Handle *> & GetChildren() = 0;
326 virtual void DetachFromHolders() = 0;
327 virtual void DetachFromParent() = 0;
342 operator bool()
const;
357 typedef boolean(OCI_API *HandleFreeFunc)(
AnyPointer handle);
359 typedef void(*SmartHandleFreeNotifyFunc)(SmartHandle *smartHandle);
361 Handle* GetHandle()
const;
363 void Acquire(T handle, HandleFreeFunc handleFreefunc, SmartHandleFreeNotifyFunc freeNotifyFunc, Handle *parent);
367 class SmartHandle :
public Handle
371 SmartHandle(
HandleHolder *holder, T handle, HandleFreeFunc handleFreefunc, SmartHandleFreeNotifyFunc freeNotifyFunc, Handle *parent);
372 virtual ~SmartHandle();
379 Handle *GetParent()
const;
384 ConcurrentList<Handle *> & GetChildren()
override;
385 void DetachFromHolders()
override;
386 void DetachFromParent()
override;
390 static void DeleteHandle(Handle *handle);
393 ConcurrentList<HandleHolder *> _holders;
394 ConcurrentList<Handle *> _children;
399 HandleFreeFunc _handleFreeFunc;
400 SmartHandleFreeNotifyFunc _freeNotifyFunc;
405 SmartHandle *_smartHandle;
424 virtual ostring ToString()
const = 0;
427 friend T& operator << (T &lhs,
const Streamable &rhs)
429 lhs << static_cast<ostring>(rhs);
438 BindObject(
const Statement &statement,
const ostring& name,
unsigned int mode);
440 virtual ~BindObject();
446 unsigned int GetMode()
const;
448 virtual void SetInData() = 0;
449 virtual void SetOutData() = 0;
458 class BindArray :
public BindObject
462 BindArray(
const Statement &statement,
const ostring& name,
unsigned int mode);
463 virtual ~BindArray();
466 void SetVector(std::vector<T> & vector,
bool isPlSqlTable,
unsigned int elemSize);
471 void SetInData()
override;
472 void SetOutData()
override;
474 unsigned int GetSize();
475 unsigned int GetSizeForBindCall();
479 class AbstractBindArrayObject
482 AbstractBindArrayObject() { }
483 virtual ~AbstractBindArrayObject() { }
484 virtual void SetInData() = 0;
485 virtual void SetOutData() = 0;
487 virtual bool IsHandleObject() = 0;
488 virtual unsigned int GetSize() = 0;
489 virtual unsigned int GetSizeForBindCall() = 0;
493 class BindArrayObject :
public AbstractBindArrayObject
497 typedef T ObjectType;
498 typedef std::vector<ObjectType> ObjectVector;
501 BindArrayObject(
const Statement &statement,
const ostring& name, ObjectVector &vector,
bool isPlSqlTable,
unsigned int mode,
unsigned int elemSize);
502 virtual ~BindArrayObject();
503 void SetInData()
override;
504 void SetOutData()
override;
506 bool IsHandleObject()
override;
507 unsigned int GetSize()
override;
508 unsigned int GetSizeForBindCall()
override;
510 operator ObjectVector & ()
const;
511 operator NativeType * ()
const;
516 void FreeData()
const;
520 ObjectVector& _vector;
524 unsigned int _elemCount;
525 unsigned int _elemSize;
528 AbstractBindArrayObject * _object;
532 class BindObjectAdaptor :
public BindObject
538 typedef T ObjectType;
541 operator NativeType *()
const;
543 void SetInData()
override;
544 void SetOutData()
override;
546 BindObjectAdaptor(
const Statement &statement,
const ostring& name,
unsigned int mode, ObjectType &
object,
unsigned int size);
547 virtual ~BindObjectAdaptor();
557 class BindTypeAdaptor :
public BindObject
563 typedef T ObjectType;
566 operator NativeType *()
const;
568 void SetInData()
override;
569 void SetOutData()
override;
571 BindTypeAdaptor(
const Statement &statement,
const ostring& name,
unsigned int mode, ObjectType &
object);
572 virtual ~BindTypeAdaptor();
589 void AddBindObject(BindObject *bindObject);
596 std::vector<BindObject *> _bindObjects;
OCI_Mutex * MutexHandle
Alias for an OCI_Mutex pointer.
Object used for executing SQL or PL/SQL statement and returning the produced results.
Raw MakeRaw(void *result, unsigned int size)
Internal usage. Constructs a C++ Raw object from the given OCILIB raw buffer.
Template Enumeration template class providing some type safety to some extends for manipulating enume...
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so, it raises a C++ exception using the retrieved error handle.
void * AnyPointer
Alias for the generic void pointer.
Abstract class allowing derived classes to be compatible with any type supporting the operator << oci...
Template class providing OCILIB handles auto memory, life cycle and scope management.
Template Flags template class providing some type safety to some extends for manipulating flags set v...
std::vector< unsigned char > Raw
C++ counterpart of SQL RAW data type.
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
Internal usage. Allow resolving a native type used by C API from a C++ type in binding operations...
std::basic_string< otext, std::char_traits< otext >, std::allocator< otext > > ostring
string class wrapping the OCILIB otext * type and OTEXT() macros ( see Character sets ) ...