MySQLCursor.fetchone()

9.5.8 Method MySQLCursor.fetchone()
http://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-fetchone.html

# Using a while loop
cursor.execute(“SELECT * FROM employees”)
row = cursor.fetchone()
while row is not None:
___print(row)
___row = cursor.fetchone()

# Using the cursor as iterator
cursor.execute(“SELECT * FROM employees”)
for row in cursor:
___print(row)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s