/**
     * SC_Queryインスタンスに設定された検索条件を元に並び替え済みの検索結果商品IDの配列を取得する。
     *
     * 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります.
     *
     * @param SC_Query $objQuery SC_Query インスタンス
     * @param array $arrVal 検索パラメーターの配列
     * @return array 商品IDの配列
     */
    function findProductIdsOrder(&$objQuery, $arrVal = array())
    {
        if (DB_TYPE != 'sqlsrv') {
            return parent::findProductIdsOrder($objQuery, $arrVal);
        } else {
            $table = <<<__EOS__
            dtb_products AS alldtl
__EOS__;
            $objQuery->setGroupBy('alldtl.product_id');
            if (is_array($this->arrOrderData) and $objQuery->order == '') {
                $o_col = $this->arrOrderData['col'];
                $o_table = $this->arrOrderData['table'];
                $o_order = $this->arrOrderData['order'];
                $order = <<<__EOS__
                    (
                        SELECT TOP 1 {$o_col}
                        FROM
                            {$o_table} as T2
                        WHERE T2.product_id = alldtl.product_id
                        ORDER BY T2.{$o_col} {$o_order}
                    ) {$o_order}, product_id
__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;
        }
    }
 /**
  * 検索結果の取得
  * @param array $whereAndBind string whereと array bindの連想配列
  * @param SC_Product $objProduct
  */
 function getProducts($whereAndBind, &$objProduct, $page_max, $startno)
 {
     $where = $whereAndBind['where'];
     $bind = $whereAndBind['bind'];
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objQuery->setWhere($where);
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setLimitOffset($page_max, $startno);
     // 検索結果の取得
     return $objProduct->findProductIdsOrder($objQuery, $bind);
 }