[Zope] Detecting empty SQL call

Martijn Pieters mj@antraciet.nl
Thu, 01 Jul 1999 11:11:31 +0200


At 10:56 01/07/99 , Phil Grove wrote:
>Hi all,
>
>Can anyone tell me how to detect if the call to a mySQL database returns an
>empty recordset as my code causes an error if the SQL returns an empty
>recordset.
>
>This is what i am currently using:
>
><!--#in dBcall-->
>   <!--#if "newName == name"-->
>    <!--#call "REQUEST.set('titleTrue', 'true')"-->
>   <!--#else-->
>    <!--#call "REQUEST.set('titleTrue', 'false')"-->
>   <!--#/if-->
><!--#/in-->
>
>i have tried various <!--#if  --> statement, but it doesn't seem to make
>any difference.

Have you tried the <!--#else--> block of the <!--#in--> tag?

Like so:

<!--#in dBcall-->
   <!--#if "newName == name"-->
    <!--#call "REQUEST.set('titleTrue', 'true')"-->
   <!--#else-->
    <!--#call "REQUEST.set('titleTrue', 'false')"-->
   <!--#/if-->
<!--#else-->
Sorry, no results from the query.
<!--#/in-->

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------