[xoops-cvslog 3482] CVS update: xoops2jp/html/modules/base/kernel

Back to archive index

Minahito minah****@users*****
2006年 7月 10日 (月) 19:01:49 JST


Index: xoops2jp/html/modules/base/kernel/handler.php
diff -u xoops2jp/html/modules/base/kernel/handler.php:1.1.2.17 xoops2jp/html/modules/base/kernel/handler.php:1.1.2.18
--- xoops2jp/html/modules/base/kernel/handler.php:1.1.2.17	Mon Jul 10 18:37:08 2006
+++ xoops2jp/html/modules/base/kernel/handler.php	Mon Jul 10 19:01:49 2006
@@ -311,20 +311,32 @@
 	}
 
 	/**
+	 * Delete $obj.
+	 * 
 	 * @return bool
 	 */
-	function delete(&$obj, $force=false)
+	function delete(&$obj, $force = false)
 	{
-		$id = $this->db->quoteString($obj->get($this->mPrimary));
-		$sql = "DELETE FROM " . $this->mTable . " WHERE " . $this->mPrimary . "=${id}";
+		//
+		// Because Criteria can generate the most appropriate sentence, use
+		// criteria even if this approach is few slow.
+		//
+		$criteria =& new Criteria($this->mPrimary, $obj->get($this->mPrimary));
+		$sql = "DELETE FROM " . $this->mTable . " WHERE " . $this->_makeCriteriaElement4sql($criteria, $obj);
 
 		return $force ? $this->db->queryF($sql) : $this->db->query($sql);
 	}
 	
 	/**
-	 * @param $criteria mixed Criteria or string
+	 * Delete plural objects by $criteria. If the sub-class want to override
+	 * the procedure of delete, delete() is better. This member function
+	 * fetches objects by $criteria and casts these objects into delete()
+	 * inside.
+	 * 
+	 * @param Criteria $criteria
+	 * @param bool     $force
 	 */
-	function deleteAll($criteria, $force=false)
+	function deleteAll($criteria, $force = false)
 	{
 		$objs =& $this->getObjects($criteria);
 		


xoops-cvslog メーリングリストの案内
Back to archive index