用户
 找回密码
 入住 CI 中国社区
搜索
查看: 5663|回复: 3
收起左侧

[修补 Patch] [1.5.4]修复 MySQL 数据库抽象层驱动加端口无效的bug

[复制链接]
发表于 2007-12-27 11:43:01 | 显示全部楼层 |阅读模式
这个问题是俺在更改数据库服务器端口时发现滴,找到 \database\drivers\mysql\mysql_driver.php 将其中的相关函数替换成如下内容即可.(PS:可能其它的数据库驱动也有这个问题,不过俺暂时用不到,也就懒得去看了.)

PHP复制代码
 
        /**
         * Non-persistent database connection
         *
         * @access        private called by the base class
         * @return        resource
         */
       
        function db_connect()
        {
                if ($this->port != "")
                {
                    return @mysql_connect($this->hostname.":".$this->port, $this->username, $this->password, TRUE);
                }
                else
                {
                    return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);                
                }
        }
       
        // --------------------------------------------------------------------
 
        /**
         * Persistent database connection
         *
         * @access        private called by the base class
         * @return        resource
         */
       
        function db_pconnect()
        {
                if ($this->port != "")
                {        
                    return @mysql_pconnect($this->hostname.":".$this->port, $this->username, $this->password);
                }
                else
                {
                    return @mysql_pconnect($this->hostname, $this->username, $this->password);
                }
        }
 
复制代码

评分

参与人数 1威望 +5 收起 理由
Hex + 5 精品文章

查看全部评分

发表于 2007-12-27 11:52:43 | 显示全部楼层
不错!以后是不是得弄一个 BUG 报告区啊?以后统一报告给官方!呵呵
 楼主| 发表于 2007-12-27 12:29:31 | 显示全部楼层
这个建义8错哟 .
发表于 2007-12-27 13:29:16 | 显示全部楼层
哈哈。。用pgsql吧。。换几个端口都没问题。。

本版积分规则