[Zope] SQL Methods and namespace question
Rik Hoekstra
hoekstra@fsw.leidenuniv.nl
Thu, 16 Dec 1999 10:09:41 +0100
Ulrich Wisser wrote:
>
> Hi Rik,
>
> > Perhaps I could help you a bit with your question
> >
> > > I tried an argument arg:int=0 and in SQL
> >
> > Where did you put the arg:int=0? I can't think of a place where this would
> > be valid as such.
> > What is your intention with this method?
>
> in the argument list of the ZSQL method. So the
> method should import arg from REQUEST and if
> there isn't any "arg" value in the Request arg
> should be set to 0.
>
> > > SELECT * FROM DATA
> > > <dtml-sqlgroup where>
> > > <dtml-if arg>
If you want to exclude arg if it is 0 this tag should read
<dtml-if "arg and arg<>0">
if you want to leave arg unset, just don't pass it to you SQL method
(either in your form or otherwise)
> > > <dtm-sqltest arg type=int>
according to the sql documentation sqltest is used for testing against
sql values not against variables in the current namespace, though I've
neve used it myself, so I may be mistaken (the documentation is not
overly clear)
> > > </dtml-if>
> > > </dtml-sqlgroup>
> > >
> > > and I always get
> > >
> > > SELECT * FROM DATA WHERE ARG=0
> > >
> > > Shouldn't that be impossible?
> >
> > Not per se.
>
> When arg is 0, how can <dtm-if arg> evaluate
> it to true?
Because there is a variable arg and its value is 0 ;-)
0 does not mean false in DTML or Python.
Does this make it clearer?
Rik