]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
docs: use "result set" consistently
authorFedor Kobak <56638067+fedorkobak@users.noreply.github.com>
Sun, 4 May 2025 10:52:23 +0000 (13:52 +0300)
committerGitHub <noreply@github.com>
Sun, 4 May 2025 10:52:23 +0000 (11:52 +0100)
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.

docs/api/cursors.rst
psycopg/psycopg/_cursor_base.py
psycopg/psycopg/cursor.py
psycopg/psycopg/cursor_async.py

index 64af11e4f9fd53d9972596029d0ae07572fab6b5..e1f6d0b0254bf9bbeaae6b8108c7d467ee305c12 100644 (file)
@@ -232,7 +232,7 @@ The `!Cursor` class
 
     .. 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`.
@@ -244,7 +244,7 @@ The `!Cursor` class
             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
 
@@ -263,10 +263,9 @@ The `!Cursor` class
     .. 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.
 
 
index 89c636632ae86c2ec26342f823075c9700d04f23..7fa31125cb6adb48b0c73e13bbadd5284dc2e84c 100644 (file)
@@ -127,12 +127,15 @@ class BaseCursor(Generic[ConnectionType, Row]):
 
     @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.
         """
@@ -164,7 +167,7 @@ class BaseCursor(Generic[ConnectionType, Row]):
     @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.
         """
index fb2df08ebd896d7be2c83a28a8fb12dbf2837ae1..25449e38442755c6c69edfb48f7fd7e85d0a971e 100644 (file)
@@ -179,9 +179,9 @@ class Cursor(BaseCursor["Connection[Any]", Row]):
 
     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`
         """
@@ -193,7 +193,7 @@ class Cursor(BaseCursor["Connection[Any]", Row]):
 
     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.
 
@@ -213,7 +213,7 @@ class Cursor(BaseCursor["Connection[Any]", Row]):
 
     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`
         """
index 4c6bdc55fc1886fe9a5e19ad72443dc902a14178..0601088d9baae7f75e6ffb9c2ccb33edd365dac8 100644 (file)
@@ -183,9 +183,9 @@ class AsyncCursor(BaseCursor["AsyncConnection[Any]", Row]):
 
     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`
         """
@@ -197,7 +197,7 @@ class AsyncCursor(BaseCursor["AsyncConnection[Any]", Row]):
 
     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.
 
@@ -217,7 +217,7 @@ class AsyncCursor(BaseCursor["AsyncConnection[Any]", Row]):
 
     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`
         """