diff options
Diffstat (limited to 'connectivity/source/drivers/ado/AStatement.cxx')
-rw-r--r-- | connectivity/source/drivers/ado/AStatement.cxx | 125 |
1 files changed, 80 insertions, 45 deletions
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx index 599df13aba36..c2a09385dee6 100644 --- a/connectivity/source/drivers/ado/AStatement.cxx +++ b/connectivity/source/drivers/ado/AStatement.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/sdbc/FetchDirection.hpp> #include <connectivity/dbexception.hxx> #include <comphelper/types.hxx> +#include <rtl/ref.hxx> #undef max @@ -40,7 +41,7 @@ using namespace ::comphelper; #define CHECK_RETURN(x) \ if(!x) \ - ADOS::ThrowException(*m_pConnection->getConnection(),*this); + ADOS::ThrowException(m_pConnection->getConnection(),*this); using namespace connectivity::ado; @@ -50,7 +51,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; -using namespace ::std; OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex) ,OPropertySetHelper(OStatement_BASE::rBHelper) @@ -66,7 +66,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE( if(m_Command.IsValid()) m_Command.putref_ActiveConnection(m_pConnection->getConnection()); else - ADOS::ThrowException(*m_pConnection->getConnection(),*this); + ADOS::ThrowException(m_pConnection->getConnection(),*this); m_RecordsAffected.setNoArg(); m_Parameters.setNoArg(); @@ -94,7 +94,7 @@ void OStatement_Base::disposing() disposeResultSet(); if ( m_Command.IsValid() ) - m_Command.putref_ActiveConnection( nullptr ); + m_Command.putref_ActiveConnection({}); m_Command.clear(); if ( m_RecordSet.IsValid() ) @@ -107,7 +107,7 @@ void OStatement_Base::disposing() OStatement_BASE::disposing(); } -void SAL_CALL OStatement_Base::release() throw() +void SAL_CALL OStatement_Base::release() noexcept { OStatement_BASE::release(); } @@ -239,7 +239,7 @@ void OStatement_Base::setWarning (const SQLWarning &ex) void OStatement_Base::assignRecordSet( ADORecordset* _pRS ) { WpADORecordset aOldRS( m_RecordSet ); - m_RecordSet = WpADORecordset( _pRS ); + m_RecordSet.set( _pRS ); if ( aOldRS.IsValid() ) aOldRS.PutRefDataSource( nullptr ); @@ -305,13 +305,12 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const OUString& CHECK_RETURN(aSet.get_CursorType(m_eCursorType)) CHECK_RETURN(aSet.get_LockType(m_eLockType)) - OResultSet* pSet = new OResultSet(aSet,this); - Reference< XResultSet > xRs = pSet; + rtl::Reference<OResultSet> pSet = new OResultSet(aSet,this); pSet->construct(); - m_xResultSet = WeakReference<XResultSet>(xRs); + m_xResultSet = WeakReference<XResultSet>(pSet); - return xRs; + return pSet; } @@ -441,8 +440,6 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) checkDisposed(OStatement_BASE::rBHelper.bDisposed); - SQLWarning warning; - // clear previous warnings clearWarnings (); @@ -456,13 +453,11 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) if(m_RecordSet.IsValid() && m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet) assignRecordSet( pSet ); } - catch (SQLWarning &ex) + catch (SQLWarning &) { - // Save pointer to warning and save with ResultSet + //TODO: Save pointer to warning and save with ResultSet // object once it is created. - - warning = ex; } return m_RecordSet.IsValid(); } @@ -474,7 +469,7 @@ Any SAL_CALL OStatement_Base::getWarnings( ) checkDisposed(OStatement_BASE::rBHelper.bDisposed); - return makeAny(m_aLastWarning); + return Any(m_aLastWarning); } @@ -645,31 +640,71 @@ void OStatement_Base::setCursorName(std::u16string_view _par0) ::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const { - Sequence< css::beans::Property > aProps(10); - css::beans::Property* pProperties = aProps.getArray(); - sal_Int32 nPos = 0; - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME), - PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING), - PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), - PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), - PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE), - PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS), - PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT), - PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), - PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), - PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0); - pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS), - PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0); - - return new ::cppu::OPropertyArrayHelper(aProps); + return new ::cppu::OPropertyArrayHelper + { + { + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME), + PROPERTY_ID_CURSORNAME, + cppu::UnoType<OUString>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING), + PROPERTY_ID_ESCAPEPROCESSING, + cppu::UnoType<bool>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), + PROPERTY_ID_FETCHDIRECTION, + cppu::UnoType<sal_Int32>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), + PROPERTY_ID_FETCHSIZE, + cppu::UnoType<sal_Int32>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE), + PROPERTY_ID_MAXFIELDSIZE, + cppu::UnoType<sal_Int32>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS), + PROPERTY_ID_MAXROWS, + cppu::UnoType<sal_Int32>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT), + PROPERTY_ID_QUERYTIMEOUT, + cppu::UnoType<sal_Int32>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), + PROPERTY_ID_RESULTSETCONCURRENCY, + cppu::UnoType<sal_Int32>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), + PROPERTY_ID_RESULTSETTYPE, + cppu::UnoType<sal_Int32>::get(), + 0 + }, + { + ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS), + PROPERTY_ID_USEBOOKMARKS, + cppu::UnoType<bool>::get(), + 0 + } + } + }; } @@ -809,17 +844,17 @@ OStatement::~OStatement() } IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement"); -void SAL_CALL OStatement_Base::acquire() throw() +void SAL_CALL OStatement_Base::acquire() noexcept { OStatement_BASE::acquire(); } -void SAL_CALL OStatement::acquire() throw() +void SAL_CALL OStatement::acquire() noexcept { OStatement_Base::acquire(); } -void SAL_CALL OStatement::release() throw() +void SAL_CALL OStatement::release() noexcept { OStatement_Base::release(); } |