Home » Database » MDB2_Driver_mysql » Bug #4308
Typo in MySQL::connect
Details
| Submitted | 2005-05-09 22:20 UTC |
|---|---|
| From | scragz at hotmail dot com |
| Status | No Feedback |
| Package | MDB2_Driver_mysql |
| PHP Version | 4.3.10 |
| OS | SuSE 9.3 |
| Roadmaps | (Not assigned) |
Comments
[2005-05-09 22:20 UTC] scragz at hotmail dot com
Description:
------------
In MDB2/Driver/mysql.php at appx. line 331, there are a couple variables that should be $this->dsn instead of $dsn. This is for the new_link bit.
I'm currently having a problem where connecting to two databases with the same info except database name, executing a query on the first, executing a query on the second, and then executing a query on the first again results in the third query using the wrong database. I found this while trying to figure out what is going on to cause this problem that didn't exist before I migrated from DB to MDB2.
This is using a CVS pull from today, 2005-05-09.
Reproduce code:
---------------
This is what it should be as far as I can tell:
if (!$this->options['persistent']) {
if (isset($this->dsn['new_link'])
&& ($this->dsn['new_link'] == 'true' || $this->dsn['new_link'] === true))
{
$params[] = true;
} else {
$params[] = false;
}
}
[2005-05-10 00:20 UTC] smith at backendmedia dot com
This bug has been fixed in CVS.
In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.
In case this was a pear.php.net website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PEAR better.
MDB2 does not select the database on every query like DB does. But using the new_link option should give you independent connections.
[2006-05-29 17:37 UTC] tomass at splius dot lt
I'am afraid, but this bug still exists :(
I'm currently having a problem where connecting to two databases with
the same info except database name, executing a query on the first,
executing a query on the second, and then executing a query on the
first again results in the third query using the wrong database. I
found this while trying to figure out what is going on to cause this
problem that didn't exist before I migrated from DB to MDB2.
I'am using MDB2 v2.0.3
[2006-05-30 03:46 UTC] tomass at splius dot lt
The code, what I use:
$dbUser = "root";
$dbPasswd = "toor";
$database = "db1";
$dsn = "mysql://$dbUser:$dbPasswd@localhost/$database?new_link=true";
$db =& MDB2::factory($dsn);
if (PEAR::isError($db)) {
die ($db->getMessage());
}
$dbUser = "root";
$dbPasswd = "toor";
$database = "db2";
$dsn = "mysql://$dbUser:$dbPasswd@localhost/$database?new_link=true";
$stdb =& MDB2::factory($dsn);
[2006-05-30 09:07 UTC] tomass at splius dot lt
PHP is 4.4.2
[2006-05-30 21:38 UTC] str at strgt dot cjb dot net
I tried that option on the dsn and it works now. Thank you... but you shuould update the documentation.