[Zope] Probably Dumb Question re count(*)

Dan Shafer dan@gui.com
Sat, 29 Dec 2001 12:32:57 -0800


I know this has to be easy but my eyes are bloody from looking for 
the answer at zope.org and in the Zope docs.

I want to have a sentence on a page that simply tells people how many 
records are in a database. I created a ZSQL method that just does 
this:

select count(*) from database1

That method is called countrecords.

Now in the DTML document, I have:

There are <dtml-var countrecords> records in the database.

No joy. No value ever gets placed into the sentence.

So I suspect that the count is being returned as a list (which is how 
SQL results are supposed to be returned to Zope/Python, a I get it). 
But here, there's no row and there's no variable name, so how would I 
possibly iterate over it?

Is there an easier, more direct way to do this? I'm sure there is but 
I can't find a single example of this use anywhere.
-- 
Dan Shafer, Author-Consultant
http://www.danshafer.com
http://www.shafermedia.com