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. A very simple example could be like this: user enters 'dog AND biscuit' SQL statement created is like: SELECT * FROM TABLE1 WHERE (FIELD1 LIKE '%dog%' AND FIELD1 LIKE '%biscuit%') OR (FIELD2 LIKE '%dog%' AND FIELD2 LIKE '%biscuit%') Yes, I know that I can do the above very simply, but how about when the string contains multiple sections with AND, OR, NEAR, NOT? I think its difficult, so I am hoping someone else has already done it! A quick search on the lists hasn't revealed anything obvious. Regards Neil
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/
participants (2)
-
Neil Burnett -
Stuart Bishop