[Zope] no data matching query

Chris McDonough chrism@digicool.com
Wed, 8 Dec 1999 09:29:38 -0500


 
> is it possible to test if a database-query returned data or not?
> i'm not interested in the result - data, only if there where 
> one or more
> rows matching the query...

It's easier than you think.  If you have a ZSQL Method "sqlMyQuery":

<dtml-if sqlMyQuery>
...do stuff...
</dtml-if>

That's it.

> 
> another simple question:
> is there a more simple possibility to get only the first 
> query-match than:
> 
> <dtml-in dataquery size=1 orphan=1>
> 
> ...
> </dtml-in>
> 

errr... this isn't simple enough?

you could always do:

<dtml-in sqlMyQuery>
  <dtml-if sequence-start>
   ...do stuff...
  </dtml-if>
</dtml-in>

But that's more complicated, I think.