Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::OCI::HandleBase Class Referenceabstract

Base class for OCI handle wrappers. More...

#include <HOCI.h>

Inheritance diagram for Harlinn::OCI::HandleBase:
[legend]

Public Member Functions

constexpr void * Handle () const noexcept
 Provides access to the value of the handle object.
 
constexpr operator bool () const noexcept
 Test if the handle value is assigned.
 
constexpr bool IsValid () const noexcept
 Test if the handle value is assigned.
 
constexpr OCI::HandleType HandleType () const noexcept
 Returns a value identifying the type of the wrapped handle object.
 
virtual const OCI::ErrorHandleError () const noexcept=0
 Provides access to the OCIError that will be used for OCI calls for this object.
 

Protected Member Functions

constexpr HandleBase () noexcept
 Default constructor.
 
constexpr HandleBase (OCI::HandleType handleType, void *handle, bool ownsHandle) noexcept
 Constructs a new HandleBase object.
 
 HandleBase (const HandleBase &other)=delete
 
constexpr HandleBase (HandleBase &&other) noexcept
 Move constructor.
 
virtual ~HandleBase ()
 Destructor.
 
constexpr void SetHandle (void *newHandleValue, bool ownsHandle) noexcept
 Assigns the handle value and ownership to this object.
 
constexpr bool OwnsHandle () const noexcept
 Returns true if this object is the owner of the handle value.
 
void * DetachHandle ()
 If this object is the owner of a handle this function rescinds that ownership, and returns the handle value without closing the handle.
 
void DestroyHandle ()
 Destroys the handle if it is owned by this object.
 
HandleBaseoperator= (const HandleBase &other)=delete
 
constexpr HandleBaseoperator= (HandleBase &&other) noexcept
 
constexpr void swap (HandleBase &other) noexcept
 
template<typename Derived >
constexpr void Take (Derived &&derived) noexcept
 Template function used to implement move assignement in derived classes.
 
void InitializeHandle (void *handle, bool ownsHandle)
 Provides a "safe" mechanism for assigning a handle value. This functions throws if a handle value is already assigned to this object.
 
HO_EXPORT Int32 GetAttribute (void *buffer, UInt32 *size, Attribute attribute) const
 Gets the value of an attribute from the handle.
 
HO_EXPORT Int32 SetAttribute (void *buffer, UInt32 size, Attribute attribute) const
 Sets the value of an attribute on the handle.
 
DateTime GetDateTimeAttribute (Attribute attribute) const
 Gets the value of an attribute from the handle as a DateTime.
 
void SetDateTimeAttribute (Attribute attribute, const DateTime &value) const
 Sets the value of an attribute on the handle as a DateTime.
 
template<WideStringLike StringT = WideString>
StringT GetStringAttribute (Attribute attribute) const
 Gets the value of an attribute from the handle as a WideString.
 
template<WideStringLike StringT = WideString>
StringT GetStringAttributeFromByteString (Attribute attribute) const
 Gets the value of an attribute from the handle as a WideString For use with attributes that are not returned as UTF-16.
 
template<WideStringLike StringT>
void SetStringAttribute (Attribute attribute, const StringT &value) const
 Sets the value of an attribute on the handle as a WideString.
 
void SetStringAttribute (Attribute attribute, const wchar_t *value, size_t valueLength) const
 
bool GetBooleanAttribute (Attribute attribute) const
 Gets the value of an attribute from the handle as a bool.
 
void SetBooleanAttribute (Attribute attribute, bool value) const
 Sets the value of an attribute on the handle as a bool.
 
Byte GetByteAttribute (Attribute attribute) const
 Gets the value of an attribute from the handle as a Byte.
 
void SetByteAttribute (Attribute attribute, Byte value) const
 Sets the value of an attribute on the handle as a Byte.
 
SByte GetSByteAttribute (Attribute attribute) const
 Gets the value of an attribute from the handle as a SByte.
 
void SetSByteAttribute (Attribute attribute, SByte value) const
 Sets the value of an attribute on the handle as a Byte.
 
Int16 GetInt16Attribute (Attribute attribute) const
 Gets the value of an attribute from the handle as an Int16.
 
void SetInt16Attribute (Attribute attribute, Int16 value) const
 Sets the value of an attribute on the handle as an Int16.
 
UInt16 GetUInt16Attribute (Attribute attribute) const
 Gets the value of an attribute from the handle as an UInt16.
 
void SetUInt16Attribute (Attribute attribute, UInt16 value) const
 Sets the value of an attribute on the handle as an UInt16.
 
