Re: Z SQL equivelant of MySQL's SQL_CALC_FOUND_ROWS?

Charlie Clark <[email protected]>
Newsgroups gmane.comp.web.zope.database
Message-ID <[email protected]>
On 2005-11-29 at 20:20:10 [+0100], Kevin Monceaux <[email protected]> 
wrote:
> Zope Enthusiasts,
> 
> I'm new to Zope so forgive me if the answer to this question is obvious.  If
> one performs a select with a limit clause is it possible to determine how
> many results would have been returned if there was no limit?  For example,
> if I wanted to select the first picture in a photo album but wanted to know
> the total number of pictures in the album, how would I do that via Z SQL?
> With MySQL it can be done this way:
> 
> SELECT SQL_CALC_FOUND_ROWS, * from Pictures where AlbumID = 25 LIMIT 1;
> 
> SELECT FOUND_ROWS() as Count;
> 
> According to the "Z SQL Methods User's Manual" multiple SQL statements can
> be included in a Z SQL method but that no more than one select statement can
> be included.  The above MySQL technique requires two select statements.

You can use <dtml-var sqldelimiter> - search the archives for that.
But that is wrong. If you want to count the number of records, use count()

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/
________________________________________________________________________
2005-10-17: Released mxODBC.Zope.DA 1.0.9        http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.