/** * Insert data at forced logicalRowId, use only for defragmentation !! * @param logicalRowId * @param bb data * @throws IOException */ private void forceInsert(long logicalRowId, byte[] data) throws IOException { long physLoc = _physMgr.insert(data, 0, data.length); _logicMgr.forceInsert(logicalRowId, physLoc); }
/** * Inserts a new record using a custom serializer. * * @param obj the object for the new record. * @param serializer a custom serializer * @return the rowid for the new record. * @throws IOException when one of the underlying I/O operations fails. */ public long insert( Object obj, Serializer serializer ) throws IOException { byte[] data; long recid; Location physRowId; checkIfClosed(); data = serializer.serialize( obj ); physRowId = physMgr.insert( data, 0, data.length ); recid = logMgr.insert( physRowId ).toLong(); LOG.debug( "BaseRecordManager.insert() recid {} length {}", recid, data.length ); return recid; }
/** * Inserts a new record using a custom serializer. * * @param obj the object for the new record. * @param serializer a custom serializer * @return the rowid for the new record. * @throws IOException when one of the underlying I/O operations fails. */ public synchronized long insert( Object obj, Serializer serializer ) throws IOException { byte[] data; long recid; Location physRowId; checkIfClosed(); data = serializer.serialize( obj ); physRowId = physMgr.insert( data, 0, data.length ); recid = logMgr.insert( physRowId ).toLong(); if ( DEBUG ) { System.out.println( "BaseRecordManager.insert() recid " + recid + " length " + data.length ); } return recid; }
/** * Inserts a new record using a custom serializer. * * @param obj the object for the new record. * @param serializer a custom serializer * @return the rowid for the new record. * @throws IOException when one of the underlying I/O operations fails. */ public synchronized long insert( Object obj, Serializer serializer ) throws IOException { byte[] data; long recid; Location physRowId; checkIfClosed(); data = serializer.serialize( obj ); physRowId = physMgr.insert( data, 0, data.length ); recid = logMgr.insert( physRowId ).toLong(); if ( DEBUG ) { System.out.println( "BaseRecordManager.insert() recid " + recid + " length " + data.length ) ; } return recid; }
private <A> long insert2(A obj, Serializer<A> serializer, byte[] insertBuffer, OpenByteArrayOutputStream insertBAO, SerializerOutput insertOut) throws IOException { insertBAO.reset(insertBuffer); serializer.serialize(insertOut, obj); if(compress){ byte[] data = compress(insertBAO.getBuf(),insertBAO.size()); insertBAO.reset(insertBuffer); insertBAO.write(data); } long physRowId = _physMgr.insert( insertBAO.getBuf(), 0, insertBAO.size() ); long recid = _logicMgr.insert( physRowId ); if ( DEBUG ) { System.out.println( "BaseRecordManager.insert() recid " + recid + " length " + insertBAO.size() ) ; } return compressRecid(recid); }