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.