note 41174 modified in function.mysql-unbuffered-query by danbrown

From: Date: Wed, 03 Aug 2011 19:19:20 +0000
Subject: note 41174 modified in function.mysql-unbuffered-query by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182193@lists.php.net to get a copy of this message
If you are going to do a large query, but are concerned about blocking access to the table during an unbuffered query, why not go through a temporary table? (Of course, this is predicated on the current user having permission to create tables.) <?php $dbQuery = "SELECT something ..."; if (mysql_query ("CREATE TEMPORARY TABLE MyQuery $dbQuery")) { $numRows = mysql_affected_rows(); if ($numRows == 0) { /* handle empty selection */ } else { $result = mysql_unbuffered_query ('SELECT * FROM MyQuery'); /* handle result */ } mysql_query ('DROP TABLE MyQuery'); } ?> --was-- If you are going to do a large query, but are concerned about blocking access to the table during an unbuffered query, why not go through a temporary table? (Of course, this is predicated on the current user having permission to create tables.) $dbQuery = "SELECT something ..."; if (mysql_query ("CREATE TEMPORARY TABLE MyQuery $dbQuery")) { $numRows = mysql_affected_rows(); if ($numRows == 0) { /* handle empty selection */ } else { $result = mysql_unbuffered_query ('SELECT * FROM MyQuery'); /* handle result */ } mysql_query ('DROP TABLE MyQuery'); } http://php.net/manual/en/function.mysql-unbuffered-query.php

« previous php.notes (#182193) next »