Jwang refactor query encoding

It will be caught and wrapped as a `CatalogException` by the caller, at line 1145/1152 above. I felt `queryStatusHelper` doesn't have to be aware of the notion of "catalog" since it's job is to fetch things from the sqlite statement, so I didn't bring `CatalogException` to it.