Hello
I have been exploring further, following problems mentioned in an earlier post, and I have identified what looks like a definite bug. I can’t say whether it explains any of my earlier problems, but it seems worth mentioning in its own right.
To be clear, I am using the version posted as TorstenBergmann.28 on 11 May 2016 on the mumez site (https://github.com/mumez/PunQLite), because I couldn’t get Esteban’s version to work. I am using Moose 6.0 (Pharo 5.0 Latest update: #50761) on Windows 10. I started with this example from the mumez site:
"Using explicit transaction"
db := PqDatabase open: 'trans.db'.
db disableAutoCommit.
1 to: 100 do: [:idx | | key |
key := idx asString.
db transact: [db at: key put: ('value-', key)]
].
db close.
Because I had observed in my previous failures that the database was only supplying one buffer-full of data (1024 bytes), I decided to try the effect of storing longer values in the database. First I created a filler of 900 bytes (the string ‘123456789’ repeated 100 times) and included this in each of the stored values. The returned value of “db at: ‘1’ “ was correct – a ByteArray of 907 bytes. Then I doubled the length of the filler and tried again. This time the returned value was only 1024 bytes long – correct as far as it went, but incomplete. When I included the statement ‘db fetchBufferSize: 2048’, the whole record was retrieved correctly. Note that I did not rewrite the database file to get this correct result; clearly the data have been written correctly, and the problem lies in the retrieval.
All the trials I did earlier included strings of several thousand bytes, so it seems clear that, even if they were written correctly, they would not be retrieved. I don’t know how much this explains, but it’s clearly part of the problem. Looking at the tests package, all the tests write and retrieve strings of only a few bytes. It would be a good idea to include a test that writes and retrieves a value which is longer that the buffer.
Hope this is helpful
Peter Kenny