[Zope] SQL Methods and namespace question

Rik Hoekstra hoekstra@fsw.LeidenUniv.nl
Wed, 15 Dec 1999 10:32:37 +0100


> Hello Rik,
>
> it's good to know that I am not the only one with this problem.
> I posted some days ago but didn't get any answer. I can't even
> get "normal" REQUEST variables to evaluate correct.
>

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?

I you have a form you could set the argument in a hidden field (<input
type="hidden" name="arg:int" value="0">) you will be able to access this
easily in a SQL Method. Obviously it will alway be evaluated as true in the
following method

>
> SELECT * FROM DATA
> <dtml-sqlgroup where>
>   <dtml-if arg>
>     <dtm-sqltest arg type=int>
>   </dtml-if>
> </dtml-sqlgroup>
>
> and I always get
>
> SELECT * FROM DATA WHERE ARG=0
>
> Shouldn't that be impossible?

Not per se.

>
> To your problem:
>
> Did you try searchitem.searchterm? Although "searchitem."
> shouldn't be needed. Maybe you need to use REQUEST.searchitem
> or did you define searchitem as argument in the ZSQL form?
>

The records addition makes the searchsitem available as a list of records
with fields. It may be iterated with a dtml-in. In this case that would be
<dtml-in searchitem>. The sequence-item then has the 'fields' of the record
as its attributes, so that in this case you can access them with <dtml-var
connector> and <dtml-var searchterm>. This works nicely in a normal DTML
Method.

The problem seems to be that the SQL Method is only able to retrieve items
from the REQUEST.form dictionary, and the records list is in the REQUEST
object itself.  This seems not to be directly accessibly from the SQL
Method, because it gets its values from the stated input fields (the ones
you define as tokens in a SQL Method). But I'm not completely sure.


Rik