Kaydet (Commit) 6e80862e authored tarafından Tamas Bunth's avatar Tamas Bunth Kaydeden (comit) Tamás Bunth

mysqlc: resultset's previous() on first position..

.. should move the cursor backwards to beforeFirst position and return
false.

Change-Id: Icbb4bed0ea39ea3a0bf375d5616e3ef768fc69d9
Reviewed-on: https://gerrit.libreoffice.org/66729
Tested-by: Jenkins
Reviewed-by: 's avatarTamás Bunth <btomi96@gmail.com>
üst 81ab8e73
...@@ -256,6 +256,12 @@ void MysqlTestDriver::testDBPositionChange() ...@@ -256,6 +256,12 @@ void MysqlTestDriver::testDBPositionChange()
xResultSet->first(); xResultSet->first();
CPPUNIT_ASSERT_EQUAL(1, xResultSet->getRow()); CPPUNIT_ASSERT_EQUAL(1, xResultSet->getRow());
// Now previous should put the cursor to before-first position, but it
// should return with false.
successPrevious = xResultSet->previous();
CPPUNIT_ASSERT(!successPrevious);
CPPUNIT_ASSERT_EQUAL(0, xResultSet->getRow());
nUpdateCount = xStatement->executeUpdate("DROP TABLE myTestTable"); nUpdateCount = xStatement->executeUpdate("DROP TABLE myTestTable");
CPPUNIT_ASSERT_EQUAL(0, nUpdateCount); // it's a DDL statement CPPUNIT_ASSERT_EQUAL(0, nUpdateCount); // it's a DDL statement
} }
......
...@@ -652,8 +652,15 @@ sal_Bool SAL_CALL OResultSet::previous() ...@@ -652,8 +652,15 @@ sal_Bool SAL_CALL OResultSet::previous()
MutexGuard aGuard(m_aMutex); MutexGuard aGuard(m_aMutex);
checkDisposed(OResultSet_BASE::rBHelper.bDisposed); checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
if (m_nRowPosition <= 0) if (m_nRowPosition == 0)
{
m_nRowPosition--;
return false; return false;
}
else if (m_nRowPosition < 0)
{
return false;
}
m_nRowPosition--; m_nRowPosition--;
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment