24#include <com/sun/star/lang/XMultiServiceFactory.hpp>
25#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
26#include <com/sun/star/sdbc/SQLException.hpp>
40using namespace ::
cppu;
47 const Reference< XInterface > & _xStatement)
50 ,m_bUseBookmarks( false )
51 ,m_bEscapeProcessing( true )
54 OSL_ENSURE(_xStatement.is() ,
"Statement is NULL!");
71 OSubComponent::getTypes() );
75 Reference< XPreparedBatchExecution > xPreparedBatchExecution(
m_xAggregateAsSet, UNO_QUERY);
76 if ( xPreparedBatchExecution.is() )
85 Any aIface = OSubComponent::queryInterface( rType );
86 if (!aIface.hasValue())
88 aIface = ::cppu::queryInterface(
91 static_cast< XWarningsSupplier *
>(
this ),
92 static_cast< XCloseable *
>(
this ),
93 static_cast< XMultipleResults *
>(
this ),
94 static_cast< css::util::XCancellable *
>(
this ));
95 if ( !aIface.hasValue() )
99 aIface = ::cppu::queryInterface(rType,
static_cast< XGeneratedResultSet *
>(
this ));
101 if ( !aIface.hasValue() )
105 aIface = ::cppu::queryInterface(rType,
static_cast< XPreparedBatchExecution *
>(
this ));
113 OSubComponent::acquire();
124 Reference< XComponent > xComp(
m_aResultSet.get(), UNO_QUERY);
133 OPropertySetHelper::disposing();
159 OSubComponent::disposing();
167 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
181 return new ::cppu::OPropertyArrayHelper
206 bool bModified(
false);
210 bModified = ::comphelper::tryPropertyValue( rConvertedValue, rOldValue, rValue,
m_bUseBookmarks );
214 bModified = ::comphelper::tryPropertyValue( rConvertedValue, rOldValue, rValue,
m_bEscapeProcessing );
226 if ( aCurrentValue != rValue )
228 rOldValue = aCurrentValue;
229 rConvertedValue = rValue;
296 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
298 return Reference< XWarningsSupplier >(
m_xAggregateAsSet, UNO_QUERY_THROW)->getWarnings();
304 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
306 Reference< XWarningsSupplier >(
m_xAggregateAsSet, UNO_QUERY_THROW)->clearWarnings();
323 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
326 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
327 if (!xMeta.is() || !xMeta->supportsMultipleResultSets())
330 return Reference< XMultipleResults >(
m_xAggregateAsSet, UNO_QUERY_THROW)->getResultSet();
336 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
339 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
340 if (!xMeta.is() || !xMeta->supportsMultipleResultSets())
343 return Reference< XMultipleResults >(
m_xAggregateAsSet, UNO_QUERY_THROW)->getUpdateCount();
349 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
352 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
353 if (!xMeta.is() || !xMeta->supportsMultipleResultSets())
359 return Reference< XMultipleResults >(
m_xAggregateAsSet, UNO_QUERY_THROW)->getMoreResults();
366 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
369 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
370 if (!xMeta.is() || !xMeta->supportsBatchUpdates())
373 Reference< XPreparedBatchExecution >(
m_xAggregateAsSet, UNO_QUERY_THROW)->addBatch();
379 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
382 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
383 if (!xMeta.is() || !xMeta->supportsBatchUpdates())
386 Reference< XPreparedBatchExecution >(
m_xAggregateAsSet, UNO_QUERY_THROW)->clearBatch();
392 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
395 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
396 if (!xMeta.is() || !xMeta->supportsBatchUpdates())
402 return Reference< XPreparedBatchExecution >(
m_xAggregateAsSet, UNO_QUERY_THROW)->executeBatch();
408 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
412 return xGRes->getGeneratedValues( );
413 return Reference< XResultSet >();
419OStatement::OStatement(
const Reference< XConnection >& _xConn,
const Reference< XInterface > & _xStatement )
421 ,m_bAttemptedComposerCreation( false )
423 m_xAggregateStatement.set( _xStatement, UNO_QUERY_THROW );
432 return "com.sun.star.sdb.OStatement";
449 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
452 Reference< XResultSet > xResultSet;
457 Reference< XConnection > xConnection(
m_xParent, UNO_QUERY_THROW );
459 if ( xInnerResultSet.is() )
461 Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData();
462 bool bCaseSensitive = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers();
463 xResultSet =
new OResultSet( xInnerResultSet, *
this, bCaseSensitive );
475 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
486 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
497 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
500 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
501 if (!xMeta.is() || !xMeta->supportsBatchUpdates())
505 Reference< XBatchExecution >(
m_xAggregateAsSet, UNO_QUERY_THROW)->addBatch( sSQL );
511 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
513 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
514 if (!xMeta.is() || !xMeta->supportsBatchUpdates())
523 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
525 Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (
m_xParent, UNO_QUERY_THROW)->getMetaData();
526 if (!xMeta.is() || !xMeta->supportsBatchUpdates())
528 return Reference< XBatchExecution >(
m_xAggregateAsSet, UNO_QUERY_THROW)->executeBatch( );
534 return Reference< XConnection >(
m_xParent, UNO_QUERY );
553 bool bParseable =
false;
554 try {
m_xComposer->setQuery( _rSQL ); bParseable =
true; }
555 catch(
const SQLException& ) { }
561 OUString sLowLevelSQL =
m_xComposer->getQueryWithSubstitution();
virtual void SAL_CALL acquire() noexcept override
virtual sal_Int32 SAL_CALL getUpdateCount() override
virtual void SAL_CALL clearWarnings() override
virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
css::uno::WeakReferenceHelper m_aResultSet
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet() override
virtual css::uno::Any SAL_CALL getWarnings() override
virtual void SAL_CALL clearBatch() override
virtual void SAL_CALL close() override
virtual void SAL_CALL release() noexcept override
virtual sal_Bool SAL_CALL getMoreResults() override
OStatementBase(const css::uno::Reference< css::sdbc::XConnection > &_xConn, const css::uno::Reference< css::uno::XInterface > &_xStatement)
virtual void SAL_CALL disposing() override
virtual void SAL_CALL addBatch() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
css::uno::Reference< css::util::XCancellable > m_xAggregateAsCancellable
virtual ~OStatementBase() override
virtual void SAL_CALL cancel() override
::osl::Mutex m_aCancelMutex
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
css::uno::Reference< css::beans::XPropertySet > m_xAggregateAsSet
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
OStatement(const css::uno::Reference< css::sdbc::XConnection > &_xConn, const css::uno::Reference< css::uno::XInterface > &_xStatement)
OUString impl_doEscapeProcessing_nothrow(const OUString &_rSQL) const
does escape processing for the given SQL command, if the our EscapeProcessing property allows so.
css::uno::Reference< css::sdbc::XStatement > m_xAggregateStatement
bool m_bAttemptedComposerCreation
virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Int32 SAL_CALL executeUpdate(const OUString &sql) override
virtual sal_Bool SAL_CALL execute(const OUString &sql) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery(const OUString &sql) override
css::uno::Reference< css::sdb::XSingleSelectQueryComposer > m_xComposer
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL addBatch() override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection() override
bool impl_ensureComposer_nothrow() const
virtual void SAL_CALL clearBatch() override
css::uno::Reference< css::uno::XInterface > m_xParent
virtual void SAL_CALL release() noexcept override
::cppu::IPropertyArrayHelper * getArrayHelper()
mutable::osl::Mutex m_aMutex
virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(::rtl::OUString *pPropName, sal_Int16 *pAttributes, sal_Int32 nHandle)=0
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
css::uno::Type const & get()
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XSingleServiceFactory > xFactory
class SAL_NO_VTABLE XPropertySet
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OStatement, OStatementBase, OStatement_IFACE)
IMPLEMENT_FORWARD_XINTERFACE2(OStatement, OStatementBase, OStatement_IFACE)
#define PROPERTY_ID_RESULTSETTYPE
#define PROPERTY_ID_QUERYTIMEOUT
#define PROPERTY_ID_ESCAPE_PROCESSING
#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_FETCHDIRECTION
constexpr OUStringLiteral PROPERTY_FETCHDIRECTION(u"FetchDirection")
constexpr OUStringLiteral PROPERTY_RESULTSETCONCURRENCY(u"ResultSetConcurrency")
constexpr OUStringLiteral PROPERTY_RESULTSETTYPE(u"ResultSetType")
constexpr OUStringLiteral SERVICE_SDBC_STATEMENT
constexpr OUStringLiteral PROPERTY_QUERYTIMEOUT(u"QueryTimeOut")
constexpr OUStringLiteral SERVICE_NAME_SINGLESELECTQUERYCOMPOSER
constexpr OUStringLiteral PROPERTY_MAXFIELDSIZE(u"MaxFieldSize")
constexpr OUStringLiteral PROPERTY_MAXROWS(u"MaxRows")
constexpr OUStringLiteral PROPERTY_ESCAPE_PROCESSING(u"EscapeProcessing")
constexpr OUStringLiteral PROPERTY_USEBOOKMARKS(u"UseBookmarks")
constexpr OUStringLiteral PROPERTY_FETCHSIZE(u"FetchSize")
constexpr OUStringLiteral PROPERTY_CURSORNAME(u"CursorName")