I use pymysql in my project , and need use_result to fetch rows? There is a fetchmany function in pymysql . Is it the same as use_result ?
Asked
Active
Viewed 921 times
1 Answers
0
mysql_use_result() + mysql_fetch_row() is used in mysql to fetch the data 1 row at a time and store it client side.
In pymysql, you can use the fetchone() function for this purpose. You can also use fetchmany() to fetch a subset of rows, and fetchall() to store the whole result clientside - like mysql_store_result().
You can read this for an example of each.
-
I checked the source code of pymysql and it seems like all the rows will be buffered in the client side just like mysql_store_result() .fetchone() just reads from the client buffer ~. – renenglish Sep 20 '11 at 05:37
-
Yes, i just read up a little more on it. Though the purpose of fetchone() was supposed to be that it fetches only one row of the result set, it hasn't been implemented that way. The cursor class used to implement it executes the query and returns the result set to the client. There is a work around, but i'm not sure what it is. – Jan S Sep 20 '11 at 05:50