Beispiel #1
0
 /**
  * Строит GROUP BY часть запроса
  * @internal
  * @param ISelectBuilder $query
  * @return string
  */
 private function buildSelectGroupByPart(ISelectBuilder $query)
 {
     $conditions = $query->getGroupByConditions();
     if (!count($conditions)) {
         return '';
     }
     $result = [];
     foreach ($conditions as $column => $direction) {
         $direction = strtoupper($direction);
         if ($direction == IQueryBuilder::ORDER_ASC) {
             $result[] = $this->quoteIdentifier($column);
         } else {
             $result[] = $this->quoteIdentifier($column) . ' ' . $direction;
         }
     }
     return "\nGROUP BY " . implode(", ", $result);
 }
 /**
  * Строит GROUP BY часть запроса
  * @internal
  * @param ISelectBuilder $query
  * @return string
  */
 private function buildSelectGroupByPart(ISelectBuilder $query)
 {
     $conditions = $query->getGroupByConditions();
     if (!count($conditions)) {
         return '';
     }
     $result = [];
     foreach ($conditions as $column => $direction) {
         $result[] = $this->quoteIdentifier($column);
     }
     return "\nGROUP BY " . implode(", ", $result);
 }