当前位置: 首页>>代码示例>>PHP>>正文


PHP SC_Query_Ex::getSql方法代码示例

本文整理汇总了PHP中SC_Query_Ex::getSql方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Query_Ex::getSql方法的具体用法?PHP SC_Query_Ex::getSql怎么用?PHP SC_Query_Ex::getSql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SC_Query_Ex的用法示例。


在下文中一共展示了SC_Query_Ex::getSql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: selectSubquery

 function selectSubquery($column, $table, $where, $arrWhereVal)
 {
     if (is_string($column)) {
         $objQuery = new SC_Query_Ex();
         $subquery = $objQuery->getSql($column, $table, $where, $arrWhereVal);
         $this->setWhere("{$column} IN ({$subquery})");
     } else {
         $objQuery = new SC_Query_Ex();
         $_column = $column["column"];
         $_from = $column["from"];
         $_where = $column["where"];
         $column1 = sprintf("(%s)", $objQuery->getSql($_column, $_from, $_where));
         $subquery = $objQuery->getSql($column1, $table, $where, $arrWhereVal);
         $this->setWhere("{$_column} IN ({$subquery})");
     }
     if (is_array($arrWhereVal)) {
         foreach ($arrWhereVal as $value) {
             $this->arrVal[] = $value;
         }
     } elseif (!is_null($arrWhereVal)) {
         $this->arrVal[] = $arrWhereVal;
     }
 }
开发者ID:alice-asahina,项目名称:kisekae_touch,代码行数:23,代码来源:SC_CustomerList_Ex.php

示例2: buildQuery

 /**
  * クエリを構築する.
  *
  * 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する.
  * クエリパラメーターは, SC_FormParam の入力値から取得する.
  *
  * 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される.
  *
  * @param  string       $key          検索条件のキー
  * @param  string       $where        構築する WHERE 句
  * @param  array        $arrValues    構築するクエリパラメーター
  * @param  SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param  SC_FormParam $objDb        SC_Helper_DB_Ex インスタンス
  * @return void
  */
 public function buildQuery($key, &$where, &$arrValues, SC_FormParam &$objFormParam, SC_Helper_DB &$objDb)
 {
     $objSql = new SC_SelectSql_Ex();
     $objSql->setWhere($where);
     $objQuery = new SC_Query_Ex("", false, true);
     $data = array();
     $id = "product_id";
     $extends = true;
     $value = $objFormParam->getValue($key);
     switch ($key) {
         case "search_orderby":
             $column = "update_date";
             switch ($value) {
                 default:
                 case "date":
                     $column = "auto_display_start_date";
             }
             if ($objDb->sfColumnExists("dtb_products", $column)) {
                 $this->order = $column;
             }
             break;
         case "search_character_id":
             $sub_query = $objQuery->getSql($id, "cp_dtb_product_characters", "character_id=?");
             $objSql->setWhere("{$id} IN ({$sub_query})");
             $arrValues[] = $value;
             break;
         case "search_auto_display_status":
             if (is_array($value)) {
                 $data = $objSql->setItemTerm($value, "auto_display_status");
             } elseif (is_string($value)) {
                 $data = $objSql->setItemTerm((array) $value, "auto_display_status");
             }
             break;
         case "search_auto_display_start_date_start_year":
         case "search_auto_display_start_date_end_year":
         case "search_auto_display_end_date_start_year":
         case "search_auto_display_end_date_end_year":
         case "search_spass_provide_start_date_start_year":
         case "search_spass_provide_start_date_end_year":
         case "search_spass_provide_end_date_start_year":
         case "search_spass_provide_end_date_end_year":
             $y = $objFormParam->getValue($key);
             $m = $objFormParam->getValue(str_replace("_year", "_month", $key));
             $d = $objFormParam->getValue(str_replace("_year", "_day", $key));
             switch ($key) {
                 case "search_auto_display_start_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "auto_display_start_date");
                     break;
                 case "search_auto_display_start_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "auto_display_start_date");
                     break;
                 case "search_auto_display_end_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "auto_display_end_date");
                     break;
                 case "search_auto_display_end_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "auto_display_end_date");
                     break;
                 case "search_spass_provide_start_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "spass_provide_start_date");
                     break;
                 case "search_search_spass_provide_start_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "spass_provide_start_date");
                     break;
                 case "search_search_spass_provide_end_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "spass_provide_end_date");
                     break;
                 case "search_search_spass_provide_end_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "spass_provide_end_date");
                     break;
             }
             break;
         default:
             $extends = false;
             parent::buildQuery($key, $where, $arrValues, $objFormParam, $objDb);
     }
     if ($extends) {
         foreach ($data as $d) {
             $arrValues[] = $d;
         }
         $where = $objSql->getWhere();
     }
 }
开发者ID:alice-asahina,项目名称:kisekae_touch,代码行数:97,代码来源:LC_Page_Admin_Products_Ex.php


注:本文中的SC_Query_Ex::getSql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。