moved code from SQLGenerator to TypeMapper