Deveel.Data.Sql.Query.QueryTablePlanner.EvaluatePatterns C# (CSharp) Method

EvaluatePatterns() private method

private EvaluatePatterns ( List list, List plans ) : void
list List
plans List
return void
        private void EvaluatePatterns(List<SqlBinaryExpression> list, List<ExpressionPlan> plans)
        {
            foreach (var expression in list) {
                // If the LHS is a single column and the RHS is a constant then
                // the conditions are right for a simple pattern search.
                var leftColumnName = expression.Left.AsReferenceName();

                if (expression.IsConstant()) {
                    plans.Add(new ConstantPlan(this, expression));
                } else if (leftColumnName != null &&
                           expression.Right.IsConstant()) {
                    plans.Add(new SimplePatternPlan(this, leftColumnName, expression));
                } else {
                    // Otherwise we must assume a complex pattern search which may
                    // require a join.  For example, 'a + b LIKE 'a%'' or
                    // 'a LIKE b'.  At the very least, this will be an exhaustive
                    // search and at the worst it will be a join + exhaustive search.
                    // So we should evaluate these at the end of the evaluation order.
                    plans.Add(new ExhaustiveSelectPlan(this, expression));
                }
            }
        }