Re: Escape character question
Re: Escape character question
- Subject: Re: Escape character question
- From: Sacha Michel Mallais <email@hidden>
- Date: Mon, 24 Oct 2005 12:21:11 -0700
On Oct 24, 2005, at 12:00 PM, Ismael Perdido wrote:
I am having trouble sending a 'like' operator query
from WO5.2.3 to Postgresql8 (also installed project
wonder). It apparently bombs on the escape character
being used by default ('\').
Is there a way to modify this character or work around
it WITHOUT having to use the EOAdaptorChannel to send
the SQL directly to the server? Below is the error.
Any advice would be greatly appreciated.
com.webobjects.jdbcadaptor.JDBCAdaptorException:
EvaluateExpression failed:
<com.webobjects.jdbcadaptor.JDBCExpression: "SELECT
t0.address, t0.city, t0.email1, t0.fullname,
t0.grade_id, t0.password, t0.phone1, RTRIM(t0.state),
t0.u_id, t0.zip FROM public.userinfo t0 WHERE
UPPER(t0.fullname) LIKE UPPER(?) ESCAPE '\'"
withBindings: 1:"%o%"(fullname)>:
Next exception:SQL State:42601 -- error code: 0 --
msg: ERROR: unterminated quoted string at or near
"'\'"
I'm not a Postgres expert, but it looks to me like it is not properly
quoting the column names, which causes problems when you have column
names that are the same as keywords, for example "password". One way
that I use to debug stuff like this is to copy and paste that SQL
directly into the SQL interpreter. Then you can quickly try various
permutations and see what's actually happening.
On a separate issue, it looks like you're using caseInsensitiveLike,
and it also looks like that ends up using UPPER. That will work but
it cannot use the index, so your query will be slower than you might
otherwise suspect.
sacha
--
Sacha Michel Mallais Senior Developer / President
Global Village Consulting Inc. http://www.global-village.net/
PGP Key ID: 7D757B65 AIM: smallais
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden