/// <summary> /// Append the data item to the end of the database. /// </summary> /// <param name="data">The data item to store in the database</param> /// <param name="txn"> /// If the operation is part of an application-specified transaction, /// <paramref name="txn"/> is a Transaction object returned from /// <see cref="DatabaseEnvironment.BeginTransaction"/>; if /// the operation is part of a Berkeley DB Concurrent Data Store group, /// <paramref name="txn"/> is a handle returned from /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null. /// </param> /// <returns>The heap record id allocated to the record</returns> public HeapRecordId Append(DatabaseEntry data, Transaction txn) { DatabaseEntry key = new DatabaseEntry(); Put(key, data, txn, DbConstants.DB_APPEND); return(HeapRecordId.fromArray(key.Data)); }
public void PutRecordCase1(HeapDatabase db, Transaction txn) { byte[] bigArray = new byte[4000]; HeapRecordId rid = new HeapRecordId(2, 0); for (int i = 1; i <= 100; i++) { if (txn == null) rid = db.Append( new DatabaseEntry(BitConverter.GetBytes(i))); else rid = db.Append( new DatabaseEntry(BitConverter.GetBytes(i)), txn); } DatabaseEntry key = new DatabaseEntry(rid.toArray()); for (int i = 100; i <= 500; i++) { if (txn == null) db.Put(key, new DatabaseEntry(bigArray)); else db.Put(key, new DatabaseEntry(bigArray), txn); } }