Rename DebugWriteSQL to GetSQLCommandString and make it public

Rename DebugWriteSQL to GetSQLCommandString and make it public