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: Tamás Bunth <btomi96@gmail.com>
diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx b/connectivity/qa/connectivity/mysql/mysql.cxx
index 0d1d9ef8..bfefeec 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -256,6 +256,12 @@ void MysqlTestDriver::testDBPositionChange()
    xResultSet->first();
    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");
    CPPUNIT_ASSERT_EQUAL(0, nUpdateCount); // it's a DDL statement
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
index f8d3f8f..c8a5f38 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
@@ -652,8 +652,15 @@ sal_Bool SAL_CALL OResultSet::previous()
    MutexGuard aGuard(m_aMutex);
    checkDisposed(OResultSet_BASE::rBHelper.bDisposed);

    if (m_nRowPosition <= 0)
    if (m_nRowPosition == 0)
    {
        m_nRowPosition--;
        return false;
    }
    else if (m_nRowPosition < 0)
    {
        return false;
    }

    m_nRowPosition--;
    return true;