try fetchall except, back in executesql, thanks Carlos
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.0.6 (2012-09-03 14:34:54) stable
|
Version 2.0.6 (2012-09-03 16:15:01) stable
|
||||||
|
|||||||
+5
-4
@@ -7179,7 +7179,7 @@ def index():
|
|||||||
adapter.close()
|
adapter.close()
|
||||||
|
|
||||||
def executesql(self, query, placeholders=None, as_dict=False,
|
def executesql(self, query, placeholders=None, as_dict=False,
|
||||||
fields=None, colnames=None, fetch=True):
|
fields=None, colnames=None):
|
||||||
"""
|
"""
|
||||||
placeholders is optional and will always be None.
|
placeholders is optional and will always be None.
|
||||||
If using raw SQL with placeholders, placeholders may be
|
If using raw SQL with placeholders, placeholders may be
|
||||||
@@ -7232,8 +7232,6 @@ def index():
|
|||||||
adapter.execute(query, placeholders)
|
adapter.execute(query, placeholders)
|
||||||
else:
|
else:
|
||||||
adapter.execute(query)
|
adapter.execute(query)
|
||||||
if not fetch:
|
|
||||||
return None
|
|
||||||
if as_dict:
|
if as_dict:
|
||||||
if not hasattr(adapter.cursor,'description'):
|
if not hasattr(adapter.cursor,'description'):
|
||||||
raise RuntimeError, "database does not support executesql(...,as_dict=True)"
|
raise RuntimeError, "database does not support executesql(...,as_dict=True)"
|
||||||
@@ -7248,7 +7246,10 @@ def index():
|
|||||||
# convert the list for each row into a dictionary so it's
|
# convert the list for each row into a dictionary so it's
|
||||||
# easier to work with. row['field_name'] rather than row[0]
|
# easier to work with. row['field_name'] rather than row[0]
|
||||||
return [dict(zip(fields,row)) for row in data]
|
return [dict(zip(fields,row)) for row in data]
|
||||||
data = adapter.cursor.fetchall()
|
try:
|
||||||
|
data = adapter.cursor.fetchall()
|
||||||
|
except:
|
||||||
|
return None
|
||||||
if fields or colnames:
|
if fields or colnames:
|
||||||
fields = [] if fields is None else fields
|
fields = [] if fields is None else fields
|
||||||
if not isinstance(fields, list):
|
if not isinstance(fields, list):
|
||||||
|
|||||||
Reference in New Issue
Block a user