cvs: pear /DB_DataObject DataObject.php

[email protected] ("Alan Knowles")
Newsgroups php.pear.cvs
Message-ID <cvsalan_k1209437049@cvsserver>
alan_k		Tue Apr 29 02:44:09 2008 UTC

  Modified files:              
    /pear/DB_DataObject	DataObject.php 
  Log:
  fix bug #13773 - delete(true) honours join conditions
  
http://cvs.php.net/viewvc.cgi/pear/DB_DataObject/DataObject.php?r1=1.439&r2=1.440&diff_format=u
Index: pear/DB_DataObject/DataObject.php
diff -u pear/DB_DataObject/DataObject.php:1.439 pear/DB_DataObject/DataObject.php:1.440
--- pear/DB_DataObject/DataObject.php:1.439	Wed Jan 30 02:14:06 2008
+++ pear/DB_DataObject/DataObject.php	Tue Apr 29 02:44:09 2008
@@ -15,7 +15,7 @@
  * @author     Alan Knowles <[email protected]>
  * @copyright  1997-2006 The PHP Group
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: DataObject.php,v 1.439 2008/01/30 02:14:06 alan_k Exp $
+ * @version    CVS: $Id: DataObject.php,v 1.440 2008/04/29 02:44:09 alan_k Exp $
  * @link       http://pear.php.net/package/DB_DataObject
  */
   
@@ -1369,7 +1369,13 @@
         if (($this->_query !== false) && $this->_query['condition']) {
         
             $table = ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table);
-            $sql = "DELETE FROM {$table} {$this->_query['condition']}{$extra_cond}";
+            $sql = "DELETE ";
+            // using a joined delete. - with useWhere..
+            $sql .= (!empty($this->_join) && $useWhere) ? 
+                "{$table} FROM {$table} {$this->_join} " : 
+                "FROM {$table} ";
+                
+            $sql .= $this->_query['condition']. $extra_cond;
             
             // add limit..
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.