Exemplo n.º 1
0
        public void PanicPreparedTxn(string home, string dbName,
                                     out DatabaseEnvironment env, out byte[] globalID)
        {
            Transaction txn;

            // Put record into database within transaction.
            PutRecordWithTxn(out env, home, dbName, out txn);

            /*
             * Generate global ID for the transaction. Copy
             * transaction ID to the first 4 tyes in global ID.
             */
            globalID = new byte[Transaction.GlobalIdLength];
            byte[] txnID = new byte[4];
            txnID = BitConverter.GetBytes(txn.Id);
            for (int i = 0; i < txnID.Length; i++)
            {
                globalID[i] = txnID[i];
            }

            // Prepare the transaction.
            txn.Prepare(globalID);

            // Panic the environment.
            env.Panic();
        }