zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Monkeyrunner环境搭建
    学习Monkeyrunner过程
    uiautomatorviewer使用报错
    安装JMeter
    如何测试网页的访问速度
    安装Android studio
    软件测试工程师具备技能
    WinRAR去除广告弹框(精华在末尾)
    android studio adb连接不上手机
    DOM的理解
  • 原文地址:https://www.cnblogs.com/x3d/p/3916198.html
Copyright © 2011-2022 走看看