Edit report at http://bugs.php.net/bug.php?id=19974&edit=1
ID: 19974 Updated by: and...@php.net Reported by: artem at osp dot ru Summary: force close persistent SQL connections -Status: Assigned +Status: Wont fix Type: Feature/Change Request Package: MySQL related Operating System: Linux PHP Version: 4.2.3 Assigned To: mysql Block user comment: N Private report: N New Comment: Please use mysql_change_user() to reset the connection Previous Comments: ------------------------------------------------------------------------ [2011-01-06 17:20:28] u...@php.net ... don't think we should do anything on it. That magic new function is mysql_change_user, its called by default with mysqli to clean up connection, its exported in the mysqli API. People should just move forward to mysqli. ------------------------------------------------------------------------ [2002-10-21 02:53:14] artem at osp dot ru You can call it function 'mysql_reset_connection' or 'mysql_pclose', as you like. Of course, the target of this function is close those disadvantages, which you list. ------------------------------------------------------------------------ [2002-10-18 08:46:40] ge...@php.net When you have a pclose, there is no need for pconnect, you can also use mysql_connect. Currently the problem is, that persistent connections in MySQL have some disadvantages/bugs/problems: - no unset for user variables - session variables are not restored to global variables - no unlock for tables - unselect previous selected database - temporary tables are not deleted - ROLLBACK of not commited transactions - SQL_FOUND_ROWS returns a valid result currently MySQL AB works on a new api-function mysql_reset_connection to fix all these things, so we have to wait. Currently there is not enough functionality to fix/handle this inside the mysql extension. ------------------------------------------------------------------------ [2002-10-18 07:13:16] artem at osp dot ru >From time to time I need close my SQL connections becose using Lock, temporary tables, etc. But such code executed rare. Can you add new function? like: bool mysql_pclose ([bool on_script_exit_or_now=FALSE,[resource link_identifier]]) This function will allow easy using locks and temporary tables and do not loose efficiency. using this function can be such: ------ mysql_pconnent(...); ... if(rare_case) { mysql_pclose(TRUE); # close connect at exit mysql_query("create temporary table ...."); ... } ----- or such: ------ mysql_pconnent(...); ... if(rare_case) { mysql_query("create temporary table ...."); ... mysql_pclose(); # close connect now } ----- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=19974&edit=1