Hello,
In looking around for a way to insert entries via html for via JDBC
containing single quotes I came upon this:
escapeQuotes
protected java.lang.String escapeQuotes(java.lang.String old)
Tokenizes the original string with \' and \" as delimiters, then
replaces them with \\\' and \\\", respectively. This is primarily useful
for escaping quotes that will be interpreted as part of a mySQL query.
Is there a method like this that is callable for Postgresql JDBC driver
too?
I also found this method
private String escape(String s) {
String retvalue = s;
if ( s.indexOf ("'") != -1 ) {
StringBuffer hold = new StringBuffer();
char c;
for ( int i = 0; i < s.length(); i++ ) {
if ( (c=s.charAt(i)) == '\'' )
hold.append ("''");
else
hold.append(c);
}
retvalue = hold.toString();
}
return retvalue;
}
Not being a java god - where do I insert this in my jsp code? Each form
has several fields where single quotes may be inserted.
TIA
Cheers
Tony Grant
--