File tree Expand file tree Collapse file tree 2 files changed +20
-14
lines changed
src/main/java/net/sf/jsqlparser/statement Expand file tree Collapse file tree 2 files changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -197,17 +197,19 @@ public String toString() {
197197
198198 if (itemsList != null ) {
199199 sql .append (itemsList );
200+ }else {
201+ if (useSelectBrackets ) {
202+ sql .append ("(" );
203+ }
204+ if (select != null ) {
205+ sql .append (select );
206+ }
207+ if (useSelectBrackets ) {
208+ sql .append (")" );
209+ }
200210 }
201211
202- if (useSelectBrackets ) {
203- sql .append ("(" );
204- }
205- if (select != null ) {
206- sql .append (select );
207- }
208- if (useSelectBrackets ) {
209- sql .append (")" );
210- }
212+
211213
212214 if (useDuplicate ){
213215 sql .append (" ON DUPLICATE KEY UPDATE " );
Original file line number Diff line number Diff line change @@ -407,25 +407,29 @@ public static String getStringList(List<?> list) {
407407 * @return comma separated list of the elements in the list
408408 */
409409 public static String getStringList (List <?> list , boolean useComma , boolean useBrackets ) {
410- String ans = "" ;
410+ StringBuilder ans =new StringBuilder ();
411+ // String ans = "";
411412 String comma = "," ;
412413 if (!useComma ) {
413414 comma = "" ;
414415 }
415416 if (list != null ) {
416417 if (useBrackets ) {
417- ans += "(" ;
418+ ans .append ("(" );
419+ // ans += "(";
418420 }
419421
420422 for (int i = 0 ; i < list .size (); i ++) {
421- ans += "" + list .get (i ) + ((i < list .size () - 1 ) ? comma + " " : "" );
423+ ans .append (list .get (i )).append (((i < list .size () - 1 ) ? comma + " " : "" ));
424+ // ans += "" + list.get(i) + ((i < list.size() - 1) ? comma + " " : "");
422425 }
423426
424427 if (useBrackets ) {
425- ans += ")" ;
428+ ans .append (")" );
429+ // ans += ")";
426430 }
427431 }
428432
429- return ans ;
433+ return ans . toString () ;
430434 }
431435}
You can’t perform that action at this time.
0 commit comments