Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::OCI::Statement Class Referencefinal

Statement, the context that identifies a SQL or PL/SQL statement and its associated attributes. More...

#include <HOCI.h>

Inheritance diagram for Harlinn::OCI::Statement:
[legend]
Collaboration diagram for Harlinn::OCI::Statement:
[legend]

Public Member Functions

 Statement () noexcept
 
 Statement (const Statement &other)=delete
 
 Statement (Statement &&other) noexcept
 
 Statement (const OCI::ServiceContext &serviceContext, void *ocistmt, bool ownsHandle)
 Constructs a new Statement object.
 
HO_EXPORT ~Statement ()
 
Statementoperator= (const Statement &other)=delete
 
Statementoperator= (Statement &&other) noexcept
 
void swap (Statement &other) noexcept
 
constexpr const OCI::ServiceContextServiceContext () const noexcept
 
const OCI::EnvironmentEnvironment () const noexcept
 
const OCI::ErrorHandleError () const noexcept final override
 Provides access to the OCIError that will be used for OCI calls for this object.
 
template<typename BindType , typename ... ArgTypes>
requires std::is_base_of_v<BindBase, BindType>
BindType * Bind (UInt32 position, ArgTypes &&... args) const
 
template<typename T , typename ... ArgTypes>
requires Internal::HasTraits<T>
Internal::Traits< T >::BindType * Bind (UInt32 position, ArgTypes &&... args) const
 
template<typename BindType , typename ... ArgTypes>
requires std::is_base_of_v<BindBase, BindType>
BindType * Bind (const WideString &name, ArgTypes &&... args) const
 
template<typename T , typename ... ArgTypes>
requires Internal::HasTraits<T>
Internal::Traits< T >::BindType * Bind (const WideString &name, ArgTypes &&... args) const
 
const std::vector< std::unique_ptr< OCI::BindBase > > & Binds () const
 
OCI::StatementType StatementType () const
 Returns the type of statement associated with the handle.
 
UInt32 BindCount () const
 Returns the number of bind positions on the statement handle.
 
UInt64 ContinuousQueryId () const
 Obtains the query ID of a registered query.
 
UInt32 CurrentPosition () const
 Indicates the current position in the result set.
 
UInt32 NumDMLErrors () const
 Returns the number of errors in the DML operation.
 
bool FetchRowId () const
 Specifies that the ROWIDs are fetched after doing a define at position 0, and a SELECT...FOR UPDATE statement.
 
void SetFetchRowId (bool value) const
 Specifies that the ROWIDs are fetched after doing a define at position 0, and a SELECT...FOR UPDATE statement.
 
UInt32 ImplicitResultCount () const
 Returns the total number of implicit results available on the top-level OCI statement handle.
 
UInt32 ParamCount () const
 Gets the number of columns in the select-list for the statement associated with the statement handle.
 
UInt32 ParseErrorOffset () const
 Returns the parse error offset for a statement.
 
void SetPrefetchMemory (UInt32 size) const
 Sets the memory level for top-level rows to be prefetched.
 
void SetPrefetchRows (UInt32 count) const
 Sets the number of top-level rows to be prefetched. The default value is 1 row.
 
UInt64 RowCount () const
 Returns the number of rows processed so far after SELECT statements.
 
UInt32 RowsFetched () const
 Indicates the number of rows that were successfully fetched into the user's buffers in the last fetch or execute with nonzero iterations. It can be used for both scrollable and nonscrollable statement handles.
 
UInt16 SqlFunctionCode () const
 Returns the function code of the SQL command associated with the statement.
 
WideString Text () const
 Returns the text of the SQL statement prepared in a statement handle. In UTF-16 mode, the returned statement is in UTF-16 encoding.
 
bool IsReturning () const
 Returns true if the SQL Statement has a RETURNING INTO clause.
 
StatementState State () const
 Returns the fetch state of that statement.
 
const OCI::SubscriptionChangeNotification () const
 Returns a reference to the registered continous query notification handler.
 
void SetChangeNotification (Subscription &&changeNotification)
 When this attribute is set to the appropriate subscription handle, execution of the query also creates the registration of the query for continuous query notification.
 
HO_EXPORT Int32 Execute (UInt32 iters=1, StatementExecuteMode executeMode=StatementExecuteMode::Default, UInt32 rowoff=0)
 
