Repository: incubator-ignite Updated Branches: refs/heads/ignite-961-promise 76f2e01d3 -> 895674726
#ignite-961-promise: add close method for query. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/89567472 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/89567472 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/89567472 Branch: refs/heads/ignite-961-promise Commit: 8956747267d2b28c264855c629530454f9826002 Parents: 76f2e01 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Tue Jul 14 17:22:40 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Tue Jul 14 17:22:40 2015 +0300 ---------------------------------------------------------------------- examples/src/main/js/cache-query-example.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/89567472/examples/src/main/js/cache-query-example.js ---------------------------------------------------------------------- diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js index 5edf118..2703464 100644 --- a/examples/src/main/js/cache-query-example.js +++ b/examples/src/main/js/cache-query-example.js @@ -68,7 +68,11 @@ main = function() { var fullRes = []; - function onPage(page, cursor) { + // Get query cursor. + var cursor = ignite.cache(cacheName).query(qry); + + // Get query's page. + return cursor.nextPage().then(function(cursor){ console.log(">>> Get result on page: " + JSON.stringify(page)); //Concat query page results. @@ -83,16 +87,10 @@ main = function() { } //Get Promise for next page. - var nextPromise = cursor.next(); - - return nextPromise.then(onQuery); - } + var nextPromise = cursor.next(); - // Get query cursor. - var cursor = ignite.cache(cacheName).query(qry); - - // Get query's page. - return cursor.nextPage().then(onQuery).then(function(){ + return nextPromise.then(onQuery); + }).then(function(){ console.log(">>> End of sql query example."); }); })