ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/4] incubator-ignite git commit: #ignite-964: wip.
Date Thu, 25 Jun 2015 15:58:20 GMT
#ignite-964: wip.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/414022ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/414022ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/414022ed

Branch: refs/heads/ignite-964
Commit: 414022edfb12760ae7c6a72ed81c2cc46c6b2541
Parents: 1c3d406
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Jun 25 17:55:25 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Jun 25 17:55:25 2015 +0300

----------------------------------------------------------------------
 .../processors/rest/GridRestCommand.java        |  5 +-
 .../rest/request/RestSqlQueryRequest.java       | 57 ++++++++++++++++++++
 modules/nodejs/src/main/js/cache.js             | 11 +++-
 .../http/jetty/GridJettyRestHandler.java        |  5 ++
 4 files changed, 75 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/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 f4d92b7..dcc1699 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
@@ -103,7 +103,10 @@ public enum GridRestCommand {
     RUN_SCRIPT("runscript"),
 
     /** Execute map reduce script. */
-    EXECUTE_MAP_REDUCE_SCRIPT("excmapreduce");
+    EXECUTE_MAP_REDUCE_SCRIPT("excmapreduce"),
+
+    /** Execute sql query. */
+    EXECUTE_SQL_QUERY("sqlqry");
 
     /** Enum values. */
     private static final GridRestCommand[] VALS = values();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
new file mode 100644
index 0000000..4d74626
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.request;
+
+/**
+ * Sql query request.
+ */
+public class RestSqlQueryRequest extends GridRestRequest {
+    /** Sql query. */
+    private String sqlQry;
+
+    /** Sql query arguments. */
+    private Object[] args;
+
+    /**
+     * @param sqlQry Sql query.
+     */
+    public void sqlQuery(String sqlQry) {
+        this.sqlQry = sqlQry;
+    }
+
+    /**
+     * @return Sql query.
+     */
+    public String sqlQuery() {
+        return sqlQry;
+    }
+
+    /**
+     * @param args Sql query arguments.
+     */
+    public void arguments(Object[] args) {
+        this.args = args;
+    }
+
+    /**
+     * @return Sql query arguments.
+     */
+    public Object[] arguments() {
+        return args;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/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 ae76dab..9333254 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -128,8 +128,15 @@ Cache.prototype.getAll = function(keys, callback) {
     this._server.runCommand("getall", params, callback);
 }
 
-Cache.prototype.query = function(qry, callback) {
-    this._server.runCommand("sqlqry", [Server.pair("qry", qry)])
+/**
+ * Execute sql query
+ *
+ * @param {string} qry Query
+ * @param {string[]} arg Arguments
+ * @param {onGet} callback Callback.
+ */
+Cache.prototype.query = function(qry, arg, callback) {
+    this._server.runCommand("sqlqry", [Server.pair("qry", qry), Server.pair("arg", arg)],
callback);
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index b669bdd..8b2c79c 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -471,6 +471,11 @@ public class GridJettyRestHandler extends AbstractHandler {
                 break;
             }
 
+            case EXECUTE_SQL_QUERY: {
+                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+
+            }
+
             default:
                 throw new IgniteCheckedException("Invalid command: " + cmd);
         }


Mime
View raw message