summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/file/fcomp.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/file/fcomp.cxx')
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx48
1 files changed, 20 insertions, 28 deletions
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index 982d0266b949..86ed7d4cf8c5 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -22,9 +22,6 @@
#include <connectivity/sqlparse.hxx>
#include <file/fanalyzer.hxx>
#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/util/Time.hpp>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbconversion.hxx>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
@@ -32,7 +29,7 @@
#include <file/FDateFunctions.hxx>
#include <file/FNumericFunctions.hxx>
#include <file/FConnection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sqlbison.hxx>
#include <strings.hrc>
@@ -78,7 +75,7 @@ void OPredicateCompiler::start(OSQLParseNode const * pSQLParseNode)
DBG_ASSERT(pSQLParseNode->count() >= 4,"OFILECursor: Error in Parse Tree");
OSQLParseNode * pTableExp = pSQLParseNode->getChild(3);
- DBG_ASSERT(pTableExp != nullptr,"Error in Parse Tree");
+ assert(pTableExp && "Error in Parse Tree");
DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Error in Parse Tree");
DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Error in Parse Tree");
@@ -333,12 +330,12 @@ void OPredicateCompiler::execute_BETWEEN(OSQLParseNode const * pPredicateNode)
OOperand* pColumnOp = execute(pColumn);
OOperand* pOb1 = execute(p1stValue);
- OBoolOperator* pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::LESS_EQUAL : SQLFilterOperator::GREATER);
+ OBoolOperator* pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::LESS : SQLFilterOperator::GREATER_EQUAL);
m_aCodeList.emplace_back(pOperator);
execute(pColumn);
OOperand* pOb2 = execute(p2ndtValue);
- pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::GREATER_EQUAL : SQLFilterOperator::LESS);
+ pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::GREATER : SQLFilterOperator::LESS_EQUAL);
m_aCodeList.emplace_back(pOperator);
if ( pColumnOp && pOb1 && pOb2 )
@@ -353,29 +350,26 @@ 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()));
- break;
- case DataType::FLOAT:
- pOb1->setValue(static_cast<float>(pOb1->getValue()));
- pOb2->setValue(static_cast<float>(pOb2->getValue()));
- 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::FLOAT:
+ pOb1->setValue(pOb1->getValue().getFloat());
+ pOb2->setValue(pOb2->getValue().getFloat());
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;
}
}
@@ -457,7 +451,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode const * pPredicateNo
}
else if (SQL_ISRULE(pPredicateNode,parameter))
{
- pOperand = new OOperandParam(pPredicateNode, ++m_nParamCounter);
+ pOperand = new OOperandParam(++m_nParamCounter);
}
else if (pPredicateNode->getNodeType() == SQLNodeType::String ||
pPredicateNode->getNodeType() == SQLNodeType::IntNum ||
@@ -533,8 +527,6 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode const * pPredicateNo
bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
{
- static bool bResult;
-
if (!(rCodeList[0]))
return true; // no Predicate
@@ -551,9 +543,9 @@ bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
m_aStack.pop();
DBG_ASSERT(m_aStack.empty(), "Stack error");
- DBG_ASSERT(pOperand, "Stack error");
+ assert(pOperand && "Stack error");
- bResult = pOperand->isValid();
+ const bool bResult = pOperand->isValid();
if (typeid(OOperandResult) == typeid(*pOperand))
delete pOperand;
return bResult;
@@ -577,7 +569,7 @@ void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList, ORowSetValue
m_aStack.pop();
DBG_ASSERT(m_aStack.empty(), "Stack error");
- DBG_ASSERT(pOperand, "Stack error");
+ assert(pOperand && "Stack error");
(*_rVal) = pOperand->getValue();
if (typeid(OOperandResult) == typeid(*pOperand))