Ticket Details

Inverted logic + missing checks in MySQL::connect()

BUG Ticket (closed)

###What happened:
- something

config checks for persistent connection and uses non-persistent if the latter is set to true

###What was expected:
- something else

MySQL should use a persistent connection if configured as so
on 08.23.10 reported by: ddebernardy owned by: nate

Updates

on 08.23.10 by ddebernardy
{{{
diff --git a/libraries/lithium/data/source/database/adapter/MySql.php b/libraries/lithiu
index 5d0b4ad..8a8c938 100644
--- a/libraries/lithium/data/source/database/adapter/MySql.php
+++ b/libraries/lithium/data/source/database/adapter/MySql.php
@@ -116,14 +116,20 @@ class MySql extends \lithium\data\source\Database {
                        return false;
                }
 
-               if ($config['persistent']) {
+               if (!$config['persistent']) {
                        $this->connection = mysql_connect($host, $config['login'], $conf
                } else {
                        $this->connection = mysql_pconnect($host, $config['login'], $con
                }
+               
+               if (!$this->connection) {
+                       return false;
+               }
 
                if (mysql_select_db($config['database'], $this->connection)) {
                        $this->_isConnected = true;
+               } else {
+                       return false;
                }
 
                if ($config['encoding']) {
}}}
on 08.23.10 by ddebernardy
formatted patch here:

http://pastium.org/view/d4cce6654646e25636c0072554164e83
on 08.23.10 by ddebernardy
See http://rad-dev.org/forks/ddebernardy/lithium/source/branches/mysql
on 09.29.10 by nate
  • owner was changed to nate
  • status was changed to in progress
(fixed) on 10.08.10 by nate
  • status was changed to closed
  • resolution was changed to fixed
Thanks for the fix.