Ticket #121: quote_name.patch
File quote_name.patch, 2.4 KB (added by , 19 years ago) |
---|
-
django/core/db/__init__.py
37 37 get_last_insert_id = dbmod.get_last_insert_id 38 38 get_date_extract_sql = dbmod.get_date_extract_sql 39 39 get_date_trunc_sql = dbmod.get_date_trunc_sql 40 quote_name = dbmod.quote_name 40 41 OPERATOR_MAPPING = dbmod.OPERATOR_MAPPING 41 42 DATA_TYPES = dbmod.DATA_TYPES -
django/core/db/backends/postgresql.py
71 71 # http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC 72 72 return "DATE_TRUNC('%s', %s)" % (lookup_type, field_name) 73 73 74 def quote_name(name): 75 if name.startswith('"') and name.endswith('"'): 76 # Quoting once is enough! 77 return name 78 else: 79 return '"%s"' % name 80 74 81 # Register these custom typecasts, because Django expects dates/times to be 75 82 # in Python's native (standard-library) datetime/time format, whereas psycopg 76 83 # use mx.DateTime by default. -
django/core/db/backends/sqlite3.py
98 98 elif lookup_type == 'day': 99 99 return "%i-%02i-%02i 00:00:00" % (dt.year, dt.month, dt.day) 100 100 101 def quote_name(name): 102 if name.startswith('"') and name.endswith('"'): 103 # Quoting once is enough! 104 return name 105 else: 106 return '"%s"' % name 107 101 108 # Operators and fields ######################################################## 102 109 103 110 OPERATOR_MAPPING = { -
django/core/db/backends/mysql.py
68 68 subtractions.append(" - interval (DATE_FORMAT(%s, '%%%%m')-1) month" % field_name) 69 69 return "(%s - %s)" % (field_name, ''.join(subtractions)) 70 70 71 def quote_name(name): 72 if name.startswith("`") and name.endswith("`"): 73 # Quoting once is enough! 74 return name 75 else: 76 return "`%s`" % name 77 71 78 OPERATOR_MAPPING = { 72 79 'exact': '=', 73 80 'iexact': 'LIKE',