public static void appendEscapedSQLString(StringBuilder sb,String sqlString){
  sb.append('\'');
  if (sqlString.indexOf('\'') != -1) {
    int length=sqlString.length();
    for (int i=0; i < length; i++) {
      char c=sqlString.charAt(i);
      if (c == '\'') {
        sb.append('\'');
      }
      sb.append(c);
    }
  }
 else {
    sb.append(sqlString);
  }
  sb.append('\'');
}

public static void appendEscapedSQLString ( StringBuilder sb , String sqlString ) { sb . append ( '\'' ) ; if ( sqlString . indexOf ( '\'' ) != - 1 ) { int length = sqlString . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = sqlString . charAt ( i ) ; if ( c == '\'' ) { sb . append ( '\'' ) ; } sb . append ( c ) ; } } else { sb . append ( sqlString ) ; } sb . append ( '\'' ) ; }
appends an sql string to the given stringbuilder , including the opening and closing single quotes . any single quotes internal to sqlstring will be escaped . this method is deprecated because we want to encourage everyone to use the " ? " binding form . however , when implementing a contentprovider , one may want to add where clauses that were not provided by the caller . since " ? " is a positional form , using it in this case could break the caller because the indexes would be shifted to accomodate the contentprovider ' s internal bindings . in that case , it may be necessary to construct a where clause manually . this method is useful for those cases .
