Skip to content

Commit

Permalink
add executeQuerySync to abe sql because plugin / hook need a sync ver…
Browse files Browse the repository at this point in the history
…sion of the method
  • Loading branch information
wonknu committed Sep 1, 2016
1 parent 26d3429 commit 256e0d6
Show file tree
Hide file tree
Showing 4 changed files with 300 additions and 276 deletions.
29 changes: 21 additions & 8 deletions dist/cli/helpers/abe-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,19 +358,32 @@ var Sql = function () {

return files;
}
}, {
key: 'execQuery',
value: function execQuery(path, match, jsonPage) {
var res = [];
var files = [];
var request = Sql.handleSqlRequest((0, _.getAttr)(match, 'source'), jsonPage);

files = Sql.executeFromClause(request.from, path);
files = Sql.executeOrderByClause(files, request.orderby);
res = Sql.executeWhereClause(files, request.where, request.limit, request.columns, jsonPage);

return res;
}
}, {
key: 'executeQuerySync',
value: function executeQuerySync(path, match, jsonPage) {
return Sql.execQuery(path, match, jsonPage);
}
}, {
key: 'executeQuery',
value: function executeQuery(path, match, jsonPage) {
var p = new _es6Promise.Promise(function (resolve, reject) {
var res = [];
var files = [];
var request = Sql.handleSqlRequest((0, _.getAttr)(match, 'source'), jsonPage);

files = Sql.executeFromClause(request.from, path);
files = Sql.executeOrderByClause(files, request.orderby);
res = Sql.executeWhereClause(files, request.where, request.limit, request.columns, jsonPage);

var res = Sql.execQuery(path, match, jsonPage);
resolve(res);
}).catch(function (e) {
console.error(e);
});

return p;
Expand Down
Loading

0 comments on commit 256e0d6

Please sign in to comment.