[Svn-src-all:843] [version-2_5-dev 19730] #855(SC_Query の #select, #getRow, #getCol, #get, #min, #max の引数順を統一する)

Seasoft admin @ mail.ec-cube.net
2010年 12月 16日 (木) 23:18:05 JST


Subversion committed to /home/svn/open 19730
http://svn.ec-cube.net/open_trac/changeset/19730
┌────────────────────────────┐
│更新者 :  Seasoft                                      │
│更新日時:  2010-12-16 23:18:05 +0900 (木, 16 12月 2010)│
└────────────────────────────┘

Log:
--------------------------------------------------------
#855(SC_Query の #select, #getRow, #getCol, #get, #min, #max の引数順を統一する)
  * SC_Query#getCol を改訂

Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
U   branches/version-2_5-dev/data/class/SC_Product.php
U   branches/version-2_5-dev/data/class/SC_Query.php
U   branches/version-2_5-dev/data/class/helper/SC_Helper_CSV.php
U   branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php
U   branches/version-2_5-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
U   branches/version-2_5-dev/data/include/module.inc
U   branches/version-2_5-dev/test/class/SC_Query_Test.php

変更: branches/version-2_5-dev/data/class/SC_Product.php
===================================================================
--- branches/version-2_5-dev/data/class/SC_Product.php	2010-12-16 14:12:59 UTC (rev 19729)
+++ branches/version-2_5-dev/data/class/SC_Product.php	2010-12-16 14:18:05 UTC (rev 19730)
@@ -585,7 +585,7 @@
         $size = count($productClassIds);
         $objQuery =& SC_Query::getSingletonInstance();
         $objQuery->groupby = 'GROUP BY payment_id HAVING COUNT(payment_id) = ?';
-        $paymentIds = $objQuery->getCol('dtb_payment_options', 'payment_id',
+        $paymentIds = $objQuery->getCol('payment_id', 'dtb_payment_options',
                                         'product_class_id IN (' . implode(', ', array_pad(array(), $size, '?')) . ')',
                                         array_merge($productClassIds, array($size)),
                                         MDB2_FETCHMODE_ORDERED);

変更: branches/version-2_5-dev/data/class/SC_Query.php
===================================================================
--- branches/version-2_5-dev/data/class/SC_Query.php	2010-12-16 14:12:59 UTC (rev 19729)
+++ branches/version-2_5-dev/data/class/SC_Query.php	2010-12-16 14:18:05 UTC (rev 19730)
@@ -608,7 +608,7 @@
      * @param array $arrval ブレースホルダに挿入する値
      * @return array SQL の実行結果の配列
      */
-    function getCol($table, $col, $where = "", $arrval = array()) {
+    function getCol($col, $table, $where = "", $arrval = array()) {
         $sql = $this->getSql($col, $table, $where);
         $sql = $this->dbFactory->sfChangeMySQL($sql);
 

変更: branches/version-2_5-dev/data/class/helper/SC_Helper_CSV.php
===================================================================
--- branches/version-2_5-dev/data/class/helper/SC_Helper_CSV.php	2010-12-16 14:12:59 UTC (rev 19729)
+++ branches/version-2_5-dev/data/class/helper/SC_Helper_CSV.php	2010-12-16 14:18:05 UTC (rev 19730)
@@ -169,10 +169,12 @@
 
             // カテゴリID
             if (in_array('category_id', $arrOutputCols)) {
-                $row['category_id'] = $objQuery->getCol("dtb_product_categories",
-                                  "category_id",
-                                  "product_id = ?",
-                                  array($row['product_id']));
+                $row['category_id'] = $objQuery->getCol(
+                    "category_id",
+                    "dtb_product_categories",
+                    "product_id = ?",
+                    array($row['product_id'])
+                );
             }
 
             $outputArray[] = $row;

変更: branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php
===================================================================
--- branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php	2010-12-16 14:12:59 UTC (rev 19729)
+++ branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php	2010-12-16 14:18:05 UTC (rev 19730)
@@ -798,7 +798,7 @@
             } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) {
                 $objQuery =& SC_Query::getSingletonInstance();
                 $where = "product_id = ?";
-                $category_id = $objQuery->getCol("dtb_product_categories", "category_id", "product_id = ?", array($product_id));
+                $category_id = $objQuery->getCol("category_id", "dtb_product_categories", "product_id = ?", array($product_id));
                 $this->g_category_id = $category_id;
             } else {
                 // 不正な場合は、空の配列を返す。
@@ -1722,7 +1722,7 @@
             } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) {
                 $objQuery =& SC_Query::getSingletonInstance();
                 $where = "product_id = ?";
-                $maker_id = $objQuery->getCol("dtb_products", "maker_id", "product_id = ?", array($product_id));
+                $maker_id = $objQuery->getCol("maker_id", "dtb_products", "product_id = ?", array($product_id));
                 $this->g_maker_id = $maker_id;
             } else {
                 // 不正な場合は、空の配列を返す。

変更: branches/version-2_5-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	2010-12-16 14:12:59 UTC (rev 19729)
+++ branches/version-2_5-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	2010-12-16 14:18:05 UTC (rev 19730)
@@ -387,10 +387,12 @@
         $arrRet = $objQuery->select($col, $table, $where, array($product_id));
 
         // カテゴリID を取得
-        $arrRet[0]['category_id'] = $objQuery->getCol("dtb_product_categories",
-                                                      "category_id",
-                                                      "product_id = ?",
-        array($product_id));
+        $arrRet[0]['category_id'] = $objQuery->getCol(
+            "category_id",
+            "dtb_product_categories",
+            "product_id = ?",
+            array($product_id)
+        );
         //編集時に規格IDが変わってしまうのを防ぐために規格が登録されていなければ規格IDを取得する
         if (!$objDb->sfHasProductClass($_POST['product_id'])) {
             $arrRet[0]['product_class_id'] = SC_Utils::sfGetProductClassId($product_id,"0","0");

変更: branches/version-2_5-dev/data/include/module.inc
===================================================================
(バイナリファイルが異なっています)

変更: branches/version-2_5-dev/test/class/SC_Query_Test.php
===================================================================
--- branches/version-2_5-dev/test/class/SC_Query_Test.php	2010-12-16 14:12:59 UTC (rev 19729)
+++ branches/version-2_5-dev/test/class/SC_Query_Test.php	2010-12-16 14:18:05 UTC (rev 19730)
@@ -153,7 +153,7 @@
         $this->setTestData(3, "3", "f");
 
         $this->expected = array(1, 2);
-        $this->actual = $this->objQuery->getCol("test_table", "column1",  "id < ?",  array(3));
+        $this->actual = $this->objQuery->getCol("column1", "test_table", "id < ?",  array(3));
 
         $this->verify();
 




Svn-src-all メーリングリストの案内