mirror of https://github.com/django/django.git
This commit is contained in:
parent
fedda6d9bd
commit
bf1c957027
|
@ -443,17 +443,12 @@ class FormatStylePlaceholderCursor:
|
||||||
# values. It can be used only in single query execute() because
|
# values. It can be used only in single query execute() because
|
||||||
# executemany() shares the formatted query with each of the params
|
# executemany() shares the formatted query with each of the params
|
||||||
# list. e.g. for input params = [0.75, 2, 0.75, 'sth', 0.75]
|
# list. e.g. for input params = [0.75, 2, 0.75, 'sth', 0.75]
|
||||||
# params_dict = {
|
# params_dict = {0.75: ':arg0', 2: ':arg1', 'sth': ':arg2'}
|
||||||
# (2, <type 'int'>): ':arg2',
|
|
||||||
# (0.75, <type 'float'>): ':arg1',
|
|
||||||
# ('sth', <type 'str'>): ':arg0',
|
|
||||||
# }
|
|
||||||
# args = [':arg0', ':arg1', ':arg0', ':arg2', ':arg0']
|
# args = [':arg0', ':arg1', ':arg0', ':arg2', ':arg0']
|
||||||
# params = {':arg0': 0.75, ':arg1': 2, ':arg2': 'sth'}
|
# params = {':arg0': 0.75, ':arg1': 2, ':arg2': 'sth'}
|
||||||
params = [(param, type(param)) for param in params]
|
|
||||||
params_dict = {param: ':arg%d' % i for i, param in enumerate(set(params))}
|
params_dict = {param: ':arg%d' % i for i, param in enumerate(set(params))}
|
||||||
args = [params_dict[param] for param in params]
|
args = [params_dict[param] for param in params]
|
||||||
params = {value: key[0] for key, value in params_dict.items()}
|
params = {value: key for key, value in params_dict.items()}
|
||||||
query = query % tuple(args)
|
query = query % tuple(args)
|
||||||
else:
|
else:
|
||||||
# Handle params as sequence
|
# Handle params as sequence
|
||||||
|
|
Loading…
Reference in New Issue