[Solar-svn] Revision 3146

pmjones at solarphp.com pmjones at solarphp.com
Sat May 3 15:45:30 CDT 2008


Solar_Sql_Adapter: [FIX] Fixes cache conflicts across multiple connections.  Patch from Rodrigo Moraes; thanks, Rodrigo.  :-)


Modified: trunk/Solar/Sql/Adapter.php
===================================================================
--- trunk/Solar/Sql/Adapter.php	2008-05-03 20:38:40 UTC (rev 3145)
+++ trunk/Solar/Sql/Adapter.php	2008-05-03 20:45:27 UTC (rev 3146)
@@ -234,6 +234,15 @@
      * 
      */
     protected $_profiling = false;
+
+    /**
+     * 
+     * A PDO-style DSN, for example, "mysql:host=127.0.0.1;dbname=test"
+     * 
+     * @var string
+     * 
+     */
+    protected $_dsn;
     
     /**
      * 
@@ -247,6 +256,12 @@
         parent::__construct($config);
         $this->_cache = Solar::dependency('Solar_Cache', $this->_config['cache']);
         $this->setProfiling($this->_config['profiling']);
+        
+        // build a DSN
+        $this->_dsn = $this->_dsn();
+        
+        // save the cache-key prefix
+        $this->_cache_key_prefix = get_class($this) . '/' . md5($this->_dsn);
     }
     
     /**
@@ -342,15 +357,9 @@
         // start profile time
         $before = microtime(true);
         
-        // build a DSN
-        $dsn = $this->_dsn();
-        
-        // save the cache-key prefix
-        $this->_cache_key_prefix = get_class($this) . '/' . md5($dsn);
-        
         // attempt the connection
         $this->_pdo = new PDO(
-            $dsn,
+            $this->_dsn,
             $this->_config['user'],
             $this->_config['pass']
         );




More information about the Solar-svn mailing list