int quoteIndex = s.indexOf('\''); while (quoteIndex >= 0) { s = s.substring(0, quoteIndex) + "''" + s.substring(quoteIndex + 1); quoteIndex = s.indexOf('\'', quoteIndex + 2); }
    private static String sqlQuote(String s) {        if (s == null) return "null";        return "'" + s + "'";    }