question: public static String quoteStringSQL ( String s ) { if ( s == null ) { return "NULL" ; } int length = s . length ( ) ; StringBuilder buff = new StringBuilder ( length + 2 ) ; buff . append ( '\'' ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\'' ) { buff . append ( c ) ; } else if ( c < ' ' || c > 127 ) { return "STRINGDECODE(" + quoteStringSQL ( javaEncode ( s ) ) + ")" ; } buff . append ( c ) ; } buff . append ( '\'' ) ; return buff . toString ( ) ; }
target:  Convert a string to a SQL literal. Null is converted to NULL. The text is enclosed in single quotes. If there are any special characters, the method STRINGDECODE is used.