Resolved issues regarding the rows, and column description not return by

the given query in the execute_dict and execute_2darray function in the
psycopg2 driver.
This commit is contained in:
Ashesh Vashi 2016-01-04 12:11:44 +05:30
parent 109b367fc3
commit 49373df02d

View File

@ -356,11 +356,14 @@ Attempt to reconnect it failed with the below error:
import copy
# Get Resultset Column Name, Type and size
columns = [copy.deepcopy(desc.__dict__) for desc in cur.description]
columns = cur.description and [
copy.deepcopy(desc.__dict__) for desc in cur.description
] or []
rows = []
for row in cur:
rows.append(row)
if cur.rowcount > 0:
for row in cur:
rows.append(row)
return True, {'columns': columns, 'rows': rows}
@ -395,11 +398,14 @@ Attempt to reconnect it failed with the below error:
import copy
# Get Resultset Column Name, Type and size
columns = [copy.deepcopy(desc.__dict__) for desc in cur.description]
columns = cur.description and [
copy.deepcopy(desc.__dict__) for desc in cur.description
] or []
rows = []
for row in cur:
rows.append(dict(row))
if cur.rowcount > 0:
for row in cur:
rows.append(dict(row))
return True, {'columns': columns, 'rows': rows}