remove as much code from SqlGenerator as possible