Int32 GetInt32Attribute (Attribute attribute) const
 Gets the value of an attribute from the handle as an Int32.
 
void SetInt32Attribute (Attribute attribute, Int32 value) const
 Sets the value of an attribute on the handle as an Int32.
 
UInt32 GetUInt32Attribute (Attribute attribute) const
 Gets the value of an attribute from the handle as an UInt32.
 
void SetUInt32Attribute (Attribute attribute, UInt32 value) const
 Sets the value of an attribute on the handle as an UInt32.
 
Int64 GetInt64Attribute (Attribute attribute) const
 Gets the value of an attribute from the handle as an Int64.
 
void SetInt64Attribute (Attribute attribute, Int64 value) const
 Sets the value of an attribute on the handle as an Int64.
 
UInt64 GetUInt64Attribute (Attribute attribute) const
 Gets the value of an attribute from the handle as an UInt64.
 
void SetUInt64Attribute (Attribute attribute, UInt64 value) const
 Sets the value of an attribute on the handle as an UInt64.
 
void * GetPointerAttribute (Attribute attribute) const
 Gets the value of an attribute from the handle as a pointer.
 
void SetPointerAttribute (Attribute attribute, void *value) const
 Sets the value of an attribute on the handle as a pointer.
 
OCI::NumberGetNumberAttribute (Attribute attribute) const
 Gets the value of an attribute from the handle as a pointer to an OCI::Number.
 

Static Protected Member Functions

static HO_EXPORT void HandleFree (void *handle, OCI::HandleType handleType) noexcept
 Calls OCIHandleFree to release the handle.
 

Private Attributes

void * handle_
 
OCI::HandleType handleType_
 
bool ownsHandle_
 

Detailed Description

Base class for OCI handle wrappers.

Constructor & Destructor Documentation

◆ HandleBase() [1/4]

Harlinn::OCI::HandleBase::HandleBase ( )
inlineconstexprprotectednoexcept

Default constructor.

◆ HandleBase() [2/4]

Harlinn::OCI::HandleBase::HandleBase ( OCI::HandleType handleType,
void * handle,
bool ownsHandle )
inlineconstexprprotectednoexcept

Constructs a new HandleBase object.

Parameters
handleTypeThe type of the handle wrapped by this object.
handleThe handle wrapped by this object.
ownsHandleSet to true if the new object will take owneship of the handle value

◆ HandleBase() [3/4]

Harlinn::OCI::HandleBase::HandleBase ( const HandleBase & other)
protecteddelete

◆ HandleBase() [4/4]

Harlinn::OCI::HandleBase::HandleBase ( HandleBase && other)
inlineconstexprprotectednoexcept

Move constructor.

Parameters
otherexisting object

◆ ~HandleBase()

virtual Harlinn::OCI::HandleBase::~HandleBase ( )
inlineprotectedvirtual

Destructor.

Member Function Documentation

◆ DestroyHandle()

void Harlinn::OCI::HandleBase::DestroyHandle ( )
inlineprotected

Destroys the handle if it is owned by this object.

◆ DetachHandle()

void * Harlinn::OCI::HandleBase::DetachHandle ( )
inlinenodiscardprotected

If this object is the owner of a handle this function rescinds that ownership, and returns the handle value without closing the handle.

Returns
The value of the handle

◆ Error()

virtual const OCI::ErrorHandle & Harlinn::OCI::HandleBase::Error ( ) const
pure virtualnoexcept

◆ GetAttribute()

Int32 Harlinn::OCI::HandleBase::GetAttribute ( void * buffer,
UInt32 * size,
Attribute attribute ) const
protected

Gets the value of an attribute from the handle.

Parameters
bufferPointer to the storage for an attribute value. In EnvironmentMode::UTF16 environment mode, the value of a string attribute will be returned as a UTF-16 string.
sizeThe size of the attribute value, always in bytes. This can be passed as null for most attributes because the sizes of non-string attributes are already known by the OCI library. For text attributes, a pointer to a UInt32 must be passed in to get the length of the string.
attributeIdentifies the attribute to retrieve the value for
Returns

◆ GetBooleanAttribute()

bool Harlinn::OCI::HandleBase::GetBooleanAttribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a bool.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as a bool

◆ GetByteAttribute()

Byte Harlinn::OCI::HandleBase::GetByteAttribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a Byte.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as a Byte

◆ GetDateTimeAttribute()

DateTime Harlinn::OCI::HandleBase::GetDateTimeAttribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a DateTime.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as a DateTime

