Beispiel #1
0
  public boolean visit(MySqlSelectQueryBlock.Limit x) {
    print("LIMIT ");
    if (x.getOffset() != null) {
      x.getOffset().accept(this);
      print(", ");
    }
    x.getRowCount().accept(this);

    return false;
  }
Beispiel #2
0
  public Limit parseLimit() {
    if (lexer.token() == Token.LIMIT) {
      lexer.nextToken();

      MySqlSelectQueryBlock.Limit limit = new MySqlSelectQueryBlock.Limit();

      SQLExpr temp = this.expr();
      if (lexer.token() == (Token.COMMA)) {
        limit.setOffset(temp);
        lexer.nextToken();
        limit.setRowCount(this.expr());
      } else if (identifierEquals("OFFSET")) {
        limit.setRowCount(temp);
        lexer.nextToken();
        limit.setOffset(this.expr());
      } else {
        limit.setRowCount(temp);
      }
      return limit;
    }

    return null;
  }