@@ -253,11 +253,12 @@ class KeepaliveConfig:
253253 """Initialize new config."""
254254
255255class Cursor :
256- """Represent opened cursor in a transaction.
256+ """Represent binary cursor in a transaction.
257257
258258 It can be used as an asynchronous iterator.
259259 """
260260
261+ array_size : int
261262 cursor_name : str
262263 querystring : str
263264 parameters : ParamsT = None
@@ -282,118 +283,27 @@ class Cursor:
282283
283284 Execute DECLARE command for the cursor.
284285 """
285- async def close (self : Self ) -> None :
286+ def close (self : Self ) -> None :
286287 """Close the cursor.
287288
288289 Execute CLOSE command for the cursor.
289290 """
290- async def fetch (
291- self : Self ,
292- fetch_number : int | None = None ,
293- ) -> QueryResult :
294- """Fetch next <fetch_number> rows.
295-
296- By default fetches 10 next rows.
297-
298- ### Parameters:
299- - `fetch_number`: how many rows need to fetch.
300-
301- ### Returns:
302- result as `QueryResult`.
303- """
304- async def fetch_next (
305- self : Self ,
306- ) -> QueryResult :
307- """Fetch next row.
308-
309- Execute FETCH NEXT
310-
311- ### Returns:
312- result as `QueryResult`.
313- """
314- async def fetch_prior (
315- self : Self ,
316- ) -> QueryResult :
317- """Fetch previous row.
318-
319- Execute FETCH PRIOR
320-
321- ### Returns:
322- result as `QueryResult`.
323- """
324- async def fetch_first (
325- self : Self ,
326- ) -> QueryResult :
327- """Fetch first row.
328-
329- Execute FETCH FIRST
330-
331- ### Returns:
332- result as `QueryResult`.
333- """
334- async def fetch_last (
335- self : Self ,
336- ) -> QueryResult :
337- """Fetch last row.
338-
339- Execute FETCH LAST
340-
341- ### Returns:
342- result as `QueryResult`.
343- """
344- async def fetch_absolute (
345- self : Self ,
346- absolute_number : int ,
347- ) -> QueryResult :
348- """Fetch absolute rows.
349-
350- Execute FETCH ABSOLUTE <absolute_number>.
351-
352- ### Returns:
353- result as `QueryResult`.
354- """
355- async def fetch_relative (
356- self : Self ,
357- relative_number : int ,
358- ) -> QueryResult :
359- """Fetch absolute rows.
360-
361- Execute FETCH RELATIVE <relative_number>.
362-
363- ### Returns:
364- result as `QueryResult`.
365- """
366- async def fetch_forward_all (
367- self : Self ,
368- ) -> QueryResult :
369- """Fetch forward all rows.
370-
371- Execute FETCH FORWARD ALL.
372-
373- ### Returns:
374- result as `QueryResult`.
375- """
376- async def fetch_backward (
377- self : Self ,
378- backward_count : int ,
379- ) -> QueryResult :
380- """Fetch backward rows.
381-
382- Execute FETCH BACKWARD <backward_count>.
383-
384- ### Returns:
385- result as `QueryResult`.
386- """
387- async def fetch_backward_all (
291+ async def execute (
388292 self : Self ,
293+ querystring : str ,
294+ parameters : ParamsT = None ,
389295 ) -> QueryResult :
390- """Fetch backward all rows.
391-
392- Execute FETCH BACKWARD ALL.
296+ """Start cursor with querystring and parameters.
393297
394- ### Returns:
395- result as `QueryResult` .
298+ Method should be used instead of context manager
299+ and `start` method .
396300 """
301+ async def fetchone (self : Self ) -> QueryResult :
302+ """Return next one row from the cursor."""
303+ async def fetchmany (self : Self , size : int | None = None ) -> QueryResult :
304+ """Return <size> rows from the cursor."""
305+ async def fetchall (self : Self , size : int | None = None ) -> QueryResult :
306+ """Return all remaining rows from the cursor."""
397307
398308class Transaction :
399309 """Single connection for executing queries.
@@ -1098,8 +1008,6 @@ class Connection:
10981008 querystring : str ,
10991009 parameters : ParamsT = None ,
11001010 fetch_number : int | None = None ,
1101- scroll : bool | None = None ,
1102- prepared : bool = True ,
11031011 ) -> Cursor :
11041012 """Create new cursor object.
11051013
@@ -1136,7 +1044,7 @@ class Connection:
11361044 ... # do something with this result.
11371045 ```
11381046 """
1139- def back_to_pool (self : Self ) -> None :
1047+ def close (self : Self ) -> None :
11401048 """Return connection back to the pool.
11411049
11421050 It necessary to commit all transactions and close all cursor
0 commit comments