Created
September 19, 2012 21:31
-
-
Save durango/3752407 to your computer and use it in GitHub Desktop.
QueryChainer - adding custom classMethods with complex queries [example]
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
| // This is in classMethods: | |
| a_method: function(id, order_id) { | |
| var query1 = s.Utils.format(['query goes here...']); | |
| var query2 = s.Utils.format(['query goes here....']); | |
| return new s.Utils.CustomEventEmitter(function(emitter) { | |
| db.query(query1, null, {raw:true}).success(function(row1){ | |
| db.query(query2, null, {raw:true}).success(function(row2){ | |
| emitter.emit('success', {results1: row1, results2: row2}); | |
| }); | |
| }); | |
| }).run(); | |
| }, | |
| // .... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment