Bug #16495 Updated: more mysql module info in phpinfo();
| From: | georg@php.net | Date: | Sun, 21 Jul 2002 21:46:32 +0000 |
| Subject: | Bug #16495 Updated: more mysql module info in phpinfo(); | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-14754@lists.php.net to get a copy of this message | ||
ID: 16495
Updated by: georg@php.net
-Summary: Can mysql_select_db return the previously selected db?
-Reported By: pgl@instinct.org
+Reported By: Xuefer@21cn.com
-Status: Closed
+Status: Won't fix
Bug Type: Feature/Change Request
-Operating System: FreeBSD
+Operating System: all
-PHP Version: 4.1.2
+PHP Version: 4.2.0
New Comment:
As a result of some inconsistencies this feature was removed.
To determine the current databasename, use the SQL Command "SELECT
DATABASE()", which returns the current databasename (or an error, if
something happened :)
Previous Comments:
------------------------------------------------------------------------
[2002-04-28 12:02:50] sniper@php.net
There is now 3rd optional parameter added to
mysql_select_db() in CVS HEAD.
This:
$prev_dbname = mysql_select_db("new_db", $db, TRUE);
returns the previous database name provided that you
have selected some database before. (And not used "USE some_db" query
to do that as was pointed by Markus in previous comments.
--Jani
------------------------------------------------------------------------
[2002-04-26 10:40:25] pgl@instinct.org
Ah, I just found out about mysql_stat(), which seems to show most of
the output from a "\s" on the mysql command line, but not the current
database. Could the current db be added to the output of mysql_stat()?
------------------------------------------------------------------------
[2002-04-26 09:44:11] pgl@instinct.org
How about a function that would give you access to the information
output from the "\s" command? mysql_get_server_info, _client_info(),
and _host_info() don't display this. And if this function could be
implemented, might it be possible for PHP to call it before selecting
to a new db (but only if RETURN_OLD_DBNAME was specified when calling
mysql_select_db())?
------------------------------------------------------------------------
[2002-04-26 09:31:29] mfischer@php.net
I think you can't accurately implement the tracking of which database
you're currently using. As long as you are using mysql_select_db() it's
possible to track it with the current mysql resource context. But if
you issue a mysql_query() like "use another_db" you're getting out of
sync.
------------------------------------------------------------------------
[2002-04-26 09:27:54] pgl@instinct.org
Would it be possible to add a flag to the end of the function call to
specify that you want it to return the name of the previously selected
db? eg:
$old_db_name = mysql_select_db('somedb', RETURN_OLD_DBNAME);
?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/16495
--
Edit this bug report at http://bugs.php.net/?id=16495&edit=1