[Svn-src-all:3595] [version-2_12-dev 22507] #2044 (無駄な処理を改善する for 2.12.4)
Seasoft
admin @ mail.ec-cube.net
2013年 2月 6日 (水) 20:32:57 JST
Subversion committed to /home/svn/open 22507
http://svn.ec-cube.net/open_trac/changeset/22507
┌────────────────────────────┐
│更新者 : Seasoft │
│更新日時: 2013-02-06 20:32:57 +0900 (水, 06 2月 2013)│
└────────────────────────────┘
Log:
--------------------------------------------------------
#2044 (無駄な処理を改善する for 2.12.4)
* SC_Query::select -> SC_Query::getCol
* 同一文字列定数値の重複記述を回避
#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Changed: [U:修正,A:追加,D:削除]
--------------------------------------------------------
U branches/version-2_12-dev/data/class/SC_Product.php
U branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php
変更: branches/version-2_12-dev/data/class/SC_Product.php
===================================================================
--- branches/version-2_12-dev/data/class/SC_Product.php 2013-02-06 07:30:41 UTC (rev 22506)
+++ branches/version-2_12-dev/data/class/SC_Product.php 2013-02-06 11:32:57 UTC (rev 22507)
@@ -73,9 +73,8 @@
* @return array 商品IDの配列
*/
function findProductIdsOrder(&$objQuery, $arrVal = array()) {
- $table = <<< __EOS__
- dtb_products AS alldtl
-__EOS__;
+ $table = 'dtb_products AS alldtl';
+
$objQuery->setGroupBy('alldtl.product_id');
if (is_array($this->arrOrderData) and $objQuery->order == '') {
$o_col = $this->arrOrderData['col'];
@@ -93,12 +92,9 @@
__EOS__;
$objQuery->setOrder($order);
}
- $results = $objQuery->select('alldtl.product_id', $table, '', $arrVal, MDB2_FETCHMODE_ORDERED);
- $resultValues = array();
- foreach ($results as $val) {
- $resultValues[] = $val[0];
- }
- return $resultValues;
+ $arrReturn = $objQuery->getCol('alldtl.product_id', $table, '', $arrVal);
+
+ return $arrReturn;
}
/**
@@ -111,9 +107,8 @@
* @return array 対象商品ID数
*/
function findProductCount(&$objQuery, $arrVal = array()) {
- $table = <<< __EOS__
- dtb_products AS alldtl
-__EOS__;
+ $table = 'dtb_products AS alldtl';
+
return $objQuery->count($table, '', $arrVal);
}
@@ -153,6 +148,7 @@
,update_date
__EOS__;
$res = $objQuery->select($col, $this->alldtlSQL());
+
return $res;
}
@@ -231,6 +227,7 @@
function getDetailAndProductsClass($productClassId) {
$result = $this->getProductsClass($productClassId);
$result = array_merge($result, $this->getDetail($result['product_id']));
+
return $result;
}
@@ -403,6 +400,7 @@
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objQuery->setWhere('product_class_id = ? AND T1.del_flg = 0');
$arrRes = $this->getProductsClassByQuery($objQuery, $productClassId);
+
return (array)$arrRes[0];
}
@@ -423,6 +421,7 @@
$where .= ' AND T1.del_flg = 0';
}
$objQuery->setWhere($where);
+
return $this->getProductsClassByQuery($objQuery, $productIds);
}
@@ -435,6 +434,7 @@
*/
function getProductsClassFullByProductId($productId, $has_deleted = false) {
$arrRet = $this->getProductsClassByProductIds(array($productId), $has_deleted);
+
return $arrRet;
}
@@ -457,6 +457,7 @@
foreach ($productStatus as $status) {
$results[$status['product_id']][] = $status['product_status_id'];
}
+
return $results;
}
@@ -503,6 +504,7 @@
} elseif ($p['stock_unlimited'] != '1') {
$limit = $p['stock'];
}
+
return $limit;
}
@@ -700,6 +702,7 @@
ON dtb_products.maker_id = dtb_maker.maker_id
) AS alldtl
__EOS__;
+
return $sql;
}
@@ -749,6 +752,7 @@
$where_clause
) as prdcls
__EOS__;
+
return $sql;
}
}
変更: branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php 2013-02-06 07:30:41 UTC (rev 22506)
+++ branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php 2013-02-06 11:32:57 UTC (rev 22507)
@@ -374,14 +374,14 @@
$searchCondition['arrval'][] = $arrSearchData['maker_id'];
}
- $searchCondition['where_for_count'] = $searchCondition['where'];
-
// 在庫無し商品の非表示
if (NOSTOCK_HIDDEN) {
$searchCondition['where'] .= ' AND EXISTS(SELECT * FROM dtb_products_class WHERE product_id = alldtl.product_id AND del_flg = 0 AND (stock >= 1 OR stock_unlimited = 1))';
- $searchCondition['where_for_count'] .= ' AND EXISTS(SELECT * FROM dtb_products_class WHERE product_id = alldtl.product_id AND del_flg = 0 AND (stock >= 1 OR stock_unlimited = 1))';
}
+ // XXX 一時期内容が異なっていたことがあるので別要素にも格納している。
+ $searchCondition['where_for_count'] = $searchCondition['where'];
+
return $searchCondition;
}
Svn-src-all メーリングリストの案内