當前位置: 首頁>>代碼示例>>PHP>>正文


PHP model::_buildQueryWhere方法代碼示例

本文整理匯總了PHP中model::_buildQueryWhere方法的典型用法代碼示例。如果您正苦於以下問題:PHP model::_buildQueryWhere方法的具體用法?PHP model::_buildQueryWhere怎麽用?PHP model::_buildQueryWhere使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在model的用法示例。


在下文中一共展示了model::_buildQueryWhere方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAvgQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param model $listModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getAvgQuery(&$listModel, $label = "'calc'")
 {
     $table =& $listModel->getTable();
     $joinSQL = $listModel->_buildQueryJoin();
     $whereSQL = $listModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     return "SELECT FROM_UNIXTIME(AVG(UNIX_TIMESTAMP({$name}))) AS value, {$label} AS label FROM `{$table->db_table_name}` {$joinSQL} {$whereSQL}";
 }
開發者ID:nickbunyan,項目名稱:fabrik,代碼行數:14,代碼來源:date.php

示例2: getAvgQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param	model	$listModel
  * @param	string	$label the label to apply to each avg
  * @return	string	sql statement
  */
 protected function getAvgQuery(&$listModel, $label = "'calc'")
 {
     $item = $listModel->getTable();
     $joinSQL = $listModel->_buildQueryJoin();
     $whereSQL = $listModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     $groupModel = $this->getGroup();
     $roundTo = (int) $this->getParams()->get('avg_round');
     if ($groupModel->isJoin()) {
         //element is in a joined column - lets presume the user wants to sum all cols, rather than reducing down to the main cols totals
         return "SELECT ROUND(AVG({$name}), {$roundTo}) AS value, {$label} AS label FROM " . FabrikString::safeColName($item->db_table_name) . " {$joinSQL} {$whereSQL}";
     } else {
         // need to do first query to get distinct records as if we are doing left joins the sum is too large
         return "SELECT ROUND(AVG(value), {$roundTo}) AS value, label\nFROM (SELECT DISTINCT {$item->db_primary_key}, {$name} AS value, {$label} AS label FROM " . FabrikString::safeColName($item->db_table_name) . " {$joinSQL} {$whereSQL}) AS t";
     }
 }
開發者ID:romuland,項目名稱:khparts,代碼行數:22,代碼來源:element.php

示例3: getMedianQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param model $tableModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getMedianQuery(&$tableModel, $label = "'calc'")
 {
     $table =& $tableModel->getTable();
     $joinSQL = $tableModel->_buildQueryJoin();
     $whereSQL = $tableModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     //return "SELECT DATE_FORMAT(FROM_UNIXTIME((UNIX_TIMESTAMP($name))), '%H:%i:%s') AS value, $label AS label FROM `$table->db_table_name` $joinSQL $whereSQL";
     return "SELECT SEC_TO_TIME(TIME_TO_SEC({$name})) AS value, {$label} AS label FROM `{$table->db_table_name}` {$joinSQL} {$whereSQL}";
 }
開發者ID:nikshade,項目名稱:fabrik21,代碼行數:15,代碼來源:fabriktimer.php

示例4: getMedianQuery

 /**
  * build the query for the avg caclculation
  * @param model $listModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getMedianQuery(&$listModel, $label = "'calc'")
 {
     $fields = $listModel->getDBFields($this->getTableName(), 'Field');
     if ($fields[$this->getElement()->name]->Type == 'time') {
         $name = $this->getFullName(false, false, false);
         $table =& $listModel->getTable();
         $joinSQL = $listModel->_buildQueryJoin();
         $whereSQL = $listModel->_buildQueryWhere();
         return "SELECT SEC_TO_TIME(TIME_TO_SEC({$name})) AS value, {$label} AS label FROM `{$table->db_table_name}` {$joinSQL} {$whereSQL}";
     } else {
         return parent::getMedianQuery($listModel, $label);
     }
 }
開發者ID:juliano-hallac,項目名稱:fabrik,代碼行數:19,代碼來源:calc.php

示例5: getAvgQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param model $tableModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getAvgQuery(&$tableModel, $label = "'calc'")
 {
     $table =& $tableModel->getTable();
     $joinSQL = $tableModel->_buildQueryJoin();
     $whereSQL = $tableModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     $groupModel =& $this->getGroup();
     if ($groupModel->isJoin()) {
         //element is in a joined column - lets presume the user wants to sum all cols, rather than reducing down to the main cols totals
         return "SELECT ROUND(AVG({$name})) AS value, {$label} AS label FROM " . FabrikString::safeColName($table->db_table_name) . " {$joinSQL} {$whereSQL}";
     } else {
         // need to do first query to get distinct records as if we are doing left joins the sum is too large
         //return "SELECT ROUND(AVG(value)) AS value, label FROM (SELECT DISTINCT ".FabrikString::safeColName($table->db_table_name.'.'.$table->db_primary_key).", $name AS value, $label AS label FROM ".FabrikString::safeColName($table->db_table_name)." $joinSQL $whereSQL) AS t";
         return "SELECT ROUND(AVG(value)) AS value, label FROM (SELECT DISTINCT " . FabrikString::safeColName($table->db_table_name . '.' . $table->db_primary_key) . ", {$name} AS value, {$label} AS label FROM " . FabrikString::safeColName($table->db_table_name) . " {$joinSQL} {$whereSQL}) AS t";
     }
 }
開發者ID:nikshade,項目名稱:fabrik21,代碼行數:22,代碼來源:element.php


注:本文中的model::_buildQueryWhere方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。