void add(UndoLogRecord entry){
  records.add(entry);
  if (largeTransactions) {
    memoryUndo++;
    if (memoryUndo > database.getMaxMemoryUndo() && database.isPersistent() && !database.isMultiVersion()) {
      if (file == null) {
        String fileName=database.createTempFile();
        file=database.openFile(fileName,"rw",false);
        file.setCheckedWriting(false);
        file.setLength(FileStore.HEADER_LENGTH);
      }
      Data buff=Data.create(database,Constants.DEFAULT_PAGE_SIZE);
      for (int i=0; i < records.size(); i++) {
        UndoLogRecord r=records.get(i);
        buff.checkCapacity(Constants.DEFAULT_PAGE_SIZE);
        r.append(buff,this);
        if (i == records.size() - 1 || buff.length() > Constants.UNDO_BLOCK_SIZE) {
          storedEntriesPos.add(file.getFilePointer());
          file.write(buff.getBytes(),0,buff.length());
          buff.reset();
        }
      }
      storedEntries+=records.size();
      memoryUndo=0;
      records.clear();
      file.autoDelete();
      return;
    }
  }
 else {
    if (!entry.isStored()) {
      memoryUndo++;
    }
    if (memoryUndo > database.getMaxMemoryUndo() && database.isPersistent() && !database.isMultiVersion()) {
      if (file == null) {
        String fileName=database.createTempFile();
        file=database.openFile(fileName,"rw",false);
        file.setCheckedWriting(false);
        file.seek(FileStore.HEADER_LENGTH);
        rowBuff=Data.create(database,Constants.DEFAULT_PAGE_SIZE);
        Data buff=rowBuff;
        for (int i=0; i < records.size(); i++) {
          UndoLogRecord r=records.get(i);
          saveIfPossible(r,buff);
        }
      }
 else {
        saveIfPossible(entry,rowBuff);
      }
      file.autoDelete();
    }
  }
}

void add ( UndoLogRecord entry ) { records . add ( entry ) ; if ( largeTransactions ) { memoryUndo ++ ; if ( memoryUndo > database . getMaxMemoryUndo ( ) && database . isPersistent ( ) && ! database . isMultiVersion ( ) ) { if ( file == null ) { String fileName = database . createTempFile ( ) ; file = database . openFile ( fileName , "rw" , false ) ; file . setCheckedWriting ( false ) ; file . setLength ( FileStore . HEADER_LENGTH ) ; } Data buff = Data . create ( database , Constants . DEFAULT_PAGE_SIZE ) ; for ( int i = 0 ; i < records . size ( ) ; i ++ ) { UndoLogRecord r = records . get ( i ) ; buff . checkCapacity ( Constants . DEFAULT_PAGE_SIZE ) ; r . append ( buff , this ) ; if ( i == records . size ( ) - 1 || buff . length ( ) > Constants . UNDO_BLOCK_SIZE ) { storedEntriesPos . add ( file . getFilePointer ( ) ) ; file . write ( buff . getBytes ( ) , 0 , buff . length ( ) ) ; buff . reset ( ) ; } } storedEntries += records . size ( ) ; memoryUndo = 0 ; records . clear ( ) ; file . autoDelete ( ) ; return ; } } else { if ( ! entry . isStored ( ) ) { memoryUndo ++ ; } if ( memoryUndo > database . getMaxMemoryUndo ( ) && database . isPersistent ( ) && ! database . isMultiVersion ( ) ) { if ( file == null ) { String fileName = database . createTempFile ( ) ; file = database . openFile ( fileName , "rw" , false ) ; file . setCheckedWriting ( false ) ; file . seek ( FileStore . HEADER_LENGTH ) ; rowBuff = Data . create ( database , Constants . DEFAULT_PAGE_SIZE ) ; Data buff = rowBuff ; for ( int i = 0 ; i < records . size ( ) ; i ++ ) { UndoLogRecord r = records . get ( i ) ; saveIfPossible ( r , buff ) ; } } else { saveIfPossible ( entry , rowBuff ) ; } file . autoDelete ( ) ; } } }
append an undo log entry to the log .