template<typename DataReaderType = OCI::DataReader>
requires std::is_base_of_v<OCI::DataReader, DataReaderType>
std::unique_ptr< DataReaderType > ExecuteReader (StatementExecuteMode executeMode=StatementExecuteMode::Default)
 
template<typename DataReaderType >
requires std::is_base_of_v<OCI::ArrayDataReader, DataReaderType>
std::unique_ptr< DataReaderType > ExecuteReader (size_t defineSize=1000, StatementExecuteMode executeMode=StatementExecuteMode::Default)
 
template<typename T >
std::optional< TExecuteScalar ()
 
Int64 ExecuteNonQuery (UInt32 iters=1, StatementExecuteMode executeMode=StatementExecuteMode::Default, UInt32 rowoff=0)
 
HO_EXPORT Int32 Fetch (UInt32 numberOfRows=1, FetchOrientation orientation=FetchOrientation::Next, long fetchOffset=0) const
 
UInt32 DescriptorCount () const
 
HO_EXPORT std::unique_ptr< ParameterDescriptorDescriptor (UInt32 descriptorIndex) const
 
HO_EXPORT void GetDescriptors (std::vector< std::unique_ptr< ParameterDescriptor > > &descriptors) const
 
HO_EXPORT std::unique_ptr< OCI::DefineDefine (UInt32 descriptorIndex) const
 
HO_EXPORT std::unique_ptr< OCI::DefineDefine (UInt32 descriptorIndex, const OCI::ColumnDescriptor &columnDescriptor) const
 
HO_EXPORT std::unique_ptr< OCI::ArrayDefineDefine (size_t defineSize, UInt32 descriptorIndex) const
 
HO_EXPORT std::unique_ptr< OCI::ArrayDefineDefine (size_t defineSize, UInt32 descriptorIndex, const OCI::ColumnDescriptor &columnDescriptor) const
 
- Public Member Functions inherited from Harlinn::OCI::HandleBase
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.
 

Static Public Attributes

static constexpr OCI::HandleType OCIHandleType = OCI::HandleType::Statement
 

Private Types

using Base = HandleBase
 

Private Attributes

const OCI::ServiceContextserviceContext_
 
const OCI::ErrorHandleerror_
 
OCI::Subscription changeNotification_
 
std::vector< std::unique_ptr< OCI::BindBase > > binds_
 

Additional Inherited Members

- Protected Member Functions inherited from Harlinn::OCI::HandleBase
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 inherited from Harlinn::OCI::HandleBase
static HO_EXPORT void HandleFree (void *handle, OCI::HandleType handleType) noexcept
 Calls OCIHandleFree to release the handle.
 

Detailed Description

Statement, the context that identifies a SQL or PL/SQL statement and its associated attributes.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ Statement() [1/4]

Harlinn::OCI::Statement::Statement ( )
inlinenoexcept

◆ Statement() [2/4]

Harlinn::OCI::Statement::Statement ( const Statement & other)
delete

◆ Statement() [3/4]

Harlinn::OCI::Statement::Statement ( Statement && other)
inlinenoexcept

◆ Statement() [4/4]

Harlinn::OCI::Statement::Statement ( const OCI::ServiceContext & serviceContext,
void * ocistmt,
bool ownsHandle )
inline

Constructs a new Statement object.

Parameters
serviceContextA reference to the service context used to create the statement handle
handleThe handle wrapped by this object.
ownsHandleSet to true if the new object will take owneship of the handle value

◆ ~Statement()

Harlinn::OCI::Statement::~Statement ( )

Member Function Documentation

◆ Bind() [1/4]

template<typename BindType , typename ... ArgTypes>
requires std::is_base_of_v<BindBase, BindType>
BindType * Harlinn::OCI::Statement::Bind ( const WideString & name,
ArgTypes &&... args ) const
inline

◆ Bind() [2/4]

template<typename T , typename ... ArgTypes>
requires Internal::HasTraits<T>
Internal::Traits< T >::BindType * Harlinn::OCI::Statement::Bind ( const WideString & name,
ArgTypes &&... args ) const
inline

◆ Bind() [3/4]

template<typename BindType , typename ... ArgTypes>
requires std::is_base_of_v<BindBase, BindType>
BindType * Harlinn::OCI::Statement::Bind ( UInt32 position,
ArgTypes &&... args ) const
inline

◆ Bind() [4/4]

