Returns an array containing all values from a given column in the result set

@param string|int $fieldIndex Either a column name or an index (0-based)
@return array
@throws exceptions\InvalidArgumentException
424078
public function fetchColumn($fieldIndex): array
    {
        $this->checkFieldIndex($fieldIndex);
        if (is_string($fieldIndex)) {
            $fieldIndex = $this->namesHash[$fieldIndex];
        }

        $result = [];
        for ($i = 0; $i < $this->numRows; $i++) {
            $result[] = $this->converters[$fieldIndex]->input(
                pg_fetch_result($this->resource, $i, $fieldIndex)
            );
        }
        return $result;
    }
797016
public function dropIndex($indexName, array $options = [])
    {
        if ('*' === $indexName) {
            throw new InvalidArgumentException(
                'Invalid $indexName "*", use dropIndexes() method to delete all indexes.'
            );
        }

        $command = [
            'dropIndexes' => $this->collectionName,
            'index' => $indexName,
        ];

        $cursor = $this->executeCommand($command, $options);

        return $cursor->current();
    }
696982
public function get($index = 0, $field = null) {
        if ($this->performed) {
            if (is_numeric($index)) {
                $index = intval($index);
            } else if (is_string($index)) {
                $field = $index;
                $index = 0;
            } else {
                return null;
            }
        } else {
            if (is_array($index)) {
                return $this->where($index);
            }

            if (is_numeric($index)) {
                $index = intval($index);
            } else if (is_string($index)) {
                $field = $index;
                $this->field($field);
                $index = 0;
                $this->limit(0, 1);
            } else {
                $index = 0;
            }
            $this->select();
        }
        if (isset ($this->resultSets [ $index ])) {
            $row = $this->resultSets [ $index ];
            if ($field != null && isset ($row [ $field ])) {
                return $row [ $field ];
            }
            if ($field == null) {
                return $row;
            }
        }

        return null;
    }
1144428
public static function fromIndex(Db\Index $index)
    {
        return new self([
            'name' => $index->getName(),
            'columns' => $index->getColumns(),
            'type' => $index->getType()
        ]);
    }
851221
public function upsertToIndex($subject, $indexName = null)
    {
        $indexName = $this->resolveIndexName($indexName);

        if ($subject instanceof Searchable) {
            $subject = [$subject];
        }

        if (is_array($subject) || $subject instanceof Traversable) {
            $searchableItems = collect($subject)
                ->each(function ($item) {
                    if (!$item instanceof Searchable) {
                        throw new InvalidArgumentException();
                    }
                })
                ->flatMap(function ($item) use($indexName) {
                    return
                        [
                            [
                                'index' => [
                                    '_id'    => $item->getSearchableId(),
                                    '_index' => $indexName,
                                    '_type'  => $item->getSearchableType(),
                                ],
                            ],

                            $item->getSearchableBody(),
                        ];
                })
                ->toArray();

            $payload['body'] = $searchableItems;

            $this->elasticsearch->bulk($payload);

            return;
        }

        throw new InvalidArgumentException('Subject must be a searchable or array of searchables');
    }
1012722
public function offsetGet($index)
    {
        if (!isset($this->a[$index])) {
            throw new InvalidArgumentException('Element not found at the'
                . " given offset $index.");
        }

        return $this->a[$index];
    }
553151
public function getRow($index = 0, $column = null)
    {
        //argument test
        Argument::i()
            //Argument 1 must be a string or int
            ->test(1, 'string', 'int')
            //Argument 2 must be a string or null
            ->test(2, 'string', 'null');
        
        if (is_string($index)) {
            $column = $index;
            $index = 0;
        }
        
        $rows = $this->getRows();
        
        if (!is_null($column) && isset($rows[$index][$column])) {
            return $rows[$index][$column];
        } else if (is_null($column) && isset($rows[$index])) {
            return $rows[$index];
        }
        
        return null;
    }
