php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #19974 force close persistent SQL connections
Submitted: 2002-10-18 07:13 UTC Modified: 2011-01-07 16:13 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: artem at osp dot ru Assigned: mysql (profile)
Status: Wont fix Package: MySQL related
PHP Version: 4.2.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: artem at osp dot ru
New email:
PHP Version: OS:

 

 [2002-10-18 07:13 UTC] 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
}
-----


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-18 08:46 UTC] georg@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-21 02:53 UTC] 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.
 [2011-01-01 01:08 UTC] jani@php.net
-Package: Feature/Change Request +Package: MySQL related
 [2011-01-06 17:20 UTC] uw@php.net
-Assigned To: +Assigned To: mysql
 [2011-01-06 17:20 UTC] uw@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.
 [2011-01-07 15:36 UTC] andrey@php.net
-Status: Assigned +Status: Wont fix
 [2011-01-07 15:36 UTC] andrey@php.net
Please use mysql_change_user() to reset the connection
 [2011-01-07 16:13 UTC] uw@php.net
ext/mysql does not export mysql_change_user(). It cannot be called from PHP. However, I agree with Won't fix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC