Implement visitor pattern for formatting text

I have switched over to using the visitor pattern for building SQL. I
also changed the code for building CASE statements, among various other
minor changes.