jamesfredley commented on code in PR #16719:
URL: https://github.com/apache/grails-core/pull/16719#discussion_r4408367124


##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/HqlQueryContext.java:
##########
@@ -184,6 +184,42 @@ static Class<?> getTarget(CharSequence hql, Class<?> 
clazz) {
         };
     }
 
+    /** Unwraps only parentheses enclosing the whole query for analysis, 
without changing the executed HQL. */
+    private static @Nullable String unwrapRootQuery(@Nullable String hql) {
+        if (hql == null) return null;
+        String s = hql.trim();
+        while (s.startsWith("(") && s.endsWith(")")) {
+            int depth = 0;
+            int closing = -1;
+            int i = 0;
+            while (i < s.length()) {
+                char c = s.charAt(i);
+                if (c == '\'' || c == '"' || c == '`') {
+                    i = SqlRestriction.skipQuoted(s, i, c);

Review Comment:
   @C:\Users\james\AppData\Local\Temp\reply-hql-skip.txt



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to