博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Discuz DB层跨库映射关系表名前缀BUG修复后产生的新bug
阅读量:6983 次
发布时间:2019-06-27

本文共 1132 字,大约阅读时间需要 3 分钟。

新的逻辑引入了新的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://tqcpl.baihongyu.com/

你可能感兴趣的文章
TarsGo新版本发布,支持protobuf,zipkin和自定义插件
查看>>
Flutter 如何创建并发布 Plugin (VS Code + GitHub 发布)
查看>>
TableStore实战:GEO索引打造亿量级店铺搜索系统
查看>>
js的防抖和节流
查看>>
redis学与思系列(2)
查看>>
学习springBoot(11)shiro安全框架
查看>>
c++那些事儿11 0 STL List
查看>>
问题记录——跨域
查看>>
PHP7.3即将到来,快来了解一下新特性吧
查看>>
1月9日云栖精选夜读:场景化封装,一站式使用,普惠AI集成 ——阿里云发布智能媒体管理产品...
查看>>
Java Servlet Filter 详解
查看>>
区块链走向何方,或许从美国证劵史可以得到答案
查看>>
Golang web之http标准库简析
查看>>
项目冷启动,搭建MVP产品框架
查看>>
Python爬取网易云音乐歌单歌曲
查看>>
掘金markdown笔记快捷键
查看>>
[译] 为什么加密货币泡沫会破裂?
查看>>
Python 发送邮件
查看>>
图解git原理与日常实用指南
查看>>
程序员的职业发展:技术路线 v.s. 管理路线?
查看>>