Fix build on Mac by handling the return value of SQLite calls.

Handle the return value and print a message error if the request failed.
Merge pull request #1171 from darktears/mac-build-fix

Fix build on Mac by handling the return value of SQLite calls.