Created
December 10, 2018 17:59
-
-
Save phplaw/23688ca2c7b4ce575e2881cdcbff67d8 to your computer and use it in GitHub Desktop.
NodeJS development Tips & Tricks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const doQuery = function(db, sql, parameters) { | |
| if (parameters === void(0)) { | |
| parameters = []; | |
| } | |
| return new Promise(function(resolve, reject) { | |
| db.driver.execQuery(sql, parameters, function(err, result) { | |
| resolve(result); | |
| }); | |
| }); | |
| }; | |
| doQuery(db, 'SELECT * FROM users') | |
| .then(function (user) { | |
| return doQuery(db, 'SELECT * FROM parent') | |
| }) | |
| .then(function (parent) { | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment