30#include <com/sun/star/sdbc/SQLException.hpp>
47OStatementCommonBase::OStatementCommonBase(
Connection* _pConnection)
50 m_pConnection(_pConnection),
51#
if SAL_TYPES_SIZEOFPOINTER == 8
54 m_aStatementHandle(nullptr)
65 uno::Reference< XComponent > xComp(
m_xResultSet, UNO_QUERY);
79 u"isc_dsql_free_statement",
87 Any aRet = OStatementCommonBase_Base::queryInterface(rType);
107 checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
113 SAL_INFO(
"connectivity.firebird",
"close");
117 checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
133 pOutSqlda =
static_cast<XSQLDA*
>(calloc(1, XSQLDA_LENGTH(10)));
134 pOutSqlda->version = SQLDA_VERSION1;
135 pOutSqlda->sqln = 10;
145 u"isc_dsql_allocate_statement",
167 if (pOutSqlda->sqld > pOutSqlda->sqln)
169 int n = pOutSqlda->sqld;
171 pOutSqlda =
static_cast<XSQLDA*
>(calloc(1, XSQLDA_LENGTH(
n)));
172 pOutSqlda->version = SQLDA_VERSION1;
184 u"isc_dsql_describe",
210 checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
244 return new ::cppu::OPropertyArrayHelper
368 OStatementCommonBase_Base::acquire();
373 OStatementCommonBase_Base::release();
378 return ::cppu::OPropertySetHelper::createPropertySetInfo(
getInfoHelper());
383 ISC_STATUS_ARRAY aStatusVector;
386 char aInfoItems[] = {aInfoItem};
387 char aResultsBuffer[8];
389 aErr = isc_dsql_sql_info(aStatusVector,
393 sizeof(aResultsBuffer),
396 if (!aErr && aResultsBuffer[0] == aInfoItem)
398 const short aBytes =
static_cast<short>(isc_vax_integer(aResultsBuffer+1, 2));
399 return static_cast<short>(isc_vax_integer(aResultsBuffer+3, aBytes));
410 return getSqlInfoItem(isc_info_sql_stmt_type) == isc_info_sql_stmt_ddl;
415 const short aStatementType =
getSqlInfoItem(isc_info_sql_stmt_type);
418 ISC_STATUS_ARRAY aStatusVector;
422 char aInfoItems[] = {isc_info_sql_records};
423 char aResultsBuffer[1024];
425 aErr = isc_dsql_sql_info(aStatusVector,
429 sizeof(aResultsBuffer),
440 short aDesiredInfoType = 0;
441 switch (aStatementType)
443 case isc_info_sql_stmt_select:
444 aDesiredInfoType = isc_info_req_select_count;
446 case isc_info_sql_stmt_insert:
447 aDesiredInfoType = isc_info_req_insert_count;
449 case isc_info_sql_stmt_update:
450 aDesiredInfoType = isc_info_req_update_count;
452 case isc_info_sql_stmt_delete:
453 aDesiredInfoType = isc_info_req_delete_count;
455 case isc_info_sql_stmt_exec_procedure:
456 case isc_info_sql_stmt_ddl:
459 throw SQLException();
462 char* pResults = aResultsBuffer;
463 if (
static_cast<short>(*pResults++) != isc_info_sql_records)
470 while (*pResults != isc_info_rsb_end)
472 const char aToken = *pResults;
473 const short aLength =
static_cast<short>(isc_vax_integer(pResults+1, 2));
475 if (aToken == aDesiredInfoType)
477 return isc_vax_integer(pResults + 3, aLength);
480 pResults += (3 + aLength);
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
::cppu::IPropertyArrayHelper * getArrayHelper()
call this in the getInfoHelper method of your derived class.
virtual void SAL_CALL release() noexcept override
virtual css::uno::Any SAL_CALL getWarnings() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
used to implement the creation of the array helper which is shared amongst all instances of the class...
virtual void SAL_CALL cancel() override
::rtl::Reference< Connection > m_pConnection
virtual sal_Bool SAL_CALL getMoreResults() override
virtual ~OStatementCommonBase() override
isc_stmt_handle m_aStatementHandle
css::uno::Reference< css::sdbc::XResultSet > m_xResultSet
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
sal_Int32 getStatementChangeCount()
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
ISC_STATUS_ARRAY m_statusVector
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual sal_Int32 SAL_CALL getUpdateCount() override
void prepareAndDescribeStatement(std::u16string_view sqlIn, XSQLDA *&pOutSqlda)
short getSqlInfoItem(char aInfoItem)
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet() override
virtual void SAL_CALL acquire() noexcept override
virtual void disposeResultSet()
void freeStatementHandle()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL close() override
virtual void SAL_CALL clearWarnings() override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
css::uno::Type const & get()
#define SAL_INFO(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
void checkDisposed(bool _bThrow)
void evaluateStatusVector(const ISC_STATUS_ARRAY &rStatusVector, std::u16string_view aCause, const css::uno::Reference< css::uno::XInterface > &_rxContext)
Evaluate a firebird status vector and throw exceptions as necessary.
void mallocSQLVAR(XSQLDA *pSqlda)
::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, css::util::XCancellable, css::sdbc::XCloseable, css::sdbc::XMultipleResults > OStatementCommonBase_Base
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
#define PROPERTY_ID_RESULTSETTYPE
#define PROPERTY_ID_QUERYTIMEOUT
#define PROPERTY_ID_USEBOOKMARKS
#define PROPERTY_ID_CURSORNAME
#define PROPERTY_ID_RESULTSETCONCURRENCY
#define PROPERTY_ID_MAXFIELDSIZE
#define PROPERTY_ID_FETCHSIZE
#define PROPERTY_ID_MAXROWS
#define PROPERTY_ID_ESCAPEPROCESSING
#define PROPERTY_ID_FETCHDIRECTION