Переглянути джерело

Merge r25228 to 1.12 release branch

git-svn-id: http://framework.zend.com/svn/framework/standard/branches/release-1.12@25229 44c647ce-9c0f-0410-b52a-842ac1e357ba
frosch 13 роки тому
батько
коміт
8675b68af5

+ 8 - 0
documentation/manual/en/module_specs/Zend_Db_Adapter.xml

@@ -380,6 +380,14 @@ $db = Zend_Db::factory($config->database);
                         load a non-Zend database adapter class.
                     </para>
                 </listitem>
+
+                <listitem>
+                    <para>
+                        <emphasis>socket</emphasis>:
+                        allows you to specify the socket or named pipe to use.
+                        Currently supported only by mysqli adapter.
+                    </para>
+                </listitem>
             </itemizedlist>
 
             <example id="zend.db.adapter.connecting.parameters.example1">

+ 1 - 0
library/Zend/Db/Adapter/Abstract.php

@@ -156,6 +156,7 @@ abstract class Zend_Db_Adapter_Abstract
      * persistent     => (boolean) Whether to use a persistent connection or not, defaults to false
      * protocol       => (string) The network protocol, defaults to TCPIP
      * caseFolding    => (int) style of case-alteration used for identifiers
+     * socket         => (string) The socket or named pipe that should be used
      *
      * @param  array|Zend_Config $config An array or instance of Zend_Config having configuration data
      * @throws Zend_Db_Adapter_Exception

+ 8 - 1
library/Zend/Db/Adapter/Mysqli.php

@@ -297,6 +297,12 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
             $port = null;
         }
 
+        if (isset($this->_config['socket'])) {
+            $socket = $this->_config['socket'];
+        } else {
+            $socket = null;
+        }
+
         $this->_connection = mysqli_init();
 
         if(!empty($this->_config['driver_options'])) {
@@ -320,7 +326,8 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
             $this->_config['username'],
             $this->_config['password'],
             $this->_config['dbname'],
-            $port
+            $port,
+            $socket
         );
 
         if ($_isConnected === false || mysqli_connect_errno()) {