[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - dbaccess/source
Lionel Elie Mamane
lionel at mamane.lu
Thu Dec 28 12:02:23 UTC 2017
dbaccess/source/core/api/statement.cxx | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
New commits:
commit feb476f67a906d01697d4e5b9ffca5b8da2fb987
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Dec 28 06:16:30 2017 +0100
dbaccess OStatementBase: correctly check database metadata
the previous test didn't make any sense:
* if xMeta.is(), then the test evaluated to false
* if !xMeta.is(), then it called supportsMultipleResultSets
(or supportsBatchUpdates, respectively) on a NULL pointer,
which guaranteed a segfault / assert.
Change-Id: I6d6b93350557936b924a286732ae6d4f5ab2ce56
(cherry picked from commit 66d7540bcf3f82de906a588f01d1fbedc3d2928c)
Change-Id: Icb33a8d344cc5644fc4722e02aabfed6bbbc0e5d
Reviewed-on: https://gerrit.libreoffice.org/47125
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx
index f25e08be6a43..54f412fcf065 100644
--- a/dbaccess/source/core/api/statement.cxx
+++ b/dbaccess/source/core/api/statement.cxx
@@ -321,7 +321,7 @@ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( )
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsMultipleResultSets())
+ if (!xMeta.is() || !xMeta->supportsMultipleResultSets())
throwFunctionSequenceException(*this);
return Reference< XMultipleResults >(m_xAggregateAsSet, UNO_QUERY)->getResultSet();
@@ -334,7 +334,7 @@ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( )
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsMultipleResultSets())
+ if (!xMeta.is() || !xMeta->supportsMultipleResultSets())
throwFunctionSequenceException(*this);
return Reference< XMultipleResults >(m_xAggregateAsSet, UNO_QUERY)->getUpdateCount();
@@ -347,7 +347,7 @@ sal_Bool SAL_CALL OStatementBase::getMoreResults( )
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsMultipleResultSets())
+ if (!xMeta.is() || !xMeta->supportsMultipleResultSets())
throwFunctionSequenceException(*this);
// free the previous results
@@ -364,7 +364,7 @@ void SAL_CALL OStatementBase::addBatch( )
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ if (!xMeta.is() || !xMeta->supportsBatchUpdates())
throwFunctionSequenceException(*this);
Reference< XPreparedBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->addBatch();
@@ -377,7 +377,7 @@ void SAL_CALL OStatementBase::clearBatch( )
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ if (!xMeta.is() || !xMeta->supportsBatchUpdates())
throwFunctionSequenceException(*this);
Reference< XPreparedBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->clearBatch();
@@ -390,7 +390,7 @@ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( )
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ if (!xMeta.is() || !xMeta->supportsBatchUpdates())
throwFunctionSequenceException(*this);
// free the previous results
@@ -496,7 +496,7 @@ void OStatement::addBatch( const OUString& _rSQL )
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ if (!xMeta.is() || !xMeta->supportsBatchUpdates())
throwFunctionSequenceException(*this);
OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) );
@@ -509,7 +509,7 @@ void OStatement::clearBatch( )
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ if (!xMeta.is() || !xMeta->supportsBatchUpdates())
throwFunctionSequenceException(*this);
Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->clearBatch();
@@ -521,7 +521,7 @@ Sequence< sal_Int32 > OStatement::executeBatch( )
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
- if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ if (!xMeta.is() || !xMeta->supportsBatchUpdates())
throwFunctionSequenceException(*this);
return Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->executeBatch( );
}
More information about the Libreoffice-commits
mailing list