Refactor the interface to make it more easily extensible.
Fix a typo preventing this from building with SQLITE_ENABLE_STMT_SCANSTATUS defined.