Add database query method