示例#1
0
void SQLBinaryExpression::toECLStringTranslateSource(
            StringBuffer & eclStr,
            IProperties * map,
            bool ignoreMisTranslations,
            bool forHaving,
            bool funcParam,
            bool countFuncParam)
{
    StringBuffer translation1;
    StringBuffer translation2;

    operand1->toECLStringTranslateSource(translation1, map, ignoreMisTranslations, forHaving, false, false);
    operand2->toECLStringTranslateSource(translation2, map, ignoreMisTranslations, forHaving, false, false);

    if (translation1.length()>0 && translation2.length()>0)
    {
        eclStr.append(translation1);
        eclStr.append(getOpStr());
        eclStr.append(translation2);

    }
    else if (translation1.length()<0 && translation2.length()<0)
    {
        return;
    }
    else if (ignoreMisTranslations)
    {
        /*
        * If operand1 or operand2 could not be translated using the translation map,
        * and ignoreMisTranslations = true, we're going to attempt to return an valid
        * ECL translation of this binary expression. IF the binary expression is of type
        * OR | AND, we can substitute the mistranslated operand with the appropriate boolean value
        * to complete the expression with out changing the gist of the expression.
        *
        * This is typically done when converting an SQL 'WHERE' clause or 'ON' clause to ECL to
        * be used in an ECL JOIN function. In any one particular ECL Join funtion only two datasets
        * are joined, therefore not all portions of the SQL logic clause might be relevant.
        *
        */
        if (op == OR_SYM || op == AND_SYM)
        {
            StringBuffer convert( op == OR_SYM ? "FALSE" : "TRUE");

            if (translation1.length()>0)
            {
                WARNLOG("Operand 1 of binary expression could not be translated.");
                eclStr.append(translation1);
                eclStr.append(getOpStr());
                eclStr.append(convert);
            }
            else
            {
                WARNLOG("Operand 2 of binary expression could not be translated.");
                eclStr.append(convert);
                eclStr.append(getOpStr());
                eclStr.append(translation2);
            }
        }
        else
        {
            WARNLOG("Binary expression could not be translated.");
            return;
        }
    }
    else
    {
        WARNLOG("Binary expression could not be translated.");
        return;
    }
}
示例#2
0
void SQLBinaryExpression::toString(StringBuffer & targetstr, bool fullOutput)
{
    operand1->toString(targetstr, fullOutput);
    targetstr.append(getOpStr());
    operand2->toString(targetstr, fullOutput);
}
示例#3
0
std::string RFSMasmt::toString()
{
	std::string str = "";
	str.append(m_lValue->toString()).append(" ").append(getOpStr(m_op)).append(" ").append(RFSMvalue::toString(m_rValue));
	return str;
}