From: | Thomas O'Dowd <tom(at)nooper(dot)com> |
---|---|
To: | Chris White <cjwhite(at)cisco(dot)com> |
Cc: | Timothy Reaves <treaves(at)silverfields(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Escaping strings? |
Date: | 2002-11-04 03:31:46 |
Message-ID: | 1036380706.13828.37.camel@beast.uwillsee.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hmmm... I had no idea :) Actually, I just had a look at the driver code
behind setString(). It actually looks pretty similar to what I wrote
earlier and doesn't escape the '_' as far as I can see.
synchronized (sbuf)
{
sbuf.setLength(0);
sbuf.ensureCapacity(x.length());
int i;
sbuf.append('\'');
for (i = 0 ; i < x.length() ; ++i)
{
char c = x.charAt(i);
if (c == '\\' || c == '\'')
sbuf.append((char)'\\');
sbuf.append(c);
}
sbuf.append('\'');
bind(parameterIndex, sbuf.toString(), type);
}
Does the '_' need to be escaped? Why? If so, the driver code should be
updated I guess.
Tom.
On Mon, 2002-11-04 at 12:10, Chris White wrote:
> I think you also have to escape underscore(_).
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2002-11-04 03:56:11 | Re: [Solved] A result was returned by the statement, when none |
Previous Message | Chris White | 2002-11-04 03:10:39 | Re: Escaping strings? |