template<typename T , typename ... ArgTypes>
requires Internal::HasTraits<T>
Internal::Traits< T >::BindType * Harlinn::OCI::Statement::Bind ( UInt32 position,
ArgTypes &&... args ) const
inline

◆ BindCount()

UInt32 Harlinn::OCI::Statement::BindCount ( ) const
inline

Returns the number of bind positions on the statement handle.

◆ Binds()

const std::vector< std::unique_ptr< OCI::BindBase > > & Harlinn::OCI::Statement::Binds ( ) const
inline

◆ ChangeNotification()

const OCI::Subscription & Harlinn::OCI::Statement::ChangeNotification ( ) const
inline

Returns a reference to the registered continous query notification handler.

Returns

◆ ContinuousQueryId()

UInt64 Harlinn::OCI::Statement::ContinuousQueryId ( ) const
inline

Obtains the query ID of a registered query.

◆ CurrentPosition()

UInt32 Harlinn::OCI::Statement::CurrentPosition ( ) const
inline

Indicates the current position in the result set.

◆ Define() [1/4]

std::unique_ptr< OCI::ArrayDefine > Harlinn::OCI::Statement::Define ( size_t defineSize,
UInt32 descriptorIndex ) const

◆ Define() [2/4]

std::unique_ptr< OCI::ArrayDefine > Harlinn::OCI::Statement::Define ( size_t defineSize,
UInt32 descriptorIndex,
const OCI::ColumnDescriptor & columnDescriptor ) const

◆ Define() [3/4]

std::unique_ptr< OCI::Define > Harlinn::OCI::Statement::Define ( UInt32 descriptorIndex) const

◆ Define() [4/4]

std::unique_ptr< OCI::Define > Harlinn::OCI::Statement::Define ( UInt32 descriptorIndex,
const OCI::ColumnDescriptor & columnDescriptor ) const

◆ Descriptor()

std::unique_ptr< OCI::ParameterDescriptor > Harlinn::OCI::Statement::Descriptor ( UInt32 descriptorIndex) const

◆ DescriptorCount()

UInt32 Harlinn::OCI::Statement::DescriptorCount ( ) const
inline

◆ Environment()

const OCI::Environment & Harlinn::OCI::Statement::Environment ( ) const
inlinenoexcept

◆ Error()

const OCI::ErrorHandle & Harlinn::OCI::Statement::Error ( ) const
inlinefinaloverridevirtualnoexcept

Provides access to the OCIError that will be used for OCI calls for this object.

Returns

Implements Harlinn::OCI::HandleBase.

◆ Execute()

Int32 Harlinn::OCI::Statement::Execute ( UInt32 iters = 1,
StatementExecuteMode executeMode = StatementExecuteMode::Default,
UInt32 rowoff = 0 )

◆ ExecuteNonQuery()

Int64 Harlinn::OCI::Statement::ExecuteNonQuery ( UInt32 iters = 1,
StatementExecuteMode executeMode = StatementExecuteMode::Default,
UInt32 rowoff = 0 )
inline

◆ ExecuteReader() [1/2]

template<typename DataReaderType >
requires std::is_base_of_v<OCI::ArrayDataReader, DataReaderType>
std::unique_ptr< DataReaderType > Harlinn::OCI::Statement::ExecuteReader ( size_t defineSize = 1000,
StatementExecuteMode executeMode = StatementExecuteMode::Default )
inline

◆ ExecuteReader() [2/2]

template<typename DataReaderType >
requires std::is_base_of_v<OCI::DataReader, DataReaderType>
std::unique_ptr< DataReaderType > Harlinn::OCI::Statement::ExecuteReader ( StatementExecuteMode executeMode = StatementExecuteMode::Default)
inline

◆ ExecuteScalar()

template<typename T >
std::optional< T > Harlinn::OCI::Statement::ExecuteScalar ( )
inline

◆ Fetch()

Int32 Harlinn::OCI::Statement::Fetch ( UInt32 numberOfRows = 1,
FetchOrientation orientation = FetchOrientation::Next,
long fetchOffset = 0 ) const

◆ FetchRowId()

bool Harlinn::OCI::Statement::FetchRowId ( ) const
inline

Specifies that the ROWIDs are fetched after doing a define at position 0, and a SELECT...FOR UPDATE statement.

◆ GetDescriptors()

