Kaydet (Commit) 250ef02b authored tarafından Michael Stahl's avatar Michael Stahl

connectivity: replace magic numbers with constants from CompareBookmark

Change-Id: Ifcd5766ce10de44f38d5c383cd7dc35b75152e88
üst 86796f12
...@@ -110,7 +110,7 @@ sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark, ...@@ -110,7 +110,7 @@ sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark,
sal_Int32 SAL_CALL OCalcResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException, std::exception) sal_Int32 SAL_CALL OCalcResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException, std::exception)
{ {
return (lhs == rhs) ? 0 : 2; return (lhs == rhs) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL;
} }
sal_Bool SAL_CALL OCalcResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException, std::exception) sal_Bool SAL_CALL OCalcResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException, std::exception)
......
...@@ -122,14 +122,12 @@ sal_Int32 SAL_CALL ODbaseResultSet::compareBookmarks( const Any& lhs, const Any& ...@@ -122,14 +122,12 @@ sal_Int32 SAL_CALL ODbaseResultSet::compareBookmarks( const Any& lhs, const Any&
::dbtools::throwGenericSQLException(sMessage ,*this); ::dbtools::throwGenericSQLException(sMessage ,*this);
} // if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) ) } // if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) )
// have a look at CompareBookmark
// we can't use the names there because we already have defines with the same name from the parser
if(nFirst < nSecond) if(nFirst < nSecond)
nResult = -1; nResult = CompareBookmark::LESS;
else if(nFirst > nSecond) else if(nFirst > nSecond)
nResult = 1; nResult = CompareBookmark::GREATER;
else else
nResult = 0; nResult = CompareBookmark::EQUAL;
return nResult; return nResult;
} }
......
...@@ -129,7 +129,7 @@ sal_Bool SAL_CALL OFlatResultSet::moveRelativeToBookmark( const Any& bookmark, ...@@ -129,7 +129,7 @@ sal_Bool SAL_CALL OFlatResultSet::moveRelativeToBookmark( const Any& bookmark,
sal_Int32 SAL_CALL OFlatResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException, std::exception) sal_Int32 SAL_CALL OFlatResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException, std::exception)
{ {
return (lhs == rhs) ? 0 : 2; return (lhs == rhs) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL;
} }
sal_Bool SAL_CALL OFlatResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException, std::exception) sal_Bool SAL_CALL OFlatResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException, std::exception)
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/FetchDirection.hpp> #include <com/sun/star/sdbc/FetchDirection.hpp>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
#include <comphelper/types.hxx> #include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx> #include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx> #include <connectivity/dbtools.hxx>
...@@ -57,6 +58,7 @@ using namespace com::sun::star::uno; ...@@ -57,6 +58,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang; using namespace com::sun::star::lang;
using namespace com::sun::star::beans; using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container; using namespace com::sun::star::container;
using namespace com::sun::star::io; using namespace com::sun::star::io;
using namespace com::sun::star::util; using namespace com::sun::star::util;
...@@ -1610,11 +1612,11 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c ...@@ -1610,11 +1612,11 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c
} }
if(nFirst < nSecond) if(nFirst < nSecond)
nResult = -1; nResult = CompareBookmark::LESS;
else if(nFirst > nSecond) else if(nFirst > nSecond)
nResult = 1; nResult = CompareBookmark::GREATER;
else else
nResult = 0; nResult = CompareBookmark::EQUAL;
return nResult; return nResult;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/FetchDirection.hpp> #include <com/sun/star/sdbc/FetchDirection.hpp>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
#include <comphelper/types.hxx> #include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx> #include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx> #include <connectivity/dbtools.hxx>
...@@ -56,6 +57,7 @@ using namespace com::sun::star::uno; ...@@ -56,6 +57,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang; using namespace com::sun::star::lang;
using namespace com::sun::star::beans; using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container; using namespace com::sun::star::container;
using namespace com::sun::star::io; using namespace com::sun::star::io;
using namespace com::sun::star::util; using namespace com::sun::star::util;
...@@ -1619,11 +1621,11 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c ...@@ -1619,11 +1621,11 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c
m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this ); m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
if(nFirst < nSecond) if(nFirst < nSecond)
nResult = -1; nResult = CompareBookmark::LESS;
else if(nFirst > nSecond) else if(nFirst > nSecond)
nResult = 1; nResult = CompareBookmark::GREATER;
else else
nResult = 0; nResult = CompareBookmark::EQUAL;
return nResult; return nResult;
} }
......
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