File tree Expand file tree Collapse file tree
main/java/org/sap/cytoscape/internal/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public static String toStrNull(Object obj){
2121 * @return Quoted String
2222 */
2323 public static String quoteIdentifier (String id ){
24- return '"' + id + '"' ;
24+ return '"' + id . replace ( " \" " , " \" \" " ) + '"' ;
2525 }
2626
2727 /**
Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ public void testQuoteIdentifier_emptyString() {
3737 Assert .assertEquals ("\" \" " , HanaUtils .quoteIdentifier ("" ));
3838 }
3939
40+ @ Test
41+ public void testQuoteIdentifier_containsDoubleQuote () {
42+ // An embedded " must be escaped as "" per SQL standard identifier quoting.
43+ // Without escaping, foo"bar produces "foo"bar" which breaks out of the identifier.
44+ Assert .assertEquals ("\" foo\" \" bar\" " , HanaUtils .quoteIdentifier ("foo\" bar" ));
45+ }
46+
4047 // -------------------------------------------------------------------------
4148 // isCloudEdition
4249 // -------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments