(name, isTable=False)
return retVal
Returns a safe representation of SQL identificator name (internal data format)
    Reference: http://stackoverflow.com/questions/954884/what-special-characters-are-allowed-in-t-sql-column-retVal
Returns a safe representation of SQL identificator name (internal data format)
    Reference: http://stackoverflow.com/questions/954884/what-special-characters-are-allowed-in-t-sql-column-retVal
Returns a safe representation of SQL identificator name ( internal data format ) Reference : http : // stackoverflow . com / questions / 954884 / what - special - characters - are - allowed - in - t - sql - column - retVal
def safeSQLIdentificatorNaming(name, isTable=False):
    """
    Returns a safe representation of SQL identificator name (internal data format)
    Reference: http://stackoverflow.com/questions/954884/what-special-characters-are-allowed-in-t-sql-column-retVal
    """

    retVal = name

    if isinstance(name, basestring):
        retVal = getUnicode(name)
        _ = isTable and Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE)

        if _:
            retVal = re.sub(r"(?i)\A%s\." % DEFAULT_MSSQL_SCHEMA, "", retVal)

        if retVal.upper() in kb.keywords or (retVal or " ")[0].isdigit() or not re.match(r"\A[A-Za-z0-9_@%s\$]+\Z" % ("." if _ else ""), retVal):  # MsSQL is the only DBMS where we automatically prepend schema to table name (dot is normal)
            if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ACCESS):
                retVal = "`%s`" % retVal.strip("`")
            elif Backend.getIdentifiedDbms() in (DBMS.PGSQL, DBMS.DB2):
                retVal = "\"%s\"" % retVal.strip("\"")
            elif Backend.getIdentifiedDbms() in (DBMS.ORACLE,):
                retVal = "\"%s\"" % retVal.strip("\"").upper()
            elif Backend.getIdentifiedDbms() in (DBMS.MSSQL,) and not re.match(r"\A\w+\Z", retVal, re.U):
                retVal = "[%s]" % retVal.strip("[]")

        if _ and DEFAULT_MSSQL_SCHEMA not in retVal and '.' not in re.sub(r"\[[^]]+\]", "", retVal):
            retVal = "%s.%s" % (DEFAULT_MSSQL_SCHEMA, retVal)

    return retVal
def safeSQLIdentificatorNaming ( name , isTable = False ) : retVal = name if isinstance ( name , basestring ) : retVal = getUnicode ( name ) _ = isTable and Backend . getIdentifiedDbms ( ) in ( DBMS . MSSQL , DBMS . SYBASE ) if _ : retVal = re . sub ( r"(?i)\A%s\." % DEFAULT_MSSQL_SCHEMA , "" , retVal ) if retVal . upper ( ) in kb . keywords or ( retVal or " " ) [ 0 ] . isdigit ( ) or not re . match ( r"\A[A-Za-z0-9_@%s\$]+\Z" % ( "." if _ else "" ) , retVal ) : # MsSQL is the only DBMS where we automatically prepend schema to table name (dot is normal) if Backend . getIdentifiedDbms ( ) in ( DBMS . MYSQL , DBMS . ACCESS ) : retVal = "`%s`" % retVal . strip ( "`" ) elif Backend . getIdentifiedDbms ( ) in ( DBMS . PGSQL , DBMS . DB2 ) : retVal = "\"%s\"" % retVal . strip ( "\"" ) elif Backend . getIdentifiedDbms ( ) in ( DBMS . ORACLE , ) : retVal = "\"%s\"" % retVal . strip ( "\"" ) . upper ( ) elif Backend . getIdentifiedDbms ( ) in ( DBMS . MSSQL , ) and not re . match ( r"\A\w+\Z" , retVal , re . U ) : retVal = "[%s]" % retVal . strip ( "[]" ) if _ and DEFAULT_MSSQL_SCHEMA not in retVal and '.' not in re . sub ( r"\[[^]]+\]" , "" , retVal ) : retVal = "%s.%s" % ( DEFAULT_MSSQL_SCHEMA , retVal ) return retVal