MCPcopy Create free account
hub / github.com/ActiveState/code / runquery

Function runquery

recipes/Python/163605_resultsetpy/recipe-163605.py:36–44  ·  view source on GitHub ↗

Returns a list of ResultRow objects based upon a connected cursor and a query sql string to execute

(cursor, sql)

Source from the content-addressed store, hash-verified

34# classes.
35
36def runquery(cursor, sql):
37 """Returns a list of ResultRow objects based upon a connected cursor
38 and a query sql string to execute"""
39
40 # run the query
41 cursor.execute(sql)
42
43 # return the list
44 return getdict(cursor.fetchall(), cursor.description)
45
46
47def getdict(results, description):

Callers

nothing calls this directly

Calls 3

getdictFunction · 0.85
executeMethod · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected