In case anyone comes back looking for the answer.
You need to createa a CSQuery object and us the toString() method to get the query.