I am having serious problems with the functions of the PHP data object. I am trying to do a circular set of results (~ 60k lines, ~ 1gig) using a buffered query to avoid fetching the whole set.
No matter what I do, the script just hangs in PDO :: query () - it seems that the query is working unbuffered (why else would changing the size of the result set change?). Here is my code to reproduce the problem:
<?php $Database = new PDO( 'mysql:host=localhost;port=3306;dbname=mydatabase', 'root', '', array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true ) ); $rQuery = $Database->query('SELECT id FROM mytable');
If I limit the request to some reasonable number, it works fine:
$rQuery = $Database->query('SELECT id FROM mytable LIMIT 10');
I tried playing with PDO :: MYSQL_ATTR_MAX_BUFFER_SIZE and using PDO :: prepare () and PDO :: execute () (although there are no parameters in the above query), both of them have no effect. Any help would be appreciated.
php mysql pdo
Stewart
source share