◆ GetInt16Attribute()

Int16 Harlinn::OCI::HandleBase::GetInt16Attribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as an Int16.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as an Int16

◆ GetInt32Attribute()

Int32 Harlinn::OCI::HandleBase::GetInt32Attribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as an Int32.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as an Int32

◆ GetInt64Attribute()

Int64 Harlinn::OCI::HandleBase::GetInt64Attribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as an Int64.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as an Int64

◆ GetNumberAttribute()

OCI::Number * Harlinn::OCI::HandleBase::GetNumberAttribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a pointer to an OCI::Number.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
A pointer to an OCI::Number

◆ GetPointerAttribute()

void * Harlinn::OCI::HandleBase::GetPointerAttribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a pointer.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as a pointer

◆ GetSByteAttribute()

SByte Harlinn::OCI::HandleBase::GetSByteAttribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a SByte.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as a SByte

◆ GetStringAttribute()

template<WideStringLike StringT = WideString>
StringT Harlinn::OCI::HandleBase::GetStringAttribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a WideString.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as a WideString

◆ GetStringAttributeFromByteString()

template<WideStringLike StringT = WideString>
StringT Harlinn::OCI::HandleBase::GetStringAttributeFromByteString ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as a WideString For use with attributes that are not returned as UTF-16.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as a WideString

◆ GetUInt16Attribute()

UInt16 Harlinn::OCI::HandleBase::GetUInt16Attribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as an UInt16.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as an UInt16

◆ GetUInt32Attribute()

UInt32 Harlinn::OCI::HandleBase::GetUInt32Attribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as an UInt32.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as an UInt32

◆ GetUInt64Attribute()

UInt64 Harlinn::OCI::HandleBase::GetUInt64Attribute ( Attribute attribute) const
inlineprotected

Gets the value of an attribute from the handle as an UInt64.

Parameters
attributeIdentifies the attribute to retrieve the value for
Returns
Value of the attribute as an UInt64

◆ Handle()

void * Harlinn::OCI::HandleBase::Handle ( ) const
inlineconstexprnoexcept

Provides access to the value of the handle object.

Returns
The OCI handle

◆ HandleFree()

void Harlinn::OCI::HandleBase::HandleFree ( void * handle,
OCI::HandleType handleType )
staticprotectednoexcept

Calls OCIHandleFree to release the handle.

Parameters
handleThe handle to release
handleTypeThe type of the handle to release
Returns

◆ HandleType()

OCI::HandleType Harlinn::OCI::HandleBase::HandleType ( ) const
inlineconstexprnoexcept

Returns a value identifying the type of the wrapped handle object.

Returns

◆ InitializeHandle()

void Harlinn::OCI::HandleBase::InitializeHandle ( void * handle,
bool ownsHandle )
inlineprotected

Provides a "safe" mechanism for assigning a handle value. This functions throws if a handle value is already assigned to this object.

Parameters
handleThe OCI handle value
ownsHandletrue if this object will take ownership of the handle value.

◆ IsValid()

bool Harlinn::OCI::HandleBase::IsValid ( ) const
inlineconstexprnoexcept

Test if the handle value is assigned.

Returns
returns true if the value of the handle object is not equal to nullptr

◆ operator bool()

Harlinn::OCI::HandleBase::operator bool ( ) const
inlineexplicitconstexprnoexcept

Test if the handle value is assigned.

Returns
returns true if the value of the handle object is not equal to nullptr

◆ operator=() [1/2]

HandleBase & Harlinn::OCI::HandleBase::operator= ( const HandleBase & other)
protecteddelete

◆ operator=() [2/2]

HandleBase & Harlinn::OCI::HandleBase::operator= ( HandleBase && other)
inlineconstexprprotectednoexcept

◆ OwnsHandle()

bool Harlinn::OCI::HandleBase::OwnsHandle ( ) const
inlineconstexprprotectednoexcept

Returns true if this object is the owner of the handle value.

Returns
true if this object is the owner of the handle value

◆ SetAttribute()

Int32 Harlinn::OCI::HandleBase::SetAttribute ( void * buffer,
UInt32 size,
Attribute attribute ) const
protected

Sets the value of an attribute on the handle.

Parameters
bufferPointer to an attribute value. The attribute value is copied into the target handle. If the attribute value is a pointer, then only the pointer is copied, not the contents of the pointer. String attributes must be in UTF-16 in OCI_UTF16 environment.
sizeThe size of an attribute value. This can be passed in as 0 for most attributes as the size is already known by the OCI library. For text attributes, a UInt32 must be passed in set to the length of the string in bytes, regardless of encoding.
attributeIdentifies the attribute to assign the value to
Returns

