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/09 10:16:17 UTC

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

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



##########
File path: modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java
##########
@@ -230,12 +234,33 @@ public void start() {
                 plan = prepareSingle(qry0, pctx);
             }
 
+            checkQueryType(plan.type(), isQuery);
+
             cursors.add(executePlan(UUID.randomUUID(), pctx, plan));
         }
 
         return cursors;
     }
 
+    /**
+     * Check expected statement type (when it is set by JDBC) and given statement type.
+     *
+     * @param qryType Query type.
+     * @param isQuery {@code null} if not applicable, {@code true} for select queries,
+     *                           otherwise (DML/DDL queries) {@code false}.
+     */
+    private static void checkQueryType(Type qryType, Boolean isQuery) {
+        if (isQuery == null || qryType == Type.EXPLAIN) {
+            return;
+        }
+        if (isQuery && qryType != Type.QUERY) {
+            throw new IgniteInternalException("Given statement type does not match that declared by JDBC driver");

Review comment:
       Why does the error that is thrown from common executor module, refers to JDBC driver?




-- 
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