有研究过felixge/node-mysql模块的同学没
 发布于 12 年前  作者 vfan2010  4106 次预览  最后一次回复是 12 年前  来自  

问一个关于PoolCluster.js的问题 在https://github.com/felixge/node-mysql这个模块里面 有个文件 node_modules\mysql\lib\PoolCluster.js,里面有这么一句话

//这里为什么要处理一下pattern("abd"将被处理成"ab")
var keyword = pattern.substring(pattern.length - 1, 0);

  foundNodeIds = this._serviceableNodeIds.filter(function (id) {
      return id.indexOf(keyword) === 0;
    });
//如果我 在poolCluster里面增加了两个连接配置,分别是"abc","abd",

    poolCluster.getConnection("abc",function(err, connection) {
//这里有可能返回"abd" 这个连接,这不科学啊。
}));