PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #1726

ORDER BY and LIMIT not considered on DELETE

Details

Request #1726ORDER BY and LIMIT not considered on DELETE
Submitted2004-06-26 07:23 UTC
Frompear at l2gx dot net
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.3.6
OSAll
Roadmaps(Not assigned)

Comments

[2004-06-26 07:23 UTC] pear at l2gx dot net

Description:
------------
When performing $do->delete(), LIMIT and ORDER BY
statements are not considered when performing the
DELETE. Using the normal DB_DO methology, it's
impossible to perform queries like:

DELETE FROM item_management_revisions WHERE
item_management_revisions.item_id = 31 AND
item_management_revisions.item_type = 1 ORDER BY
date_revision LIMIT 1

So you're forced to use raw queries: $do->query().

Reproduce code:
---------------
to enable this feature:

DB_DataObject.php line 1199:

remove:
$this->_query = array(); // as it's probably unset!

DB_DataObject.php line 1213:

change to:
$r = $this->_query("DELETE FROM {$table} {$this->_query['condition']} {$this->_query['order_by']} {$this->_query['limit']}");