Skip to content

Commit e5b46d9

Browse files
Backfill async cursor docstrings for description, rowcount, rownumber
The async cursor's properties mirrored the sync cursor's behaviour but had shorter docstrings that dropped details the sync side spelled out — the 7-tuple layout and the ``type_code`` semantics for ``description``, the ``-1`` return for ``rowcount``, and the "no result set" condition for ``rownumber``. Copy the fuller sync docstrings so IDE hovers and rendered API docs are consistent across the two cursor variants. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6956b67 commit e5b46d9

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/dqlitedbapi/aio/cursor.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,27 @@ def description(
4747
) -> list[tuple[str, int | None, None, None, None, None, None]] | None:
4848
"""Column descriptions for the last query.
4949
50-
Returns a fresh shallow copy so a caller can't corrupt internal
51-
cursor state by mutating the returned list.
50+
Returns a list of 7-tuples:
51+
(name, type_code, display_size, internal_size, precision, scale, null_ok)
52+
53+
``type_code`` is the wire-level ``ValueType`` integer from the first
54+
result frame (e.g. 10 for ISO8601, 9 for UNIXTIME). The other fields
55+
are None — dqlite doesn't expose them.
56+
57+
Returns a fresh shallow copy each call so that a caller
58+
mutating the list (e.g. ``cursor.description.clear()``) can't
59+
corrupt the cursor's internal state.
5260
"""
5361
if self._description is None:
5462
return None
5563
return list(self._description)
5664

5765
@property
5866
def rowcount(self) -> int:
59-
"""Number of rows affected by the last execute."""
67+
"""Number of rows affected by the last execute.
68+
69+
Returns -1 if not applicable or unknown.
70+
"""
6071
return self._rowcount
6172

6273
@property
@@ -68,8 +79,10 @@ def lastrowid(self) -> int | None:
6879
def rownumber(self) -> int | None:
6980
"""0-based index of the next row in the current result set.
7081
71-
PEP 249 optional extension. ``None`` when no result set is
72-
active.
82+
PEP 249 optional extension: returns ``None`` if no result set is
83+
active (no query executed, or last statement was DML without
84+
RETURNING); otherwise returns the index of the row that the next
85+
``fetchone()`` would produce.
7386
"""
7487
if self._description is None:
7588
return None

0 commit comments

Comments
 (0)