#ignite-961-promise: add Javadoc for query cursor.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/82d15a00 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/82d15a00 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/82d15a00 Branch: refs/heads/ignite-961-promise Commit: 82d15a00df16231d0035acde46691dd322ef31f8 Parents: 5150d39 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Tue Jul 14 17:42:57 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Tue Jul 14 17:42:57 2015 +0300 ---------------------------------------------------------------------- modules/nodejs/src/main/js/cache.js | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/82d15a00/modules/nodejs/src/main/js/cache.js ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 92acc2b..bbd3455 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -266,10 +266,10 @@ Cache.prototype.size = function(callback) { * Execute sql query * * @param {SqlQuery|SqlFieldsQuery} qry Query - * @returns {Cursor} Cursor for current query. + * @returns {QueryCursor} Cursor for current query. */ Cache.prototype.query = function(qry) { - return new Cursor(this, qry, true, null); + return new QueryCursor(this, qry, true, null); } Cache.prototype.__createPromise = function(cmd) { @@ -294,16 +294,16 @@ Cache.prototype._createCommand = function(name) { } /** - * Creates an instance of Cursor + * Creates an instance of QueryCursor * * @constructor - * @this {Cursor} + * @this {QueryCursor} * @param {Cache} cache Cache that runs query * @param {SqlQuery|SqlFieldsQuery} qry Sql query * @param {boolean} init True if query is not started * @param {Object[]} res Current page result */ -Cursor = function(cache, qry, init, res) { +QueryCursor = function(cache, qry, init, res) { this._qry = qry; this._cache = cache; this._init = first; @@ -318,10 +318,10 @@ Cursor = function(cache, qry, init, res) { * Since all the results will be fetched, all the resources will be closed * automatically after this call, e.g. there is no need to call close() method in this case. * - * @this{Cursor} + * @this{QueryCursor} * @returns {Promise} Promise with query result */ -Cursor.prototype.getAll = function() { +QueryCursor.prototype.getAll = function() { if (!this._init) { return new Promise(function(resolve, reject){ reject("GetAll is called after nextPage."); @@ -360,10 +360,10 @@ Cursor.prototype.getAll = function() { /** * Gets Promise with Cursor on next page of the query results. * - * @this{Cursor} + * @this{QueryCursor} * @returns {Promise} Promise with Cursor on next page */ -Cursor.prototype.nextPage = function() { +QueryCursor.prototype.nextPage = function() { if (this._res !== null && this._res["last"]) { throw "All pages are returned."; } @@ -389,10 +389,10 @@ Cursor.prototype.nextPage = function() { /** * Gets collections of the query page results. * - * @this{Cursor} + * @this{QueryCursor} * @returns {Object[]} Query page result. */ -Cursor.prototype.page = function() { +QueryCursor.prototype.page = function() { if (this._res === null) return null; @@ -402,10 +402,10 @@ Cursor.prototype.page = function() { /** * Closes all resources related to this cursor. * - * @this{Cursor} + * @this{QueryCursor} * @returns {Promise} Promise on cursor close. */ -Cursor.prototype.close = function() { +QueryCursor.prototype.close = function() { if (this._init) { return new Promise(function(resolve, reject) { return resolve(true); @@ -430,17 +430,17 @@ Cursor.prototype.close = function() { /** * Returns True if the iteration has no more elements. * - * @this{Cursor} + * @this{QueryCursor} * @returns {boolean} True if it is the last page */ -Cursor.prototype.isFinished = function() { +QueryCursor.prototype.isFinished = function() { if (this._res === null) return false; return this._res["last"]; } -Cursor.prototype._getQueryCommand = function() { +QueryCursor.prototype._getQueryCommand = function() { if (this._init) { if (this._qry.type() === "Sql") { return this._sqlQuery(this._qry); @@ -455,17 +455,17 @@ Cursor.prototype._getQueryCommand = function() { addParam("psz", this._qry.pageSize()); } -Cursor.prototype._sqlFieldsQuery = function(qry) { +QueryCursor.prototype._sqlFieldsQuery = function(qry) { return this._createQueryCommand("qryfieldsexecute", qry). setPostData(JSON.stringify({"arg" : qry.arguments()})); } -Cursor.prototype._sqlQuery = function(qry) { +QueryCursor.prototype._sqlQuery = function(qry) { return this._createQueryCommand("qryexecute", qry).addParam("type", qry.returnType()). setPostData(JSON.stringify({"arg" : qry.arguments()})); } -Cursor.prototype._createQueryCommand = function(name, qry) { +QueryCursor.prototype._createQueryCommand = function(name, qry) { return new Command(name).addParam("cacheName", this._cache._cacheName). addParam("qry", qry.query()).addParam("psz", qry.pageSize()); }