You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/26 18:46:58 UTC
[3/7] incubator-ignite git commit: #ignite-964: Add CacheQueryResult.
#ignite-964: Add CacheQueryResult.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1e61b51f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1e61b51f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1e61b51f
Branch: refs/heads/ignite-964
Commit: 1e61b51f6dbde16b12080e241deba49bd2070dc6
Parents: 10d3229
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jun 26 18:00:33 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jun 26 18:00:33 2015 +0300
----------------------------------------------------------------------
.../processors/rest/GridRestCommand.java | 5 +-
.../rest/handlers/query/CacheQueryResult.java | 115 +++++++++++++++++++
modules/nodejs/src/main/js/cache.js | 2 +-
3 files changed, 120 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e61b51f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
index dcc1699..3893eea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
@@ -106,7 +106,10 @@ public enum GridRestCommand {
EXECUTE_MAP_REDUCE_SCRIPT("excmapreduce"),
/** Execute sql query. */
- EXECUTE_SQL_QUERY("sqlqry");
+ EXECUTE_SQL_QUERY("qryexecute"),
+
+ /** Fetch query results. */
+ FETCH_SQL_QUERY("qryfetch");
/** Enum values. */
private static final GridRestCommand[] VALS = values();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e61b51f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
new file mode 100644
index 0000000..ede8a45
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.rest.handlers.query;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Client query result.
+ */
+public class CacheQueryResult implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Query ID. */
+ private long qryId;
+
+ /** Result items. */
+ private Collection<?> items;
+
+ /** Last flag. */
+ private boolean last;
+
+ /** Node ID. */
+ private UUID nodeId;
+
+ /**
+ * @return Query ID.
+ */
+ public long queryId() {
+ return qryId;
+ }
+
+ /**
+ * @param qryId Query ID.
+ */
+ public void queryId(long qryId) {
+ this.qryId = qryId;
+ }
+
+ /**
+ * @return Items.
+ */
+ public Collection<?> items() {
+ return items;
+ }
+
+ /**
+ * @param items Items.
+ */
+ public void items(Collection<?> items) {
+ this.items = items;
+ }
+
+ /**
+ * @return Last flag.
+ */
+ public boolean last() {
+ return last;
+ }
+
+ /**
+ * @param last Last flag.
+ */
+ public void last(boolean last) {
+ this.last = last;
+ }
+
+ /**
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ */
+ public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeBoolean(last);
+ out.writeLong(qryId);
+ U.writeUuid(out, nodeId);
+ U.writeCollection(out, items);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ last = in.readBoolean();
+ qryId = in.readLong();
+ nodeId = U.readUuid(in);
+ items = U.readCollection(in);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e61b51f/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 fcb3d49..cdbd6d4 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -144,7 +144,7 @@ Cache.prototype.query = function(qry) {
qry.end(res);
}
- this._server.runCommand("sqlqry", [
+ this._server.runCommand("qryexecute", [
Server.pair("cacheName", this._cacheName),
Server.pair("qry", qry.query()),
Server.pair("arg", qry.arguments()),