Example #1
0
        string ICriteriaVisitor <string> .Visit(FunctionOperator theOperator)
        {
            try
            {
                _isNeedUpper = theOperator.Operands.Any(IsNeedUpper);

                var str = OracleFormatterHelper.FormatFunction(obj => Process((CriteriaOperator)obj), theOperator.OperatorType, theOperator.Operands.ToArray());
                if (!string.IsNullOrEmpty(str))
                {
                    return(str);
                }

                var operands = new string[theOperator.Operands.Count];
                for (var i = 0; i < theOperator.Operands.Count; i++)
                {
                    operands[i] = Process(theOperator.Operands[i]);
                }
                str = OracleFormatterHelper.FormatFunction(theOperator.OperatorType, operands);
                if (!string.IsNullOrEmpty(str))
                {
                    return(str);
                }

                return(base.VisitInternal(theOperator));
            }
            finally
            {
                _isNeedUpper = false;
            }
        }
Example #2
0
 string ICriteriaVisitor <string> .Visit(BinaryOperator theOperator)
 {
     // если левый или правый оператор нужно приводить к верхнему регистру, то приводим оба
     _isNeedUpper = IsNeedUpper(theOperator.LeftOperand) || IsNeedUpper(theOperator.RightOperand);
     try
     {
         string leftOperand  = Process(theOperator.LeftOperand);
         string rightOperand = Process(theOperator.RightOperand);
         return(OracleFormatterHelper.FormatBinary(theOperator.OperatorType, leftOperand, rightOperand));
     }
     finally
     {
         _isNeedUpper = false;
     }
 }