Cursor.fetchone

Return the next row of result set.

For an overview see page Python Cursor Class

Prototype

 
    Cursor.fetchone()
 

Arguments

void No arguments

Description

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.

Returns

row The next row in the result set (dataset)
None

There are no more rows in the result set

Example

     
    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()