[Zope] how to get the fields returned SQL method

Chris Withers chrisw@nipltd.com
Fri, 24 Mar 2000 09:21:48 +0000


Okay, a lot depends on what your query is returning.

If 'names' is not the name of a column, then ignore the rest of this message ;-)

If it is, then try the following:
<dtml-in SQL>
 <dtml-var names><BR>
</dtml-in>

- If 'SQL' returns a single row and 'names' is a single-valued column, then it should display the
value of names.
- If 'SQL' returns multiple rows and 'names' is a single-valued column, then it should display the
value of names for each row returned on a seperate line.
- If names is a multi-valued column then you should get something like
  [...,...,...]
  for each row returned.

cheers,

Chris 


If names is a single-valued column then the following should work

Eric BARROCA wrote:
> 
> Hello,
> 
> I'm trying to get a list of fields returned by a dynamic SQL query.
> I've found a howto telling me to write something like :
>         <dtml-in SQL.names>
>         <dtml-var sequence-item>
>         </dtml-in>
> But it doesn't work : I get the error "Attribute Error : names".
> I've tried with .items, .keys and .fields too.
> 
> I'd like to do the same for an LDAP query.
> 
> Any idea ? I think it's very useful and that an easy way exists but I
> can't find it.
> 
> Thanks,
> 
> EB.
> 
> _______________________________________________
> 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 )