lib,test: replace connection query() method with sync_exec{,_params}.