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

From: Date: Thu, 03 Mar 2005 16:57:33 +0000
Subject: cvs: pear /DB package.xml /DB/DB common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-30024@lists.php.net to get a copy of this message
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);

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