Skip to content

Commit 4aa65da

Browse files
committed
Fixups
1 parent cc891e3 commit 4aa65da

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

asyncpg/prepared_stmt.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,12 @@ async def executemany(self, args, *, timeout: float=None):
243243
"""
244244
return await self.__do_execute(
245245
lambda protocol: protocol.bind_execute_many(
246-
self._state, args, '', timeout))
246+
self._state,
247+
args,
248+
portal_name='',
249+
timeout=timeout,
250+
return_rows=False,
251+
))
247252

248253
async def __do_execute(self, executor):
249254
protocol = self._connection._protocol

tests/test_prepare.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,10 +613,15 @@ async def test_prepare_explicitly_named(self):
613613
await self.con.prepare('select 1', name='foobar')
614614

615615
async def test_prepare_fetchmany(self):
616-
await self.con.execute('CREATE TABLE mytab (a int, b text)')
616+
tr = self.con.transaction()
617+
await tr.start()
618+
try:
619+
await self.con.execute('CREATE TABLE fetchmany (a int, b text)')
617620

618-
stmt = await self.con.prepare(
619-
'INSERT INTO mytab (a, b) VALUES ($1, $2) RETURNING a, b'
620-
)
621-
result = await stmt.fetchmany([(1, 'a'), (2, 'b'), (3, 'c')])
622-
self.assertEqual(result, [(1, 'a'), (2, 'b'), (3, 'c')])
621+
stmt = await self.con.prepare(
622+
'INSERT INTO fetchmany (a, b) VALUES ($1, $2) RETURNING a, b'
623+
)
624+
result = await stmt.fetchmany([(1, 'a'), (2, 'b'), (3, 'c')])
625+
self.assertEqual(result, [(1, 'a'), (2, 'b'), (3, 'c')])
626+
finally:
627+
await tr.rollback()

0 commit comments

Comments
 (0)