|
@@ -16,7 +16,7 @@ us.mysqlconnection = function(host, database) {
|
|
// let port = host == '123.58.32.152' ? 20330 : 20007;
|
|
// let port = host == '123.58.32.152' ? 20330 : 20007;
|
|
us.sqle[host] = us.sqle[host] || {};
|
|
us.sqle[host] = us.sqle[host] || {};
|
|
us.sqle[host][database] = us.mysql.createPool({
|
|
us.sqle[host][database] = us.mysql.createPool({
|
|
- connectionLimit: 0,
|
|
|
|
|
|
+ connectionLimit: 1000000,
|
|
host: host, //数据库地址
|
|
host: host, //数据库地址
|
|
// host: '123.58.32.151', //数据库地址
|
|
// host: '123.58.32.151', //数据库地址
|
|
user: "root", //用户名
|
|
user: "root", //用户名
|
|
@@ -38,6 +38,7 @@ exports.usselect = function(param, callback) {
|
|
_mysqlconnection.getConnection(function(error, connection) { //获取连接
|
|
_mysqlconnection.getConnection(function(error, connection) { //获取连接
|
|
if (error) { //连接错误
|
|
if (error) { //连接错误
|
|
console.log("连接失败:", error);
|
|
console.log("连接失败:", error);
|
|
|
|
+ callback(error);
|
|
} else { //连接成功
|
|
} else { //连接成功
|
|
for (i = 0; i < param.length; i++) {
|
|
for (i = 0; i < param.length; i++) {
|
|
param[i] = decodeURIComponent(param[i]);
|
|
param[i] = decodeURIComponent(param[i]);
|
|
@@ -74,7 +75,10 @@ exports.usselect = function(param, callback) {
|
|
});
|
|
});
|
|
|
|
|
|
connection.release(function(error) { //释放资源
|
|
connection.release(function(error) { //释放资源
|
|
- if (error) console.log("连接释放错误", error);
|
|
|
|
|
|
+ if (error) {
|
|
|
|
+ console.log("连接释放错误", error)
|
|
|
|
+ callback(error);
|
|
|
|
+ };
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
}
|