ยปCore Development>Code coverage>Doc/includes/sqlite3/row_factory.py

Python code coverage for Doc/includes/sqlite3/row_factory.py

#countcontent
1n/aimport sqlite3
2n/a
3n/adef dict_factory(cursor, row):
4n/a d = {}
5n/a for idx, col in enumerate(cursor.description):
6n/a d[col[0]] = row[idx]
7n/a return d
8n/a
9n/acon = sqlite3.connect(":memory:")
10n/acon.row_factory = dict_factory
11n/acur = con.cursor()
12n/acur.execute("select 1 as a")
13n/aprint(cur.fetchone()["a"])