extract errstrForDB from conn.errstr

Two upcoming commits need a bit more control over exactly which db is used to generate an error.

In anticipation of that, do some light refactoring.

While we're here handle db == 0 gracefully: skip sqlite3_errmsg, which would misleadingly return "out of memory" for a NULL handle.

Merge request reports

Loading