Fix #334 Update from 1.6.8 to 1.6.10 failed

#334
Instead of using the query function directly we should always use the correct database method.
Note that you can't upgrade to 1.6.x as the SQLite driver was broken. To test this you need to upgrade to 1.8 (.2 in my case)