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) {
|
DB.find = function (obj, params) {
|
||||||
var err;
|
var err;
|
||||||
Object.keys(obj).forEach(function (key) {
|
var sql = 'SELECT * FROM \'' + tablename + '\' ';
|
||||||
if (undefined === obj[key]) {
|
var keys = obj && Object.keys(obj);
|
||||||
err = new Error("'" + key + "' was `undefined'. For security purposes you must explicitly set the value to null or ''");
|
|
||||||
}
|
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) {
|
if (err) {
|
||||||
return PromiseA.reject(err);
|
return PromiseA.reject(err);
|
||||||
}
|
}
|
||||||
var sql = 'SELECT * FROM \'' + tablename + '\' ';
|
|
||||||
var keys = obj && Object.keys(obj);
|
|
||||||
|
|
||||||
if (obj && keys.length) {
|
if (obj && keys.length) {
|
||||||
sql += 'WHERE ';
|
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>> })"));
|
return PromiseA.reject(new Error("to find all you must explicitly specify find(null, { limit: <<int>> })"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue