diff options
author | wei <> | 2007-01-04 11:23:26 +0000 |
---|---|---|
committer | wei <> | 2007-01-04 11:23:26 +0000 |
commit | dd028bec3822d1d9c28c35d599d687e038c7705f (patch) | |
tree | f3d2fb7f95073ea481a4dec86f0f0d30c7fe3588 /framework/Data/ActiveRecord/Vendor | |
parent | cac90ea6547fe194ab6ab101dfe11a0b751823ca (diff) |
Add chat demo and tutorial.
Diffstat (limited to 'framework/Data/ActiveRecord/Vendor')
-rw-r--r-- | framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php index 74c97689..fffdb6fb 100644 --- a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php +++ b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php @@ -161,9 +161,9 @@ abstract class TDbMetaDataCommon extends TDbMetaData {
$conn->setActive(true);
$numKeys = count($this->getPrimaryKeys());
- if($numKeys===0)
- throw new TActiveRecordException('ar_no_primary_key_found',$this->getTableName());
$table = $this->getTableName();
+ if($numKeys===0)
+ throw new TActiveRecordException('ar_no_primary_key_found',$table);
if($numKeys===1)
$criteria = $this->getDeleteInPkCriteria($conn,$keys);
else
@@ -173,6 +173,21 @@ abstract class TDbMetaDataCommon extends TDbMetaData $command->prepare();
return $command;
}
+
+
+ /**
+ * SQL command to delete records by criteria
+ * @param TDbConnection database connection.
+ * @param TActiveRecordCriteria criteria object.
+ * @return TDbCommand delete command.
+ */
+ public function getDeleteByCriteriaCommand($conn, $criteria)
+ {
+ $conditions = $criteria!==null?$this->getSqlFromCriteria($conn,$criteria) : '';
+ $table = $this->getTableName();
+ $sql = "DELETE FROM {$table} {$conditions}";
+ return $this->createCriteriaBindedCommand($conn,$sql, $criteria);
+ }
}
?>
\ No newline at end of file |