public void deParse(CreateTable createTable) {
    buffer.append("CREATE TABLE ").append(createTable.getTable().getFullyQualifiedName());
    if (createTable.getColumnDefinitions() != null) {
      buffer.append(" (");
      for (Iterator<ColumnDefinition> iter = createTable.getColumnDefinitions().iterator();
          iter.hasNext(); ) {
        ColumnDefinition columnDefinition = iter.next();
        buffer.append(columnDefinition.getColumnName());
        buffer.append(" ");
        buffer.append(columnDefinition.getColDataType().toString());
        if (columnDefinition.getColumnSpecStrings() != null) {
          for (String s : columnDefinition.getColumnSpecStrings()) {
            buffer.append(" ");
            buffer.append(s);
          }
        }

        if (iter.hasNext()) {
          buffer.append(", ");
        }
      }

      if (createTable.getIndexes() != null) {
        for (Iterator<Index> iter = createTable.getIndexes().iterator(); iter.hasNext(); ) {
          buffer.append(", ");
          Index index = iter.next();
          buffer.append(index.toString());
        }
      }

      buffer.append(")");
    }
  }
  public void parseCreate(
      ArrayList<CreateTable> createqueries, Environment myDbEnvironment, File dataDir) {
    try {
      this.myDbEnvironment = myDbEnvironment;

      // System.out.println(createqueries);
      for (CreateTable ct : createqueries) {

        // Open the database. Create it if it does not already exist.
        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        dbConfig.setAllowCreate(true);
        // dbConfig.setSortedDuplicates(true);

        myDatabase = myDbEnvironment.openDatabase(null, ct.getTable().getName(), dbConfig);
        for (File data : dataDir.listFiles()) {

          if (data.getName().endsWith(".tbl") || data.getName().endsWith(".dat")) {
            if (ct.getTable()
                    .getName()
                    .toLowerCase()
                    .equals(data.getName().substring(0, data.getName().lastIndexOf('.')))
                || ct.getTable()
                    .getName()
                    .toUpperCase()
                    .equals(data.getName().substring(0, data.getName().lastIndexOf('.')))) {
              path = data;
            }
          }
        }

        ArrayList<ColumnDefinition> schema =
            (ArrayList<ColumnDefinition>) ct.getColumnDefinitions();
        // Start load phase
        LoadPhase load = new LoadPhase(myDatabase, path, myDbEnvironment, schema);

        if (ct.getTable().getName().equals("lineitem")
            || ct.getTable().getName().equals("LINEITEM")) {

          myDatabase = load.processLineItem();
        }
        if (ct.getTable().getName().equals("orders") || ct.getTable().getName().equals("ORDERS")) {
          myDatabase = load.processOrders();
        }
        if (ct.getTable().getName().equals("customer")
            || ct.getTable().getName().equals("CUSTOMER")) {
          myDatabase = load.processCustomer();
        }
        if (ct.getTable().getName().equals("supplier")
            || ct.getTable().getName().equals("SUPPLIER")) {
          myDatabase = load.processSupplier();
        }
        if (ct.getTable().getName().equals("partsupp")
            || ct.getTable().getName().equals("PARTSUPP")) {
          myDatabase = load.processPartSupp();
        }
        if (ct.getTable().getName().equals("nation") || ct.getTable().getName().equals("NATION")) {
          myDatabase = load.processNation();
        }
        if (ct.getTable().getName().equals("region") || ct.getTable().getName().equals("REGION")) {
          myDatabase = load.processRegion();
        }

        if (myDatabase != null) {
          myDatabase.close();
        }
      }

    } catch (DatabaseException dbe) {
      System.out.println("Error in database / environment" + dbe);
    }
  }