[Zope] A ZSQL Method to do it like Google?

Stuart Bishop zen@shangri-la.dropbear.id.au
Wed, 13 Feb 2002 15:29:08 +1100


On Monday, February 11, 2002, at 11:37  PM, Neil Burnett wrote:

> Dear Zopers
>
> I wonder if anyone has a ZSQL Method that will take a single text 
> string,
> parse it for 'AND' and 'OR' then create the appropriate sql statement.

Try the following:

SELECT * FROM TABLE1
WHERE
	<dtml-in args prefix=seq>
		<dtml-unless seq_first>
			AND
		</dtml-unless>
		FIELD1 LIKE '%' || <dtml-sqlvar seq_item type=nb> || '%'
	</dtml-in>

The  trick is to get the arguments quoted properly so your
method does what you expect if passed [ "Don't doit!" ].

--
Stuart Bishop <zen@shangri-la.dropbear.id.au>
http://shangri-la.dropbear.id.au/