(s)
return "'" + s2 + "'"
Quote a literal value for SQL.

    If string contains '\\', extended E'' quoting is used,
    otherwise standard quoting.  Input value of None results
    in string "null" without quotes.

    Python implementation.
Quote a literal value for SQL.
Quote a literal value for SQL .
def quote_literal(s):
    """Quote a literal value for SQL.

    If string contains '\\', extended E'' quoting is used,
    otherwise standard quoting.  Input value of None results
    in string "null" without quotes.

    Python implementation.
    """

    if s == None:
        return "null"
    s = str(s).replace("'", "''")
    s2 = s.replace("\\", "\\\\")
    if len(s) != len(s2):
        return "E'" + s2 + "'"
    return "'" + s2 + "'"
def quote_literal ( s ) : if s == None : return "null" s = str ( s ) . replace ( "'" , "''" ) s2 = s . replace ( "\\" , "\\\\" ) if len ( s ) != len ( s2 ) : return "E'" + s2 + "'" return "'" + s2 + "'"