mysql - How do I use num_rows() function in the MySQLDB API for Python? -


i have statement

cursor = connection.cursor() query = "select * table" cursor.execute(query) res = cursor.fetchall() 

cursor = connection.cursor() query = "select * table" cursor.execute(query) print cursor.rowcount 

according python database api specification v2.0, rowcount attribute of cursor object should return number of rows last query produced or affected (the latter queries alter database). if database module conforms api specification, should able use rowcount attribute.

the num_rows() function looking not exist in mysqldb module. there internal module called _mysql has result class num_rows method, shouldn't using - existence of _mysql considered implementation detail.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -