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 .