RE: [PHP-DB] Long running db queries and the "STOP" button

From: Date: Fri, 28 Oct 2005 14:47:30 +0000
Subject: RE: [PHP-DB] Long running db queries and the "STOP" button
Groups: php.db 
Request: Send a blank email to php-db+get-40558@lists.php.net to get a copy of this message
Hi Jochem, > if you are using apache then virtual() might offer a solution? (just > guessing) Cool, I didn't know of that one. But it seems that is just calls back into apache, i.e. it doesn't generate a second independent thread. This would have been too good to be true :) We have since found a solution for postgres. It supports asynchronous queries and also killing of them: //snip ---------------------------------------------------------- // Setup query cancel handler ignore_user_abort(false); register_shutdown_function(cancel_query); ... // Handler function cancel_query() { pg_cancel_query($dblink); } ... // Actual Query pg_send_query($dblink, $query); // this is non-blocking // This seems to be needed so that php recognizes closed connections while(pg_connection_busy($dblink)){ usleep(500000); echo ' '; flush(); } // get the result from async query execution. $result = pg_get_result($dblink); //snip---------------------------------------------------------------- We are now looking for something similar for mysql. Cheers, Thomas

« previous php.db (#40558) next »