fix `statusmessage` docs to reflect the fact that it refers to the current result, not the last one, as it was in psycopg2. Improve docs consistency about other attributes which might be affected by current result.
See #1062.
.. rubric:: Methods to retrieve results
- Fetch methods are only available if the last operation produced results,
+ Fetch methods are only available if the current result set contains results,
e.g. a :sql:`SELECT` or a command with :sql:`RETURNING`. They will raise
an exception if used with operations that don't return result, such as an
:sql:`INSERT` with no :sql:`RETURNING` or an :sql:`ALTER TABLE`.
for record in cursor:
...
- syntax will iterate on the records in the current recordset.
+ syntax will iterate on the records in the current result set.
.. autoattribute:: row_factory
.. attribute:: pgresult
:type: Optional[psycopg.pq.PGresult]
- The result returned by the last query and currently exposed by the
- cursor, if available, else `!None`.
+ Representation of the current result set, if available, else `!None`.
- It can be used to obtain low level info about the last query result
+ It can be used to obtain low level info about the current result set
and to access to features not currently wrapped by Psycopg.
@property
def rowcount(self) -> int:
- """Number of records affected by the precedent operation."""
+ """
+ Number of records affected by the operation that produced
+ the current result set.
+ """
return self._rowcount
@property
def rownumber(self) -> int | None:
- """Index of the next row to fetch in the current result.
+ """Index of the next row to fetch in the current result set.
`!None` if there is no result to fetch.
"""
@property
def statusmessage(self) -> str | None:
"""
- The command status tag from the last SQL command executed.
+ The status tag of the current result set.
`!None` if the cursor doesn't have a result available.
"""
def fetchone(self) -> Row | None:
"""
- Return the next record from the current recordset.
+ Return the next record from the current result set.
- Return `!None` the recordset is finished.
+ Return `!None` the result set is finished.
:rtype: Row | None, with Row defined by `row_factory`
"""
def fetchmany(self, size: int = 0) -> list[Row]:
"""
- Return the next `!size` records from the current recordset.
+ Return the next `!size` records from the current result set.
`!size` default to `!self.arraysize` if not specified.
def fetchall(self) -> list[Row]:
"""
- Return all the remaining records from the current recordset.
+ Return all the remaining records from the current result set.
:rtype: Sequence[Row], with Row defined by `row_factory`
"""
async def fetchone(self) -> Row | None:
"""
- Return the next record from the current recordset.
+ Return the next record from the current result set.
- Return `!None` the recordset is finished.
+ Return `!None` the result set is finished.
:rtype: Row | None, with Row defined by `row_factory`
"""
async def fetchmany(self, size: int = 0) -> list[Row]:
"""
- Return the next `!size` records from the current recordset.
+ Return the next `!size` records from the current result set.
`!size` default to `!self.arraysize` if not specified.
async def fetchall(self) -> list[Row]:
"""
- Return all the remaining records from the current recordset.
+ Return all the remaining records from the current result set.
:rtype: Sequence[Row], with Row defined by `row_factory`
"""