Let getQuery return instead of echo the query.