Re: cvs: pear /DB package.xml /DB/DB common.php

From: Date: Thu, 03 Mar 2005 18:23:20 +0000
Subject: Re: cvs: pear /DB package.xml /DB/DB common.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-30027@lists.php.net to get a copy of this message
Don't know much about this, but why are these 5 functions special? I know in SQLite, I can define my own aggregate functions with any old name I choose. What will happen if I mix those with getOne()? -adam On Thu, 3 Mar 2005, Daniel Convissor wrote: > danielc Thu Mar 3 11:57:33 2005 EDT > > Modified files: > /pear/DB package.xml > /pear/DB/DB common.php > Log: > * getOne() and getRow() should not use limit > queries if the query contains aggregation > functions: AVG, COUNT, MAX, MIN, SUM. Bug 3680. > > > > http://cvs.php.net/diff.php/pear/DB/package.xml?r1=1.177&r2=1.178&ty=u > Index: pear/DB/package.xml > diff -u pear/DB/package.xml:1.177 pear/DB/package.xml:1.178 > --- pear/DB/package.xml:1.177 Wed Mar 2 09:42:58 2005 > +++ pear/DB/package.xml Thu Mar 3 11:57:30 2005 > @@ -1,6 +1,6 @@ > <?xml version="1.0" encoding="ISO-8859-1" ?> > <package version="1.0"> > - <!-- $Id: package.xml,v 1.177 2005/03/02 14:42:58 danielc Exp $ --> > + <!-- $Id: package.xml,v 1.178 2005/03/03 16:57:30 danielc Exp $ --> > <name>DB</name> > <summary>Database Abstraction Layer</summary> > <description> > @@ -68,12 +68,14 @@ > <release> > <version>1.7.2</version> > <state>stable</state> > - <date>pending</date> > + <date>2005-03-03</date> > <notes><![CDATA[ > all: > -* Make modifyLimitQuery() accommodate > - queries that already have ";" > - appended to them. Bug 3666. > +* Make modifyLimitQuery() accommodate queries > + that already have ";" appended to them. Bug 3666. > +* getOne() and getRow() should not use limit > + queries if the query contains aggregation > + functions: AVG, COUNT, MAX, MIN, SUM. Bug 3680. > ]]></notes> > <filelist> > <file name="DB.php" role="php" baseinstalldir="/"> > > http://cvs.php.net/diff.php/pear/DB/DB/common.php?r1=1.133&r2=1.134&ty=u > Index: pear/DB/DB/common.php > diff -u pear/DB/DB/common.php:1.133 pear/DB/DB/common.php:1.134 > --- pear/DB/DB/common.php:1.133 Mon Feb 28 13:37:31 2005 > +++ pear/DB/DB/common.php Thu Mar 3 11:57:32 2005 > @@ -20,7 +20,7 @@ > * @author Daniel Convissor <danielc@php.net> > * @copyright 1997-2005 The PHP Group > * @license http://www.php.net/license/3_0.txt PHP License > 3.0 > - * @version CVS: $Id: common.php,v 1.133 2005/02/28 18:37:31 danielc Exp $ > + * @version CVS: $Id: common.php,v 1.134 2005/03/03 16:57:32 danielc Exp $ > * @link http://pear.php.net/package/DB > */ > > @@ -1221,7 +1221,9 @@ > { > $params = (array)$params; > if ($this->features['limit'] == 'alter') { > - $query = $this->modifyLimitQuery($query, 0, 1, $params); > + if (!preg_match('/(AVG|COUNT|MAX|MIN|SUM)\s*\(/i', $query)) { > + $query = $this->modifyLimitQuery($query, 0, 1, $params); > + } > } > if (sizeof($params) > 0) { > $sth = $this->prepare($query); > @@ -1287,7 +1289,9 @@ > } > } > if ($this->features['limit'] == 'alter') { > - $query = $this->modifyLimitQuery($query, 0, 1, $params); > + if (!preg_match('/(AVG|COUNT|MAX|MIN|SUM)\s*\(/i', $query)) { > + $query = $this->modifyLimitQuery($query, 0, 1, $params); > + } > } > if (sizeof($params) > 0) { > $sth = $this->prepare($query); > > -- adam@trachtenberg.com | http://www.trachtenberg.com author of o'reilly's "upgrading to php 5" and "php cookbook" avoid the holiday rush, buy your copies today!

« previous php.pear.cvs (#30027) next »