Results 1 to 1 of 1

Thread: The file change date of database file

  1. #1
    Junior Member
    Join Date
    Oct 2011

    Default The file change date of database file

    The file change date of database file is changing when we open and close database. In other words, the file change date of database file reflects the time of closing the database. I would like that file change date reflects the time of data changes. I changed two methods in FileSystem.cs as:
        internal void SetFileInfo(ulong handle, FileInfo fileInfo) {
          byte[] buffer = StructurePrimitives.StructToByteArray(fileInfo);
          byte[] buffer1 = StructurePrimitives.StructToByteArray(GetFileInfo(handle));//Load old FileInfo
          bool equal = General.Buffers.ArrayExtensions.EqualsТо(buffer, buffer1);// Compare FileInfos
          if (!equal) CatalogFile.Write(handle * FileInfo.SIZE, buffer, 0, buffer.Length);
    // Original line   CatalogFile.Write(handle * FileInfo.SIZE, buffer, 0, buffer.Length);
        private void WriteSystemData() {
          const ulong SYSTEM_SECTOR_ID = 0;
          byte[] buffer;
          using (MemoryStream stream = new MemoryStream((int)(FileInfo.SIZE + FileInfo.SIZE + sizeof(ulong)))) {
            BinaryWriter writer = new BinaryWriter(stream);
            CatalogInfo = new FileInfo(CatalogFile.RootSectorID, CatalogFile.Length);
            GarbageInfo = new FileInfo(GarbageFile.RootSectorID, GarbageFile.Length);
            buffer = StructurePrimitives.StructToByteArray(CatalogInfo);
            buffer = StructurePrimitives.StructToByteArray(GarbageInfo);
            // Compare current and old SystemData
            buffer = stream.GetBuffer();// current SystemData
            byte[] buffer1 = new byte[FileInfo.SIZE + FileInfo.SIZE + sizeof(ulong)];//Load old SystemData
            Volume.Read(SYSTEM_SECTOR_ID * Sector.SIZE_64, buffer1, 0, buffer1.Length);
            bool equal = General.Buffers.ArrayExtensions.EqualsТо(buffer, buffer1);// compare SystemData
            // Save SystemData
            if (!equal) Volume.Write(SYSTEM_SECTOR_ID * Sector.SIZE_64, buffer, 0, buffer.Length);
    //  Original line       Volume.Write(SYSTEM_SECTOR_ID * Sector.SIZE_64, stream.GetBuffer(), 0, (int)stream.Length);
    After these changes the file change date of database reflects the database data changes. Also, the speed of writing data increased on ~0.5% (I run test for 1.5 mln records dataset in 1 table with custom persistance). The speed of reading data did not change.

    I would like that stsdb team will include these changes in future release of database
    Last edited by spetrik; 24.02.2012 at 21:59.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
2002 - 2014 STS Soft SC. All Rights reserved.
STSdb, Waterfall Tree and WTree are registered trademarks of STS Soft SC.