Hi Erel,
Thank you for your reply, it spurred me on.. I discovered that I made some mistakes in my calculations, I've been used to flat files, and assumed that just iterating with a fixed Type size would work for data writing and retrieval.
It turned out that I was telling it to write to an incorrect position, which was causing it to corrupt the database.
It does appear to be extremely inefficient though, as now that I have it working, the RandomAccessFile system writes a lot of extra data with each record. I was writing a 166 byte type object to file, and it was appending an extra 839 bytes, it quickly became apparent that compression would probably be needed for any reasonable use of this library's object writing/reading features. But then this effects the sequential capabilities.
Is there a chance, as a future feature request to allow for the same object writing, only without the header information tacked on to it? A flat file, with nothing but sequential object data, spaced apart only by the size of the object (as declared by the programmer, whom keeping in mind that it would have to be a fixed size to work properly) could then keep file size down, and also use simple math to get record counts and more easily jump around the file at his/her whim. This would also mean this would never occur:
Note that changing your package name may make older objects files unusable (requiring you to write them again).
making it far more stable, and powerful in my opinion.
eg:
RAF as RandomAccessFile
RAF.Initialize4(Dir as string, File as string, ReadOnly as boolean,
FixedLengthUDT as object)
that once initialized, would perform operations on said file without writing any headers/footers.
And an added function like:
RAF.ObjectSize as int (object size in bytes, returns 0 if no object initialized)
if I know the object size, and my file size, I can easily determine my record count.
my BIG wish list.. I'm super thankful that you've taken the time to reply to my message, and I'd like to hear any feedback on these ideas.. perhaps it's impossible to do, but if I can I'd love to help in any way.
Thanks again!