Ejemplo n.º 1
0
        public static WhereClause Create(SearchCondition sc)
        {
            var wh = new WhereClause();

            wh.Stack.AddLast(Keyword.Create("WHERE"));
            wh.Stack.AddLast(Whitespace.Create());
            wh.Stack.AddLast(sc);

            return(wh);
        }
Ejemplo n.º 2
0
        public void Append(SelectList last)
        {
            SelectList ll, sl;

            ll = sl = this;
            while ((ll = sl.FindDescendant <SelectList>()) != null)
            {
                sl = ll;
            }

            sl.Stack.AddLast(Comma.Create());
            sl.Stack.AddLast(CommentOrWhitespace.Create(Whitespace.Create()));
            sl.Stack.AddLast(last);
        }
Ejemplo n.º 3
0
        public static SearchCondition Create(SearchConditionBrackets br, LogicalOperator op, SearchCondition sc)
        {
            var nsc = new SearchCondition();

            // TODO: add whitespaces here

            nsc.Stack.AddLast(br);
            nsc.Stack.AddLast(Whitespace.Create());
            nsc.Stack.AddLast(op);
            nsc.Stack.AddLast(Whitespace.Create());
            nsc.Stack.AddLast(sc);

            return(nsc);
        }
Ejemplo n.º 4
0
        public WhereClause GenerateWhereClauseSpecificToTable(TableReference table)
        {
            SearchCondition sc = null;

            // Loop over all conditions (JOIN ONs and WHERE conditions)
            // Result will be a combinations of the table specific conditions terms
            // of all these

            // Chain up search conditions with AND operator
            foreach (var condition in conditions)
            {
                foreach (var ex in EnumerateCnfTermsSpecificToTable(condition, table))
                {
                    var nsc = ex.GetParsingTree();

                    if (sc != null)
                    {
                        nsc.Stack.AddLast(Whitespace.Create());
                        nsc.Stack.AddLast(LogicalOperator.CreateAnd());
                        nsc.Stack.AddLast(Whitespace.Create());
                        nsc.Stack.AddLast(sc);
                    }

                    sc = nsc;
                }
            }

            // Prefix with the WHERE keyword
            if (sc != null)
            {
                var where = new WhereClause();
                where.Stack.AddLast(Keyword.Create("WHERE"));
                where.Stack.AddLast(Whitespace.Create());
                where.Stack.AddLast(sc);

                return(where);
            }
            else
            {
                return(null);
            }
        }