1095919
public function select(array $fields)
    {
        if (empty($fields)) {
            throw new InvalidArgumentException('The field array must not be' .
                ' empty.');
        }

        foreach ($fields as $field) {
            $validationResult = QueryValidator::validateFieldName($field);
            if ($validationResult->isFailed()) {
                throw new InvalidArgumentException('The field array for' .
                    ' building the SELECT clause contains invalid field name.' .
                    ' Validation fail reason: ' .
                    $validationResult->getFailReason());
            }
        }

        // Flipping an array will create a new associative array. The keys of
        // the new associative array make a set of distinct fields.
        $distinctFields = array_flip($fields);
        $this->selectFields = array_keys($distinctFields);
    }
514154
protected static function loadByPrimaryKey($index, $fields = null)
    {
        //
        $table = static::getTable();

        // get primary key
        $key = static::getPrimaryKey();

        //
        $alias = static::getClassName();

        //
        $join = null;

        //
        $requestedFields = $fields ? $fields : static::getDefaultFields();

        // parse SQL select fields
        $selectFields = static::getDatabase()
            ->getWriter()
            ->selectFields($requestedFields, $alias, $join);

        // prepare SQL query
        $sql = " SELECT {$selectFields} "
             ."   FROM {$table} AS {$alias} {$join} "
             ."  WHERE {$alias}.{$key}=:index "
             .'  LIMIT 1';

        $params = [
            'index' => $index,
        ];

        // fetch data on database and return it
        $result = static::fetch($sql, $params, [
            'SingleRow'     => true,
            'SingleValue'   => is_string($fields),
            'CastToObject'  => is_null($fields),
            //'ExpanseObject' => static::isReadable(),
            'ExpanseObject' => false,
        ]);

        //
        return $result;
    }
802377
private function get_dataset($index, $apiindex) {
        if (isset($this->data[$index])) {
            return $this->data[$index];
        }

        $data = array();
        foreach ($this->raw as $k => $v) {
            $pos = strpos($k, $apiindex);
            if ($pos !== 0) {
                continue;
            }

            $data[] = substr($k, strlen($apiindex));
        }

        $this->data[$index] = $data;

        return $data;
    }
622456
public function getColumnByIndex($index)
    {
        $keys = array_keys($this->columns);
        if (empty($keys[$index]) || empty($column = $this->columns[$keys[$index]])) {
            throw new \InvalidArgumentException('Table don\'t have a column index : ' . $index);
        }

        return $column;
    }
1082406
public function getSheet($sheetIndex = 0)
    {
        if (!isset($this->sheets[$sheetIndex])) {
            throw new \InvalidArgumentException(sprintf('No sheet with index %d defined', $sheetIndex));
        }

        return $this->sheets[$sheetIndex];
    }
687714
public function getRow($index = 0, $column = null)
    {
        if (is_string($index)) {
            $column = $index;
            $index = 0;
        }

        $rows = $this->getRows();

        if (!is_null($column) && isset($rows[$index][$column])) {
            return $rows[$index][$column];
        } else if (is_null($column) && isset($rows[$index])) {
            return $rows[$index];
        }

        return null;
    }
1365103
public Field getFieldByIndex(int fieldIndex)
    {
        checkElementIndex(fieldIndex, allFields.size(), "fieldIndex");
        return allFields.get(fieldIndex);
    }
814146
public function getIndexDeclarationSQL($name, Index $index)
    {
        $columns = $index->getQuotedColumns($this);
        $name = new Identifier($name);

        if (count($columns) == 0) {
            throw new \InvalidArgumentException("Incomplete definition. 'columns' required.");
        }

        return 'INDEX ' . $name->getQuotedName($this) . ' USING FULLTEXT ('. $this->getIndexFieldDeclarationListSQL($columns) . ')';
    }
422507
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value',
                reset($field->value->data),
                new Search\FieldType\StringField()
            ),
        );
    }
1228100
public function offsetGet($index)
    {
        if (!array_key_exists($index, $this->data)) {
            throw InvalidArgumentException::format(
                    'Invalid array object index: expecting one of (%s), %s given',
                    Debug::formatValues(array_keys($this->data)), is_string($index) ? "'{$index}'" : $index
            );
        }

        return $this->data[$index];
    }