def get_cursor(
self,
connection=None,
release_new_connection=True,
force_release_connection=False,
):
need_release_connection = release_new_connection and not connection
connection = connection or await self.get_conn()
cursor = await connection.cursor()
if need_release_connection or force_release_connection:
pool = await self.pool
weakref.finalize(cursor, pool.release, connection)
return cursor
评论列表
文章目录