@@ -124,6 +124,7 @@ public static void splitSqlScript(String resource, String script, String separat
124124 Character currentLiteralDelimiter = null ;
125125
126126 int compoundStatementDepth = 0 ;
127+ final String lowerCaseScriptContent = script .toLowerCase ();
127128 char [] content = script .toCharArray ();
128129 for (int i = 0 ; i < script .length (); i ++) {
129130 char c = content [i ];
@@ -148,24 +149,24 @@ public static void splitSqlScript(String resource, String script, String separat
148149 }
149150 final boolean inLiteral = currentLiteralDelimiter != null ;
150151
151- if (!inLiteral && containsSubstringAtOffset (script , commentPrefix , i )) {
152+ if (!inLiteral && containsSubstringAtOffset (lowerCaseScriptContent , commentPrefix , i )) {
152153 inLineComment = true ;
153154 }
154155 if (inLineComment && c == '\n' ) {
155156 inLineComment = false ;
156157 }
157- if (!inLiteral && containsSubstringAtOffset (script , blockCommentStartDelimiter , i )) {
158+ if (!inLiteral && containsSubstringAtOffset (lowerCaseScriptContent , blockCommentStartDelimiter , i )) {
158159 inBlockComment = true ;
159160 }
160- if (!inLiteral && inBlockComment && containsSubstringAtOffset (script , blockCommentEndDelimiter , i )) {
161+ if (!inLiteral && inBlockComment && containsSubstringAtOffset (lowerCaseScriptContent , blockCommentEndDelimiter , i )) {
161162 inBlockComment = false ;
162163 }
163164 final boolean inComment = inLineComment || inBlockComment ;
164165
165- if (!inLiteral && !inComment && containsSubstringAtOffset (script , "BEGIN" , i )) {
166+ if (!inLiteral && !inComment && containsSubstringAtOffset (lowerCaseScriptContent , "BEGIN" , i )) {
166167 compoundStatementDepth ++;
167168 }
168- if (!inLiteral && !inComment && containsSubstringAtOffset (script , "END" , i )) {
169+ if (!inLiteral && !inComment && containsSubstringAtOffset (lowerCaseScriptContent , "END" , i )) {
169170 compoundStatementDepth --;
170171 }
171172 final boolean inCompoundStatement = compoundStatementDepth != 0 ;
@@ -222,8 +223,7 @@ else if (c == ' ' || c == '\n' || c == '\t') {
222223 }
223224 }
224225
225- private static boolean containsSubstringAtOffset (String string , String substring , int offset ) {
226- String lowercaseString = string .toLowerCase ();
226+ private static boolean containsSubstringAtOffset (String lowercaseString , String substring , int offset ) {
227227 String lowercaseSubstring = substring .toLowerCase ();
228228
229229 return lowercaseString .startsWith (lowercaseSubstring , offset );
0 commit comments