Name

Method: statement_handle.fetchrows( )

Signature

list = statement_handle.fetchrows(rownum)

Synopsis

Fetches the row values of the specified row number associated with the result set represented by the statement handler. If you pass -1 as an argument, this method will return a list of all the rows. For each row in the list, a row is represented by a list whose number of elements equals the number of columns in the result set. The first element represents the first column value, the second element the second column, and so on.

Example

rows = hndl.fetchrows(-1);
for row in rows:
    col1 = row[0];
    col2 = row[1];

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.