[Zope-DB] return count() from mysql in zope
Charlie Clark
charlie at egenix.com
Thu Sep 23 03:45:25 EDT 2004
>
> if I want to get a count value, e.g. the total number of Bears, my SQL
> query would be:
>
> SELECT COUNT(pkID) FROM animals WHERE animalTypeID = 3;
>
> Within Zope, I'm not sure whether to tackle this via DTML or via a
> Python script. I've tried dtml-call and that's not working, as well as a
> few other approaches and clearly am missing something obvious given how
> easy this should be... ideas?
Just create a ZSQL method with this statement and call that. Read the
documentation on ZSQL methods and use PageTemplates instead of DTML.
Charlie
--
Charlie Clark
eGenix.com
Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Zope-DB
mailing list