You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/02/14 15:05:36 UTC

[GitHub] [ignite-3] korlov42 commented on a change in pull request #613: IGNITE-16268 JDBC. Validation of statement type should be done before its execution

korlov42 commented on a change in pull request #613:
URL: https://github.com/apache/ignite-3/pull/613#discussion_r805901291



##########
File path: modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/StatementMismatchException.java
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.sql.engine.exec;
+
+import org.apache.ignite.lang.IgniteInternalException;
+
+/**
+ * StatementMismatchException.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ */
+public class StatementMismatchException extends IgniteInternalException {

Review comment:
       Please, write a proper javadoc describing the purpose of this exception

##########
File path: modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteRequest.java
##########
@@ -110,9 +116,19 @@ public String schemaName() {
         return schemaName;
     }
 
+    /**
+     * Get the expected statement type.

Review comment:
       returns 

##########
File path: modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionService.java
##########
@@ -29,12 +29,13 @@
     /**
      * Executes a query.
      *
+     * @param isQuery Flag indicating that the expected type of request is a query.
      * @param schema Schema name.
      * @param query  Query.
      * @param params Query parameters.
      * @return Query cursor.
      */
-    List<SqlCursor<List<?>>> executeQuery(String schema, String query, Object[] params);
+    List<SqlCursor<List<?>>> executeQuery(Boolean isQuery, String schema, String query, Object[] params);

Review comment:
       let's introduce an enum instead of boolean flag

##########
File path: modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/ItJdbcStatementSelfTest.java
##########
@@ -718,8 +718,9 @@ public void testStatementTypeMismatchSelectForCachedQuery() throws Exception {
     }
 
     @Test
-    @Disabled("https://issues.apache.org/jira/browse/IGNITE-16268")
     public void testStatementTypeMismatchUpdate() throws Exception {
+        stmt.executeUpdate("update TEST set NAME='28' where ID=1");

Review comment:
       this update is hiding original problem

##########
File path: modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteRequest.java
##########
@@ -110,9 +116,19 @@ public String schemaName() {
         return schemaName;
     }
 
+    /**
+     * Get the expected statement type.
+     *
+     * @return Statement type.
+     */
+    public JdbcStatementType getStmtType() {
+        return stmtType;
+    }
+
     /** {@inheritDoc} */
     @Override
     public void writeBinary(ClientMessagePacker packer) {
+        packer.packByte((byte) stmtType.ordinal());

Review comment:
       Not the best decision to use ordinal outside the scope of single JVM




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org