Re: Using LIKE with PostgreSQL
Re: Using LIKE with PostgreSQL
- Subject: Re: Using LIKE with PostgreSQL
- From: "Colin Shreffler" <email@hidden>
- Date: Wed, 10 Aug 2005 09:56:16 -0600 (MDT)
- Importance: Normal
Here is my code:
if(searchParam.objectForKey("lastName") != null)
searchParam.takeValueForKey(searchParam.objectForKey("lastName") +
"*", "lastName");
This seems pretty standard. Can you see any flaw in it?
-c
> Hi, Colin,
>
> I think the way you modified your code to add the '*' to the
> $lastName value is getting tangled up in escape levels. The JDBC
> adaptor is complaining about an "... unterminated quoted string at or
> near "'\'", which suggests that you are escaping something one too
> many or one too few times.
>
> Regards,
> Jerry
>
> On Aug 10, 2005, at 12:51 AM, Colin Shreffler wrote:
>
>> I am trying to create a simple LIKE query in EOModeler to run
>> against PostgreSQL. In EOModeler I have added a single qualifier:
>>
>> (lastName LIKE $lastName).
>>
>> I have also modified my code to insert an * after the value
>> before it is passed to EOF.
>>
>> I keep getting the error below. Can anyone tell me what Im doing
>> wrong?
>>
>> Error: com.webobjects.jdbcadaptor.JDBCAdaptorException:
>> EvaluateExpression failed: : Next exception:SQL State:42601 --
>> error code: 0 -- msg: ERROR: unterminated quoted string at or near
>> "'\' ORDER BY t0.last_name ASC"
>> Reason: EvaluateExpression failed:
>> <com.webobjects.jdbcadaptor.JDBCExpression: "SELECT
>> t0.customer_contact_id, t0.customer_fid, RTRIM(t0.email), RTRIM
>> (t0.fax), RTRIM(t0.first_name), RTRIM(t0.home_phone), RTRIM
>> (t0.last_name), RTRIM(t0.mobile_phone), t0.salutation_fid, RTRIM
>> (t0.work_phone) FROM customer_contact t0 WHERE UPPER(t0.last_name)
>> LIKE UPPER(?) ESCAPE '\' ORDER BY t0.last_name ASC" withBindings:
>> 1:"Shr%"(lastName)>: Next exception:SQL State:42601 -- error code:
>> 0 -- msg: ERROR: unterminated quoted string at or near "'\' ORDER
>> BY t0.last_name ASC"
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40codefab.com
>>
>> This email sent to email@hidden
>
>
> --
> __ Jerry W. Walker, Partner
> C o d e F a b, LLC - "High Performance Industrial Strength
> Internet Enabled Systems"
> email@hidden
> 212 465 8484 X-102 office
> 212 465 9178 fax
>
>
>
Thank you,
Colin Shreffler
Principal
303.349.9010 - cell
928.396.1099 - fax
email@hidden
Warp 9 Software, LLC.
6791 Halifax Avenue
Castle Rock, CO 80104
Confidentiality Notice: The information in this e-mail may be confidential
and/or privileged. This e-mail is intended to be reviewed by only the
individual or organization named in the e-mail address. If you are not the
intended recipient, you are hereby notified that any review, dissemination
or copying of this e-mail and attachments, if any, or the information
contained herein, is strictly prohibited.
_______________________________________________
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