From 66b67f40a7785f08ae214e62b669e001148b474c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 12 Oct 2016 16:17:38 +0200 Subject: [PATCH] ADO: return correct css::sdbcx::CompareBookmark values css.sdbcx.XRowLocate's compareBookmarks is documented to return values from the css.sdbcx.ConpareBookmark constants group, which has LESS = -1, EQUAL = 0, GREATER = 1, NOT_EQUAL = 2, NOT_COMPARABLE = 3. So in case of equality return EQUAL (0) instead of sal_True (1). And, in the MS SDK's adoint.h, the CompareEnum enum os defined with enumeators adCompareLessThan = 0, adCompareEqual = 1, adCompareGreaterThan = 2, adCompareNotEqual = 3, adCOmpareNotComparable = 4, so mapping from the latter to the former needs to do -1, not +1. Change-Id: I6643da31f326e38153e4ebab9e680b33a6854918 Reviewed-on: https://gerrit.libreoffice.org/29735 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- connectivity/source/drivers/ado/AResultSet.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index 128458bcaa4f..020c643b487b 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -872,13 +873,13 @@ sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& bookmark1, const Any sal_Int32 nPos2 = 0; bookmark2 >>= nPos2; if(nPos1 == nPos2) // they should be equal - return sal_True; + return css::sdbcx::CompareBookmark::EQUAL; OSL_ENSURE((nPos1 >= 0 && nPos1 < (sal_Int32)m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < (sal_Int32)m_aBookmarks.size()),"Invalid Index for vector"); CompareEnum eNum; m_pRecordSet->CompareBookmarks(m_aBookmarks[nPos1],m_aBookmarks[nPos2],&eNum); - return ((sal_Int32)eNum) +1; + return ((sal_Int32)eNum) - 1; } sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException)