/** * Deletes a record. */ void delete( Location rowid ) throws IOException { free( rowid ); }
/** * Deletes a record. */ void delete( Location rowid ) throws IOException { free( rowid ); }
/** * Deletes a record. */ void delete(long rowid) throws IOException { free(rowid); }
/** * Deletes a record. */ void delete( Location rowid ) throws IOException { free( rowid ); }
/** * Updates an existing record. Returns the possibly changed physical rowid. */ long update(long rowid, byte[] data, int start, int length) throws IOException { // fetch the record header BlockIo block = file.get(Location.getBlock(rowid)); short head = Location.getOffset(rowid); int availSize = RecordHeader.getAvailableSize(block, head); if (length > availSize || //difference between free and available space can be only 64KB. //if bigger, need to realocate and free block availSize - length > RecordHeader.MAX_SIZE_SPACE ) { // not enough space - we need to copy to a new rowid. file.release(block); free(rowid); rowid = alloc(length); } else { file.release(block); } // 'nuff space, write it in and return the rowid. write(rowid, data, start, length); return rowid; }
/** * Updates an existing record. Returns the possibly changed * physical rowid. */ Location update( Location rowid, byte[] data, int start, int length ) throws IOException { // fetch the record header BlockIo block = file.get( rowid.getBlock() ); RecordHeader head = new RecordHeader( block, rowid.getOffset() ); if ( length > head.getAvailableSize() ) { // not enough space - we need to copy to a new rowid. file.release( block ); free( rowid ); rowid = alloc( length ); } else { file.release( block ); } // 'nuff space, write it in and return the rowid. write( rowid, data, start, length ); return rowid; }
/** * Updates an existing record. Returns the possibly changed * physical rowid. */ Location update( Location rowid, byte[] data, int start, int length ) throws IOException { // fetch the record header BlockIo block = pageManager.getRecordFile().get( rowid.getBlock() ); RecordHeader head = new RecordHeader( block, rowid.getOffset() ); if ( length > head.getAvailableSize() ) { // not enough space - we need to copy to a new rowid. pageManager.getRecordFile().release( block ); free( rowid ); rowid = alloc( length ); } else { pageManager.getRecordFile().release( block ); } // 'nuff space, write it in and return the rowid. write( rowid, data, start, length ); return rowid; }
/** * Updates an existing record. Returns the possibly changed * physical rowid. */ Location update( Location rowid, byte[] data, int start, int length ) throws IOException { // fetch the record header BlockIo block = pageManager.getRecordFile().get( rowid.getBlock() ); RecordHeader head = new RecordHeader( block, rowid.getOffset() ); if ( length > head.getAvailableSize() ) { // not enough space - we need to copy to a new rowid. pageManager.getRecordFile().release( block ); free( rowid ); rowid = alloc( length ); } else { pageManager.getRecordFile().release( block ); } // 'nuff space, write it in and return the rowid. write( rowid, data, start, length ); return rowid; }