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() {
197
197
198
198
if (itemsList != null ) {
199
199
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
+ }
200
210
}
201
211
202
- if (useSelectBrackets ) {
203
- sql .append ("(" );
204
- }
205
- if (select != null ) {
206
- sql .append (select );
207
- }
208
- if (useSelectBrackets ) {
209
- sql .append (")" );
210
- }
212
+
211
213
212
214
if (useDuplicate ){
213
215
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) {
407
407
* @return comma separated list of the elements in the list
408
408
*/
409
409
public static String getStringList (List <?> list , boolean useComma , boolean useBrackets ) {
410
- String ans = "" ;
410
+ StringBuilder ans =new StringBuilder ();
411
+ // String ans = "";
411
412
String comma = "," ;
412
413
if (!useComma ) {
413
414
comma = "" ;
414
415
}
415
416
if (list != null ) {
416
417
if (useBrackets ) {
417
- ans += "(" ;
418
+ ans .append ("(" );
419
+ // ans += "(";
418
420
}
419
421
420
422
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 + " " : "");
422
425
}
423
426
424
427
if (useBrackets ) {
425
- ans += ")" ;
428
+ ans .append (")" );
429
+ // ans += ")";
426
430
}
427
431
}
428
432
429
- return ans ;
433
+ return ans . toString () ;
430
434
}
431
435
}
You can’t perform that action at this time.
0 commit comments