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

mysqlc: fix return value of XResultSet::next

Change-Id: I59e4803a5d9b01062eb0eaca0bf65d28298bd3e4
Reviewed-on: https://gerrit.libreoffice.org/63121
Tested-by: Jenkins
Reviewed-by: 's avatarTamás Bunth <btomi96@gmail.com>
üst e95dae94
......@@ -123,6 +123,7 @@ void MysqlTestDriver::testCreateAndDropTable()
uno::Reference<XStatement> xStatement = xConnection->createStatement();
CPPUNIT_ASSERT(xStatement.is());
xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
auto nUpdateCount
= xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY KEY)");
......@@ -143,6 +144,7 @@ void MysqlTestDriver::testIntegerInsertAndQuery()
Reference<XStatement> xStatement = xConnection->createStatement();
CPPUNIT_ASSERT(xStatement.is());
xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
auto nUpdateCount
= xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY KEY)");
......@@ -171,6 +173,9 @@ void MysqlTestDriver::testIntegerInsertAndQuery()
CPPUNIT_ASSERT_MESSAGE("not enough result after query", hasRow);
CPPUNIT_ASSERT_EQUAL(i, xRow->getLong(1)); // first and only column
}
bool hasRow = xResultSet->next();
// no more rows
CPPUNIT_ASSERT_MESSAGE("next returns true after last row", !hasRow);
nUpdateCount = xStatement->executeUpdate("DROP TABLE myTestTable");
CPPUNIT_ASSERT_EQUAL(0, nUpdateCount); // it's a DDL statement
......@@ -186,6 +191,7 @@ void MysqlTestDriver::testDBPositionChange()
Reference<XStatement> xStatement = xConnection->createStatement();
CPPUNIT_ASSERT(xStatement.is());
xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
auto nUpdateCount
= xStatement->executeUpdate("CREATE TABLE myTestTable (id INTEGER PRIMARY KEY)");
......
......@@ -691,7 +691,7 @@ sal_Bool SAL_CALL OResultSet::next()
MutexGuard aGuard(m_aMutex);
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
ensureResultFetched();
if (m_nRowPosition >= m_nRowCount)
if (m_nRowPosition + 1 >= m_nRowCount)
return false;
++m_nRowPosition;
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