Xeos
Xeos

Reputation: 6487

Is MySQL data returned from the query buffered?

If I run mysql_query() with SELECT statement, then while I am processing all the records another process amends some data from the result set, which was not yet processed. Using mysql_fetch_row() do I get old data or updated data?

For example:
Table:

id data
1  a
2  b
3  c
4  d

I have processed rows 1 and 2, then row with id 3 and changed data to e
Calling mysql_fetch_row() will get me an array with data equal to c or e?

Upvotes: 0

Views: 264

Answers (1)

Michael
Michael

Reputation: 12806

Using mysql_query the result will be buffered. If you want it unbuffered then you'd use mysql_unbuffered_query, though keep in mind the following:

The benefits of mysql_unbuffered_query() come at a cost: you cannot use mysql_num_rows() and mysql_data_seek() on a result set returned from mysql_unbuffered_query(), until all rows are fetched. You also have to fetch all result rows from an unbuffered SQL query before you can send a new SQL query to MySQL, using the same *link_identifier*.

Although, you shouldn't be using mysql functions anymore, anyway...

Upvotes: 2

Related Questions