Move sqlite3 utility functions into their own file