·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> php网站开发 >> Discuz DB层跨库映射关系表名前缀BUG修复后产生的新bug

Discuz DB层跨库映射关系表名前缀BUG修复后产生的新bug

作者:佚名      php网站开发编辑:admin      更新时间:2022-07-23
Discuz DB层跨库映射关系表名前缀BUG修复后产生的新bug

新的逻辑引入了新的bug,会导致在跨多库连接时,产生表名前缀映射混乱,需要再做逻辑上的修复。

function table_name($tablename) {        if(!empty($this->map) && !empty($this->map[$tablename])) {            $id = $this->map[$tablename];            if(!empty($this->config[$id]['tablePRe'])){                $this->tablepre = $this->config[$id]['tablepre'];            }            if(!$this->link[$id]) {                $this->connect($id);            }            $this->curlink = $this->link[$id];        } else {            $this->tablepre = $this->config['1']['tablepre'];            $this->curlink = $this->link[1];        }        return $this->tablepre.$tablename;    }

附db Map 写法:

$_config['db']['1']['dbhost'] = 'localhost'; // 服务器地址$_config['db']['1']['dbuser'] = 'root'; // 用户$_config['db']['1']['dbpw'] = 'root';// 密码$_config['db']['1']['dbcharset'] = 'gbk';// 字符集$_config['db']['1']['pconnect'] = '0';// 是否持续连接$_config['db']['1']['dbname'] = 'x1';// 数据库$_config['db']['1']['tablepre'] = 'pre_';// 表名前缀$_config['db']['2']['dbhost'] = 'localhost';.....//再配置一些数据源$_config['db']['xxx_sys']['dbhost'] = 'localhost';//映射$_config['db']['map']['yyy_table'] = 'xxx_sys';

上一篇文章:http://www.cnblogs.com/x3d/p/3913690.html