Bug #16495 Updated: return last selected databasename

From: Date: Wed, 24 Jul 2002 08:58:29 +0000
Subject: Bug #16495 Updated: return last selected databasename
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15020@lists.php.net to get a copy of this message
ID: 16495 Updated by: georg@php.net -Summary: more mysql module info in phpinfo(); Reported By: pgl@instinct.org -Status: Open +Status: Won't fix Bug Type: Feature/Change Request Operating System: all PHP Version: 4.2.0 New Comment: Of course, it would be possible to implement a "SELECT DATABASE" query inside the mysql_select_db function. But why should we implement additional client features, which already exist at the server side. In the manual there are a some functions, which are marked as deprecated (and will be removed in the near future). The major reason for that is, that there already an equivalent in the MySQL SQL-Syntax exists (e.g mysql_drop_db). Except for the transaction rollback for non committed transactions in persistent connections, the mysql extension don't uses any SQL-Syntax features. Previous Comments: ------------------------------------------------------------------------ [2002-07-24 03:59:13] pgl@instinct.org I asked for this feature request because I thought it would be useful. Is it not now considered potentially useful? Can't the "internal inconsistencies" be fixed (at some point in the future)? It's not exactly high priority, but it's still a feature request, no? :) Thanks for the tip about "select database()". (Incidentally, couldn't PHP just send that query to get mysql_select_db() working as requested..? :)) ------------------------------------------------------------------------ [2002-07-21 17:46:31] georg@php.net 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 :) ------------------------------------------------------------------------ [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())? ------------------------------------------------------------------------ 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

« previous php.bugs (#15020) next »