[sql] install a sqlite log handler

Fixes #86