DB/mysql.php limitQuery() / modifyLimitQuery() problem
| From: | Roman Neuhauser | Date: | Thu, 15 Aug 2002 09:52:34 +0000 |
| Subject: | DB/mysql.php limitQuery() / modifyLimitQuery() problem | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-8437@lists.php.net to get a copy of this message | ||
Hi there,
mysql supports the LIMIT clause in UPDATE and DELETE queries (besides
SELECT), but it takes only one argument in these. The attached patch
solves this problem by silently discarding the $from argument.
--
FreeBSD 4.6-STABLE
11:30AM up 5 days, 23:25, 18 users, load averages: 0.00, 0.00, 0.00
Index: DB/mysql.php =================================================================== RCS file: /repository/pear/DB/DB/mysql.php,v retrieving revision 1.8 diff -u -u -r1.8 mysql.php --- DB/mysql.php 14 Aug 2002 08:55:15 -0000 1.8 +++ DB/mysql.php 15 Aug 2002 09:45:33 -0000 @@ -697,7 +697,11 @@ function modifyLimitQuery($query, $from, $count) { - return $query . " LIMIT $from, $count"; + if (DB::isManip($query)) { + return $query . " LIMIT $count"; + } else { + return $query . " LIMIT $from, $count"; + } } // }}}
Index: DB/mysql.php =================================================================== RCS file: /repository/pear/DB/DB/mysql.php,v retrieving revision 1.8 diff -u -u -r1.8 mysql.php --- DB/mysql.php 14 Aug 2002 08:55:15 -0000 1.8 +++ DB/mysql.php 15 Aug 2002 09:45:33 -0000 @@ -697,7 +697,11 @@ function modifyLimitQuery($query, $from, $count) { - return $query . " LIMIT $from, $count"; + if (DB::isManip($query)) { + return $query . " LIMIT $count"; + } else { + return $query . " LIMIT $from, $count"; + } } // }}}