fix template
add query_db and row_factory