[Solar-svn] Revision 2661

pmjones at solarphp.com pmjones at solarphp.com
Mon Aug 6 11:14:41 CDT 2007


Branch: Solar_Sql_Adapter: [ADD] Added method _postConnect() for post-connection tasks; portability PDO settings have moved here from _connect().


Modified: branches/orm/Solar/Sql/Adapter.php
===================================================================
--- branches/orm/Solar/Sql/Adapter.php	2007-08-06 16:00:45 UTC (rev 2660)
+++ branches/orm/Solar/Sql/Adapter.php	2007-08-06 16:14:41 UTC (rev 2661)
@@ -328,7 +328,6 @@
         // build a DSN
         $dsn = $this->_dsn();
         
-        // create PDO object
         // attempt the connection
         $this->_pdo = new PDO(
             $dsn,
@@ -336,6 +335,25 @@
             $this->_config['pass']
         );
         
+        // post-connection tasks
+        $this->_postConnect();
+        
+        // retain the profile data?
+        if ($this->_profiling) {
+            $after = microtime(true);
+            $this->_profile[] = array($after - $before, '__CONNECT');
+        }
+    }
+    
+    /**
+     * 
+     * After connection, set various connection attributes.
+     * 
+     * @return void
+     * 
+     */
+    protected function _postConnect()
+    {
         // always emulate prepared statements; this is faster, and works
         // better with CREATE, DROP, ALTER statements.  requires PHP 5.1.3
         // or later. note that we do this *first* (before using exceptions)
@@ -348,12 +366,6 @@
             
         // force names to lower case
         $this->_pdo->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
-        
-        // retain the profile data?
-        if ($this->_profiling) {
-            $after = microtime(true);
-            $this->_profile[] = array($after - $before, '__CONNECT');
-        }
     }
     
     /**




More information about the Solar-svn mailing list