[Libreoffice-commits] .: 2 commits - dbaccess/source
Lionel Elie Mamane
lmamane at kemper.freedesktop.org
Fri Jun 1 08:02:20 PDT 2012
dbaccess/source/core/api/KeySet.cxx | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
New commits:
commit 228c360e7d53a74d9908e9b164b12ace316cd34e
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Fri Jun 1 16:40:41 2012 +0200
fdo#47520 use the already retrieved row instead of driver row
This avoids asking the driver for the same data twice.
This is particularly important for ODBC data sources, because when asking for (VAR)CHAR data the second time, one gets no data (and status SQL_NO_DATA) because of the "retrieve in parts" semantics of these datatypes.
Change-Id: I96f2df9927fda72ccf19f78ec5c561f5626c003f
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index c74cb23..f462b9b 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -1234,8 +1234,7 @@ sal_Bool OKeySet::absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow )
bNext = fetchRow();
if ( bNext )
{
- m_xRow.set(m_xDriverRow,UNO_QUERY_THROW);
- return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
+ i_bFetchRow = true;
}
}
else
commit 76a74b72db45a5aa3f064034e0fa05440aefb52b
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Fri Jun 1 11:42:53 2012 +0200
fdo#50372: crash when refresh of last already-known row unexpectedly fails
Instead, try to do the least unreasonable thing:
Fetch a new row
If that fails because no new row to fetch, at least we are properly positioned after last row. Calling code may not expect that and get confused, but that is the best we can do.
Change-Id: Ib7248e99ae3deee8344e9386cac2c9440e8bccd8
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 7399cb5..c74cb23 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -1344,10 +1344,23 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
sal_Bool bOK = doTryRefetch_throw();
if ( !bOK )
{
+ // This row has disappeared; remove it.
OKeySetMatrix::iterator aTemp = m_aKeyIter;
+ // use *next* row
++m_aKeyIter;
m_aKeyMap.erase(aTemp);
- --m_rRowCount;
+
+ // adjust RowCount for the row we have removed
+ if (m_rRowCount > 0)
+ --m_rRowCount;
+ else
+ OSL_FAIL("m_rRowCount got out of sync: non-empty m_aKeyMap, but m_rRowCount <= 0");
+
+ if (!isAfterLast())
+ {
+ // it was the last row, but there may be another one to fetch
+ fetchRow();
+ }
refreshRow();
}
else
More information about the Libreoffice-commits
mailing list