[Zope] SQL Queries

Casey Duncan casey at zope.com
Tue Jan 6 10:21:03 EST 2004


On Tue, 6 Jan 2004 09:50:55 -0500 (EST)
Asad Habib <ahabib at engin.umich.edu> wrote:

> Hello. Does anyone know if there is a way to determine how many rows
> where retrieved by a select statement? Is there a variable that keeps
> track of this in Zope that I can access? Any help would be greatly
> appreciated. Thanks.

  SELECT count(*) FROM mytable WHERE myconstraints;

or given a resultset from a zsql method:

  len(results)

However the latter may have an upper limit set by the zsql method or the
query itself (using the SQL LIMIT keyword) and so may not actually
return the full count.

-Casey



More information about the Zope mailing list