Added quote_name hook for each database backend. Refs #121. Thanks, Robin Munn -- we miss you.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1039 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c65332d409
commit
23bb8c4a4b
|
@ -36,6 +36,7 @@ get_limit_offset_sql = dbmod.get_limit_offset_sql
|
||||||
get_random_function_sql = dbmod.get_random_function_sql
|
get_random_function_sql = dbmod.get_random_function_sql
|
||||||
get_table_list = dbmod.get_table_list
|
get_table_list = dbmod.get_table_list
|
||||||
get_relations = dbmod.get_relations
|
get_relations = dbmod.get_relations
|
||||||
|
quote_name = dbmod.quote_name
|
||||||
OPERATOR_MAPPING = dbmod.OPERATOR_MAPPING
|
OPERATOR_MAPPING = dbmod.OPERATOR_MAPPING
|
||||||
DATA_TYPES = dbmod.DATA_TYPES
|
DATA_TYPES = dbmod.DATA_TYPES
|
||||||
DATA_TYPES_REVERSE = dbmod.DATA_TYPES_REVERSE
|
DATA_TYPES_REVERSE = dbmod.DATA_TYPES_REVERSE
|
||||||
|
|
|
@ -110,6 +110,10 @@ def get_table_list(cursor):
|
||||||
def get_relations(cursor, table_name):
|
def get_relations(cursor, table_name):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def quote_name(name):
|
||||||
|
# TODO: Figure out how MS-SQL quotes database identifiers.
|
||||||
|
return name
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '=',
|
'exact': '=',
|
||||||
'iexact': 'LIKE',
|
'iexact': 'LIKE',
|
||||||
|
|
|
@ -122,6 +122,11 @@ def get_table_list(cursor):
|
||||||
def get_relations(cursor, table_name):
|
def get_relations(cursor, table_name):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def quote_name(name):
|
||||||
|
if name.startswith("`") and name.endswith("`"):
|
||||||
|
return name # Quoting once is enough.
|
||||||
|
return "`%s`" % name
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '=',
|
'exact': '=',
|
||||||
'iexact': 'LIKE',
|
'iexact': 'LIKE',
|
||||||
|
|
|
@ -116,6 +116,11 @@ def get_relations(cursor, table_name):
|
||||||
continue
|
continue
|
||||||
return relations
|
return relations
|
||||||
|
|
||||||
|
def quote_name(name):
|
||||||
|
if name.startswith('"') and name.endswith('"'):
|
||||||
|
return name # Quoting once is enough.
|
||||||
|
return '"%s"' % name
|
||||||
|
|
||||||
# Register these custom typecasts, because Django expects dates/times to be
|
# Register these custom typecasts, because Django expects dates/times to be
|
||||||
# in Python's native (standard-library) datetime/time format, whereas psycopg
|
# in Python's native (standard-library) datetime/time format, whereas psycopg
|
||||||
# use mx.DateTime by default.
|
# use mx.DateTime by default.
|
||||||
|
|
|
@ -124,6 +124,11 @@ def get_table_list(cursor):
|
||||||
def get_relations(cursor, table_name):
|
def get_relations(cursor, table_name):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def quote_name(name):
|
||||||
|
if name.startswith('"') and name.endswith('"'):
|
||||||
|
return name # Quoting once is enough.
|
||||||
|
return '"%s"' % name
|
||||||
|
|
||||||
# Operators and fields ########################################################
|
# Operators and fields ########################################################
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
|
|
Loading…
Reference in New Issue