New utility function execute_query, wrapping cursor.execute.
This is a hack to avoid a problem with using %(foo)d in a query with a NULL value.
This commit is contained in:
parent
b34f8da82b
commit
87e0cdda9d
|
@ -1,6 +1,12 @@
|
|||
import os
|
||||
import tempfile
|
||||
|
||||
def execute_query(cursor, query, bindings):
|
||||
for (key, val) in bindings.items():
|
||||
if val == None:
|
||||
query = query.replace('%(' + key + ')d', 'NULL')
|
||||
cursor.execute(query, bindings)
|
||||
|
||||
def make_result_dict(cursor, row):
|
||||
d = {}
|
||||
for i in xrange(len(row)):
|
||||
|
|
Reference in New Issue