@@ -296,17 +296,6 @@ else if (c == ' ' || c == '\r' || c == '\n' || c == '\t') {
296
296
}
297
297
}
298
298
299
- /**
300
- * Read a script from the given resource, using "{@code --}" as the comment prefix
301
- * and "{@code ;}" as the statement separator, and build a String containing the lines.
302
- * @param resource the {@code EncodedResource} to be read
303
- * @return {@code String} containing the script lines
304
- * @throws IOException in case of I/O errors
305
- */
306
- static String readScript (EncodedResource resource ) throws IOException {
307
- return readScript (resource , DEFAULT_COMMENT_PREFIXES , DEFAULT_STATEMENT_SEPARATOR , DEFAULT_BLOCK_COMMENT_END_DELIMITER );
308
- }
309
-
310
299
/**
311
300
* Read a script from the provided resource, using the supplied comment prefixes
312
301
* and statement separator, and build a {@code String} containing the lines.
@@ -315,15 +304,15 @@ static String readScript(EncodedResource resource) throws IOException {
315
304
* within a statement — will be included in the results.
316
305
* @param resource the {@code EncodedResource} containing the script
317
306
* to be processed
307
+ * @param separator the statement separator in the SQL script (typically ";")
318
308
* @param commentPrefixes the prefixes that identify comments in the SQL script
319
309
* (typically "--")
320
- * @param separator the statement separator in the SQL script (typically ";")
321
310
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter
322
311
* @return a {@code String} containing the script lines
323
312
* @throws IOException in case of I/O errors
324
313
*/
325
- private static String readScript (EncodedResource resource , @ Nullable String [] commentPrefixes ,
326
- @ Nullable String separator , @ Nullable String blockCommentEndDelimiter ) throws IOException {
314
+ static String readScript (EncodedResource resource , @ Nullable String separator ,
315
+ @ Nullable String [] commentPrefixes , @ Nullable String blockCommentEndDelimiter ) throws IOException {
327
316
328
317
try (LineNumberReader lnr = new LineNumberReader (resource .getReader ())) {
329
318
return readScript (lnr , commentPrefixes , separator , blockCommentEndDelimiter );
@@ -339,18 +328,18 @@ private static String readScript(EncodedResource resource, @Nullable String[] co
339
328
* a statement — will be included in the results.
340
329
* @param lineNumberReader the {@code LineNumberReader} containing the script
341
330
* to be processed
342
- * @param lineCommentPrefix the prefix that identifies comments in the SQL script
331
+ * @param commentPrefix the prefix that identifies comments in the SQL script
343
332
* (typically "--")
344
333
* @param separator the statement separator in the SQL script (typically ";")
345
334
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter
346
335
* @return a {@code String} containing the script lines
347
336
* @throws IOException in case of I/O errors
348
337
*/
349
- public static String readScript (LineNumberReader lineNumberReader , @ Nullable String lineCommentPrefix ,
338
+ public static String readScript (LineNumberReader lineNumberReader , @ Nullable String commentPrefix ,
350
339
@ Nullable String separator , @ Nullable String blockCommentEndDelimiter ) throws IOException {
351
340
352
- String [] lineCommentPrefixes = (lineCommentPrefix != null ) ? new String [] { lineCommentPrefix } : null ;
353
- return readScript (lineNumberReader , lineCommentPrefixes , separator , blockCommentEndDelimiter );
341
+ String [] commentPrefixes = (commentPrefix != null ) ? new String [] { commentPrefix } : null ;
342
+ return readScript (lineNumberReader , commentPrefixes , separator , blockCommentEndDelimiter );
354
343
}
355
344
356
345
/**
@@ -362,22 +351,22 @@ public static String readScript(LineNumberReader lineNumberReader, @Nullable Str
362
351
* within a statement — will be included in the results.
363
352
* @param lineNumberReader the {@code LineNumberReader} containing the script
364
353
* to be processed
365
- * @param lineCommentPrefixes the prefixes that identify comments in the SQL script
354
+ * @param commentPrefixes the prefixes that identify comments in the SQL script
366
355
* (typically "--")
367
356
* @param separator the statement separator in the SQL script (typically ";")
368
357
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter
369
358
* @return a {@code String} containing the script lines
370
359
* @throws IOException in case of I/O errors
371
360
* @since 5.2
372
361
*/
373
- public static String readScript (LineNumberReader lineNumberReader , @ Nullable String [] lineCommentPrefixes ,
362
+ public static String readScript (LineNumberReader lineNumberReader , @ Nullable String [] commentPrefixes ,
374
363
@ Nullable String separator , @ Nullable String blockCommentEndDelimiter ) throws IOException {
375
364
376
365
String currentStatement = lineNumberReader .readLine ();
377
366
StringBuilder scriptBuilder = new StringBuilder ();
378
367
while (currentStatement != null ) {
379
368
if ((blockCommentEndDelimiter != null && currentStatement .contains (blockCommentEndDelimiter )) ||
380
- (lineCommentPrefixes != null && !startsWithAny (currentStatement , lineCommentPrefixes , 0 ))) {
369
+ (commentPrefixes != null && !startsWithAny (currentStatement , commentPrefixes , 0 ))) {
381
370
if (scriptBuilder .length () > 0 ) {
382
371
scriptBuilder .append ('\n' );
383
372
}
@@ -642,7 +631,7 @@ public static void executeSqlScript(Connection connection, EncodedResource resou
642
631
643
632
String script ;
644
633
try {
645
- script = readScript (resource , commentPrefixes , separator , blockCommentEndDelimiter );
634
+ script = readScript (resource , separator , commentPrefixes , blockCommentEndDelimiter );
646
635
}
647
636
catch (IOException ex ) {
648
637
throw new CannotReadScriptException (resource , ex );
0 commit comments