MySQL Connector/Python 發行說明
MySQLCursorBufferedRaw 類別繼承自 MySQLCursor。
MySQLCursorBufferedRaw 游標類似於 MySQLCursorRaw 游標,但是經過緩衝處理:在執行查詢後,它會從伺服器擷取整個結果集並緩衝處理資料列。有關緩衝處理的影響的資訊,請參閱章節 10.6.1,「cursor.MySQLCursorBuffered 類別」。
若要建立緩衝的原始游標,請在呼叫連線的 cursor() 方法時使用 raw 和 buffered 引數。或者,若要讓從連線建立的所有游標預設為原始和緩衝,請使用 raw 和 buffered 連線引數。
範例
import mysql.connector
cnx = mysql.connector.connect()
# Only this particular cursor will be raw and buffered
cursor = cnx.cursor(raw=True, buffered=True)
# All cursors created from cnx2 will be raw and buffered by default
cnx2 = mysql.connector.connect(raw=True, buffered=True)