This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9520|Reply: 0

The difference between mysql_unbuffered_query and mysql_query in PHP

[Copy link]
Posted on 2/20/2016 8:53:29 PM | | |

Everyone is familiar with mysql_query, so let's briefly introduce the mysql_unbuffered_query

mysql_unbuffered_query

(PHP 4 >= 4.0.6, PHP 5) mysql_unbuffered_query -- Sends a SQL query to MySQL without fetching and caching the resulting rows

Description resource mysql_unbuffered_query ( string query [, resource link_identifier] )


mysql_unbuffered_query() sends a SQL query query to MySQL, but doesn't automatically fetch and cache the result set like mysql_query(). On the one hand, this saves considerable memory when working with large result sets. On the other hand, you can manipulate the result set as soon as you get the first row, rather than waiting for the entire SQL statement to be executed. When using multiple database connections, you must specify the optional parameter link_identifier.

Note: The benefits of mysql_unbuffered_query() come at a cost: you can't use mysql_num_rows() and mysql_data_seek() on top of the result set returned by mysql_unbuffered_query(). In addition, before sending a new SQL query to MySQL, all uncached SQL queries must be extracted from the resulting rows.

The above is the explanation of mysql_unbuffered_query in the php manual, I searched a lot of explanations for the explanations already in the manual on the Internet, many people hope to have an example to better understand the application of this function, I followed the explanation given, made an example, for reference only:







Previous:php generates random numbers
Next:C# rounds the double
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com