[Zope-DB] Counting hits

Jon Erickson jon.erickson@neicoltech.org
16 Aug 2002 08:59:12 -0500


On Fri, 2002-08-16 at 08:14, Smith, Neil wrote:
> Is it possible to get the number of records that are returned by a select in
> a ZSQL method?  I'm using DCOracle2.  Ideally I would like to avoid having
> to do a second ZSQL method with a "select count(*)" in it.

No, ZSQL methods are not able to report the number of rows returned
which kinda stinks.  If your using python to process the ZSQL method you
could:

results = container.zsql_method()
num_rows = len(results)

Performing a len() function on the results object returned by zsql
methods will give you the number of rows returned.  However, this
example is not practical if your using DTML or ZPT to process the ZSQL
method.

Jon Erickson