Sfoglia il codice sorgente

[ZF-10829]: isConnected() valid if persistent connection with Oracle

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23557 44c647ce-9c0f-0410-b52a-842ac1e357ba
mikaelkael 15 anni fa
parent
commit
af6b78cdcd
2 ha cambiato i file con 15 aggiunte e 2 eliminazioni
  1. 3 2
      library/Zend/Db/Adapter/Oracle.php
  2. 12 0
      tests/Zend/Db/Adapter/OracleTest.php

+ 3 - 2
library/Zend/Db/Adapter/Oracle.php

@@ -147,8 +147,9 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
     public function isConnected()
     {
         return ((bool) (is_resource($this->_connection)
-                     && get_resource_type($this->_connection) == 'oci8 connection'));
-    }
+                    && (get_resource_type($this->_connection) == 'oci8 connection'
+                     || get_resource_type($this->_connection) == 'oci8 persistent connection')));
+        }
 
     /**
      * Force the connection to close.

+ 12 - 0
tests/Zend/Db/Adapter/OracleTest.php

@@ -288,6 +288,18 @@ class Zend_Db_Adapter_OracleTest extends Zend_Db_Adapter_TestCommon
         $this->assertEquals(2, $result->$col_name);
     }
 
+    /**
+     * @group ZF-10829
+     */
+    public function testAdapterGetPersistentConnection()
+    {
+        $params = $this->_util->getParams();
+        $params['persistent'] = 1;
+        $db = Zend_Db::factory($this->getDriver(), $params);
+        $db->getConnection();
+        $this->assertTrue($db->isConnected());
+    }
+
     public function testAdapterInsert()
     {
         $row = array (