This is an automated email from the ASF dual-hosted git repository. damjan pushed a commit to branch windows-amd64 in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 24cfd890cd12252bfd1776fd49975d832b495337 Author: Damjan Jovanovic <dam...@apache.org> AuthorDate: Sat Jan 4 14:47:50 2025 +0200 Fix Win64 compatibility issues with the ADO database driver. Patch by: me --- .../source/drivers/ado/APreparedStatement.cxx | 6 ++++-- main/connectivity/source/drivers/ado/AResultSet.cxx | 6 ++++-- main/connectivity/source/drivers/ado/AStatement.cxx | 12 +++++++----- main/connectivity/source/drivers/ado/Awrapado.cxx | 20 ++++++++++---------- main/connectivity/source/inc/ado/Awrapado.hxx | 14 +++++++------- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/main/connectivity/source/drivers/ado/APreparedStatement.cxx b/main/connectivity/source/drivers/ado/APreparedStatement.cxx index cd6dbec237..94630d6f94 100644 --- a/main/connectivity/source/drivers/ado/APreparedStatement.cxx +++ b/main/connectivity/source/drivers/ado/APreparedStatement.cxx @@ -306,10 +306,12 @@ m_xMetaData.clear(); OLEVariant aCon; aCon.setNoArg(); CHECK_RETURN(m_RecordSet.put_CacheSize(m_nFetchSize)) - CHECK_RETURN(m_RecordSet.put_MaxRecords(m_nMaxRows)) + sal_IntPtr maxRows = m_nMaxRows; + CHECK_RETURN(m_RecordSet.put_MaxRecords(maxRows)) CHECK_RETURN(m_RecordSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified)) CHECK_RETURN(m_RecordSet.get_CacheSize(m_nFetchSize)) - CHECK_RETURN(m_RecordSet.get_MaxRecords(m_nMaxRows)) + CHECK_RETURN(m_RecordSet.get_MaxRecords(maxRows)) + m_nMaxRows = maxRows; CHECK_RETURN(m_RecordSet.get_CursorType(m_eCursorType)) CHECK_RETURN(m_RecordSet.get_LockType(m_eLockType)) diff --git a/main/connectivity/source/drivers/ado/AResultSet.cxx b/main/connectivity/source/drivers/ado/AResultSet.cxx index 5bd22c8c90..58d574831c 100644 --- a/main/connectivity/source/drivers/ado/AResultSet.cxx +++ b/main/connectivity/source/drivers/ado/AResultSet.cxx @@ -274,7 +274,7 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - PositionEnum aPos; + sal_IntPtr aPos; m_pRecordSet->get_AbsolutePosition(&aPos); return (aPos > 0) ? aPos : m_nRowPos; // return the rowcount from driver if the driver doesn't support this return our count @@ -447,7 +447,9 @@ sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveLast()); if(bRet) { - m_pRecordSet->get_RecordCount(&m_nRowPos); + sal_IntPtr rowPos; + m_pRecordSet->get_RecordCount(&rowPos); + m_nRowPos = rowPos; m_bOnFirstAfterOpen = sal_False; } return bRet; diff --git a/main/connectivity/source/drivers/ado/AStatement.cxx b/main/connectivity/source/drivers/ado/AStatement.cxx index 8371a713b0..5faebd565f 100644 --- a/main/connectivity/source/drivers/ado/AStatement.cxx +++ b/main/connectivity/source/drivers/ado/AStatement.cxx @@ -304,12 +304,14 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUS OLEVariant aCon; aCon.setNoArg(); CHECK_RETURN(aSet.put_CacheSize(m_nFetchSize)) - CHECK_RETURN(aSet.put_MaxRecords(m_nMaxRows)) + sal_IntPtr maxRows = m_nMaxRows; + CHECK_RETURN(aSet.put_MaxRecords(maxRows)) CHECK_RETURN(aSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified)) CHECK_RETURN(aSet.get_CacheSize(m_nFetchSize)) - CHECK_RETURN(aSet.get_MaxRecords(m_nMaxRows)) + CHECK_RETURN(aSet.get_MaxRecords(maxRows)) + m_nMaxRows = maxRows; CHECK_RETURN(aSet.get_CursorType(m_eCursorType)) CHECK_RETURN(aSet.get_LockType(m_eLockType)) @@ -385,7 +387,7 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, { assignRecordSet( pSet ); - sal_Int32 nValue; + sal_IntPtr nValue; if(m_RecordSet.get_RecordCount(nValue)) pArray[j] = nValue; } @@ -438,7 +440,7 @@ sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, Runti checkDisposed(OStatement_BASE::rBHelper.bDisposed); - sal_Int32 nRet; + sal_IntPtr nRet; if(m_RecordSet.IsValid() && m_RecordSet.get_RecordCount(nRet)) return nRet; return -1; @@ -507,7 +509,7 @@ sal_Int32 OStatement_Base::getQueryTimeOut() const throw(SQLException, RuntimeE //------------------------------------------------------------------------------ sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeException) { - sal_Int32 nRet=-1; + sal_IntPtr nRet=-1; if(!(m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet))) ::dbtools::throwFunctionSequenceException(NULL); return nRet; diff --git a/main/connectivity/source/drivers/ado/Awrapado.cxx b/main/connectivity/source/drivers/ado/Awrapado.cxx index 47846c88c6..9539061da2 100644 --- a/main/connectivity/source/drivers/ado/Awrapado.cxx +++ b/main/connectivity/source/drivers/ado/Awrapado.cxx @@ -476,10 +476,10 @@ WpADOProperties WpADOField::get_Properties() return aProps; } - sal_Int32 WpADOField::GetActualSize() const +sal_IntPtr WpADOField::GetActualSize() const { OSL_ENSURE(pInterface,"Interface is null!"); - sal_Int32 nActualSize=0; + ADO_LONGPTR nActualSize=0; pInterface->get_ActualSize(&nActualSize); return nActualSize; } @@ -500,10 +500,10 @@ sal_Int32 WpADOField::GetStatus() const return eADOSFieldAttributes; } -sal_Int32 WpADOField::GetDefinedSize() const +sal_IntPtr WpADOField::GetDefinedSize() const { OSL_ENSURE(pInterface,"Interface is null!"); - sal_Int32 nDefinedSize=0; + ADO_LONGPTR nDefinedSize=0; pInterface->get_DefinedSize(&nDefinedSize); return nDefinedSize; } @@ -629,7 +629,7 @@ OLEVariant WpADOField::GetUnderlyingValue() const pInterface->put_Type(eType); } - sal_Bool WpADOField::PutDefinedSize(sal_Int32 _nDefSize) + sal_Bool WpADOField::PutDefinedSize(sal_IntPtr _nDefSize) { OSL_ENSURE(pInterface,"Interface is null!"); return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize))); @@ -770,10 +770,10 @@ void WpADORecordset::Close() return bSupports == VARIANT_TRUE; } -PositionEnum WpADORecordset::get_AbsolutePosition() + sal_IntPtr WpADORecordset::get_AbsolutePosition() { OSL_ENSURE(pInterface,"Interface is null!"); - PositionEnum aTemp=adPosUnknown; + sal_IntPtr aTemp=adPosUnknown; pInterface->get_AbsolutePosition(&aTemp); return aTemp; } @@ -892,19 +892,19 @@ WpADOProperties WpADORecordset::get_Properties() const return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset)); } - sal_Bool WpADORecordset::get_RecordCount(sal_Int32 &_nRet) const + sal_Bool WpADORecordset::get_RecordCount(sal_IntPtr &_nRet) const { OSL_ENSURE(pInterface,"Interface is null!"); return SUCCEEDED(pInterface->get_RecordCount(&_nRet)); } - sal_Bool WpADORecordset::get_MaxRecords(sal_Int32 &_nRet) const + sal_Bool WpADORecordset::get_MaxRecords(sal_IntPtr &_nRet) const { OSL_ENSURE(pInterface,"Interface is null!"); return SUCCEEDED(pInterface->get_MaxRecords(&_nRet)); } - sal_Bool WpADORecordset::put_MaxRecords(sal_Int32 _nRet) + sal_Bool WpADORecordset::put_MaxRecords(sal_IntPtr _nRet) { OSL_ENSURE(pInterface,"Interface is null!"); return SUCCEEDED(pInterface->put_MaxRecords(_nRet)); diff --git a/main/connectivity/source/inc/ado/Awrapado.hxx b/main/connectivity/source/inc/ado/Awrapado.hxx index bf0654beb8..aa368f07b4 100644 --- a/main/connectivity/source/inc/ado/Awrapado.hxx +++ b/main/connectivity/source/inc/ado/Awrapado.hxx @@ -244,10 +244,10 @@ namespace connectivity ////////////////////////////////////////////////////////////////////// WpADOProperties get_Properties(); - sal_Int32 GetActualSize() const ; + sal_IntPtr GetActualSize() const ; sal_Int32 GetAttributes() const ; sal_Int32 GetStatus() const ; - sal_Int32 GetDefinedSize() const ; + sal_IntPtr GetDefinedSize() const ; // gibt den Namen des Feldes zur"ueck ::rtl::OUString GetName() const ; DataTypeEnum GetADOType() const ; @@ -271,7 +271,7 @@ namespace connectivity void PutADOType(DataTypeEnum eType) ; - sal_Bool PutDefinedSize(sal_Int32 _nDefSize); + sal_Bool PutDefinedSize(sal_IntPtr _nDefSize); sal_Bool PutAttributes(sal_Int32 _nDefSize); }; @@ -331,7 +331,7 @@ namespace connectivity sal_Bool Cancel() const; sal_Int32 get_State( ); sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions); - PositionEnum get_AbsolutePosition(); + sal_IntPtr get_AbsolutePosition(); void GetDataSource(IUnknown** pIUnknown) const ; void PutRefDataSource(IUnknown* pIUnknown); void GetBookmark(VARIANT& var); @@ -353,9 +353,9 @@ namespace connectivity sal_Bool CancelUpdate(); WpADOProperties get_Properties() const; sal_Bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset); - sal_Bool get_RecordCount(sal_Int32 &_nRet) const; - sal_Bool get_MaxRecords(sal_Int32 &_nRet) const; - sal_Bool put_MaxRecords(sal_Int32 _nRet); + sal_Bool get_RecordCount(sal_IntPtr &_nRet) const; + sal_Bool get_MaxRecords(sal_IntPtr &_nRet) const; + sal_Bool put_MaxRecords(sal_IntPtr _nRet); sal_Bool get_CursorType(CursorTypeEnum &_nRet) const; sal_Bool put_CursorType(CursorTypeEnum _nRet); sal_Bool get_LockType(LockTypeEnum &_nRet) const;