Package railo.runtime.sql.exp

Examples of railo.runtime.sql.exp.Expression


    }
    return expr;
  }
 
  private Expression andOp(ParserString raw) throws SQLParserException {
    Expression expr = notOp(raw);
   
    while(raw.forwardIfCurrentAndNoWordNumberAfter("and")) {
      raw.removeSpace();
          expr=new Operation2(expr, notOp(raw), Operation.OPERATION2_AND);
    }
View Full Code Here


    return decsionOp(raw);
  }
 
  private Expression decsionOp(ParserString raw) throws SQLParserException {

    Expression expr = plusMinusOp(raw);
    boolean hasChanged=false;
    do {
      hasChanged=false;

      // value BETWEEN value AND value
      if (raw.forwardIfCurrent("between ")) {
        raw.removeSpace();
        Expression left = plusMinusOp(raw);
        raw.removeSpace();
        if(!raw.forwardIfCurrent("and "))throw new SQLParserException("invalid operation (between) missing operator and");
        raw.removeSpace();
        Expression right = plusMinusOp(raw);
        raw.removeSpace();
        expr= new Operation3(expr,left,right, Operation.OPERATION3_BETWEEN);
        hasChanged=true;
      }
     
      // value like value [escape value]
      else if (raw.forwardIfCurrentAndNoWordNumberAfter("like")) {
        raw.removeSpace();
        Expression left = plusMinusOp(raw);
        raw.removeSpace();
        if(raw.forwardIfCurrentAndNoWordNumberAfter("escape ")){
          raw.removeSpace();
          Expression right = plusMinusOp(raw);
          raw.removeSpace();
          expr= new Operation3(expr,left,right, Operation.OPERATION3_LIKE);
        }
        else {
          raw.removeSpace();
View Full Code Here

  private Expression decisionOpCreate(ParserString raw,int operation, Expression left) throws SQLParserException {
    raw.removeSpace();
        return new Operation2(left, plusMinusOp(raw), operation);
  }
  private Expression plusMinusOp(ParserString raw) throws SQLParserException {
    Expression expr = modOp(raw);
   
    while(!raw.isLast()) {
     
      // Plus Operation
      if (raw.forwardIfCurrent('+')) {
View Full Code Here

    }
    return expr;
  }
 
  private Expression modOp(ParserString raw) throws SQLParserException {
    Expression expr = divMultiOp(raw);
   
    // Modulus Operation
    while(raw.forwardIfCurrent('%')) {
      raw.removeSpace();
            expr=new Operation2(expr, divMultiOp(raw), Operation.OPERATION2_MOD);
View Full Code Here

    }
    return expr;
  }
 
  private Expression divMultiOp(ParserString raw) throws SQLParserException {
    Expression expr = expoOp(raw);
    while (!raw.isLast()) {
        // Multiply Operation
        if(raw.forwardIfCurrent('*')) {
                    raw.removeSpace();
                    expr=new Operation2(expr, expoOp(raw), Operation.OPERATION2_MULTIPLY);
View Full Code Here

    }
    return expr;
  }

  private Expression expoOp(ParserString raw) throws SQLParserException {
    Expression exp = negateMinusOp(raw);

    // Modulus Operation
    while(raw.forwardIfCurrent('^')) {
      raw.removeSpace();
            exp=new Operation2(exp, negateMinusOp(raw),Operation.OPERATION2_EXP);
View Full Code Here

    return clip(raw);
  }
 
  //     { Expression | COUNT(*) | {COUNT | MIN | MAX | SUM | AVG | SOME | EVERY | VAR_POP | VAR_SAMP | STDDEV_POP | STDDEV_SAMP} ([ALL | DISTINCT][1]] Expression) } [[AS] label]
  private Expression clip(ParserString raw) throws SQLParserException {
    Expression exp=column(raw);
    //if(exp==null)exp=brackedColumn(raw);
    if(exp==null)exp=date(raw);
    if(exp==null)exp=bracked(raw);
    if(exp==null)exp=number(raw);
    if(exp==null)exp=string(raw);
View Full Code Here

  }

  private Expression bracked(ParserString raw) throws SQLParserException {
    if(!raw.forwardIfCurrent('(')) return null;
    raw.removeSpace();
    Expression exp = expression(raw);
    raw.removeSpace();
    if(!raw.forwardIfCurrent(')')) throw new SQLParserException("missing closing )");
    raw.removeSpace();
    return exp;//new BracketExpression(exp);
  }
View Full Code Here

  private List readArguments(ParserString raw) throws SQLParserException {
    return readArguments(raw,null);
  }
  private List readArguments(ParserString raw,Expression exp) throws SQLParserException {
    List args=new ArrayList();
    Expression arg;
    if(exp!=null)args.add(exp);
    do {
      raw.removeSpace();
      if(raw.isCurrent(')')) break;
     
      args.add(arg=expression(raw));
      raw.removeSpace();
      // check for alias
      if(raw.forwardIfCurrent("as ")) {
        raw.removeSpace();
        arg.setAlias(identifier(raw,null));
      raw.removeSpace();
    }
     
     
    }
View Full Code Here

    Map<Collection.Key,Object> selects=new HashMap<Collection.Key,Object>();
    Iterator<Key> it;
    Key k;
  // headers
    for(int i=0;i<selCount;i++) {
      Expression expSelect = expSelects[i];
     
      if(expSelect.getAlias().equals("*")) {
        it = qr.keyIterator();
        while(it.hasNext()){
          k = it.next();
          selects.put(k,k);
          queryAddColumn( target, k, qr.getColumn( k ).getType() );
        }
      }
      else {
        Key alias = Caster.toKey(expSelect.getAlias());

        selects.put(alias,expSelect);

                int type = Types.OTHER;

View Full Code Here

TOP

Related Classes of railo.runtime.sql.exp.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.