| 322 | // Escape the $ so that we can use the parameter substitution |
| 323 | // to perform bind operation. Parameter substitution will un-escape $ |
| 324 | private static String fixNonEscapedDollarSign(String s) { |
| 325 | String[] tkns = s.split("\\$", -1); |
| 326 | |
| 327 | if (tkns.length == 1) return s; |
| 328 | |
| 329 | StringBuilder sb = new StringBuilder(); |
| 330 | |
| 331 | for (int i = 0; i < tkns.length -1; i++) { |
| 332 | if (tkns[i].isEmpty()) { |
| 333 | sb.append("\\\\"); |
| 334 | } else { |
| 335 | sb.append(tkns[i]); |
| 336 | if (tkns[i].charAt(tkns[i].length()-1) != '\\') { |
| 337 | sb.append("\\\\"); |
| 338 | } |
| 339 | } |
| 340 | sb.append("$"); |
| 341 | } |
| 342 | sb.append(tkns[tkns.length - 1]); |
| 343 | |
| 344 | return sb.toString(); |
| 345 | } |
| 346 | |
| 347 | //------------------------------------------------------------------------- |
| 348 | |