[Libreoffice-commits] core.git: 7 commits - connectivity/source dbaccess/JunitTest_dbaccess_complex.mk dbaccess/qa dbaccess/source
Lionel Elie Mamane
lionel at mamane.lu
Sat May 30 08:34:13 PDT 2015
connectivity/source/drivers/hsqldb/HConnection.cxx | 13 +++++--
dbaccess/JunitTest_dbaccess_complex.mk | 1
dbaccess/qa/complex/dbaccess/RowSet.java | 36 ++++++++++++++++-----
dbaccess/source/core/api/RowSet.cxx | 25 ++++++--------
dbaccess/source/core/api/RowSet.hxx | 3 -
dbaccess/source/core/api/RowSetBase.cxx | 1
6 files changed, 53 insertions(+), 26 deletions(-)
New commits:
commit 9b06d36571bbfa2d722f36610375e7cd24be81a7
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sat May 30 17:08:49 2015 +0200
reenable JunitTest_dbaccess_complex part RowSet
Change-Id: I82a1af0cd6b068e9f349ec6b068e78d55e8ab969
diff --git a/dbaccess/JunitTest_dbaccess_complex.mk b/dbaccess/JunitTest_dbaccess_complex.mk
index e3f2c00..7a0b17b 100644
--- a/dbaccess/JunitTest_dbaccess_complex.mk
+++ b/dbaccess/JunitTest_dbaccess_complex.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_JunitTest_set_defs,dbaccess_complex,\
$(eval $(call gb_JunitTest_add_classes,dbaccess_complex,\
complex.dbaccess.Beamer \
complex.dbaccess.PropertyBag \
+ complex.dbaccess.RowSet \
))
$(eval $(call gb_JunitTest_add_sourcefiles,dbaccess_complex,\
commit f9525cb4e8174a11da5624de3c271f5c40e5f0c5
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sat May 30 16:53:58 2015 +0200
tweaks
Change-Id: I84ca5d1f3247d3ba3ed76bf3d39be14b47613703
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index 22fe961..5ee5ea2 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -86,10 +86,11 @@ public class RowSet extends TestCase
public void run()
{
+ int i=-1;
try
{
m_resultSet.beforeFirst();
- for (int i = 0; m_resultSet.next(); ++i)
+ for (i = 0; m_resultSet.next(); ++i)
{
int pos = m_resultSet.getRow();
testPosition(m_resultSet, m_row, i + 1, "clone move(" + m_id + ")");
@@ -99,7 +100,7 @@ public class RowSet extends TestCase
}
catch (Exception e)
{
- fail("ResultSetMovementStress(" + m_id + ") failed: " + e);
+ fail("ResultSetMovementStress(" + m_id + ") failed at i=" + i + ": " + e);
}
}
}
@@ -122,7 +123,7 @@ public class RowSet extends TestCase
try
{
- createStruture();
+ createStructure();
}
catch (SQLException e)
{
@@ -227,7 +228,7 @@ public class RowSet extends TestCase
}
- void createStruture() throws SQLException
+ void createStructure() throws SQLException
{
m_database.executeSQL("DROP TABLE \"TEST1\" IF EXISTS");
m_database.executeSQL("CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )");
commit d6d19acaca14d5b45ffb0db0028f17567d196c4d
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sat May 30 16:56:29 2015 +0200
do not try to get bookmark when in invalid position
Change-Id: I64fc14e527af4f0f846bbfae84cf8d1d2914b6b9
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 09c9847..01830fb 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -1239,6 +1239,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
if ( m_aBookmark.hasValue() )
{
if (_ePrepareForDirection == MOVE_NONE_REFRESH ||
+ (m_pCache->isAfterLast() != isAfterLast()) || ( m_pCache->isBeforeFirst() != isBeforeFirst() ) ||
m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() ) != CompareBookmark::EQUAL )
bSuccess = m_pCache->moveToBookmark( m_aBookmark );
else
commit b4e6dd8200145b6fa950cf813826e92a5caac1a5
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sat May 30 14:33:16 2015 +0200
handle getParameters being called before execute()
Change-Id: If81e745ee15df3848c6577a9e979672523718daf
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 619f5a7..dcbacf4 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1624,10 +1624,17 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta
_rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, makeAny( nResultSetConcurrency ) );
}
-void ORowSet::impl_makeNewStatement_throw()
+void ORowSet::impl_ensureStatement_throw()
{
OUString sCommandToExecute;
- impl_initComposer_throw( sCommandToExecute );
+ if(m_bCommandFacetsDirty)
+ {
+ impl_initComposer_throw( sCommandToExecute );
+ }
+ else
+ {
+ sCommandToExecute = m_bUseEscapeProcessing ? m_xComposer->getQueryWithSubstitution() : m_aActiveCommand;
+ }
try
{
@@ -1672,8 +1679,7 @@ void ORowSet::impl_makeNewStatement_throw()
Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
{
- if(m_bCommandFacetsDirty)
- impl_makeNewStatement_throw();
+ impl_ensureStatement_throw();
m_aParameterValueForCache.get().resize(1);
Reference< XParameters > xParam( m_xStatement, UNO_QUERY_THROW );
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index 596969d..19e50f5 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -197,7 +197,7 @@ namespace dbaccess
*/
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
impl_prepareAndExecute_throw();
- void impl_makeNewStatement_throw();
+ void impl_ensureStatement_throw();
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > calcConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
// free clones and ParseTree. Plus, if _bComplete is <TRUE/>, *all* other associated resources
commit ab873b04e6ab0ceb7750db2d105ef5e3d0c0f6ef
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sat May 30 14:27:56 2015 +0200
janitorial
Change-Id: I72cc8b84332442920eb5bb793474de0e9ec0fc86
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index 211aa2d..22fe961 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -155,10 +155,10 @@ public class RowSet extends TestCase
* the command to use for the RowSet
* @param commandType
* the command type to use for the RowSet
- * @param limitFetchSize
- * determines whether the fetch size of the RowSet should be limited to MAX_FETCH_ROWS
* @param execute
* determines whether the RowSet should be executed
+ * @param limitFetchSize
+ * determines whether the fetch size of the RowSet should be limited to MAX_FETCH_ROWS
*/
private void createRowSet(String command, int commandType, boolean execute, boolean limitFetchSize)
{
@@ -969,7 +969,7 @@ public class RowSet extends TestCase
}
catch (Exception e)
{
- fail("could not test the relationship between XParameters and XParametersSupplier" + e.getMessage());
+ fail("could not test the relationship between XParameters and XParametersSupplier: " + e.getMessage());
}
}
commit 99c6e8dc1fdabcc5af24a7a3cc8ff510140b0c94
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sat May 30 14:27:24 2015 +0200
HSQLDB connection flush: safer handling when createStatement or execute fails
Change-Id: I32f3014bbf32c4a4a990bea03ee565c9b4c0164d
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
index 562fc49..16b5378 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -150,10 +150,17 @@ namespace connectivity { namespace hsqldb
m_bReadOnly = true;
}
}
- if ( !m_bReadOnly )
+ try
{
- Reference< XStatement > xStmt( m_xConnection->createStatement(), UNO_QUERY_THROW );
- xStmt->execute( OUString( "CHECKPOINT DEFRAG" ) );
+ if ( !m_bReadOnly )
+ {
+ Reference< XStatement > xStmt( m_xConnection->createStatement(), UNO_QUERY_THROW );
+ xStmt->execute( OUString( "CHECKPOINT DEFRAG" ) );
+ }
+ }
+ catch(const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
commit 8607f8b552d917f064b2ebfd60ffcef1e6f92bb0
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sat May 30 14:25:54 2015 +0200
tdf#82591 ORowSetBase::getRow handles insert row correctly
and critically for this bug, modified row, too.
Change-Id: I11c418d8926cabe81fcdb65d7293a4283e566f7a
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index ad0968a..211aa2d 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -207,6 +207,9 @@ public class RowSet extends TestCase
// absolute positioning
testAbsolutePositioning(m_resultSet, m_row);
+ // position during modify
+ testModifyPosition(m_resultSet, m_row);
+
// 3rd test
test3(createClone(), m_resultSet);
// 4th test
@@ -289,6 +292,24 @@ public class RowSet extends TestCase
}
+ void testModifyPosition(XResultSet _resultSet, XRow _row)
+ {
+ try
+ {
+ final int testPos = 3;
+ assertTrue("testModifyPosition wants at least " + (testPos+1) + " rows", MAX_FETCH_ROWS >= testPos+1);
+ assertTrue("testModifyPosition failed on moving to row " + testPos, _resultSet.absolute(testPos));
+ UnoRuntime.queryInterface( XRowUpdate.class, _row ).updateString(2, TEST21);
+ testPosition(_resultSet, _row, testPos, "testModifyPosition");
+ UnoRuntime.queryInterface( XResultSetUpdate.class, _resultSet ).cancelRowUpdates();
+ }
+ catch (Exception e)
+ {
+ fail("testModifyPosition failed: " + e);
+ }
+ }
+
+
void test3(XResultSet clone, XResultSet _resultSet)
{
try
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 69b3571..619f5a7 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -929,15 +929,6 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException, std::
fireRowcount();
}
-sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException, std::exception)
-{
- ::osl::MutexGuard aGuard( *m_pMutex );
- checkCache();
-
- // check if we are inserting a row
- return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow();
-}
-
void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException, std::exception)
{
::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
@@ -1517,7 +1508,7 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) throw (RuntimeExce
}
catch( const Exception& )
{
- // silence it
+ DBG_UNHANDLED_EXCEPTION();
}
}
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index aae5b7f..596969d 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -287,7 +287,6 @@ namespace dbaccess
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
// ::com::sun::star::sdbc::XResultSet
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XCompletedExecution
More information about the Libreoffice-commits
mailing list