Fr0sT wrote: ↑22.09.2022, 07:57
OMG, this is the most paranoid code I've ever seen...
Thanks!
I'm not normally this paranoid, but I was having some problems so I started putting checks in. And I ended up doing the loop in case the issue was due to some sort of race condition...
Fr0sT wrote: ↑22.09.2022, 07:57Anyway it really doesn't check much. If you really are to check the loading, save blob to another memory stream and compare it with source one. Moreover, here you're checking only local assignment. Why not check if a blob was correctly saved to DB.
My guess is that blobfield reports the size with some internal payload.
Nope, no "internal payload" being reported by the blob. I know this as (a) 99.x% of the time, the BlobSize DOES report the same as the TMemoryStream.Size and I'd expect if there were a header payload it would always be reported incorrectly, not only once in a blue moon. And (B), in that rare case when the sizes don't match, if I save the blob to a file, the file exactly matches its reported size so it's not just erroneous size reporting.
I basically took your suggestion but rather than save the blob to another stream, I decided that when they next mismatched I would save both the original stream AND the blob to their own files so that I could compare them and see how they actually differed, or whether it was, in fact, merely, an erroneous reporting error.
Sadly it's a real error, and I've attached the two written files as a zip to keep the BBB happy. However, here is the binary comparison of the two files.
WRongBlobSize.jpg
As you can see, for some reason the blob (the one on the right) has doubled (aka duplicated) the last 47 bytes of my stream... and it does it so repeatedly (at least five times) despite being fully cleared out prior to each attempt to write to it.
doubled-bytes.jpg
I am hoping you can duplicate the issue and track it down by loading the
original stream file.bin into a TMemoryStrean then trying to load it into a blob within an SQLite Database
Needless to say, this is kind of a show-stopper problem for us...
so any help or insight you can provide will be gratefully accepted.
You do not have the required permissions to view the files attached to this post.