Found a problem with the way I was testing logical statements (rs != NULL) which lead to finding that some of the tests weren’t being, well, tested. After fixing that, I found the SQLite interface was reading one too many rows.
Also turned on -Wall and -Werror for the non-MSVC builds, to catch any errors I was missing – I found a few minor casting problems which I also fixed. This version is the first “healthy” version. It also seems to compile and work quite happily under MSVC.