Commit 2a7a5a8a authored by Leon Li's avatar Leon Li

Update query.js

parent 18e7d196
...@@ -18,19 +18,8 @@ try { ...@@ -18,19 +18,8 @@ try {
if (!_.isString(func)) throw "func must be a string!"; if (!_.isString(func)) throw "func must be a string!";
if (!_.isArray(paras)) throw "paras must be an array!"; if (!_.isArray(paras)) throw "paras must be an array!";
ver = DB.query(DBNAME, function (q) { var r = DB.query(DBNAME, function (q) {
var para_count = paras.length; var r = q[func].apply(q, paras);
if (para_count === 0) {
r = q[func]();
} else if (para_count === 1) {
r = q[func](paras[0]);
} else if (para_count === 2) {
r = q[func](paras[0], paras[1]);
} else if (para_count === 3) {
r = q[func](paras[0], paras[1], paras[2]);
} else {
throw "only support 3 paras.";
}
if (q.lastError().isValid()) throw q.lastError().text(); if (q.lastError().isValid()) throw q.lastError().text();
return r; return r;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment