MySQL Connector/Python 發行說明
語法
iterator = cursor.stored_results()
此方法會傳回清單迭代器物件,可用於處理使用 callproc() 方法執行的預存程序所產生的結果集。結果集會保持可用,直到您使用游標執行另一個操作或呼叫另一個預存程序為止。
以下範例會執行產生兩個結果集的預存程序,然後使用 stored_results()
來擷取它們
>>> cursor.callproc('myproc')
()
>>> for result in cursor.stored_results():
... print result.fetchall()
...
[(1,)]
[(2,)]