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

アーカイブの一覧に戻る

Minahito minah****@users*****
2006年 1月 11日 (水) 20:55:00 JST


Index: xoops2jp/html/modules/base/kernel/handler.php
diff -u xoops2jp/html/modules/base/kernel/handler.php:1.1.2.3 xoops2jp/html/modules/base/kernel/handler.php:1.1.2.4
--- xoops2jp/html/modules/base/kernel/handler.php:1.1.2.3	Mon Jan  9 03:17:29 2006
+++ xoops2jp/html/modules/base/kernel/handler.php	Wed Jan 11 20:54:59 2006
@@ -52,20 +52,26 @@
 	{
 		$ret = array();
 
+		$sql = "SELECT * FROM " . $this->mTable;
+
 		if($criteria !== null && is_a($criteria, 'CriteriaElement')) {
 			$where = $criteria->render();
 			
+			if (trim($where)) {
+				$sql .= " WHERE ".$where;
+			}
+			
 			if ($criteria->getSort() != '') {
-				$sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
+				$sql .= " ORDER BY " . $criteria->getSort() . ' ' . $criteria->getOrder();
 			}
-
+			
 			$limit=$criteria->getLimit();
 			$start=$criteria->getStart();
 			
-			$ret =& $this->_getObjects($where, $param1);
+			$ret =& $this->_getObjects($sql, $param1);
 		}
 		else {
-			$ret =& $this->_getObjects($criteria, $param1, $param2, $param3);
+			$ret =& $this->_getObjects($sql, $param1, $param2, $param3);
 		}
 		
 		return $ret;
@@ -74,16 +80,10 @@
 	/**
 	 * @access private
 	 */
-	function &_getObjects($where = null, $limit = 0, $start = 0, $id_as_key = false)
+	function &_getObjects($sql = null, $limit = 0, $start = 0, $id_as_key = false)
 	{
 		$ret = array();
 
-		$sql = "SELECT * FROM " . $this->mTable;
-		
-		if ($where) {
-			$sql .= " WHERE " . $where;
-		}
-		
 		$result = $this->db->query($sql, $limit, $start);
 
 		if (!$result) {
@@ -97,7 +97,7 @@
 			$ret[]=&$obj;
 			unset($obj);
 		}
-
+		
 		return $ret;
 	}
 
@@ -125,7 +125,6 @@
 		if ($where) {
 			$sql .= " WHERE " . $sql;
 		}
-		
 
 		$result=$this->db->query($sql);
 
@@ -144,14 +143,6 @@
 			return false;
 		}
 
-		if (!$obj->isDirty()) {
-			return true;
-		}
-
-		if (!$obj->cleanVars()) {
-			return true;
-		}
-
 		$new_flag = false;
 		
 		if ($obj->isNew()) {
@@ -164,8 +155,6 @@
 		
 		$result = $force ? $this->db->queryF($sql) : $this->db->query($sql);
 		
-		die ($sql);
-
 		if (!$result){
 			return false;
 		}
@@ -226,20 +215,15 @@
 	*/
 	function _makeVars4sql(&$obj) {
 		$ret = array();
-		foreach (array_keys($obj->cleanVars) as $v) {
-			switch ($obj->vars[$v]['data_type']) {
-				case XOBJ_DTYPE_TXTBOX:
-				case XOBJ_DTYPE_TXTAREA:
-				case XOBJ_DTYPE_URL:
-				case XOBJ_DTYPE_EMAIL:
-				case XOBJ_DTYPE_ARRAY:
-				case XOBJ_DTYPE_OTHER:
-				case XOBJ_DTYPE_SOURCE:
-					$ret[$v] = $this->db->quoteString($obj->vars[$v]['value']);
+		foreach ($obj->gets() as $key => $value) {
+			switch ($obj->mVars[$key]['data_type']) {
+				case XOBJ_DTYPE_STRING:
+				case XOBJ_DTYPE_TEXT:
+					$ret[$key] = $this->db->quoteString($value);
 					break;
 
 				default:
-					$ret[$v] = $obj->vars[$v]['value'];
+					$ret[$key] = $value;
 			}
 		}
 		


xoops-cvslog メーリングリストの案内
アーカイブの一覧に戻る