Ejemplo n.º 1
0
  /**
   * Miscellaneous post parse activity .
   *
   * @param sql
   * @param db
   * @param joinOrder
   */
  @Override
  void postParse(String sql, String joinOrder) {
    for (AbstractParsedStmt selectStmt : m_children) {
      selectStmt.postParse(sql, joinOrder);
    }

    // these just shouldn't happen right?
    assert (noTableSelectionList.size() == 0);

    this.sql = sql;
    this.joinOrder = joinOrder;
  }
Ejemplo n.º 2
0
  /**
   * @param sql
   * @param xmlSQL
   * @param db
   */
  public static AbstractParsedStmt parse(
      String sql,
      VoltXMLElement stmtTypeElement,
      String[] paramValues,
      Database db,
      String joinOrder) {

    AbstractParsedStmt retval = null;

    if (stmtTypeElement == null) {
      System.err.println("Unexpected error parsing hsql parsed stmt xml");
      throw new RuntimeException("Unexpected error parsing hsql parsed stmt xml");
    }

    // create non-abstract instances
    if (stmtTypeElement.name.equalsIgnoreCase(INSERT_NODE_NAME)) {
      retval = new ParsedInsertStmt(paramValues, db);
    } else if (stmtTypeElement.name.equalsIgnoreCase(UPDATE_NODE_NAME)) {
      retval = new ParsedUpdateStmt(paramValues, db);
    } else if (stmtTypeElement.name.equalsIgnoreCase(DELETE_NODE_NAME)) {
      retval = new ParsedDeleteStmt(paramValues, db);
    } else if (stmtTypeElement.name.equalsIgnoreCase(SELECT_NODE_NAME)) {
      retval = new ParsedSelectStmt(paramValues, db);
    } else if (stmtTypeElement.name.equalsIgnoreCase(UNION_NODE_NAME)) {
      retval = new ParsedUnionStmt(paramValues, db);
    } else {
      throw new RuntimeException("Unexpected Element: " + stmtTypeElement.name);
    }

    // parse tables and parameters
    retval.parseTablesAndParams(stmtTypeElement);

    // parse specifics
    retval.parse(stmtTypeElement);

    // post parse action
    retval.postParse(sql, joinOrder);

    return retval;
  }