MySQL连接器/Python发布说明
- 10.5.1游标。MySQLCursorConstructor
- 10.5.2 MySQLCursor.callproc()方法
- 10.5.3 MySQLCursor.close()方法
- 10.5.4 MySQLCursor.execute()方法
- 10.5.5 MySQLCursor.executemany()方法
- 10.5.6 MySQLCursor.fetchall()方法
- 10.5.7 MySQLCursor.fetchmany()方法
- 10.5.8 MySQLCursor.fetchone()方法
- 10.5.9 MySQLCursor.fetchwarnings()方法
- 10.5.10 MySQLCursor.stored_results()方法
- 10.5.11 MySQLCursor。column_names财产
- 10.5.12 MySQLCursor.description属性
- 10.5.13 MySQLCursor。lastrowid财产
- 10.5.14 MySQLCursor。rowcount财产
- 10.5.15 MySQLCursor。声明属性
- 10.5.16 MySQLCursor。with_rows财产
的MySQLCursor
类实例化可以执行SQL语句等操作的对象。指针对象与MySQL服务器交互使用MySQLConnection
对象。
要创建游标,使用光标()
连接对象的方法:
进口mysql。连接mysql.connector.connect(database='world')
继承的几个相关类MySQLCursor
.若要创建这些类型之一的游标,请将适当的参数传递给光标()
:
MySQLCursorBuffered
创建一个缓冲游标。看到第10.6.1节,“游标。MySQLCursorBufferedClass”.cursor = cnx.cursor(buffered=True)
MySQLCursorRaw
创建一个原始游标。看到第10.6.2节,“游标。MySQLCursorRaw阶级”.cursor = cnx.cursor(raw=True)
MySQLCursorBufferedRaw
创建一个缓冲的原始游标。看到第10.6.3节,“游标。MySQLCursorBufferedRawClass”.光标= cnx。光标(原始= True,缓冲= True)
MySQLCursorDict
创建一个游标,将行返回为字典。看到第10.6.4节,“游标。MySQLCursorDict阶级”.光标= cnx.cursor(dictionary=True)
MySQLCursorBufferedDict
创建一个缓冲游标,以字典的形式返回行。看到第10.6.5节,“游标。MySQLCursorBufferedDictClass”.光标= cnx。光标(字典= True,缓冲= True)
MySQLCursorNamedTuple
创建游标,返回作为命名元组的行。看到第10.6.6节,“游标。MySQLCursorNamedTupleClass”.光标= cnx.cursor(named_tuple=True)
MySQLCursorBufferedNamedTuple
创建一个缓冲游标,以命名元组的形式返回行。看到第10.6.7节,“游标。MySQLCursorBufferedNamedTuple Class”.光标= cnx。光标(named_tuple = True,缓冲= True)
MySQLCursorPrepared
创建用于执行准备语句的游标。看到第10.6.8节,“游标。MySQLCursorPreparedClass”.cursor = cnx.cursor(prepared=True)