Hello I'm never using this sqlgroup parameter. Depending on your SQL dialect (I'm using Oracle), you can do something like this: SELECT columna FROM table WHERE columnb = NVL(<dtml-sqlvar columnb type=int optional>,columnb) OR columnc = NVL(<dtml-sqlvar columnc type=int optional>,columnc) So it will produce (when both columns are empty) SELECT columna FROM table WHERE columnb = columnb OR columnc = columnc which will give the same result as SELECT columna FROM table HTH Dieter
-----Ursprüngliche Nachricht----- Von: zope-admin@zope.org [mailto:zope-admin@zope.org]Im Auftrag von Skip Montanaro Gesendet am: Montag, 25. November 2002 20:02 An: zope@zope.org Betreff: [Zope] multiple optional args to zsql method?
I have this ZSQL method:
<params> id zope_username </params> select * from worker <dtml-sqlgroup where> <dtml-sqltest name="id" op="eq" type="int" optional> <dtml-or> <dtml-sqltest name="zope_username" op="eq" type="string" optional> </dtml-sqlgroup> ;
When I test it but give no parameters it executes this SQL:
select * from worker where zope_username = '' ;
Since neither id nor zope_username were given shouldn't it have executed
select * from worker ;
? I also tried using <dtml-and> instead of <dtml-or>. Same-o, Same-o.
In addition, if I call it as
context.sql.get_worker(zope_username=user.getUserName())
from a Python script, it complains "Invalid integer value for id".
I'm flummoxed.
-- Skip Montanaro - skip@pobox.com http://www.mojam.com/ http://www.musi-cal.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 )