Ejemplo n.º 1
0
 /**
  * Read an overflow page page.
  *
  * @param id the page id
  * @return the page
  */
 PageDataOverflow getPageOverflow(int id) {
   Page p = store.getPage(id);
   if (p instanceof PageDataOverflow) {
     return (PageDataOverflow) p;
   }
   throw DbException.get(ErrorCode.FILE_CORRUPTED_1, p == null ? "null" : p.toString());
 }
Ejemplo n.º 2
0
 public DbException getNewDuplicateKeyException() {
   String sql = "PRIMARY KEY ON " + table.getSQL();
   if (mainIndexColumn >= 0 && mainIndexColumn < indexColumns.length) {
     sql += "(" + indexColumns[mainIndexColumn].getSQL() + ")";
   }
   DbException e = DbException.get(ErrorCode.DUPLICATE_KEY_1, sql);
   e.setSource(this);
   return e;
 }
Ejemplo n.º 3
0
 /**
  * Read the given page.
  *
  * @param id the page id
  * @param parent the parent, or -1 if unknown
  * @return the page
  */
 PageData getPage(int id, int parent) {
   Page pd = store.getPage(id);
   if (pd == null) {
     PageDataLeaf empty = PageDataLeaf.create(this, id, parent);
     // could have been created before, but never committed
     store.logUndo(empty, null);
     store.update(empty);
     return empty;
   } else if (!(pd instanceof PageData)) {
     throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "" + pd);
   }
   PageData p = (PageData) pd;
   if (parent != -1) {
     if (p.getParentPageId() != parent) {
       throw DbException.throwInternalError(
           p + " parent " + p.getParentPageId() + " expected " + parent);
     }
   }
   return p;
 }