MCPcopy
hub / github.com/psycopg/psycopg / work

Function work

tests/test_cursor_raw.py:85–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83 row_factory = getattr(rows, row_factory)
84
85 def work():
86 with conn_cls.connect(dsn) as conn:
87 with conn.transaction(force_rollback=True):
88 with conn.cursor(binary=fmt_out, row_factory=row_factory) as cur:
89 cur.execute(faker.drop_stmt)
90 cur.execute(faker.create_stmt)
91 with faker.find_insert_problem(conn):
92 cur.executemany(faker.insert_stmt, faker.records)
93 cur.execute(ph(cur, faker.select_stmt))
94
95 if fetch == "one":
96 while cur.fetchone() is not None:
97 pass
98 elif fetch == "many":
99 while cur.fetchmany(3):
100 pass
101 elif fetch == "all":
102 cur.fetchall()
103 elif fetch == "iter":
104 for rec in cur:
105 pass
106
107 n = []
108 gc.collect()

Callers 1

test_leakFunction · 0.70

Calls 10

phFunction · 0.85
find_insert_problemMethod · 0.80
connectMethod · 0.45
transactionMethod · 0.45
cursorMethod · 0.45
executeMethod · 0.45
executemanyMethod · 0.45
fetchoneMethod · 0.45
fetchmanyMethod · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected