change query.base to db.query #176

looked for most uses of query.base and replaced it with db.query.