Return the next row of result set.
Cursor.fetchone()
void | No arguments |
This method returns the next row of a result set (dataset
) as a tuple
, or None
if no more results available. This is a DB API compliant call.
row | The next row in the result set (dataset ) |
None |
There are no more rows in the result set |
conn = db.connect() cursor = conn.cursor() sql = "SELECT ikey, symbol, stamp, low, high, open, close, volume FROM Quote ORDER BY ikey" cursor.execute(sql) count = 0 while True: row=cursor.fetchone() if row is None: break print "Row read:", row count += 1 ... cursor.close() conn.rollback()