Example #1
0
  public static void main(String[] args) throws IOException {
    SQL sql = new SQL();
    File db = new File("src\\AP2014\\sql\\DB.dump.txt");
    sql.importFromFile(db);

    if (args.length > 0) for (String c : args) System.out.println(sql.query(c));
    MyScanner s = new MyScanner(System.in);

    String c = "";
    while (c != "exit") {

      for (Table t : sql.getDb().tables) System.out.println(t);

      System.out.print("PooyaDB> ");
      c = s.readString("\r\n");
      if (c.toLowerCase().startsWith("exit")) break;
      System.out.println(sql.query(c));
    }

    sql.exportToFile(db);
  }