void Harlinn::OCI::Statement::GetDescriptors ( std::vector< std::unique_ptr< ParameterDescriptor > > & descriptors) const

◆ ImplicitResultCount()

UInt32 Harlinn::OCI::Statement::ImplicitResultCount ( ) const
inline

Returns the total number of implicit results available on the top-level OCI statement handle.

◆ IsReturning()

bool Harlinn::OCI::Statement::IsReturning ( ) const
inline

Returns true if the SQL Statement has a RETURNING INTO clause.

Returns

◆ NumDMLErrors()

UInt32 Harlinn::OCI::Statement::NumDMLErrors ( ) const
inline

Returns the number of errors in the DML operation.

◆ operator=() [1/2]

Statement & Harlinn::OCI::Statement::operator= ( const Statement & other)
delete

◆ operator=() [2/2]

Statement & Harlinn::OCI::Statement::operator= ( Statement && other)
inlinenoexcept

◆ ParamCount()

UInt32 Harlinn::OCI::Statement::ParamCount ( ) const
inline

Gets the number of columns in the select-list for the statement associated with the statement handle.

◆ ParseErrorOffset()

UInt32 Harlinn::OCI::Statement::ParseErrorOffset ( ) const
inline

Returns the parse error offset for a statement.

◆ RowCount()

UInt64 Harlinn::OCI::Statement::RowCount ( ) const
inline

Returns the number of rows processed so far after SELECT statements.

◆ RowsFetched()

UInt32 Harlinn::OCI::Statement::RowsFetched ( ) const
inline

Indicates the number of rows that were successfully fetched into the user's buffers in the last fetch or execute with nonzero iterations. It can be used for both scrollable and nonscrollable statement handles.

Returns

◆ ServiceContext()

const OCI::ServiceContext & Harlinn::OCI::Statement::ServiceContext ( ) const
inlineconstexprnoexcept

◆ SetChangeNotification()

void Harlinn::OCI::Statement::SetChangeNotification ( Subscription && changeNotification)
inline

When this attribute is set to the appropriate subscription handle, execution of the query also creates the registration of the query for continuous query notification.

Parameters
subscriptionsubscription

◆ SetFetchRowId()

void Harlinn::OCI::Statement::SetFetchRowId ( bool value) const
inline

Specifies that the ROWIDs are fetched after doing a define at position 0, and a SELECT...FOR UPDATE statement.

◆ SetPrefetchMemory()

void Harlinn::OCI::Statement::SetPrefetchMemory ( UInt32 size) const
inline

Sets the memory level for top-level rows to be prefetched.

Rows up to the specified top-level row count are fetched if the memory level occupies no more than the specified memory usage limit. The default value is 0, which means that memory size is not included in computing the number of rows to prefetch.

Parameters
sizememory limit

◆ SetPrefetchRows()

void Harlinn::OCI::Statement::SetPrefetchRows ( UInt32 count) const
inline

Sets the number of top-level rows to be prefetched. The default value is 1 row.

Parameters
countnumber of rows to be prefetched

◆ SqlFunctionCode()

UInt16 Harlinn::OCI::Statement::SqlFunctionCode ( ) const
inline

Returns the function code of the SQL command associated with the statement.

◆ State()

StatementState Harlinn::OCI::Statement::State ( ) const
inline

Returns the fetch state of that statement.

◆ StatementType()

OCI::StatementType Harlinn::OCI::Statement::StatementType ( ) const
inline

Returns the type of statement associated with the handle.

◆ swap()

void Harlinn::OCI::Statement::swap ( Statement & other)
inlinenoexcept

◆ Text()

WideString Harlinn::OCI::Statement::Text ( ) const
inline

Returns the text of the SQL statement prepared in a statement handle. In UTF-16 mode, the returned statement is in UTF-16 encoding.

Member Data Documentation

◆ binds_

std::vector<std::unique_ptr<OCI::BindBase> > Harlinn::OCI::Statement::binds_
mutableprivate

◆ changeNotification_

OCI::Subscription Harlinn::OCI::Statement::changeNotification_
private

◆ error_

const OCI::ErrorHandle* Harlinn::OCI::Statement::error_
private

◆ OCIHandleType

OCI::HandleType Harlinn::OCI::Statement::OCIHandleType = OCI::HandleType::Statement
staticconstexpr

◆ serviceContext_

const OCI::ServiceContext* Harlinn::OCI::Statement::serviceContext_
private

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