Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #4308 Typo in MySQL::connect
Submitted: 2005-05-09 22:20 UTC
From: scragz at hotmail dot com Assigned:
Status: No Feedback Package: MDB2_Driver_mysql
PHP Version: 4.3.10 OS: SuSE 9.3
Roadmaps: (Not assigned)    
Subscription  


 [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; } }

Comments

 [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 (tomas)
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-29 20:34 UTC] lsmith (Lukas Smith)
Can you paste the DSN you use to connect?
 [2006-05-30 03:46 UTC] tomass at splius dot lt (tomas)
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 06:51 UTC] lsmith (Lukas Smith)
OK, that looks good. What version of PHP (new_link is only supported with PHP 4.2.0 and above ..)? I will try to setup a test in my system.
 [2006-05-30 09:07 UTC] tomass at splius dot lt (tomas)
PHP is 4.4.2
 [2006-05-30 21:38 UTC] str at strgt dot cjb dot net (Stuardo -StR- Rodríguez)
I tried that option on the dsn and it works now. Thank you... but you shuould update the documentation.