Ejemplo n.º 1
0
  /**
   * Deletes the heap file from the database, freeing all of its pages.
   *
   * @throws ChainException
   */
  public void deleteFile() throws ChainException {
    if (delete) throw new ChainException(null, "files have already been deleted");

    for (int i = 0; i < pages.size(); i++)
      try {
        global.Minibase.DiskManager.deallocate_page(pages.get(i));
      } catch (Exception e) {
        throw new ChainException(null, "fail to deallocate page");
      }
    global.Minibase.DiskManager.delete_file_entry(name);
    pages = null;
    pids = null;
    recordNumber = 0;
    delete = true;
  }