Esempio n. 1
0
        public void TestAppendWithoutTxn()
        {
            testName = "TestAppendWithoutTxn";
            SetUpTest(true);
            string heapDBFileName = testHome + "/" + testName + ".db";


            HeapDatabaseConfig heapConfig = new HeapDatabaseConfig();

            heapConfig.Creation = CreatePolicy.ALWAYS;
            HeapDatabase heapDB = HeapDatabase.Open(
                heapDBFileName, heapConfig);

            byte[] byteArr = new byte[4];
            byteArr = BitConverter.GetBytes((int)1);
            DatabaseEntry data = new DatabaseEntry(byteArr);
            HeapRecordId  rid  = heapDB.Append(data);

            // Confirm that the record lives on a page larger than 0.
            Assert.AreNotEqual(0, rid.PageNumber);

            // Confirm that the record exists in the database.
            DatabaseEntry key = new DatabaseEntry(rid.toArray());

            Assert.IsTrue(heapDB.Exists(key));
            heapDB.Close();
        }