core: better error messages for z_db:q and q1 in case of sql errors.
(cherry picked from commit ee9910c8725432c02dc687465cdc850b858ce5f2)