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


PHP ARSelectFilter::getFieldList方法代码示例

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


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

示例1: createStatementBody

 /**
  * Creates a string representing SQL SELECT query
  *
  * @return string
  */
 private function createStatementBody()
 {
     $filterFieldList = $this->filter instanceof ARSelectFilter ? $this->filter->getFieldList() : array();
     $fields = array_merge($this->fieldList, $filterFieldList);
     $tableAliases = array();
     $fieldListStr = "";
     $preparedFieldList = array();
     if (empty($fields)) {
         $fieldStr = "*";
     } else {
         foreach ($fields as $fieldInfo) {
             $field = "";
             if (!empty($fieldInfo['tableName'])) {
                 $field = $fieldInfo['tableName'] . "." . $fieldInfo['fieldName'];
             } else {
                 $field = $fieldInfo['fieldName'];
             }
             if (!empty($fieldInfo['fieldNameInResult'])) {
                 $field .= ' AS "' . $fieldInfo['fieldNameInResult'] . '"';
             }
             $preparedFieldList[] = $field;
         }
     }
     $fieldListStr = implode(", ", $preparedFieldList);
     $tableListStr = implode(", ", array_keys($this->tableList));
     // add joins from select filter
     $filterJoins = $this->filter->getJoinList();
     $joins = array_merge($this->joinList, $filterJoins);
     $joinListStr = "";
     if (!empty($joins)) {
         $preparedJoinList = array();
         foreach ($joins as $joinItem) {
             if (!empty($joinItem['tableAliasName'])) {
                 $alias = ' AS `' . $joinItem['tableAliasName'] . '`';
                 $tableName = $joinItem['tableAliasName'];
             } else {
                 $alias = '';
                 $tableName = $joinItem['tableName'];
             }
             if (empty($joinItem['tableAliasName'])) {
                 $tableAliases[$joinItem['tableName']] = $joinItem['tableName'];
             } else {
                 if (!isset($tableAliases[$joinItem['tableName']])) {
                     $tableAliases[$joinItem['tableName']] = $joinItem['tableAliasName'];
                 }
             }
             $preparedJoinList[] = "LEFT JOIN `" . $joinItem['tableName'] . '`' . $alias . " ON " . (isset($tableAliases[$joinItem['mainTableName']]) ? $tableAliases[$joinItem['mainTableName']] : $joinItem['mainTableName']) . "." . $joinItem['mainTableJoinFieldName'] . " = " . $tableName . "." . $joinItem['tableJoinFieldName'] . '';
         }
         $joinListStr = implode(" ", $preparedJoinList);
     }
     return "SELECT " . $fieldListStr . " FROM " . $tableListStr . " " . $joinListStr;
 }
开发者ID:saiber,项目名称:www,代码行数:57,代码来源:ARSelectQueryBuilder.php

示例2: merge

 /**
  * Merges two filters (filter supplied as parameter overwrites order and limit
  * params of this filter)
  *
  * @param ARSelectFilter $filter
  */
 public function merge(ARSelectFilter $filter)
 {
     if ($filter->isConditionSet()) {
         $this->mergeCondition($filter->getCondition());
     }
     if ($filter->isHavingConditionSet()) {
         $this->mergeHavingCondition($filter->getHavingCondition());
     }
     $this->setFieldOrder($filter->getFieldOrder());
     $this->setLimit($filter->getLimit(), $filter->getOffset());
     $groupings = $filter->getGroupingFields();
     $this->fieldListForGroup = array_merge($this->getGroupingFields(), $groupings);
     $joins = $filter->getJoinList();
     $this->joinList = array_merge($this->joinList, $joins);
     $fields = $filter->getFieldList();
     $this->fieldList = array_merge($this->fieldList, $fields);
 }
开发者ID:saiber,项目名称:www,代码行数:23,代码来源:ARSelectFilter.php


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