Passed
Push — main ( e7c4ee...cf347e )
by Thierry
01:52
created

Statement::rowCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Lagdo\DbAdmin\Driver\Db\Pdo;
4
5
use Lagdo\DbAdmin\Driver\Db\StatementInterface;
6
use Lagdo\DbAdmin\Driver\Entity\StatementFieldEntity;
7
8
use PDOStatement;
9
use PDO;
10
11
class Statement extends PDOStatement implements StatementInterface
12
{
13
    /**
14
     * @var int
15
     */
16
    public $offset = 0;
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function fetchAssoc()
22
    {
23
        return $this->fetch(PDO::FETCH_ASSOC);
24
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29
    public function fetchRow()
30
    {
31
        return $this->fetch(PDO::FETCH_NUM);
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37
    public function fetchField()
38
    {
39
        $row = $this->getColumnMeta($this->offset++);
40
        $flags = $row['flags'] ?? [];
41
        return new StatementFieldEntity($row['native_type'], in_array("blob", (array)$flags),
42
            $row['name'], $row['name'], $row['table'], $row['table']);
43
    }
44
}
45