private function getQueryResult(QueryContext $context, $query)
 {
     $result = DB::select($query, $context->getParams());
     if (!empty($this->formats)) {
         $formatResult = array();
         foreach ($result as $row) {
             $item = array();
             foreach ($row as $key => $value) {
                 $item[$key] = array_key_exists($key, $this->formats) ? $this->formatConvert($row, $this->getFieldValue($key, $value), $this->formats[$key]) : $this->getFieldValue($key, $value);
             }
             $formatResult[] = $item;
         }
     } else {
         $formatResult = array();
         foreach ($result as $row) {
             $item = array();
             foreach ($row as $key => $value) {
                 $item[$key] = $this->getFieldValue($key, $value);
             }
             $formatResult[] = $item;
         }
     }
     if (!empty($formatResult)) {
         if ($this->pluck) {
             /** @var FieldInfo $field */
             $field = $this->selectFields[0];
             $alias = $field->getAlias();
             if (isset($alias)) {
                 return $formatResult[0][$alias];
             }
             return $formatResult[0][$field->getField()];
         }
         if ($this->singleField) {
             $result = array();
             foreach ($formatResult as $row) {
                 if (!empty($row)) {
                     foreach ($row as $key => $value) {
                         $result[] = $value;
                         break;
                     }
                 }
             }
             return $result;
         }
         if ($this->detail) {
             return isset($formatResult[0]) ? $formatResult[0] : null;
         }
     } else {
         if ($this->pluck || $this->detail) {
             return null;
         }
     }
     return $formatResult;
 }