Added db.query function