I am trying to understand how the following builtin functions work when sequentially processing cursor rows. The descriptions come from the Python 3.1 manual (using SQLite3)
Cursor.fetchone()
Fetches the next row of a query result set, returning a single sequence.
Cursor.fetchmany()
Fetches the next set of rows of a query result, returning a list.
Cursor.fetchall()
Fetches all (remaining) rows of a query result, returning a list.
So if I have a loop in which I am processing one row at a time using cursor.fetchone(), and some later code requires that I return to the first row, or fetch all rows using fetchall(), how do I do it?
The concept is a bit strange to me, especially coming from a Foxpro background which has the concept of a record pointer which can be moved to the 1st or last row in a cursor (go top/bottom), or go to the nth row (go n)
Any help would be appreciated.
Alan
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…