How should I do to use 'like' with ZSql Method? Similar to the example: Ex.: SELECT field1 FROM table WHERE field2 LIKE '%test%' I tryed this: --> arq is an argument select field1 from table where field2 like '%<dtml-sqlvar arg type=string>%' Then I get this: select field1 from table where field2 like '%'agx'%' I need to put the char '%' with the var. Thanks. -- --Ricardo Kohler Costa ________________________________________________ Don't E-Mail, ZipMail! http://www.zipmail.com/
Try SELECT field1 FROM table WHERE field2 LIKE '%'+<dtml-sqlvar arg type=string>+'%' (I haven't tested this). Or use <dtml-var> instead of <dtml-sqlvar>. Tom P [After Dark] How should I do to use 'like' with ZSql Method? Similar to the example: Ex.: SELECT field1 FROM table WHERE field2 LIKE '%test%' I tryed this: --> arq is an argument select field1 from table where field2 like '%<dtml-sqlvar arg type=string>%' Then I get this: select field1 from table where field2 like '%'agx'%' I need to put the char '%' with the var.
I'm not sure if it'll work but you don't have to be afraid of testing it. And it works fine in <dtml-var <dtml-sqlvar "'%%%s%%'%arg" type="string"> A mess? but pending on that you have a monspacy fonttype you'll see what it says. Peter ----- Original Message ----- From: "After Dark" <afterz@zipmail.com> To: <zope@zope.org> Sent: Friday, June 08, 2001 7:59 PM Subject: [Zope] ZSql Method with like.
How should I do to use 'like' with ZSql Method? Similar to the example:
Ex.: SELECT field1 FROM table WHERE field2 LIKE '%test%'
I tryed this: --> arq is an argument
select field1 from table where field2 like '%<dtml-sqlvar arg type=string>%'
Then I get this: select field1 from table where field2 like '%'agx'%' I need to put the char '%' with the var.
Thanks.
-- --Ricardo Kohler Costa ________________________________________________ Don't E-Mail, ZipMail! http://www.zipmail.com/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
After Dark -
Peter Bengtsson -
Thomas B. Passin