@@ -253,11 +253,12 @@ class KeepaliveConfig:
253
253
"""Initialize new config."""
254
254
255
255
class Cursor :
256
- """Represent opened cursor in a transaction.
256
+ """Represent binary cursor in a transaction.
257
257
258
258
It can be used as an asynchronous iterator.
259
259
"""
260
260
261
+ array_size : int
261
262
cursor_name : str
262
263
querystring : str
263
264
parameters : ParamsT = None
@@ -282,118 +283,27 @@ class Cursor:
282
283
283
284
Execute DECLARE command for the cursor.
284
285
"""
285
- async def close (self : Self ) -> None :
286
+ def close (self : Self ) -> None :
286
287
"""Close the cursor.
287
288
288
289
Execute CLOSE command for the cursor.
289
290
"""
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 (
388
292
self : Self ,
293
+ querystring : str ,
294
+ parameters : ParamsT = None ,
389
295
) -> QueryResult :
390
- """Fetch backward all rows.
391
-
392
- Execute FETCH BACKWARD ALL.
296
+ """Start cursor with querystring and parameters.
393
297
394
- ### Returns:
395
- result as `QueryResult` .
298
+ Method should be used instead of context manager
299
+ and `start` method .
396
300
"""
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."""
397
307
398
308
class Transaction :
399
309
"""Single connection for executing queries.
@@ -1098,8 +1008,6 @@ class Connection:
1098
1008
querystring : str ,
1099
1009
parameters : ParamsT = None ,
1100
1010
fetch_number : int | None = None ,
1101
- scroll : bool | None = None ,
1102
- prepared : bool = True ,
1103
1011
) -> Cursor :
1104
1012
"""Create new cursor object.
1105
1013
@@ -1136,7 +1044,7 @@ class Connection:
1136
1044
... # do something with this result.
1137
1045
```
1138
1046
"""
1139
- def back_to_pool (self : Self ) -> None :
1047
+ def close (self : Self ) -> None :
1140
1048
"""Return connection back to the pool.
1141
1049
1142
1050
It necessary to commit all transactions and close all cursor
0 commit comments