/* * OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI) * * Website: http://www.ocilib.net * * Copyright (c) 2007-2023 Vincent ROGIER * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "ocilibcpp/types.hpp" // ReSharper disable CppUseAuto // ReSharper disable CppParameterMayBeConst // ReSharper disable CppClangTidyCppcoreguidelinesMacroUsage // ReSharper disable CppClangTidyModernizeReturnBracedInitList // ReSharper disable CppClangTidyModernizePassByValue // ReSharper disable CppClangTidyHicppUseAuto // ReSharper disable CppClangTidyModernizeUseAuto // ReSharper disable CppClangTidyReadabilityInconsistentDeclarationParameterName // ReSharper disable CppClangTidyPerformanceUnnecessaryValueParam // ReSharper disable CppClangTidyHicppUseEqualsDefault // ReSharper disable CppClangTidyModernizeLoopConvert // ReSharper disable CppClangTidyModernizeUseEmplace // ReSharper disable CppClangTidyModernizeUseEqualsDefault // ReSharper disable CppClangTidyHicppUseEmplace // ReSharper disable CppClangTidyCertOop54Cpp // ReSharper disable CppClangTidyMiscMisplacedConst // ReSharper disable CppClangTidyBugproneUnhandledSelfAssignment namespace ocilib { inline Statement::Statement() { } inline Statement::Statement(const Connection &connection) { AcquireAllocatedWithNotification ( core::Check(OCI_StatementCreate(connection)), connection.GetHandle(), OnFreeSmartHandle ); } inline Statement::Statement(OCI_Statement *stmt, core::Handle *parent) { AcquireTransient(stmt, parent); } inline Connection Statement::GetConnection() const { return Connection(core::Check(OCI_StatementGetConnection(*this)), Environment::GetEnvironmentHandle()); } inline void Statement::Describe(const ostring& sql) { ClearBinds(); ReleaseResultsets(); core::Check(OCI_Describe(*this, sql.c_str())); } inline void Statement::Parse(const ostring& sql) { ClearBinds(); ReleaseResultsets(); core::Check(OCI_Parse(*this, sql.c_str())); } inline void Statement::Prepare(const ostring& sql) { ClearBinds(); ReleaseResultsets(); core::Check(OCI_Prepare(*this, sql.c_str())); } inline void Statement::ExecutePrepared() { ReleaseResultsets(); SetInData(); core::Check(OCI_Execute(*this)); SetOutData(); } template unsigned int Statement::ExecutePrepared(T callback) { ExecutePrepared(); return Fetch(callback); } template unsigned int Statement::ExecutePrepared(T callback, U adapter) { ExecutePrepared(); return Fetch(callback, adapter); } inline void Statement::Execute(const ostring& sql) { ClearBinds(); ReleaseResultsets(); core::Check(OCI_ExecuteStmt(*this, sql.c_str())); } template unsigned int Statement::Execute(const ostring& sql, T callback) { Execute(sql); return Fetch(callback); } template unsigned int Statement::Execute(const ostring& sql, T callback, U adapter) { Execute(sql); return Fetch(callback, adapter); } template unsigned int Statement::Fetch(T callback) { unsigned int res = 0; Resultset rs = GetResultset(); while (rs) { res += rs.ForEach(callback); rs = GetNextResultset(); } return res; } template unsigned int Statement::Fetch(T callback, U adapter) { unsigned int res = 0; Resultset rs = GetResultset(); while (rs) { res += rs.ForEach(callback, adapter); rs = GetNextResultset(); } return res; } inline unsigned int Statement::GetAffectedRows() const { return core::Check(OCI_GetAffectedRows(*this)); } inline ostring Statement::GetSql() const { return core::MakeString(core::Check(OCI_GetSql(*this))); } inline ostring Statement::GetSqlIdentifier() const { return core::MakeString(core::Check(OCI_GetSqlIdentifier(*this))); } inline Resultset Statement::GetResultset() { return Resultset(core::Check(OCI_GetResultset(*this)), GetHandle()); } inline Resultset Statement::GetNextResultset() { return Resultset(core::Check(OCI_GetNextResultset(*this)), GetHandle()); } inline void Statement::SetBindArraySize(unsigned int size) { core::Check(OCI_BindArraySetSize(*this, size)); } inline unsigned int Statement::GetBindArraySize() const { return core::Check(OCI_BindArrayGetSize(*this)); } inline void Statement::AllowRebinding(bool value) { core::Check(OCI_AllowRebinding(*this, value)); } inline bool Statement::IsRebindingAllowed() const { return (core::Check(OCI_IsRebindingAllowed(*this)) == TRUE); } inline unsigned int Statement::GetBindIndex(const ostring& name) const { return core::Check(OCI_GetBindIndex(*this, name.c_str())); } inline unsigned int Statement::GetBindCount() const { return core::Check(OCI_GetBindCount(*this)); } inline BindInfo Statement::GetBind(unsigned int index) const { return BindInfo(core::Check(OCI_GetBind(*this, index)), GetHandle()); } inline BindInfo Statement::GetBind(const ostring& name) const { return BindInfo(core::Check(OCI_GetBind2(*this, name.c_str())), GetHandle()); } template void Statement::Bind1(M &method, const ostring& name, T& value, BindInfo::BindDirection mode) { core::Check(method(*this, name.c_str(), &value)); SetLastBindMode(mode); } template void Statement::Bind2(M &method, const ostring& name, T& value, BindInfo::BindDirection mode) { core::Check(method(*this, name.c_str(), static_cast::OutputType>(value))); SetLastBindMode(mode); } template void Statement::BindVector1(M &method, const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { support::BindArray * bnd = core::OnAllocate(new support::BindArray(*this, name, mode)); bnd->SetVector(values, type == BindInfo::AsPlSqlTable, sizeof(typename support::BindResolver::OutputType)); const boolean res = method(*this, name.c_str(), bnd->GetData(), bnd->GetSizeForBindCall()); if (res) { support::BindsHolder *bindsHolder = GetBindsHolder(true); bindsHolder->AddBindObject(bnd); SetLastBindMode(mode); } else { delete core::OnDeallocate(bnd); } core::Check(res); } template void Statement::BindVector2(M &method, const ostring& name, std::vector &values, BindInfo::BindDirection mode, U subType, BindInfo::VectorType type) { support::BindArray * bnd = core::OnAllocate(new support::BindArray(*this, name, mode)); bnd->SetVector(values, type == BindInfo::AsPlSqlTable, sizeof(typename support::BindResolver::OutputType)); const boolean res = method(*this, name.c_str(), bnd->GetData(), subType, bnd->GetSizeForBindCall()); if (res) { support::BindsHolder *bindsHolder = GetBindsHolder(true); bindsHolder->AddBindObject(bnd); SetLastBindMode(mode); } else { delete core::OnDeallocate(bnd); } core::Check(res); } template<> inline void Statement::Bind(const ostring& name, bool &value, BindInfo::BindDirection mode) { support::BindTypeAdaptor * bnd = core::OnAllocate(new support::BindTypeAdaptor(*this, name, mode, value)); const boolean res = OCI_BindBoolean(*this, name.c_str(), static_cast(*bnd)); if (res) { support::BindsHolder *bindsHolder = GetBindsHolder(true); bindsHolder->AddBindObject(bnd); SetLastBindMode(mode); } else { delete core::OnDeallocate(bnd); } core::Check(res); } template<> inline void Statement::Bind(const ostring& name, short &value, BindInfo::BindDirection mode) { Bind1(OCI_BindShort, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, unsigned short &value, BindInfo::BindDirection mode) { Bind1(OCI_BindUnsignedShort, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, int &value, BindInfo::BindDirection mode) { Bind1(OCI_BindInt, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, unsigned int &value, BindInfo::BindDirection mode) { Bind1(OCI_BindUnsignedInt, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, big_int &value, BindInfo::BindDirection mode) { Bind1(OCI_BindBigInt, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, big_uint &value, BindInfo::BindDirection mode) { Bind1(OCI_BindUnsignedBigInt, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, float &value, BindInfo::BindDirection mode) { Bind1(OCI_BindFloat, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, double &value, BindInfo::BindDirection mode) { Bind1(OCI_BindDouble, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Number &value, BindInfo::BindDirection mode) { Bind2(OCI_BindNumber, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Date &value, BindInfo::BindDirection mode) { Bind2(OCI_BindDate, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Timestamp &value, BindInfo::BindDirection mode) { Bind2(OCI_BindTimestamp, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Interval &value, BindInfo::BindDirection mode) { Bind2(OCI_BindInterval, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Clob &value, BindInfo::BindDirection mode) { Bind2(OCI_BindLob, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, NClob &value, BindInfo::BindDirection mode) { Bind2(OCI_BindLob, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Blob &value, BindInfo::BindDirection mode) { Bind2(OCI_BindLob, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, File &value, BindInfo::BindDirection mode) { Bind2(OCI_BindFile, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Object &value, BindInfo::BindDirection mode) { Bind2(OCI_BindObject, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Reference &value, BindInfo::BindDirection mode) { Bind2(OCI_BindRef, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Statement &value, BindInfo::BindDirection mode) { Bind2(OCI_BindStatement, name, value, mode); } template<> inline void Statement::Bind(const ostring& name, Clong &value, unsigned int maxSize, BindInfo::BindDirection mode) { core::Check(OCI_BindLong(*this, name.c_str(), value, maxSize)); SetLastBindMode(mode); } template<> inline void Statement::Bind(const ostring& name, Clong &value, int maxSize, BindInfo::BindDirection mode) { Bind(name, value, static_cast(maxSize), mode); } template<> inline void Statement::Bind(const ostring& name, Blong &value, unsigned int maxSize, BindInfo::BindDirection mode) { core::Check(OCI_BindLong(*this, name.c_str(), value, maxSize)); SetLastBindMode(mode); } template<> inline void Statement::Bind(const ostring& name, Blong &value, int maxSize, BindInfo::BindDirection mode) { Bind(name, value, static_cast(maxSize), mode); } template<> inline void Statement::Bind(const ostring& name, ostring &value, unsigned int maxSize, BindInfo::BindDirection mode) { if (maxSize == 0) { maxSize = static_cast(value.size()); } value.reserve(maxSize); support::BindObjectAdaptor * bnd = core::OnAllocate(new support::BindObjectAdaptor(*this, name, mode, value, maxSize + 1)); const boolean res = OCI_BindString(*this, name.c_str(), static_cast(*bnd), maxSize); if (res) { support::BindsHolder *bindsHolder = GetBindsHolder(true); bindsHolder->AddBindObject(bnd); SetLastBindMode(mode); } else { delete core::OnDeallocate(bnd); } core::Check(res); } template<> inline void Statement::Bind(const ostring& name, ostring &value, int maxSize, BindInfo::BindDirection mode) { Bind(name, value, static_cast(maxSize), mode); } template<> inline void Statement::Bind(const ostring& name, Raw &value, unsigned int maxSize, BindInfo::BindDirection mode) { if (maxSize == 0) { maxSize = static_cast(value.size()); } value.reserve(maxSize); support::BindObjectAdaptor * bnd = core::OnAllocate(new support::BindObjectAdaptor(*this, name, mode, value, maxSize)); const boolean res = OCI_BindRaw(*this, name.c_str(), static_cast(*bnd), maxSize); if (res) { support::BindsHolder *bindsHolder = GetBindsHolder(true); bindsHolder->AddBindObject(bnd); SetLastBindMode(mode); } else { delete core::OnDeallocate(bnd); } core::Check(res); } template<> inline void Statement::Bind(const ostring& name, Raw &value, int maxSize, BindInfo::BindDirection mode) { Bind(name, value, static_cast(maxSize), mode); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfShorts, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfUnsignedShorts, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfInts, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfUnsignedInts, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfBigInts, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfUnsignedBigInts, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfFloats, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfDoubles, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfDates, name, values, mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector1(OCI_BindArrayOfNumbers, name, values, mode, type); } template void Statement::Bind(const ostring& name, Collection &value, BindInfo::BindDirection mode) { core::Check(OCI_BindColl(*this, name.c_str(), value)); SetLastBindMode(mode); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, Timestamp::TimestampTypeValues subType, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfTimestamps, name, values, mode, subType, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, Timestamp::TimestampType subType, BindInfo::BindDirection mode, BindInfo::VectorType type) { Bind(name, values, subType.GetValue(), mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, Interval::IntervalTypeValues subType, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfIntervals, name, values, mode, subType, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, Interval::IntervalType subType, BindInfo::BindDirection mode, BindInfo::VectorType type) { Bind(name, values, subType.GetValue(), mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfLobs, name, values, mode, static_cast(OCI_CLOB), type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfLobs, name, values, mode, static_cast(OCI_NCLOB), type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfLobs, name, values, mode, static_cast(OCI_BLOB), type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfFiles, name, values, mode, static_cast(OCI_BFILE), type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfObjects, name, values, mode, static_cast(typeInfo), type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfRefs, name, values, mode, static_cast(typeInfo), type); } template void Statement::Bind(const ostring& name, std::vector > &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfColls, name, values, mode, static_cast(typeInfo), type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, unsigned int maxSize, BindInfo::BindDirection mode, BindInfo::VectorType type) { support::BindArray * bnd = core::OnAllocate(new support::BindArray(*this, name, mode)); bnd->SetVector(values, type == BindInfo::AsPlSqlTable, maxSize+1); const boolean res = OCI_BindArrayOfStrings(*this, name.c_str(), bnd->GetData(), maxSize, bnd->GetSizeForBindCall()); if (res) { support::BindsHolder *bindsHolder = GetBindsHolder(true); bindsHolder->AddBindObject(bnd); SetLastBindMode(mode); } else { delete core::OnDeallocate(bnd); } core::Check(res); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, int maxSize, BindInfo::BindDirection mode, BindInfo::VectorType type) { Bind(name, values, static_cast(maxSize), mode, type); } template<> inline void Statement::Bind(const ostring& name, std::vector &values, unsigned int maxSize, BindInfo::BindDirection mode, BindInfo::VectorType type) { support::BindArray * bnd = core::OnAllocate(new support::BindArray(*this, name, mode)); bnd->SetVector(values, type == BindInfo::AsPlSqlTable, maxSize); const boolean res = OCI_BindArrayOfRaws(*this, name.c_str(), bnd->GetData(), maxSize, bnd->GetSizeForBindCall()); if (res) { support::BindsHolder *bindsHolder = GetBindsHolder(true); bindsHolder->AddBindObject(bnd); SetLastBindMode(mode); } else { delete core::OnDeallocate(bnd); } core::Check(res); } template void Statement::Bind(const ostring& name, std::vector &values, TypeInfo &typeInfo, BindInfo::BindDirection mode, BindInfo::VectorType type) { BindVector2(OCI_BindArrayOfColls, name, values, mode, static_cast(typeInfo), GetArraysize(type, values)); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterUnsignedShort(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterShort(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterUnsignedInt(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterInt(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterUnsignedBigInt(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterBigInt(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterFloat(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterDouble(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterNumber(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterDate(*this, name.c_str())); } template<> inline void Statement::Register(const ostring& name, Timestamp::TimestampTypeValues type) { core::Check(OCI_RegisterTimestamp(*this, name.c_str(), type)); } template<> inline void Statement::Register(const ostring& name, Timestamp::TimestampType type) { Register(name, type.GetValue()); } template<> inline void Statement::Register(const ostring& name, Interval::IntervalTypeValues type) { core::Check(OCI_RegisterInterval(*this, name.c_str(), type)); } template<> inline void Statement::Register(const ostring& name, Interval::IntervalType type) { Register(name, type.GetValue()); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterLob(*this, name.c_str(), OCI_CLOB)); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterLob(*this, name.c_str(), OCI_NCLOB)); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterLob(*this, name.c_str(), OCI_BLOB)); } template<> inline void Statement::Register(const ostring& name) { core::Check(OCI_RegisterFile(*this, name.c_str(), OCI_BFILE)); } template<> inline void Statement::Register(const ostring& name, TypeInfo& typeInfo) { core::Check(OCI_RegisterObject(*this, name.c_str(), typeInfo)); } template<> inline void Statement::Register(const ostring& name, TypeInfo& typeInfo) { core::Check(OCI_RegisterRef(*this, name.c_str(), typeInfo)); } template<> inline void Statement::Register(const ostring& name, unsigned int len) { core::Check(OCI_RegisterString(*this, name.c_str(), len)); } template<> inline void Statement::Register(const ostring& name, int len) { Register(name, static_cast(len)); } template<> inline void Statement::Register(const ostring& name, unsigned int len) { core::Check(OCI_RegisterRaw(*this, name.c_str(), len)); } template<> inline void Statement::Register(const ostring& name, int len) { Register(name, static_cast(len)); } inline Statement::StatementType Statement::GetStatementType() const { return StatementType(static_cast(core::Check(OCI_GetStatementType(*this)))); } inline unsigned int Statement::GetSqlErrorPos() const { return core::Check(OCI_GetSqlErrorPos(*this)); } inline void Statement::SetFetchMode(FetchMode value) { core::Check(OCI_SetFetchMode(*this, value)); } inline Statement::FetchMode Statement::GetFetchMode() const { return FetchMode(static_cast(core::Check(OCI_GetFetchMode(*this)))); } inline void Statement::SetBindMode(BindMode value) { core::Check(OCI_SetBindMode(*this, value)); } inline Statement::BindMode Statement::GetBindMode() const { return BindMode(static_cast(core::Check(OCI_GetBindMode(*this)))); } inline void Statement::SetFetchSize(unsigned int value) { core::Check(OCI_SetFetchSize(*this, value)); } inline unsigned int Statement::GetFetchSize() const { return core::Check(OCI_GetFetchSize(*this)); } inline void Statement::SetPrefetchSize(unsigned int value) { core::Check(OCI_SetPrefetchSize(*this, value)); } inline unsigned int Statement::GetPrefetchSize() const { return core::Check(OCI_GetPrefetchSize(*this)); } inline void Statement::SetPrefetchMemory(unsigned int value) { core::Check(OCI_SetPrefetchMemory(*this, value)); } inline unsigned int Statement::GetPrefetchMemory() const { return core::Check(OCI_GetPrefetchMemory(*this)); } inline void Statement::SetLongMaxSize(unsigned int value) { core::Check(OCI_SetLongMaxSize(*this, value)); } inline unsigned int Statement::GetLongMaxSize() const { return core::Check(OCI_GetLongMaxSize(*this)); } inline void Statement::SetLongMode(LongMode value) { core::Check(OCI_SetLongMode(*this, value)); } inline Statement::LongMode Statement::GetLongMode() const { return LongMode(static_cast(core::Check(OCI_GetLongMode(*this)))); } inline unsigned int Statement::GetSQLCommand() const { return core::Check(OCI_GetSQLCommand(*this)); } inline ostring Statement::GetSQLVerb() const { return core::MakeString(core::Check(OCI_GetSQLVerb(*this))); } inline void Statement::GetBatchErrors(std::vector &exceptions) { exceptions.clear(); OCI_Error *err = core::Check(OCI_GetBatchError(*this)); while (err) { exceptions.push_back(Exception(err)); err = core::Check(OCI_GetBatchError(*this)); } } inline void Statement::ClearBinds() const { support::BindsHolder *bindsHolder = GetBindsHolder(false); if (bindsHolder) { bindsHolder->Clear(); } } inline void Statement::SetOutData() const { support::BindsHolder *bindsHolder = GetBindsHolder(false); if (bindsHolder) { bindsHolder->SetOutData(); } } inline void Statement::SetInData() const { support::BindsHolder *bindsHolder = GetBindsHolder(false); if (bindsHolder) { bindsHolder->SetInData(); } } inline void Statement::ReleaseResultsets() const { if (_smartHandle) { core::Handle *handle = nullptr; while (_smartHandle->GetChildren().FindIf(IsResultsetHandle, handle)) { if (handle) { handle->DetachFromHolders(); delete core::OnDeallocate(handle); handle = nullptr; } } } } inline bool Statement::IsResultsetHandle(core::Handle *handle) { Resultset::SmartHandle *smartHandle = dynamic_cast(handle); return smartHandle != nullptr; } inline void Statement::OnFreeSmartHandle(SmartHandle *smartHandle) { if (smartHandle) { support::BindsHolder *bindsHolder = static_cast(smartHandle->GetExtraInfos()); smartHandle->SetExtraInfos(nullptr); delete core::OnDeallocate(bindsHolder); } } inline void Statement::SetLastBindMode(BindInfo::BindDirection mode) { core::Check(OCI_BindSetDirection(core::Check(OCI_GetBind(*this, core::Check(OCI_GetBindCount(*this)))), mode)); } inline support::BindsHolder * Statement::GetBindsHolder(bool create) const { support::BindsHolder * bindsHolder = static_cast(_smartHandle->GetExtraInfos()); if (bindsHolder == nullptr && create) { bindsHolder = core::OnAllocate(new support::BindsHolder(*this)); _smartHandle->SetExtraInfos(bindsHolder); } return bindsHolder; } }