mysql "rows affected"

John Nagle nagle at animats.com
Thu Apr 26 21:18:57 EDT 2007


Carl K wrote:
> using MySQLdb, I do cursor.execute("update...")
> 
> How can I tell how many rows were affected ?
> 
> Carl K

	cursor = db.cursor() # get cursor					
	cursor.execute(sqlstatement, argtuple) # do command
	rowsaffected = cursor.rowcount # get count of rows affected
	cursor.close() # close cursor
	db.commit() # commit transaction	

				John Nagle							



More information about the Python-list mailing list