public void visit(QueryVisitor visitor) {
   visitor.visitEntity(entityName);
   condition.visit(visitor);
   for (QueryOrder o : order) {
     o.visit(visitor);
   }
   visitor.visitEnd();
 }
  public void visitQueries(Reader reader, QueryVisitor visitor) {

    int count = 0;
    StringBuilder builder = new StringBuilder();
    Scanner scanner = new Scanner(reader);
    while (scanner.hasNextLine()) {
      String line = trimTrailingWhitespace(scanner.nextLine());

      if (builder.length() > 0) {
        builder.append(getSeparator());
      }
      builder.append(line);

      if (statementEnds(line)) {
        visitor.visit(++count, withoutTrailingDelimiter(builder));
        builder = new StringBuilder();
      }
    }
    if (builder.length() > 0) {
      visitor.visit(++count, builder.toString());
    }
    Closeables.closeQuietly(reader);
  }
Exemple #3
0
 @Override
 public void accept(final QueryVisitor visitor) {
   visitor.visit(this);
 }