summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-07-17 17:56:10 +0000
committerxue <>2007-07-17 17:56:10 +0000
commit42f0baae8fb39be2dd7a4c5c377f23c3f56fc865 (patch)
tree27bd7fab46d4ed09aba727632863a0812146d2ae
parenta5ba85214c1d062f3726d3e2fa295539c6ccc33c (diff)
Fixed #666.
-rw-r--r--HISTORY1
-rw-r--r--framework/Data/ActiveRecord/TActiveRecord.php2
-rw-r--r--framework/Data/Common/TDbCommandBuilder.php4
3 files changed, 5 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index d14d196b..31680e59 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,6 +2,7 @@ Version 3.1.1 To be released
============================
BUG: Ticket#656 - TDatePicker does not return correct value when in callback mode (Christophe)
BUG: Ticket#662 - Ensure TForm to properly encode the ampersand in action URL (Qiang)
+BUG: Ticket#666 - TActiveRecord::deleteAll() method always requires a criteria or null parameter (Qiang)
BUG: Ticket#670 - TDatePicker: Year Issue (Christophe)
ENH: Ticket#667 - Added TFeedService.ContentType property (Qiang)
ENH: Added THead requirement check (Qiang)
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php
index b6b19d13..b7ccaa50 100644
--- a/framework/Data/ActiveRecord/TActiveRecord.php
+++ b/framework/Data/ActiveRecord/TActiveRecord.php
@@ -304,7 +304,7 @@ abstract class TActiveRecord extends TComponent
* @param mixed parameter values.
* @return int number of records deleted.
*/
- public function deleteAll($criteria, $parameters=array())
+ public function deleteAll($criteria=null, $parameters=array())
{
$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
$criteria = $this->getCriteria($criteria,$parameters, $args);
diff --git a/framework/Data/Common/TDbCommandBuilder.php b/framework/Data/Common/TDbCommandBuilder.php
index 0d960c8d..0029b4c3 100644
--- a/framework/Data/Common/TDbCommandBuilder.php
+++ b/framework/Data/Common/TDbCommandBuilder.php
@@ -203,7 +203,9 @@ class TDbCommandBuilder extends TComponent
public function createDeleteCommand($where,$parameters=array())
{
$table = $this->getTableInfo()->getTableFullName();
- $command = $this->createCommand("DELETE FROM {$table} WHERE {$where}");
+ if (!empty($where))
+ $where = 'WHERE '.$where;
+ $command = $this->createCommand("DELETE FROM {$table} ".$where);
$this->bindArrayValues($command, $parameters);
return $command;
}