diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-23 11:08:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-23 12:28:49 +0100 |
commit | a9c8ac3632bcc3499cb0e6fe1b4a358ecb4a41b6 (patch) | |
tree | c5bd847d8eb5367d5b059462fa1a873387a4dbdf /connectivity/source/drivers/file | |
parent | fa54bca695f6d17e871e43db75f06a63aec7b739 (diff) |
remove ORowSetValue implicit conversion methods
in favour of the existing get*() methods.
The get*() methods 0 or false or empty in the case of "null", which
is exactly the same behaviour as the conversion methods.
These implicit conversion methods cause lookup problems when combined
with some upcoming OUString changes.
And the code looks cleaner this way too, and has less magic when calling
methods.
Change-Id: Ieb4756bf693e83b996a32667fc1b955f89193496
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125690
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/drivers/file')
-rw-r--r-- | connectivity/source/drivers/file/FDateFunctions.cxx | 26 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FNoException.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FNumericFunctions.cxx | 50 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 40 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FStringFunctions.cxx | 44 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcode.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcomp.cxx | 24 |
7 files changed, 96 insertions, 96 deletions
diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx index d5b7c48c0dcc..1be992d4b672 100644 --- a/connectivity/source/drivers/file/FDateFunctions.cxx +++ b/connectivity/source/drivers/file/FDateFunctions.cxx @@ -32,7 +32,7 @@ ORowSetValue OOp_DayOfWeek::operate(const ORowSetValue& lhs) const return lhs; sal_Int32 nRet = 0; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); Date aDate(aD.Day, aD.Month, aD.Year); DayOfWeek eDayOfWeek = aDate.GetDayOfWeek(); switch (eDayOfWeek) @@ -69,7 +69,7 @@ ORowSetValue OOp_DayOfMonth::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); return static_cast<sal_Int16>(aD.Day); } @@ -78,7 +78,7 @@ ORowSetValue OOp_DayOfYear::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); Date aDate(aD.Day, aD.Month, aD.Year); return static_cast<sal_Int16>(aDate.GetDayOfYear()); } @@ -88,7 +88,7 @@ ORowSetValue OOp_Month::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); return static_cast<sal_Int16>(aD.Month); } @@ -98,7 +98,7 @@ ORowSetValue OOp_DayName::operate(const ORowSetValue& lhs) const return lhs; OUString sRet; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); Date aDate(aD.Day, aD.Month, aD.Year); DayOfWeek eDayOfWeek = aDate.GetDayOfWeek(); switch (eDayOfWeek) @@ -136,7 +136,7 @@ ORowSetValue OOp_MonthName::operate(const ORowSetValue& lhs) const return lhs; OUString sRet; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); switch (aD.Month) { case 1: @@ -185,7 +185,7 @@ ORowSetValue OOp_Quarter::operate(const ORowSetValue& lhs) const return lhs; sal_Int32 nRet = 1; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); if (aD.Month >= 4 && aD.Month < 7) nRet = 2; else if (aD.Month >= 7 && aD.Month < 10) @@ -202,12 +202,12 @@ ORowSetValue OOp_Week::operate(const std::vector<ORowSetValue>& lhs) const size_t nSize = lhs.size(); - css::util::Date aD = lhs[nSize - 1]; + css::util::Date aD = lhs[nSize - 1].getDate(); Date aDate(aD.Day, aD.Month, aD.Year); sal_Int16 nStartDay = SUNDAY; if (nSize == 2 && !lhs[0].isNull()) - nStartDay = lhs[0]; + nStartDay = lhs[0].getInt16(); return static_cast<sal_Int16>(aDate.GetWeekOfYear(static_cast<DayOfWeek>(nStartDay))); } @@ -217,7 +217,7 @@ ORowSetValue OOp_Year::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - css::util::Date aD = lhs; + css::util::Date aD = lhs.getDate(); return aD.Year; } @@ -226,7 +226,7 @@ ORowSetValue OOp_Hour::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - css::util::Time aT = lhs; + css::util::Time aT = lhs.getTime(); return static_cast<sal_Int16>(aT.Hours); } @@ -235,7 +235,7 @@ ORowSetValue OOp_Minute::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - css::util::Time aT = lhs; + css::util::Time aT = lhs.getTime(); return static_cast<sal_Int16>(aT.Minutes); } @@ -244,7 +244,7 @@ ORowSetValue OOp_Second::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - css::util::Time aT = lhs; + css::util::Time aT = lhs.getTime(); return static_cast<sal_Int16>(aT.Seconds); } diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx index 7c26081da12e..920bb38859f1 100644 --- a/connectivity/source/drivers/file/FNoException.cxx +++ b/connectivity/source/drivers/file/FNoException.cxx @@ -85,7 +85,7 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,std::vector< OS std::unique_ptr<OKeyValue> OResultSet::GetOrderbyKeyValue(OValueRefRow const & _rRow) { - sal_uInt32 nBookmarkValue = std::abs(static_cast<sal_Int32>((*_rRow)[0]->getValue())); + sal_uInt32 nBookmarkValue = std::abs((*_rRow)[0]->getValue().getInt32()); std::unique_ptr<OKeyValue> pKeyValue = OKeyValue::createKeyValue(nBookmarkValue); diff --git a/connectivity/source/drivers/file/FNumericFunctions.cxx b/connectivity/source/drivers/file/FNumericFunctions.cxx index a6784a55c140..7de058dee06c 100644 --- a/connectivity/source/drivers/file/FNumericFunctions.cxx +++ b/connectivity/source/drivers/file/FNumericFunctions.cxx @@ -32,7 +32,7 @@ ORowSetValue OOp_Abs::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - double nVal(lhs); + double nVal = lhs.getDouble(); if ( nVal < 0 ) nVal *= -1.0; return fabs(nVal); @@ -44,7 +44,7 @@ ORowSetValue OOp_Sign::operate(const ORowSetValue& lhs) const return lhs; sal_Int32 nRet = 0; - double nVal(lhs); + double nVal = lhs.getDouble(); if ( nVal < 0 ) nRet = -1; else if ( nVal > 0 ) @@ -58,7 +58,7 @@ ORowSetValue OOp_Mod::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) c if ( lhs.isNull() || rhs.isNull() ) return ORowSetValue(); - return fmod(static_cast<double>(lhs),static_cast<double>(rhs)); + return fmod(lhs.getDouble(), rhs.getDouble()); } ORowSetValue OOp_Floor::operate(const ORowSetValue& lhs) const @@ -66,7 +66,7 @@ ORowSetValue OOp_Floor::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - return floor(static_cast<double>(lhs)); + return floor(lhs.getDouble()); } ORowSetValue OOp_Ceiling::operate(const ORowSetValue& lhs) const @@ -74,7 +74,7 @@ ORowSetValue OOp_Ceiling::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - double nVal(lhs); + double nVal = lhs.getDouble(); return ceil(nVal); } @@ -84,11 +84,11 @@ ORowSetValue OOp_Round::operate(const std::vector<ORowSetValue>& lhs) const return ORowSetValue(); size_t nSize = lhs.size(); - double nVal = lhs[nSize-1]; + double nVal = lhs[nSize-1].getDouble(); sal_Int32 nDec = 0; if ( nSize == 2 && !lhs[0].isNull() ) - nDec = lhs[0]; + nDec = lhs[0].getDouble(); return ::rtl::math::round(nVal,nDec); } @@ -97,16 +97,16 @@ ORowSetValue OOp_Exp::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - double nVal(lhs); + double nVal = lhs.getDouble(); return exp(nVal); } ORowSetValue OOp_Ln::operate(const ORowSetValue& lhs) const { - if ( lhs.isNull() || static_cast<double>(lhs) < 0.0 ) + if ( lhs.isNull() || lhs.getDouble() < 0.0 ) return lhs; - double nVal(lhs); + double nVal = lhs.getDouble(); nVal = log(nVal); if ( std::isnan(nVal) ) return ORowSetValue(); @@ -118,11 +118,11 @@ ORowSetValue OOp_Log::operate(const std::vector<ORowSetValue>& lhs) const if ( lhs.empty() || lhs.size() > 2 ) return ORowSetValue(); size_t nSize = lhs.size(); - double nVal = log( static_cast<double>(lhs[nSize-1]) ); + double nVal = log( lhs[nSize-1].getDouble() ); if ( nSize == 2 && !lhs[0].isNull() ) - nVal /= log(static_cast<double>(lhs[0])); + nVal /= log(lhs[0].getDouble()); if ( std::isnan(nVal) ) return ORowSetValue(); @@ -131,10 +131,10 @@ ORowSetValue OOp_Log::operate(const std::vector<ORowSetValue>& lhs) const ORowSetValue OOp_Log10::operate(const ORowSetValue& lhs) const { - if ( lhs.isNull() || static_cast<double>(lhs) < 0.0 ) + if ( lhs.isNull() || lhs.getDouble() < 0.0 ) return lhs; - double nVal = log(static_cast<double>(lhs)); + double nVal = log(lhs.getDouble()); if ( std::isnan(nVal) ) return ORowSetValue(); nVal /= log(10.0); @@ -146,7 +146,7 @@ ORowSetValue OOp_Pow::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) c if ( lhs.isNull() || rhs.isNull() ) return lhs; - return pow(static_cast<double>(lhs),static_cast<double>(rhs)); + return pow(lhs.getDouble(), rhs.getDouble()); } ORowSetValue OOp_Sqrt::operate(const ORowSetValue& lhs) const @@ -154,7 +154,7 @@ ORowSetValue OOp_Sqrt::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - double nVal = sqrt(static_cast<double>(lhs)); + double nVal = sqrt(lhs.getDouble()); if ( std::isnan(nVal) ) return ORowSetValue(); return nVal; @@ -170,7 +170,7 @@ ORowSetValue OOp_Cos::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - return cos(static_cast<double>(lhs)); + return cos(lhs.getDouble()); } ORowSetValue OOp_Sin::operate(const ORowSetValue& lhs) const @@ -178,7 +178,7 @@ ORowSetValue OOp_Sin::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - return sin(static_cast<double>(lhs)); + return sin(lhs.getDouble()); } ORowSetValue OOp_Tan::operate(const ORowSetValue& lhs) const @@ -186,7 +186,7 @@ ORowSetValue OOp_Tan::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - return tan(static_cast<double>(lhs)); + return tan(lhs.getDouble()); } ORowSetValue OOp_ACos::operate(const ORowSetValue& lhs) const @@ -194,7 +194,7 @@ ORowSetValue OOp_ACos::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - return acos(static_cast<double>(lhs)); + return acos(lhs.getDouble()); } ORowSetValue OOp_ASin::operate(const ORowSetValue& lhs) const @@ -202,7 +202,7 @@ ORowSetValue OOp_ASin::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - return asin(static_cast<double>(lhs)); + return asin(lhs.getDouble()); } ORowSetValue OOp_ATan::operate(const ORowSetValue& lhs) const @@ -210,7 +210,7 @@ ORowSetValue OOp_ATan::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - return atan(static_cast<double>(lhs)); + return atan(lhs.getDouble()); } ORowSetValue OOp_ATan2::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const @@ -218,7 +218,7 @@ ORowSetValue OOp_ATan2::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) if ( lhs.isNull() || rhs.isNull() ) return lhs; - return atan2(static_cast<double>(lhs),static_cast<double>(rhs)); + return atan2(lhs.getDouble(), rhs.getDouble()); } ORowSetValue OOp_Degrees::operate(const ORowSetValue& lhs) const @@ -226,7 +226,7 @@ ORowSetValue OOp_Degrees::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - double nLhs = lhs; + double nLhs = lhs.getDouble(); return nLhs*180*(1.0/fPi); } @@ -235,7 +235,7 @@ ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const if ( lhs.isNull() ) return lhs; - double nLhs = lhs; + double nLhs = lhs.getDouble(); return nLhs*fPi*(1.0/180.0); } diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 930c5c2f7b98..fdf3a4e47d84 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -217,43 +217,43 @@ Reference< css::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_ sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) { - return bool(getValue(columnIndex)); + return getValue(columnIndex).getBool(); } sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getInt8(); } Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getSequence(); } css::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getDate(); } double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getDouble(); } float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getFloat(); } sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getInt32(); } @@ -264,13 +264,13 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getRow called for deleted row"); - return m_aSkipDeletedSet.getMappedPosition((*m_aRow)[0]->getValue()); + return m_aSkipDeletedSet.getMappedPosition((*m_aRow)[0]->getValue().getInt32()); } sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getLong(); } @@ -316,22 +316,22 @@ Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< css: sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getInt16(); } OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getString(); } css::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getTime(); } css::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) { - return getValue(columnIndex); + return getValue(columnIndex).getDateTime(); } @@ -518,12 +518,12 @@ void SAL_CALL OResultSet::insertRow( ) m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, m_xColsIdx); if(m_bRowInserted && m_pFileSet.is()) { - sal_Int32 nPos = (*m_aInsertRow)[0]->getValue(); + sal_Int32 nPos = (*m_aInsertRow)[0]->getValue().getInt32(); m_pFileSet->push_back(nPos); *(*m_aInsertRow)[0] = sal_Int32(m_pFileSet->size()); clearInsertRow(); - m_aSkipDeletedSet.insertNewPosition((*m_aRow)[0]->getValue()); + m_aSkipDeletedSet.insertNewPosition((*m_aRow)[0]->getValue().getInt32()); } } @@ -536,7 +536,7 @@ void SAL_CALL OResultSet::updateRow( ) lcl_throwError(STR_TABLE_READONLY,*this); m_bRowUpdated = m_pTable->UpdateRow(*m_aInsertRow, m_aRow,m_xColsIdx); - *(*m_aInsertRow)[0] = static_cast<sal_Int32>((*m_aRow)[0]->getValue()); + *(*m_aInsertRow)[0] = (*m_aRow)[0]->getValue().getInt32(); clearInsertRow(); } @@ -553,7 +553,7 @@ void SAL_CALL OResultSet::deleteRow() if(m_aRow->isDeleted()) lcl_throwError(STR_ROW_ALREADY_DELETED,*this); - sal_Int32 nPos = static_cast<sal_Int32>((*m_aRow)[0]->getValue()); + sal_Int32 nPos = (*m_aRow)[0]->getValue().getInt32(); m_bRowDeleted = m_pTable->DeleteRow(*m_xColumns); if(m_bRowDeleted && m_pFileSet.is()) { @@ -837,7 +837,7 @@ again: } else if (m_pFileSet.is()) { - sal_uInt32 nBookmarkValue = std::abs(static_cast<sal_Int32>((*m_aEvaluateRow)[0]->getValue())); + sal_uInt32 nBookmarkValue = std::abs((*m_aEvaluateRow)[0]->getValue().getInt32()); m_pFileSet->push_back(nBookmarkValue); } } @@ -1143,7 +1143,7 @@ void OResultSet::sortRows() (*m_aSelectRow)[0]->setValue( (*m_aRow)[0]->getValue() ); if ( m_pSQLAnalyzer->hasFunctions() ) m_pSQLAnalyzer->setSelectionEvaluationResult( m_aSelectRow, m_aColMapping ); - const sal_Int32 nBookmark = (*m_aRow->begin())->getValue(); + const sal_Int32 nBookmark = (*m_aRow->begin())->getValue().getInt32(); ExecuteRow( IResultSetHelper::BOOKMARK, nBookmark, true, false ); } @@ -1571,7 +1571,7 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO sal_Int32 OResultSet::getDriverPos() const { - return (*m_aRow)[0]->getValue(); + return (*m_aRow)[0]->getValue().getInt32(); } bool OResultSet::isRowDeleted() const diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index 8bac436e07be..619c1a128dbf 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -68,7 +68,7 @@ ORowSetValue OOp_Char::operate(const std::vector<ORowSetValue>& lhs) const { if (!aIter->isNull()) { - char c = static_cast<char>(static_cast<sal_Int32>(*aIter)); + char c = static_cast<char>(aIter->getInt32()); sRet.appendAscii(&c, 1); } @@ -90,7 +90,7 @@ ORowSetValue OOp_Concat::operate(const std::vector<ORowSetValue>& lhs) const if (aIter->isNull()) return ORowSetValue(); - sRet.append(aIter->operator OUString()); + sRet.append(aIter->getString()); } return sRet.makeStringAndClear(); @@ -108,7 +108,7 @@ ORowSetValue OOp_Locate::operate(const std::vector<ORowSetValue>& lhs) const else if (lhs.size() != 3) return ORowSetValue(); - return lhs[1].getString().indexOf(lhs[2].getString(), lhs[0]) + 1; + return lhs[1].getString().indexOf(lhs[2].getString(), lhs[0].getInt32()) + 1; } ORowSetValue OOp_SubString::operate(const std::vector<ORowSetValue>& lhs) const @@ -117,13 +117,13 @@ ORowSetValue OOp_SubString::operate(const std::vector<ORowSetValue>& lhs) const [](const ORowSetValue& rValue) { return rValue.isNull(); })) return ORowSetValue(); - if (lhs.size() == 2 && static_cast<sal_Int32>(lhs[0]) >= sal_Int32(0)) - return lhs[1].getString().copy(static_cast<sal_Int32>(lhs[0]) - 1); + if (lhs.size() == 2 && lhs[0].getInt32() >= sal_Int32(0)) + return lhs[1].getString().copy(lhs[0].getInt32() - 1); - else if (lhs.size() != 3 || static_cast<sal_Int32>(lhs[1]) < sal_Int32(0)) + else if (lhs.size() != 3 || lhs[1].getInt32() < sal_Int32(0)) return ORowSetValue(); - return lhs[2].getString().copy(static_cast<sal_Int32>(lhs[1]) - 1, lhs[0]); + return lhs[2].getString().copy(lhs[1].getInt32() - 1, lhs[0].getInt32()); } ORowSetValue OOp_LTrim::operate(const ORowSetValue& lhs) const @@ -131,7 +131,7 @@ ORowSetValue OOp_LTrim::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - OUString sRet = lhs; + OUString sRet = lhs.getString(); OUString sNew = sRet.trim(); return sRet.copy(sRet.indexOf(sNew)); } @@ -141,7 +141,7 @@ ORowSetValue OOp_RTrim::operate(const ORowSetValue& lhs) const if (lhs.isNull()) return lhs; - OUString sRet = lhs; + OUString sRet = lhs.getString(); OUString sNew = sRet.trim(); return sRet.copy(0, sRet.lastIndexOf(sNew[sNew.getLength() - 1]) + 1); } @@ -153,7 +153,7 @@ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const const char c = ' '; OUStringBuffer sRet; - sal_Int32 nCount = lhs; + sal_Int32 nCount = lhs.getInt32(); for (sal_Int32 i = 0; i < nCount; ++i) { sRet.appendAscii(&c, 1); @@ -166,9 +166,9 @@ ORowSetValue OOp_Replace::operate(const std::vector<ORowSetValue>& lhs) const if (lhs.size() != 3) return ORowSetValue(); - OUString sStr = lhs[2]; - OUString sFrom = lhs[1]; - OUString sTo = lhs[0]; + OUString sStr = lhs[2].getString(); + OUString sFrom = lhs[1].getString(); + OUString sTo = lhs[0].getString(); sal_Int32 nIndexOf = sStr.indexOf(sFrom); while (nIndexOf != -1) { @@ -185,10 +185,10 @@ ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs, const ORowSetValue& rh return lhs; OUStringBuffer sRet; - sal_Int32 nCount = rhs; + sal_Int32 nCount = rhs.getInt32(); for (sal_Int32 i = 0; i < nCount; ++i) { - sRet.append(lhs.operator OUString()); + sRet.append(lhs.getString()); } return sRet.makeStringAndClear(); } @@ -198,12 +198,12 @@ ORowSetValue OOp_Insert::operate(const std::vector<ORowSetValue>& lhs) const if (lhs.size() != 4) return ORowSetValue(); - OUString sStr = lhs[3]; + OUString sStr = lhs[3].getString(); - sal_Int32 nStart = static_cast<sal_Int32>(lhs[2]); + sal_Int32 nStart = lhs[2].getInt32(); if (nStart < 1) nStart = 1; - return sStr.replaceAt(nStart - 1, static_cast<sal_Int32>(lhs[1]), lhs[0]); + return sStr.replaceAt(nStart - 1, lhs[1].getInt32(), lhs[0].getString()); } ORowSetValue OOp_Left::operate(const ORowSetValue& lhs, const ORowSetValue& rhs) const @@ -211,8 +211,8 @@ ORowSetValue OOp_Left::operate(const ORowSetValue& lhs, const ORowSetValue& rhs) if (lhs.isNull() || rhs.isNull()) return lhs; - OUString sRet = lhs; - sal_Int32 nCount = rhs; + OUString sRet = lhs.getString(); + sal_Int32 nCount = rhs.getInt32(); if (nCount < 0) return ORowSetValue(); return sRet.copy(0, nCount); @@ -223,8 +223,8 @@ ORowSetValue OOp_Right::operate(const ORowSetValue& lhs, const ORowSetValue& rhs if (lhs.isNull() || rhs.isNull()) return lhs; - sal_Int32 nCount = rhs; - OUString sRet = lhs; + sal_Int32 nCount = rhs.getInt32(); + OUString sRet = lhs.getString(); if (nCount < 0 || nCount >= sRet.getLength()) return ORowSetValue(); diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 6e1a0cdf54e5..14fb8f41d6f8 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -231,7 +231,7 @@ bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const case DataType::VARCHAR: case DataType::LONGVARCHAR: { - OUString sLH = aLH, sRH = aRH; + OUString sLH = aLH.getString(), sRH = aRH.getString(); sal_Int32 nRes = sLH.compareToIgnoreAsciiCase(sRH); switch(aPredicateType) { @@ -256,7 +256,7 @@ bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const case DataType::DATE: case DataType::TIME: { - double n = aLH ,m = aRH; + double n = aLH.getDouble(), m = aRH.getDouble(); switch (aPredicateType) { @@ -285,7 +285,7 @@ void ONumOperator::Exec(OCodeStack& rCodeStack) OOperand *pLeft = rCodeStack.top(); rCodeStack.pop(); - rCodeStack.push(new OOperandResultNUM(operate(pLeft->getValue(), pRight->getValue()))); + rCodeStack.push(new OOperandResultNUM(operate(pLeft->getValue().getDouble(), pRight->getValue().getDouble()))); if( typeid(OOperandResult) == typeid(*pLeft)) delete pLeft; if( typeid(OOperandResult) == typeid(*pRight)) diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index be01a70ed360..e725b1870865 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -353,29 +353,29 @@ void OPredicateCompiler::execute_BETWEEN(OSQLParseNode const * pPredicateNode) break; case DataType::DECIMAL: case DataType::NUMERIC: - pOb1->setValue(static_cast<double>(pOb1->getValue())); - pOb2->setValue(static_cast<double>(pOb2->getValue())); + pOb1->setValue(pOb1->getValue().getDouble()); + pOb2->setValue(pOb2->getValue().getDouble()); break; case DataType::FLOAT: - pOb1->setValue(static_cast<float>(pOb1->getValue())); - pOb2->setValue(static_cast<float>(pOb2->getValue())); + pOb1->setValue(pOb1->getValue().getFloat()); + pOb2->setValue(pOb2->getValue().getFloat()); break; case DataType::DOUBLE: case DataType::REAL: - pOb1->setValue(static_cast<double>(pOb1->getValue())); - pOb2->setValue(static_cast<double>(pOb2->getValue())); + pOb1->setValue(pOb1->getValue().getDouble()); + pOb2->setValue(pOb2->getValue().getDouble()); break; case DataType::DATE: - pOb1->setValue(static_cast<util::Date>(pOb1->getValue())); - pOb2->setValue(static_cast<util::Date>(pOb2->getValue())); + pOb1->setValue(pOb1->getValue().getDate()); + pOb2->setValue(pOb2->getValue().getDate()); break; case DataType::TIME: - pOb1->setValue(static_cast<util::Time>(pOb1->getValue())); - pOb2->setValue(static_cast<util::Time>(pOb2->getValue())); + pOb1->setValue(pOb1->getValue().getTime()); + pOb2->setValue(pOb2->getValue().getTime()); break; case DataType::TIMESTAMP: - pOb1->setValue(static_cast<util::DateTime>(pOb1->getValue())); - pOb2->setValue(static_cast<util::DateTime>(pOb2->getValue())); + pOb1->setValue(pOb1->getValue().getDateTime()); + pOb2->setValue(pOb2->getValue().getDateTime()); break; } } |