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 <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <com/sun/star/sdbc/DataType.hpp>
|
||||
#include <com/sun/star/sdbc/KeyRule.hpp>
|
||||
#include <com/sun/star/sdbc/IndexType.hpp>
|
||||
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
|
||||
#include <comphelper/property.hxx>
|
||||
#include <com/sun/star/lang/DisposedException.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
|
||||
@@ -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)
|
||||
|
Reference in New Issue
Block a user