protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); if ($options['countOutput'] === null) { // make sure we request the hostid to be able to expand macros if ($options['expandName'] !== null || $options['expandStepName'] !== null || $options['selectHosts'] !== null) { $sqlParts = $this->addQuerySelect($this->fieldId('hostid'), $sqlParts); } // select the state field to be able to return the deprecated value_flag property if ($this->outputIsRequested('macros', $options['output'])) { $sqlParts = $this->addQuerySelect($this->fieldId('variables'), $sqlParts); } } return $sqlParts; }
protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); if ($options['countOutput'] === null && $options['selectInterface'] !== null) { $sqlParts = $this->addQuerySelect('h.hostid', $sqlParts); } return $sqlParts; }
protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); if ($options['output'] != API_OUTPUT_COUNT && $options['globalmacro'] === null) { if ($options['selectGroups'] !== null || $options['selectHosts'] !== null || $options['selectTemplates'] !== null) { $sqlParts = $this->addQuerySelect($this->fieldId('hostid'), $sqlParts); } } return $sqlParts; }
/** * Unset "image" field from output. * * @param string $tableName * @param string $tableAlias * @param array $options * @param array $sqlParts * * @return array The resulting SQL parts array */ protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { if ($options['countOutput'] === null) { if ($options['output'] == API_OUTPUT_EXTEND) { $options['output'] = array('imageid', 'imagetype', 'name'); } elseif (is_array($options['output']) && in_array('image', $options['output'])) { foreach ($options['output'] as $idx => $field) { if ($field === 'image') { unset($options['output'][$idx]); } } } $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); } return $sqlParts; }
protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); if ($options['countOutput'] === null) { if ($options['selectDRules'] !== null) { $sqlParts = $this->addQuerySelect('dh.druleid', $sqlParts); } } return $sqlParts; }
protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); if ($options['countOutput'] === null) { if ($options['selectTrigger'] !== null) { $sqlParts = $this->addQuerySelect($this->fieldId('triggerid'), $sqlParts); } } return $sqlParts; }
protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); if ($options['countOutput'] === null) { if ($options['selectTriggers'] !== null || $options['selectRelatedObject'] !== null || $options['selectItems'] !== null || $options['selectHosts'] !== null) { $sqlParts = $this->addQuerySelect('e.object', $sqlParts); $sqlParts = $this->addQuerySelect('e.objectid', $sqlParts); } } return $sqlParts; }
protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); if ($options['countOutput'] === null) { // expandData if (!is_null($options['expandData'])) { $sqlParts['select']['host'] = 'h.host'; $sqlParts['from']['hosts'] = 'hosts h'; $sqlParts['where']['ah'] = 'a.hostid=h.hostid'; } if ($options['selectHosts'] !== null) { $sqlParts = $this->addQuerySelect('a.hostid', $sqlParts); } } return $sqlParts; }
protected function applyQueryOutputOptions($tableName, $tableAlias, array $options, array $sqlParts) { $sqlParts = parent::applyQueryOutputOptions($tableName, $tableAlias, $options, $sqlParts); // expandData if ($options['expandData'] !== null) { $sqlParts['select'][] = 'i.key_'; $sqlParts['select'][] = 'i.hostid'; $sqlParts['select'][] = 'i.flags'; $sqlParts['select'][] = 'h.host'; $sqlParts['from']['items'] = 'items i'; $sqlParts['from']['hosts'] = 'hosts h'; $sqlParts['where']['gii'] = 'gi.itemid=i.itemid'; $sqlParts['where']['hi'] = 'h.hostid=i.hostid'; } if ($options['selectGraphs'] !== null) { $sqlParts = $this->addQuerySelect('graphid', $sqlParts); } return $sqlParts; }