From 42f0baae8fb39be2dd7a4c5c377f23c3f56fc865 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 17 Jul 2007 17:56:10 +0000 Subject: Fixed #666. --- framework/Data/ActiveRecord/TActiveRecord.php | 2 +- framework/Data/Common/TDbCommandBuilder.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'framework/Data') 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; } -- cgit v1.2.3