更新时间:2026-07-28 GMT+08:00
分享

connection.cursor()

功能描述

创建一个数据库游标对象,用于在数据库中执行SQL命令、管理查询结果和控制事务。

原型

cursor(name, cursor_factory, scrollable, withhold)

参数

表1 connection.cursor参数

关键字

参数说明

name

cursor名称,默认为None。

cursor_factory

用于创造非标准cursor,默认为None。

scrollable

设置SCROLL选项,默认为None。

withhold

设置HOLD选项,默认为False。

返回值

cursor对象。

相关文档