Ignore:
Timestamp:
2014/04/29 17:33:46 (10 years ago)
Author:
Seasoft
Message:

#2531 (DBMS に依存したサブクエリー内の LIMIT OFFSET を排除する)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/class/SC_Product.php

    r23230 r23378  
    8282            $o_table = $this->arrOrderData['table']; 
    8383            $o_order = $this->arrOrderData['order']; 
    84             $order = <<< __EOS__ 
    85                     ( 
    86                         SELECT $o_col 
    87                         FROM 
    88                             $o_table as T2 
    89                         WHERE T2.product_id = alldtl.product_id 
    90                         ORDER BY T2.$o_col $o_order 
    91                         LIMIT 1 
    92                     ) $o_order, product_id 
    93 __EOS__; 
    94             $objQuery->setOrder($order); 
     84            $objQuery->setOrder("T2.$o_col $o_order"); 
     85            $objQuery->setLimit(1); 
     86            $sub_sql = $objQuery->getSqlWithLimitOffset($o_col, "$o_table AS T2", 'T2.product_id = alldtl.product_id'); 
     87 
     88            $objQuery->setOrder("($sub_sql) $o_order, product_id"); 
    9589        } 
    9690        $arrReturn = $objQuery->getCol('alldtl.product_id', $table, '', $arrVal); 
Note: See TracChangeset for help on using the changeset viewer.