Package com.redspr.redquerybuilder.core.client.expression

Examples of com.redspr.redquerybuilder.core.client.expression.Expression


                    return null;
                }
                return null;
            } else if (readIf("RESTART")) {
                readIf("WITH");
                Expression start = readExpression();
                return null;
            } else if (readIf("SELECTIVITY")) {
                return null;
            } else {
                Column newColumn = parseColumnForTable(columnName);
View Full Code Here


                    Parameter p = parameters.get(index);
                    if (p == null) {
                        throw getSyntaxError();
                    }
                    read(":");
                    Expression expr = readExpression();
                  //  expr = expr.optimize(session);
                    //p.setValue(expr.getValue(session));
                } while (readIf(","));
                read("}");
                for (Parameter p : parameters) {
View Full Code Here

                readIf("OUTER");
                read("JOIN");
                // the right hand side is the 'inner' table usually
                TableFilter newTop = readTableFilter(fromOuter);
                newTop = readJoin(newTop, command, true);
                Expression on = null;
                if (readIf("ON")) {
                    on = readExpression();
                }
                newTop.addJoin(top, true, on);
                top = newTop;
                last = newTop;
            } else if (readIf("LEFT")) {
                readIf("OUTER");
                read("JOIN");
                TableFilter join = readTableFilter(true);
                top = readJoin(top, command, true);
                Expression on = null;
                if (readIf("ON")) {
                    on = readExpression();
                }
                top.addJoin(join, true, on);
                last = join;
            } else if (readIf("FULL")) {
                throw this.getSyntaxError();
            } else if (readIf("INNER")) {
                read("JOIN");
                TableFilter join = readTableFilter(fromOuter);
                top = readJoin(top, command, false);
                Expression on = null;
                if (readIf("ON")) {
                    on = readExpression();
                }
                top.addJoin(join, fromOuter, on);
                last = join;
            } else if (readIf("JOIN")) {
                TableFilter join = readTableFilter(fromOuter);
                top = readJoin(top, command, false);
                Expression on = null;
                if (readIf("ON")) {
                    on = readExpression();
                }
                top.addJoin(join, fromOuter, on);
                last = join;
            } else if (readIf("CROSS")) {
                read("JOIN");
                TableFilter join = readTableFilter(fromOuter);
                top.addJoin(join, fromOuter, null);
                last = join;
            } else if (readIf("NATURAL")) {
                read("JOIN");
                TableFilter join = readTableFilter(fromOuter);
                Column[] tableCols = last.getTable().getColumns().toArray(new Column[0]);
                Column[] joinCols = join.getTable().getColumns().toArray(new Column[0]);
                String tableSchema = last.getTable().getSchema().getName();
                String joinSchema = join.getTable().getSchema().getName();
                Expression on = null;
                for (Column tc : tableCols) {
                    String tableColumnName = tc.getName();
                    for (Column c : joinCols) {
                        String joinColumnName = c.getName();
                        if (tableColumnName.equals(joinColumnName)) {
                            // XXX join.addNaturalJoinColumn(c);
                            Expression tableExpr = new ExpressionColumn(session, tableSchema, last
                                    .getTableAlias(), tableColumnName);
                            Expression joinExpr = new ExpressionColumn(session, joinSchema, join
                                    .getTableAlias(), joinColumnName);
                            Expression equal = new Comparison(session, Operator.EQUAL, tableExpr, joinExpr);
                            if (on == null) {
                                on = equal;
                            } else {
                                on = new ConditionAndOr(session, ConditionAndOr.AND, on, equal);
                            }
View Full Code Here

        ObjectArray<Expression> expressions = ObjectArray.newInstance();
        do {
            if (readIf("*")) {
          //      expressions.add(new Wildcard(null, null));
            } else {
                Expression expr = readExpression();
                if (readIf("AS") || currentTokenType == IDENTIFIER) {
                    String alias = readAliasIdentifier();
          //          expr = new Alias(expr, alias, database.getMode().aliasColumnName);
                }
                expressions.add(expr);
View Full Code Here

              //  Window.alert("parseSelectSimple E");
            }
        }
     //   Window.alert("parseSelectSimple F" + command);
        if (readIf("WHERE")) {
            Expression condition = readExpression();
            command.addCondition(condition);
        }
     //   Window.alert("parseSelectSimple G" + command);
        // the group by is read for the outer select (or not a select)
        // so that columns that are not grouped can be used
        currentSelect = oldSelect;
        if (readIf("GROUP")) {
            read("BY");
            ObjectArray<Expression> list = ObjectArray.newInstance();
            do {
                Expression expr = readExpression();
                list.add(expr);
            } while (readIf(","));
            command.setGroupBy(list);
        }
        currentSelect = command;
        if (readIf("HAVING")) {
            Expression condition = readExpression();
            command.setHaving(condition);
        }
        // TODO 97 command.setParameterList(parameters);
        currentSelect = oldSelect;
        setSQL(command, "SELECT", start);
View Full Code Here

TOP

Related Classes of com.redspr.redquerybuilder.core.client.expression.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.