コード例 #1
0
 public override Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression Copy()
 {
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression o = Create(GetOperator(), GetLeft().Copy(), GetRight().Copy());
     o.SetDescription(GetDescription());
     o.GetClientParameters().SetAll(GetClientParameters());
     return(o);
 }
コード例 #2
0
 public override string GetSQL(object oo, Net.Vpc.Upa.Persistence.EntityExecutionContext qlContext, Net.Vpc.Upa.Impl.Persistence.SQLManager sqlManager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression)oo;
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     sb.Append('(');
     sb.Append(sqlManager.GetSQL(o.GetLeft(), qlContext, declarations));
     sb.Append(GetOperatorString(o));
     sb.Append(sqlManager.GetSQL(o.GetRight(), qlContext, declarations));
     sb.Append(')');
     return(sb.ToString());
 }
コード例 #3
0
        public override string GetSQL(object oo, Net.Vpc.Upa.Persistence.EntityExecutionContext qlContext, Net.Vpc.Upa.Impl.Persistence.SQLManager sqlManager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression)oo;
            string leftValue = o.GetLeft() != null?sqlManager.GetSQL(o.GetLeft(), qlContext, declarations) : "NULL";

            string rightValue = o.GetRight() != null?sqlManager.GetSQL(o.GetRight(), qlContext, declarations) : "NULL";

            string s = null;

            switch (o.GetOperator())
            {
            case Net.Vpc.Upa.Expressions.BinaryOperator.AND:
            {
                s = leftValue + " And " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.OR:
            {
                s = leftValue + " Or " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.BIT_AND:
            {
                s = leftValue + " & " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.LSHIFT:
            {
                s = leftValue + " << " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.BIT_OR:
            {
                s = leftValue + " | " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.RSHIFT:
            {
                s = leftValue + " >> " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.URSHIFT:
            {
                s = leftValue + " >>> " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.XOR:
            {
                s = leftValue + " ^ " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.DIFF:
            {
                if ("NULL".Equals(rightValue, System.StringComparison.InvariantCultureIgnoreCase))
                {
                    s = leftValue + " IS NOT " + rightValue;
                }
                else
                {
                    s = leftValue + " <> " + rightValue;
                }
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.EQ:
            {
                if ("NULL".Equals(rightValue, System.StringComparison.InvariantCultureIgnoreCase))
                {
                    s = leftValue + " IS " + rightValue;
                }
                else
                {
                    s = leftValue + " = " + rightValue;
                }
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.GT:
            {
                s = leftValue + " > " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.GE:
            {
                s = leftValue + " >= " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.LT:
            {
                s = leftValue + " < " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.LE:
            {
                s = leftValue + " < " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.PLUS:
            {
                s = leftValue + " + " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.MINUS:
            {
                s = leftValue + " - " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.MUL:
            {
                s = leftValue + " * " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.DIV:
            {
                s = leftValue + " - " + rightValue;
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.REM:
            {
                s = "{fn mod(" + leftValue + "," + rightValue + " )}";
                break;
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.LIKE:
            {
                //escape seems to be not supported with '*' wildcard
                //s=leftValue+" Like "+rightValue+" {escape '*'} ";
                s = leftValue + " Like " + rightValue + " ";
                break;
            }

            default:
            {
                throw new System.ArgumentException("Not Supported Yet");
            }
            }
            return("(" + s + ")");
        }
コード例 #4
0
        private string GetOperatorString(Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression expression)
        {
            switch (expression.GetOperator())
            {
            case Net.Vpc.Upa.Expressions.BinaryOperator.AND:
            {
                return("And");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.OR:
            {
                return("Or");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.BIT_AND:
            {
                return("&");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.LSHIFT:
            {
                return("<<");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.BIT_OR:
            {
                return("|");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.RSHIFT:
            {
                return(">>");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.URSHIFT:
            {
                return(">>>");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.XOR:
            {
                return("^");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.DIFF:
            {
                return("!=");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.EQ:
            {
                return("=");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.GT:
            {
                return(">");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.GE:
            {
                return(">=");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.LT:
            {
                return("<");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.LE:
            {
                return("<=");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.PLUS:
            {
                return("+");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.MINUS:
            {
                return("-");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.MUL:
            {
                return("*");
            }

            case Net.Vpc.Upa.Expressions.BinaryOperator.DIV:
            {
                return("/");
            }

            default:
            {
                throw new System.ArgumentException("Not Supported Yet");
            }
            }
        }