I wonder if quoting would be simpler if it was a separate object that the query object passed itself into before it was converted into SQL. The separate object could traverse the query and modify the expression objects/parts as needed.