(self, v)
return '"%s"' % (v, )
Return the identifier quoted in SQL syntax if needed (eg table and column names)
Return the identifier quoted in SQL syntax if needed (eg table and column names)
Return the identifier quoted in SQL syntax if needed ( eg table and column names )
def _fmt_sql_identifier(self, v):
        "Return the identifier quoted in SQL syntax if needed (eg table and column names)"
        if not len(v):  # yes sqlite does allow zero length identifiers
            return '""'
        nonalnum = re.sub("[A-Za-z_0-9]+", "", v)
        if len(nonalnum) == 0:
            if v.upper() not in self._sqlite_reserved:
                # Ok providing it doesn't start with a digit
                if v[0] not in "0123456789":
                    return v
        # double quote it unless there are any double quotes in it
        if '"' in nonalnum:
            return "[%s]" % (v, )
        return '"%s"' % (v, )
def _fmt_sql_identifier ( self , v ) : if not len ( v ) : # yes sqlite does allow zero length identifiers return '""' nonalnum = re . sub ( "[A-Za-z_0-9]+" , "" , v ) if len ( nonalnum ) == 0 : if v . upper ( ) not in self . _sqlite_reserved : # Ok providing it doesn't start with a digit if v [ 0 ] not in "0123456789" : return v # double quote it unless there are any double quotes in it if '"' in nonalnum : return "[%s]" % ( v , ) return '"%s"' % ( v , )