cvs: pear /DB package.xml /DB/DB fbsql.php ibase.php mysql.php mysqli.php pgsql.php sqlite.php
| From: | Daniel Convissor | Date: | Tue, 01 Mar 2005 20:22:04 +0000 |
| Subject: | cvs: pear /DB package.xml /DB/DB fbsql.php ibase.php mysql.php mysqli.php pgsql.php sqlite.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-29969@lists.php.net to get a copy of this message | ||
danielc Tue Mar 1 15:22:04 2005 EDT
Modified files:
/pear/DB package.xml
/pear/DB/DB fbsql.php ibase.php mysql.php mysqli.php pgsql.php
sqlite.php
Log:
* modifyLimitQuery() should not not modify the query
if it already has a LIMIT clause. Bug 3663.
http://cvs.php.net/diff.php/pear/DB/package.xml?r1=1.175&r2=1.176&ty=u Index: pear/DB/package.xml diff -u pear/DB/package.xml:1.175 pear/DB/package.xml:1.176 --- pear/DB/package.xml:1.175 Mon Feb 28 23:34:09 2005 +++ pear/DB/package.xml Tue Mar 1 15:22:03 2005 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <package version="1.0"> - <!-- $Id: package.xml,v 1.175 2005/03/01 04:34:09 danielc Exp $ --> + <!-- $Id: package.xml,v 1.176 2005/03/01 20:22:03 danielc Exp $ --> <name>DB</name> <summary>Database Abstraction Layer</summary> <description> @@ -66,67 +66,12 @@ </maintainer> </maintainers> <release> - <version>1.7.0</version> + <version>1.7.1</version> <state>stable</state> <date>2005-03-01</date> <notes><![CDATA[ -To view the majority of changes since 1.6.8, -see the changelog for Release 1.7.0RC1. - all: -* __sleep() should not call disconnect(). - Also store connection state in the new - $was_connected property. This resolves - Bug 3594 that was introduced in 1.7.0RC1. - -fbsql: -* Handle more error codes: - + 239 => DB_ERROR_TRUNCATED. - + 215 => DB_ERROR_NOSUCHFIELD for columns - not in both sides of JOIN. - -ibase: -* Change error mapping of "arithmetic - exception, numeric overflow, or string - truncation" from DB_ERROR_DIVZERO to - DB_ERROR_INVALID because it covers - much more than division by zero. - -mssql: -* Handle more error codes: - + 155 => DB_ERROR_NOSUCHFIELD for columns - not in both sides of JOIN. - -oci8: -* Handle more error codes: - + 1401 => DB_ERROR_INVALID for strings - exceeding column size. - -odbc: -* Handle more error codes: - + '22001' => DB_ERROR_INVALID for strings - exceeding column size. - -pgsql: -* For getListOf('views'), ignore views in system - schemas rather than returning views in the - public schema. Request 3595. -* Handle more error messages: - + invalid input syntax for type numeric - + column reference "active" is ambiguous - + value too long for type character varying(50) - + value "50000" is out of range for type shortint - + integer out of range - + column "p_id" specified in USING clause does - not exist in left table - + column p.p_name does not exist -* Silence errors in errorNative() when connection - doesn't exist. - -sqlite: -* Handle more error messages: - + cannot join using column b - column not - present in both tables +* modifyLimitQuery() should not not modify the query if it already has a LIMIT clause. Bug 3663. ]]></notes> <filelist> <file name="DB.php" role="php" baseinstalldir="/"> http://cvs.php.net/diff.php/pear/DB/DB/fbsql.php?r1=1.80&r2=1.81&ty=u Index: pear/DB/DB/fbsql.php diff -u pear/DB/DB/fbsql.php:1.80 pear/DB/DB/fbsql.php:1.81 --- pear/DB/DB/fbsql.php:1.80 Sun Feb 27 20:41:07 2005 +++ pear/DB/DB/fbsql.php Tue Mar 1 15:22:04 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: fbsql.php,v 1.80 2005/02/28 01:41:07 danielc Exp $ + * @version CVS: $Id: fbsql.php,v 1.81 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -544,10 +544,10 @@ function modifyLimitQuery($query, $from, $count, $params = array()) { if (DB::isManip($query)) { - return preg_replace('/^([\s(])*SELECT/i', + return preg_replace('/^([\s(])*SELECT(?!\s*TOP\s*\()/i', "\\1SELECT TOP($count)", $query); } else { - return preg_replace('/([\s(])*SELECT/i', + return preg_replace('/([\s(])*SELECT(?!\s*TOP\s*\()/i', "\\1SELECT TOP($from, $count)", $query); } } http://cvs.php.net/diff.php/pear/DB/DB/ibase.php?r1=1.107&r2=1.108&ty=u Index: pear/DB/DB/ibase.php diff -u pear/DB/DB/ibase.php:1.107 pear/DB/DB/ibase.php:1.108 --- pear/DB/DB/ibase.php:1.107 Sun Feb 27 20:41:26 2005 +++ pear/DB/DB/ibase.php Tue Mar 1 15:22:04 2005 @@ -23,7 +23,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: ibase.php,v 1.107 2005/02/28 01:41:26 danielc Exp $ + * @version CVS: $Id: ibase.php,v 1.108 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -319,10 +319,8 @@ function modifyLimitQuery($query, $from, $count, $params = array()) { if ($this->dsn['dbsyntax'] == 'firebird') { - //$from++; // SKIP starts from 1, ie SKIP 1 starts from the first record - // (cox) Seems that SKIP starts in 0 - $query = preg_replace('/^\s*select\s(.*)$/is', - "SELECT FIRST $count SKIP $from $1", $query); + $query = preg_replace('/^([\s(])*SELECT(?!\s*FIRST\s*\d+)/i', + "SELECT FIRST $count SKIP $from", $query); } return $query; } http://cvs.php.net/diff.php/pear/DB/DB/mysql.php?r1=1.112&r2=1.113&ty=u Index: pear/DB/DB/mysql.php diff -u pear/DB/DB/mysql.php:1.112 pear/DB/DB/mysql.php:1.113 --- pear/DB/DB/mysql.php:1.112 Tue Feb 22 01:23:26 2005 +++ pear/DB/DB/mysql.php Tue Mar 1 15:22:04 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: mysql.php,v 1.112 2005/02/22 06:23:26 danielc Exp $ + * @version CVS: $Id: mysql.php,v 1.113 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -849,6 +849,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } if (DB::isManip($query)) { return $query . " LIMIT $count"; } else { http://cvs.php.net/diff.php/pear/DB/DB/mysqli.php?r1=1.66&r2=1.67&ty=u Index: pear/DB/DB/mysqli.php diff -u pear/DB/DB/mysqli.php:1.66 pear/DB/DB/mysqli.php:1.67 --- pear/DB/DB/mysqli.php:1.66 Sat Feb 19 19:44:48 2005 +++ pear/DB/DB/mysqli.php Tue Mar 1 15:22:04 2005 @@ -19,7 +19,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: mysqli.php,v 1.66 2005/02/20 00:44:48 danielc Exp $ + * @version CVS: $Id: mysqli.php,v 1.67 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -878,6 +878,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } if (DB::isManip($query)) { return $query . " LIMIT $count"; } else { http://cvs.php.net/diff.php/pear/DB/DB/pgsql.php?r1=1.123&r2=1.124&ty=u Index: pear/DB/DB/pgsql.php diff -u pear/DB/DB/pgsql.php:1.123 pear/DB/DB/pgsql.php:1.124 --- pear/DB/DB/pgsql.php:1.123 Sun Feb 27 20:42:32 2005 +++ pear/DB/DB/pgsql.php Tue Mar 1 15:22:04 2005 @@ -21,7 +21,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: pgsql.php,v 1.123 2005/02/28 01:42:32 danielc Exp $ + * @version CVS: $Id: pgsql.php,v 1.124 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -758,6 +758,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } return "$query LIMIT $count OFFSET $from"; } http://cvs.php.net/diff.php/pear/DB/DB/sqlite.php?r1=1.105&r2=1.106&ty=u Index: pear/DB/DB/sqlite.php diff -u pear/DB/DB/sqlite.php:1.105 pear/DB/DB/sqlite.php:1.106 --- pear/DB/DB/sqlite.php:1.105 Sun Feb 27 20:43:04 2005 +++ pear/DB/DB/sqlite.php Tue Mar 1 15:22:04 2005 @@ -21,7 +21,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 3.0 - * @version CVS: $Id: sqlite.php,v 1.105 2005/02/28 01:43:04 danielc Exp $ + * @version CVS: $Id: sqlite.php,v 1.106 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -639,6 +639,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } return "$query LIMIT $count OFFSET $from"; }
http://cvs.php.net/diff.php/pear/DB/package.xml?r1=1.175&r2=1.176&ty=u Index: pear/DB/package.xml diff -u pear/DB/package.xml:1.175 pear/DB/package.xml:1.176 --- pear/DB/package.xml:1.175 Mon Feb 28 23:34:09 2005 +++ pear/DB/package.xml Tue Mar 1 15:22:03 2005 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <package version="1.0"> - <!-- $Id: package.xml,v 1.175 2005/03/01 04:34:09 danielc Exp $ --> + <!-- $Id: package.xml,v 1.176 2005/03/01 20:22:03 danielc Exp $ --> <name>DB</name> <summary>Database Abstraction Layer</summary> <description> @@ -66,67 +66,12 @@ </maintainer> </maintainers> <release> - <version>1.7.0</version> + <version>1.7.1</version> <state>stable</state> <date>2005-03-01</date> <notes><![CDATA[ -To view the majority of changes since 1.6.8, -see the changelog for Release 1.7.0RC1. - all: -* __sleep() should not call disconnect(). - Also store connection state in the new - $was_connected property. This resolves - Bug 3594 that was introduced in 1.7.0RC1. - -fbsql: -* Handle more error codes: - + 239 => DB_ERROR_TRUNCATED. - + 215 => DB_ERROR_NOSUCHFIELD for columns - not in both sides of JOIN. - -ibase: -* Change error mapping of "arithmetic - exception, numeric overflow, or string - truncation" from DB_ERROR_DIVZERO to - DB_ERROR_INVALID because it covers - much more than division by zero. - -mssql: -* Handle more error codes: - + 155 => DB_ERROR_NOSUCHFIELD for columns - not in both sides of JOIN. - -oci8: -* Handle more error codes: - + 1401 => DB_ERROR_INVALID for strings - exceeding column size. - -odbc: -* Handle more error codes: - + '22001' => DB_ERROR_INVALID for strings - exceeding column size. - -pgsql: -* For getListOf('views'), ignore views in system - schemas rather than returning views in the - public schema. Request 3595. -* Handle more error messages: - + invalid input syntax for type numeric - + column reference "active" is ambiguous - + value too long for type character varying(50) - + value "50000" is out of range for type shortint - + integer out of range - + column "p_id" specified in USING clause does - not exist in left table - + column p.p_name does not exist -* Silence errors in errorNative() when connection - doesn't exist. - -sqlite: -* Handle more error messages: - + cannot join using column b - column not - present in both tables +* modifyLimitQuery() should not not modify the query if it already has a LIMIT clause. Bug 3663. ]]></notes> <filelist> <file name="DB.php" role="php" baseinstalldir="/"> http://cvs.php.net/diff.php/pear/DB/DB/fbsql.php?r1=1.80&r2=1.81&ty=u Index: pear/DB/DB/fbsql.php diff -u pear/DB/DB/fbsql.php:1.80 pear/DB/DB/fbsql.php:1.81 --- pear/DB/DB/fbsql.php:1.80 Sun Feb 27 20:41:07 2005 +++ pear/DB/DB/fbsql.php Tue Mar 1 15:22:04 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: fbsql.php,v 1.80 2005/02/28 01:41:07 danielc Exp $ + * @version CVS: $Id: fbsql.php,v 1.81 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -544,10 +544,10 @@ function modifyLimitQuery($query, $from, $count, $params = array()) { if (DB::isManip($query)) { - return preg_replace('/^([\s(])*SELECT/i', + return preg_replace('/^([\s(])*SELECT(?!\s*TOP\s*\()/i', "\\1SELECT TOP($count)", $query); } else { - return preg_replace('/([\s(])*SELECT/i', + return preg_replace('/([\s(])*SELECT(?!\s*TOP\s*\()/i', "\\1SELECT TOP($from, $count)", $query); } } http://cvs.php.net/diff.php/pear/DB/DB/ibase.php?r1=1.107&r2=1.108&ty=u Index: pear/DB/DB/ibase.php diff -u pear/DB/DB/ibase.php:1.107 pear/DB/DB/ibase.php:1.108 --- pear/DB/DB/ibase.php:1.107 Sun Feb 27 20:41:26 2005 +++ pear/DB/DB/ibase.php Tue Mar 1 15:22:04 2005 @@ -23,7 +23,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: ibase.php,v 1.107 2005/02/28 01:41:26 danielc Exp $ + * @version CVS: $Id: ibase.php,v 1.108 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -319,10 +319,8 @@ function modifyLimitQuery($query, $from, $count, $params = array()) { if ($this->dsn['dbsyntax'] == 'firebird') { - //$from++; // SKIP starts from 1, ie SKIP 1 starts from the first record - // (cox) Seems that SKIP starts in 0 - $query = preg_replace('/^\s*select\s(.*)$/is', - "SELECT FIRST $count SKIP $from $1", $query); + $query = preg_replace('/^([\s(])*SELECT(?!\s*FIRST\s*\d+)/i', + "SELECT FIRST $count SKIP $from", $query); } return $query; } http://cvs.php.net/diff.php/pear/DB/DB/mysql.php?r1=1.112&r2=1.113&ty=u Index: pear/DB/DB/mysql.php diff -u pear/DB/DB/mysql.php:1.112 pear/DB/DB/mysql.php:1.113 --- pear/DB/DB/mysql.php:1.112 Tue Feb 22 01:23:26 2005 +++ pear/DB/DB/mysql.php Tue Mar 1 15:22:04 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: mysql.php,v 1.112 2005/02/22 06:23:26 danielc Exp $ + * @version CVS: $Id: mysql.php,v 1.113 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -849,6 +849,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } if (DB::isManip($query)) { return $query . " LIMIT $count"; } else { http://cvs.php.net/diff.php/pear/DB/DB/mysqli.php?r1=1.66&r2=1.67&ty=u Index: pear/DB/DB/mysqli.php diff -u pear/DB/DB/mysqli.php:1.66 pear/DB/DB/mysqli.php:1.67 --- pear/DB/DB/mysqli.php:1.66 Sat Feb 19 19:44:48 2005 +++ pear/DB/DB/mysqli.php Tue Mar 1 15:22:04 2005 @@ -19,7 +19,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: mysqli.php,v 1.66 2005/02/20 00:44:48 danielc Exp $ + * @version CVS: $Id: mysqli.php,v 1.67 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -878,6 +878,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } if (DB::isManip($query)) { return $query . " LIMIT $count"; } else { http://cvs.php.net/diff.php/pear/DB/DB/pgsql.php?r1=1.123&r2=1.124&ty=u Index: pear/DB/DB/pgsql.php diff -u pear/DB/DB/pgsql.php:1.123 pear/DB/DB/pgsql.php:1.124 --- pear/DB/DB/pgsql.php:1.123 Sun Feb 27 20:42:32 2005 +++ pear/DB/DB/pgsql.php Tue Mar 1 15:22:04 2005 @@ -21,7 +21,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: pgsql.php,v 1.123 2005/02/28 01:42:32 danielc Exp $ + * @version CVS: $Id: pgsql.php,v 1.124 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -758,6 +758,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } return "$query LIMIT $count OFFSET $from"; } http://cvs.php.net/diff.php/pear/DB/DB/sqlite.php?r1=1.105&r2=1.106&ty=u Index: pear/DB/DB/sqlite.php diff -u pear/DB/DB/sqlite.php:1.105 pear/DB/DB/sqlite.php:1.106 --- pear/DB/DB/sqlite.php:1.105 Sun Feb 27 20:43:04 2005 +++ pear/DB/DB/sqlite.php Tue Mar 1 15:22:04 2005 @@ -21,7 +21,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 3.0 - * @version CVS: $Id: sqlite.php,v 1.105 2005/02/28 01:43:04 danielc Exp $ + * @version CVS: $Id: sqlite.php,v 1.106 2005/03/01 20:22:04 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -639,6 +639,9 @@ */ function modifyLimitQuery($query, $from, $count, $params = array()) { + if (preg_match('/LIMIT\s*\d(\s*(,|OFFSET)\s*\d+)?/i', $query)) { + return $query; + } return "$query LIMIT $count OFFSET $from"; }