◆ SetBooleanAttribute()

void Harlinn::OCI::HandleBase::SetBooleanAttribute ( Attribute attribute,
bool value ) const
inlineprotected

Sets the value of an attribute on the handle as a bool.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as a bool

◆ SetByteAttribute()

void Harlinn::OCI::HandleBase::SetByteAttribute ( Attribute attribute,
Byte value ) const
inlineprotected

Sets the value of an attribute on the handle as a Byte.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as a Byte

◆ SetDateTimeAttribute()

void Harlinn::OCI::HandleBase::SetDateTimeAttribute ( Attribute attribute,
const DateTime & value ) const
inlineprotected

Sets the value of an attribute on the handle as a DateTime.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as a DateTime

◆ SetHandle()

void Harlinn::OCI::HandleBase::SetHandle ( void * newHandleValue,
bool ownsHandle )
inlineconstexprprotectednoexcept

Assigns the handle value and ownership to this object.

Warning: Careless use of this function will cause resource leakage.

Parameters
newHandleValueThe new handle value
ownsHandleSet to true if this object will take owneship of the new handle value

◆ SetInt16Attribute()

void Harlinn::OCI::HandleBase::SetInt16Attribute ( Attribute attribute,
Int16 value ) const
inlineprotected

Sets the value of an attribute on the handle as an Int16.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as an Int16

◆ SetInt32Attribute()

void Harlinn::OCI::HandleBase::SetInt32Attribute ( Attribute attribute,
Int32 value ) const
inlineprotected

Sets the value of an attribute on the handle as an Int32.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as an Int32

◆ SetInt64Attribute()

void Harlinn::OCI::HandleBase::SetInt64Attribute ( Attribute attribute,
Int64 value ) const
inlineprotected

Sets the value of an attribute on the handle as an Int64.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as an Int64

◆ SetPointerAttribute()

void Harlinn::OCI::HandleBase::SetPointerAttribute ( Attribute attribute,
void * value ) const
inlineprotected

Sets the value of an attribute on the handle as a pointer.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as a pointer

◆ SetSByteAttribute()

void Harlinn::OCI::HandleBase::SetSByteAttribute ( Attribute attribute,
SByte value ) const
inlineprotected

Sets the value of an attribute on the handle as a Byte.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as a SByte

◆ SetStringAttribute() [1/2]

template<WideStringLike StringT>
void Harlinn::OCI::HandleBase::SetStringAttribute ( Attribute attribute,
const StringT & value ) const
inlineprotected

Sets the value of an attribute on the handle as a WideString.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute

◆ SetStringAttribute() [2/2]

void Harlinn::OCI::HandleBase::SetStringAttribute ( Attribute attribute,
const wchar_t * value,
size_t valueLength ) const
inlineprotected

◆ SetUInt16Attribute()

void Harlinn::OCI::HandleBase::SetUInt16Attribute ( Attribute attribute,
UInt16 value ) const
inlineprotected

Sets the value of an attribute on the handle as an UInt16.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as an UInt16

◆ SetUInt32Attribute()

void Harlinn::OCI::HandleBase::SetUInt32Attribute ( Attribute attribute,
UInt32 value ) const
inlineprotected

Sets the value of an attribute on the handle as an UInt32.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as an UInt32

◆ SetUInt64Attribute()

void Harlinn::OCI::HandleBase::SetUInt64Attribute ( Attribute attribute,
UInt64 value ) const
inlineprotected

Sets the value of an attribute on the handle as an UInt64.

Parameters
attributeIdentifies the attribute to assign the value to
valueValue of the attribute as an UInt64

◆ swap()

void Harlinn::OCI::HandleBase::swap ( HandleBase & other)
inlineconstexprprotectednoexcept

◆ Take()

template<typename Derived >
void Harlinn::OCI::HandleBase::Take ( Derived && derived)
inlineconstexprprotectednoexcept

Template function used to implement move assignement in derived classes.

Template Parameters
DerivedThe type of the derived class
Parameters
derived
Returns

Member Data Documentation

◆ handle_

void* Harlinn::OCI::HandleBase::handle_
private

◆ handleType_

OCI::HandleType Harlinn::OCI::HandleBase::handleType_
private

◆ ownsHandle_

bool Harlinn::OCI::HandleBase::ownsHandle_
private

The documentation for this class was generated from the following files: