src/Soluble/Metadata/Reader/PdoMysqlMetadataReader.php
protected function readFields(string $sql): array
    {
        if (trim($sql) === '') {
            throw new Exception\EmptyQueryException('Cannot read fields for an empty query');
        }

        $sql = $this->getEmptiedQuery($sql);

        $stmt = $this->pdo->prepare($sql);
        if ($stmt->execute() !== true) {
            throw new Exception\InvalidQueryException(
                sprintf('Invalid query: %s', $sql)
            );
        }

        $column_count = $stmt->columnCount();
        $metaFields = [];
        for ($i = 0; $i < $column_count; ++$i) {
            $meta = $stmt->getColumnMeta($i);
            $metaFields[$i] = $meta;
        }

        $stmt->closeCursor();
        unset($stmt);

        return $metaFields;
    }
protected function readFields(string $sql): array
    {
        if (trim($sql) === '') {
            throw new Exception\EmptyQueryException('Cannot read fields for an empty query');
        }

        $sql = $this->getEmptiedQuery($sql);

        $stmt = $this->pdo->prepare($sql);
        if ($stmt->execute() !== true) {
            throw new Exception\InvalidQueryException(
                sprintf('Invalid query: %s', $sql)
            );
        }

        $column_count = $stmt->columnCount();
        $metaFields = [];
        for ($i = 0; $i < $column_count; ++$i) {
            $meta = $stmt->getColumnMeta($i);
            $metaFields[$i] = $meta;
        }

        $stmt->closeCursor();
        unset($stmt);

        return $metaFields;
    }
protected function readFields ( string $ sql ) : array { if ( trim ( $ sql ) === '' ) { throw new Exception \ EmptyQueryException ( 'Cannot read fields for an empty query' ) ; } $ sql = $ this -> getEmptiedQuery ( $ sql ) ; $ stmt = $ this -> pdo -> prepare ( $ sql ) ; if ( $ stmt -> execute ( ) !== true ) { throw new Exception \ InvalidQueryException ( sprintf ( 'Invalid query: %s' , $ sql ) ) ; } $ column_count = $ stmt -> columnCount ( ) ; $ metaFields = [ ] ; for ( $ i = 0 ; $ i < $ column_count ; ++ $ i ) { $ meta = $ stmt -> getColumnMeta ( $ i ) ; $ metaFields [ $ i ] = $ meta ; } $ stmt -> closeCursor ( ) ; unset ( $ stmt ) ; return $ metaFields ; }
Read fields from pdo source.

@return array<int, array>

@throws Exception\ConnectionException
@throws \Soluble\Metadata\Exception\EmptyQueryException
@throws \Soluble\Metadata\Exception\InvalidQueryException
Read fields from pdo source .