API refactor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-07 16:25:52 +09:00
parent 76d0d86211
commit 91c7e04474
1171 changed files with 81940 additions and 44117 deletions

View File

@@ -147,8 +147,8 @@ class PreparedStatement(connresource.ConnectionResource):
# will discard any output that a SELECT would return, other
# side effects of the statement will happen as usual. If you
# wish to use EXPLAIN ANALYZE on an INSERT, UPDATE, DELETE,
# CREATE TABLE AS, or EXECUTE statement without letting the
# command affect your data, use this approach:
# MERGE, CREATE TABLE AS, or EXECUTE statement without letting
# the command affect your data, use this approach:
# BEGIN;
# EXPLAIN ANALYZE ...;
# ROLLBACK;
@@ -210,6 +210,27 @@ class PreparedStatement(connresource.ConnectionResource):
return None
return data[0]
@connresource.guarded
async def fetchmany(self, args, *, timeout=None):
"""Execute the statement and return a list of :class:`Record` objects.
:param args: Query arguments.
:param float timeout: Optional timeout value in seconds.
:return: A list of :class:`Record` instances.
.. versionadded:: 0.30.0
"""
return await self.__do_execute(
lambda protocol: protocol.bind_execute_many(
self._state,
args,
portal_name='',
timeout=timeout,
return_rows=True,
)
)
@connresource.guarded
async def executemany(self, args, *, timeout: float=None):
"""Execute the statement for each sequence of arguments in *args*.
@@ -222,7 +243,12 @@ class PreparedStatement(connresource.ConnectionResource):
"""
return await self.__do_execute(
lambda protocol: protocol.bind_execute_many(
self._state, args, '', timeout))
self._state,
args,
portal_name='',
timeout=timeout,
return_rows=False,
))
async def __do_execute(self, executor):
protocol = self._connection._protocol