@@ -70,38 +70,44 @@ public String perform() {
7070 while ( tokens .hasMoreTokens () ) {
7171 token = tokens .nextToken ();
7272
73- if ( "-" .equals (token ) && result .toString ().endsWith ("-" ) ) {
73+ if ( "-" .equals ( token ) && result .toString ().endsWith ( "-" ) ) {
7474 do {
7575 result .append ( token );
7676 token = tokens .nextToken ();
7777 }
7878 while ( !"\n " .equals ( token ) && tokens .hasMoreTokens () );
7979 }
8080
81- lcToken = token .toLowerCase (Locale .ROOT );
82- switch (lcToken ) {
81+ lcToken = token .toLowerCase ( Locale .ROOT );
82+ switch ( lcToken ) {
8383
8484 case "'" :
8585 case "`" :
8686 case "\" " :
8787 String t ;
88+ StringBuilder sb = new StringBuilder ();
89+ sb .append ( this .token );
8890 do {
8991 t = tokens .nextToken ();
90- token += t ;
92+ sb . append ( t ) ;
9193 }
9294 while ( !lcToken .equals ( t ) && tokens .hasMoreTokens () );
95+ this .token = sb .toString ();
9396 lcToken = token ;
9497 misc ();
9598 break ;
9699 // SQL Server uses "[" and "]" to escape reserved words
97100 // see SQLServerDialect.openQuote and SQLServerDialect.closeQuote
98101 case "[" :
99102 String tt ;
103+ StringBuilder sb2 = new StringBuilder ();
104+ sb2 .append ( this .token );
100105 do {
101106 tt = tokens .nextToken ();
102- token += tt ;
107+ sb2 . append ( tt ) ;
103108 }
104109 while ( !"]" .equals ( tt ) && tokens .hasMoreTokens () );
110+ this .token = sb2 .toString ();
105111 lcToken = token ;
106112 misc ();
107113 break ;
@@ -238,7 +244,7 @@ private void from() {
238244 }
239245
240246 private void comma () {
241- if ( afterByOrSetOrFromOrSelect && inFunction == 0 ) {
247+ if ( afterByOrSetOrFromOrSelect && inFunction == 0 ) {
242248 commaAfterByOrFromOrSelect ();
243249 }
244250// else if ( afterOn && inFunction==0 ) {
@@ -313,7 +319,7 @@ private void beginCase() {
313319
314320 private void misc () {
315321 out ();
316- if ( afterInsert && inFunction == 0 ) {
322+ if ( afterInsert && inFunction == 0 ) {
317323 newline ();
318324 afterInsert = false ;
319325 }
@@ -329,7 +335,7 @@ private void white() {
329335 }
330336
331337 private void updateOrInsertOrDelete () {
332- if ( indent > 1 ) {
338+ if ( indent > 1 ) {
333339 //probably just the insert SQL function
334340 out ();
335341 }
@@ -367,7 +373,7 @@ private void select() {
367373
368374 private void out () {
369375 if ( result .charAt ( result .length () - 1 ) == ',' ) {
370- result .append (" " );
376+ result .append ( " " );
371377 }
372378 result .append ( token );
373379 }
@@ -507,7 +513,7 @@ private static boolean isWhitespace(String token) {
507513
508514 private void newline () {
509515 result .append ( System .lineSeparator () )
510- .append ( INDENT_STRING .repeat (indent ) );
516+ .append ( INDENT_STRING .repeat ( indent ) );
511517 beginLine = true ;
512518 }
513519 }
0 commit comments