コード例 #1
0
        public void ReadPageTable()
        {
            var db = new SimpleDatabase_Accessor("CCC", false);

            db.Initialize();
            var key = Guid.NewGuid().ToString();

            const int pageIndex = 100;
            const int rowIndex  = 99;
            const int fileId    = 1;

            db.CreateTable("Inventory.Car", 100);
            PageTable pt = db.DiskReadPageTable("Inventory.Car");

            pt.RecordIndices[0].Key          = key;
            pt.RecordIndices[0].PageIndex    = pageIndex;
            pt.RecordIndices[0].RowIndex     = rowIndex;
            pt.RecordIndices[0].ActiveFileId = fileId;

            db.DiskWritePageTable("Inventory.Car", pt);

            pt = db.DiskReadPageTable("Inventory.Car");
            Assert.AreEqual(pt.RecordIndices[0].Key, key);
            Assert.AreEqual(pt.RecordIndices[0].PageIndex, pageIndex);
            Assert.AreEqual(pt.RecordIndices[0].RowIndex, rowIndex);
            Assert.AreEqual(pt.RecordIndices[0].ActiveFileId, fileId);
        }
コード例 #2
0
        public void ReadPageTable()
        {
            var db = new SimpleDatabase_Accessor("CCC", false);
            db.Initialize();
            var key = Guid.NewGuid().ToString();

            const int pageIndex = 100;
            const int rowIndex = 99;
            const int fileId = 1;

            db.CreateTable("Inventory.Car", 100);
            PageTable pt = db.DiskReadPageTable("Inventory.Car");
            pt.RecordIndices[0].Key = key;
            pt.RecordIndices[0].PageIndex = pageIndex;
            pt.RecordIndices[0].RowIndex = rowIndex;
            pt.RecordIndices[0].ActiveFileId = fileId;

            db.DiskWritePageTable("Inventory.Car", pt);

            pt = db.DiskReadPageTable("Inventory.Car");
            Assert.AreEqual(pt.RecordIndices[0].Key, key);
            Assert.AreEqual(pt.RecordIndices[0].PageIndex, pageIndex);
            Assert.AreEqual(pt.RecordIndices[0].RowIndex, rowIndex);
            Assert.AreEqual(pt.RecordIndices[0].ActiveFileId, fileId);
        }