Req #63798 [Opn->Wfx]: Add dbname to mysqli_prop
| From: | johannes@php.net | Date: | Thu, 06 Apr 2017 10:03:20 +0000 |
| Subject: | Req #63798 [Opn->Wfx]: Add dbname to mysqli_prop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208355@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63798&edit=1
ID: 63798
Updated by: johannes@php.net
Reported by: thbley at gmail dot com
Summary: Add dbname to mysqli_prop
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: MySQLi related
Operating System: win7 x64
PHP Version: 5.5.0alpha1
Block user comment: N
Private report: N
New Comment:
We can't do this as we don't necessarily have the information. If a script for instance
does query("USE other_db") mysqli won't notice.
Previous Comments:
------------------------------------------------------------------------
[2012-12-18 21:07:57] thbley at gmail dot com
Description:
------------
The properties of the Mysqli object already contain server-info, server-version, errors, etc., but
not the current (selected) database.
It would be great if dbname could be added to mysqli properties.
With the property it gets easier to check if the right database was selected or if none was
selected.
Test script:
---------------
PHP code looks like this:
class mysqli_db extends mysqli {
public function __construct($host=null, $user=null, $pw=null, $db=null) {
call_user_func_array("parent::__construct", func_get_args());
$this->db = $db;
}
// same for real_connect() ...
public function select_db($db) {
parent::select_db($db);
$this->db = $db;
}
}
$db = new mysqli_db('127.0.0.1', 'root', '', 'test');
echo $db->db; // test
$db->select_db('test2');
echo $db->db; // test2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63798&edit=1