TSF.UmlToolingFramework.Wrappers.EA.Model.escapeSQLString C# (CSharp) Method

escapeSQLString() public method

escapes a literal string so it can be inserted using sql
public escapeSQLString ( string sqlString ) : string
sqlString string the string to be escaped
return string
        public string escapeSQLString(string sqlString)
        {
            string escapedString = sqlString;
            switch ( this.repositoryType)
            {
            case RepositoryType.MYSQL:
            case RepositoryType.POSTGRES:
                // replace backslash "\" by double backslash "\\"
                escapedString = escapedString.Replace(@"\",@"\\");
            break;
            }
            // ALL DBMS types: replace the single qoutes "'" by double single quotes "''"
            escapedString = escapedString.Replace("'","''");
            return escapedString;
        }