21#include <osl/diagnose.h>
24#include <sqlbison.hxx>
25#include <com/sun/star/sdb/SQLFilterOperator.hpp>
33OCode::~OCode() =
default;
35OOperandRow::OOperandRow(sal_uInt16 _nPos, sal_Int32 _rType)
42 OSL_ENSURE(_pRow.is(),
"NO EMPTY row allowed!");
44 OSL_ENSURE(
m_pRow.is() && m_nRowPos < m_pRow->
size(),
"Invalid RowPos is >= vector.size()");
50 OSL_ENSURE(
m_pRow.is() && m_nRowPos < m_pRow->
size(),
"Invalid RowPos is >= vector.size()");
56 OSL_ENSURE(
m_pRow.is() && m_nRowPos < m_pRow->
size(),
"Invalid RowPos is >= vector.size()");
114 SAL_WARN(
"connectivity.drivers",
"Parse Error");
131 OOperand *pRight = rCodeStack.top();
150 OOperand* pOperand = rCodeStack.top();
173 OOperand* pOperand = rCodeStack.top();
224 bool bResult =
false;
231 case DataType::VARCHAR:
232 case DataType::LONGVARCHAR:
235 sal_Int32 nRes = sLH.compareToIgnoreAsciiCase(sRH);
238 case SQLFilterOperator::EQUAL: bResult = (nRes == 0);
break;
239 case SQLFilterOperator::NOT_EQUAL: bResult = (nRes != 0);
break;
240 case SQLFilterOperator::LESS: bResult = (nRes < 0);
break;
241 case SQLFilterOperator::LESS_EQUAL: bResult = (nRes <= 0);
break;
242 case SQLFilterOperator::GREATER: bResult = (nRes > 0);
break;
243 case SQLFilterOperator::GREATER_EQUAL: bResult = (nRes >= 0);
break;
244 default: bResult =
false;
247 case DataType::TINYINT:
248 case DataType::SMALLINT:
249 case DataType::INTEGER:
250 case DataType::DECIMAL:
251 case DataType::NUMERIC:
253 case DataType::DOUBLE:
255 case DataType::TIMESTAMP:
263 case SQLFilterOperator::EQUAL: bResult = (
n ==
m);
break;
264 case SQLFilterOperator::LIKE: bResult = (
n ==
m);
break;
265 case SQLFilterOperator::NOT_EQUAL: bResult = (
n !=
m);
break;
266 case SQLFilterOperator::NOT_LIKE: bResult = (
n !=
m);
break;
267 case SQLFilterOperator::LESS: bResult = (
n <
m);
break;
268 case SQLFilterOperator::LESS_EQUAL: bResult = (
n <=
m);
break;
269 case SQLFilterOperator::GREATER: bResult = (
n >
m);
break;
270 case SQLFilterOperator::GREATER_EQUAL: bResult = (
n >=
m);
break;
271 default: bResult =
false;
275 bResult = aLH == aRH;
283 OOperand *pRight = rCodeStack.top();
297 return fLeft + fRight;
303 return fLeft - fRight;
309 return fLeft * fRight;
315 return fLeft / fRight;
320 std::vector<ORowSetValue> aValues;
321 std::vector<OOperand*> aOperands;
325 OSL_ENSURE(!rCodeStack.empty(),
"Stack must be none empty!");
326 pOperand = rCodeStack.top();
329 if (pOperand &&
typeid(
OStopOperand) !=
typeid(*pOperand))
330 aValues.push_back( pOperand->
getValue() );
331 aOperands.push_back( pOperand );
333 while (pOperand &&
typeid(
OStopOperand) !=
typeid(*pOperand));
337 for (
const auto& rpOperand : aOperands)
346 OOperand *pRight = rCodeStack.top();
351 if ( !rCodeStack.empty() &&
typeid(
OStopOperand) ==
typeid(*rCodeStack.top()) )
363 OSL_ENSURE(!rCodeStack.empty(),
"Stack is empty!");
364 OOperand* pOperand = rCodeStack.top();
OUString getString() const
void setBound(bool _bBound)
SQLNodeType getNodeType() const
virtual void Exec(OCodeStack &) override
virtual ORowSetValue operate(const ORowSetValue &lhs, const ORowSetValue &rhs) const =0
virtual bool operate(const OOperand *, const OOperand *) const
virtual void Exec(OCodeStack &) override
virtual void Exec(OCodeStack &) override
virtual ORowSetValue operate(const std::vector< ORowSetValue > &lhs) const =0
virtual double operate(const double &fLeft, const double &fRight) const =0
virtual void Exec(OCodeStack &) override
virtual double operate(const double &fLeft, const double &fRight) const override
virtual bool operate(const OOperand *, const OOperand *) const override
virtual bool operate(const OOperand *, const OOperand *) const override
virtual double operate(const double &fLeft, const double &fRight) const override
virtual bool operate(const OOperand *, const OOperand *) const override
virtual void Exec(OCodeStack &) override
virtual bool operate(const OOperand *, const OOperand *) const override
virtual bool operate(const OOperand *, const OOperand *) const override
const sal_Unicode cEscape
virtual double operate(const double &fLeft, const double &fRight) const override
virtual bool operate(const OOperand *, const OOperand *) const override
virtual void Exec(OCodeStack &) override
virtual bool operate(const OOperand *, const OOperand *) const override
virtual bool operate(const OOperand *, const OOperand *) const override
virtual double operate(const double &fLeft, const double &fRight) const override
OOperandConst(const connectivity::OSQLParseNode &rColumnRef, const OUString &aStrValue)
OOperandParam(sal_Int32 _nPos)
virtual const ORowSetValue & getValue() const override
virtual void setValue(const ORowSetValue &_rVal) override
void bindValue(const OValueRefRow &_pRow)
virtual const ORowSetValue & getValue() const override
virtual void setValue(const ORowSetValue &_rVal) override
sal_Int32 getDBType() const
virtual const ORowSetValue & getValue() const =0
special stop operand is appended when a list of arguments ends
virtual void Exec(OCodeStack &) override
virtual ORowSetValue operate(const ORowSetValue &lhs) const =0
#define SAL_WARN(area, stream)
std::stack< OOperand * > OCodeStack
bool match(const sal_Unicode *pWild, const sal_Unicode *pStr, const sal_Unicode cEscape)
#define SQL_ISTOKEN(pParseNode, token)