Package com.impossibl.postgres.jdbc.SQLTextTree

Examples of com.impossibl.postgres.jdbc.SQLTextTree.GrammarPiece


    if (sqlText.getStatementCount() > 1)
      return false;

    StatementNode statement = sqlText.getLastStatement();

    statement.nodes.add(0, new GrammarPiece(clause, -1));

    return true;
  }
View Full Code Here


    if (sqlText.getStatementCount() > 1)
      return false;

    StatementNode statement = sqlText.getLastStatement();

    statement.add(new GrammarPiece(clause, -1));

    return true;
  }
View Full Code Here

  static Node space() {
    return new WhitespacePiece(" ", -1);
  }

  static Node grammar(String val) {
    return new GrammarPiece(val, -1);
  }
View Full Code Here

    Iterator<Node> argsIter = args.iterator();
    while (argsIter.hasNext()) {
      groupNode.add(argsIter.next());
      if (argsIter.hasNext()) {
        groupNode.add(new GrammarPiece(sep, -1));
      }
    }

    return groupNode;
  }
View Full Code Here

            if (lookAhead(sql, ndx) == '*') {
              ndx = consumeMultilineComment(sql, ndx, parents.peek());
              continue;
            }
            else {
              parents.peek().add(new GrammarPiece("/", ndx));
              break;
            }
          case '-':
            if (lookAhead(sql, ndx) == '-') {
              ndx = consumeSinglelineComment(sql, ndx, parents.peek());
              continue;
            }
            else if (Character.isDigit(lookAhead(sql, ndx))) {
              ndx = consumeNumeric(sql, ndx, parents.peek());
              continue;
            }
            else {
              GrammarPiece grammarPiece = new GrammarPiece("-", ndx);
              parents.peek().add(grammarPiece);
              break;
            }
          case ';':
            if (parents.size() == 2) {
              paramId = 1;
              CompositeNode comp = parents.pop();
              comp.setEndPos(ndx);
              parents.peek().add(comp);
              parents.push(new StatementNode(ndx));
            }
            else {
              parents.peek().add(new GrammarPiece(";", ndx));
            }
            break;
          default:
            if (Character.isWhitespace(c)) {
              WhitespacePiece whitespacePiece = new WhitespacePiece(sql.substring(ndx, ndx + 1), ndx);
              if (parents.peek().getLastNode() instanceof WhitespacePiece) {
                ((WhitespacePiece) parents.peek().getLastNode()).coalesce(whitespacePiece);
              }
              else {
                parents.peek().add(whitespacePiece);
              }
            }
            else if (Character.isDigit(c) || (c == '+' && Character.isDigit(lookAhead(sql, ndx)))) {
              ndx = consumeNumeric(sql, ndx, parents.peek());
              continue;
            }
            else if (Character.isJavaIdentifierStart(c)) {
              ndx = consumeUnquotedIdentifier(sql, ndx, parents.peek());
              continue;
            }
            else {
              GrammarPiece grammarPiece = new GrammarPiece(sql.substring(ndx, ndx + 1), ndx);
              if (parents.peek().getLastNode() instanceof GrammarPiece) {
                ((GrammarPiece) parents.peek().getLastNode()).coalesce(grammarPiece);
              }
              else {
                parents.peek().add(grammarPiece);
View Full Code Here

        }
      }
    } while (++ndx < sql.length());

    // Just treat as a grammar piece
    parent.add(new GrammarPiece(sql.substring(start, ndx), start));
    return ndx;
  }
View Full Code Here

TOP

Related Classes of com.impossibl.postgres.jdbc.SQLTextTree.GrammarPiece

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.