Yup...You're right. I found an item that had a single quote in it. I tried
it and the query blew up. then I added parts you suggest, and bingo...works
To get around another problem I noticed...
I have a keywords text field to search through everything in every category.
On the same page, I have links which pass on the category number to the ZSQL
The keywords FORM uses a hidden category field which I set to ="" -- worked
But if I used the URL to jump right to the category listings, there was no
keyword to pass.
I just set an empty property named 'keywords' and then if the URL search is
used, keywords has a 'value'.
I am sure there is a more elegant way to do this..but it works fine.
Thanks again guys!
From: Casey Duncan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 08, 2001 11:11 AM
To: Jens Vagelpohl
Cc: Schmidt, Allen J.; [EMAIL PROTECTED]
Subject: Re: [Zope-dev] ZSQL using LIKE operator
Jens Vagelpohl wrote:
> just write it out like:
> SELECT * FROM table WHERE keywords LIKE '%<dtml-var name="my_var">%'
> on 2/8/01 7:17, Schmidt, Allen J. at [EMAIL PROTECTED] wrote:
> > I have been through the docs, searched a variety of locations, and
> > find anything on how to resolve a query which I need to read:
> > SELECT * FROM table WHERE keywords LIKE '%keywords_variable%'
> > <dtml-sqltest> has 'op=like' and when set to 'type=string' produces the
> > operation in the query, with single quotes, but I cannot get it to
> > the keywords with the percent characters and THEN the single quotes to
> > produce that which I have in the query above.
> > Ideally what I need to produce would be the query to search through some
> > text in several fields by the keyword_variable (IF any keywords are
> > provided) AND/OR within a specific category of information. If I can
> > the syntax to solve the above situation I think I can get
> > sort out what information is provided and construct the query
> > Sorry for the length of this newbie question but I am stumped on this
> > And, so ends my lurking status.
> > Thanks!
> > Allen
SELECT * FROM table WHERE keywords LIKE '%<dtml-var name="my_var"
would be a safer bet. Otherwise a value of my_var with a single quote in
it wouldn't work.
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -