@@ -222,6 +222,8 @@ async def main() -> None:
222222 )
223223 # Rollback to specified SAVEPOINT.
224224 await transaction.rollback_to(" test_savepoint" )
225+
226+ await transaction.commit()
225227```
226228
227229### Transaction RELEASE SAVEPOINT
@@ -249,6 +251,44 @@ async def main() -> None:
249251 await transaction.savepoint(" test_savepoint" )
250252 # Release savepoint
251253 await transaction.release_savepoint(" test_savepoint" )
254+
255+ await transaction.commit()
256+ ```
257+
258+ ## Cursors
259+ Library supports PostgreSQL cursors.
260+
261+ Cursors can be created only in transaction. In addition, cursor supports async iteration.
262+
263+ ``` python
264+ from typing import Any
265+ import asyncio
266+
267+ from rust_psql_driver import PSQLPool, IsolationLevel
268+
269+
270+ db_pool = PSQLPool()
271+
272+ async def main () -> None :
273+ await db_pool.startup()
274+
275+ connection = await db_pool.connection()
276+ transaction = await connection.transaction(
277+ isolation_level = IsolationLevel.Serializable,
278+ )
279+
280+ await transaction.begin()
281+ # Create new savepoint
282+ cursor = await transaction.cursor(
283+ querystring = " SELECT * FROM users WHERE username = $1" ,
284+ parameters = [" SomeUserName" ],
285+ fetch_number = 100 ,
286+ )
287+
288+ async for fetched_result in cursor:
289+ print (fetched_result.result())
290+
291+ await transaction.commit()
252292```
253293
254294## Extra Types
0 commit comments