Implement BeQtSql module; fix bugs