Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function qDB1(status_id) {
- return KnexDB1
- .select()
- .from('table1')
- .where({
- status: status_id
- })
- .orderBy('date')
- .catch(function(err) {
- console.log(err);
- });
- }
- function qDB2 () {
- var dateStart=Moment().format('L');
- var dateEnd=Moment().add(1, 'days').format('L');
- return KnexImc
- .raw("EXEC SP_DB2 'QU', '"+dateStart+"','"+dateEnd+"'")
- .catch(function(err) {
- console.log(err);
- });
- }
- QueryRepo.prototype.select = function(status_id) {
- if ( !status_id) {
- status_id=1;
- }
- var results = [];
- qDB1(status_id)
- .then(function (res) {
- for(var idx = 0; idx < res.length; idx++){
- console.log(res[idx]);
- results.push(res[idx]);
- }
- });
- qDB2()
- .then(function (res) {
- for(var idx2 = 0; idx2 < res.length; idx2++){
- console.log(res[idx2]);
- results.push(res[idx2]);
- }
- });
- return Promise.all(results);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement