PHP mysql_unbuffered_query() ফাংশন

সংজ্ঞা ও ব্যবহার

mysql_unbuffered_query() ফাংশন MySQL-কে একটি SQL কোড query (ফলাফল সংরক্ষণ না করে) পাঠায়。

ব্যবহারিক কাঠামো

mysql_unbuffered_query(query,connection)
প্রমাণ বিবরণ
query অপরিহার্য।পাঠাতে হলের জন্য SQL কোড query নির্ধারণ করুন।মন্তব্য: কোডটি সমাপ্ত হওয়ার জন্য সমাপ্তি সংকেত (;) দিতে হবে না。
connection বাছাইকৃত।SQL কানেকশন প্রতীক নির্ধারণ করুন।যদি নির্ধারণ না হয়, তবে সর্বশেষ খুলে যাওয়া কানেকশনটি ব্যবহার করা হবে。

বিবরণ

mysql_unbuffered_query() MySQL-কে একটি SQL কোড query পাঠায়, কিন্তু তা নয় mysql_query() to automatically retrieve and cache the result set. On the one hand, this saves considerable memory when handling large result sets. On the other hand, it is possible to operate on the result set immediately after obtaining the first row, without waiting for the entire SQL statement to be executed.

When using multiple database connections, it is necessary to specify the optional parameter connection.

Tips and Comments

Note:The benefit of mysql_unbuffered_query() has a cost: The connection cannot be used on the result set returned by mysql_unbuffered_query(): mysql_num_rows() and mysql_data_seek()In addition, before sending a new SQL query to MySQL, it is necessary to retrieve all the result rows generated by all the uncached SQL queries.

Example

<?php
$con = mysql_connect("localhost","mysql_user","mysql_pwd");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
// Large query
$sql = "SELECT * FROM Person";
mysql_unbuffered_query($sql,$con);
// Start processing data...
mysql_close($con);
?>