fixed db driver to support more query types