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/10 12:20:52 UTC

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

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



##########
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:
       I refactored error handling and moved all JDBC related messages to JdbcQueryEventHandler. Thnx.




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