fix syntax bug
This commit is contained in:
parent
422be49b1a
commit
2501c2fd4d
|
@ -228,16 +228,19 @@ function wrap(db, dir, dbsMap) {
|
|||
|
||||
DB.find = function (obj, params) {
|
||||
var err;
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
if (undefined === obj[key]) {
|
||||
err = new Error("'" + key + "' was `undefined'. For security purposes you must explicitly set the value to null or ''");
|
||||
}
|
||||
});
|
||||
var sql = 'SELECT * FROM \'' + tablename + '\' ';
|
||||
var keys = obj && Object.keys(obj);
|
||||
|
||||
if (obj) {
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
if (undefined === obj[key]) {
|
||||
err = new Error("'" + key + "' was `undefined'. For security purposes you must explicitly set the value to null or ''");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (err) {
|
||||
return PromiseA.reject(err);
|
||||
}
|
||||
var sql = 'SELECT * FROM \'' + tablename + '\' ';
|
||||
var keys = obj && Object.keys(obj);
|
||||
|
||||
if (obj && keys.length) {
|
||||
sql += 'WHERE ';
|
||||
|
@ -255,7 +258,7 @@ function wrap(db, dir, dbsMap) {
|
|||
}
|
||||
});
|
||||
}
|
||||
else if (null !== obj1 || (params && !params.limit)) {
|
||||
else if (null !== obj || (params && !params.limit)) {
|
||||
return PromiseA.reject(new Error("to find all you must explicitly specify find(null, { limit: <<int>> })"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue