ID: 16495 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Feature/Change Request Operating System: FreeBSD PHP Version: 4.1.2 New Comment:
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()? Previous Comments: ------------------------------------------------------------------------ [2002-04-26 09:44:11] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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); ? ------------------------------------------------------------------------ [2002-04-08 11:55:20] [EMAIL PROTECTED] True, but given that currently the only possible values the function can return are TRUE or FALSE, it seems unlikely that anyone would actually do that. Is there any other way to get the name of the current db inside a function without using global? ------------------------------------------------------------------------ [2002-04-08 11:45:32] [EMAIL PROTECTED] Well, I can see. If someone wrote if (true === mysql_select_db( ... it's broken (and the API has been long this way). ------------------------------------------------------------------------ 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