Passed
Push — main ( 9d67f9...af7fe2 )
by Thierry
02:49
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
     * @var int
20
     */
21
    public $numRows = 0;
22
23
    /**
24
     * @inheritDoc
25
     */
26
    public function rowCount()
27
    {
28
        return $this->numRows;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function fetchAssoc()
35
    {
36
        return $this->fetch(PDO::FETCH_ASSOC);
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42
    public function fetchRow()
43
    {
44
        return $this->fetch(PDO::FETCH_NUM);
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function fetchField()
51
    {
52
        $row = $this->getColumnMeta($this->offset++);
53
        return new StatementFieldEntity($row['native_type'], in_array("blob", (array)$row['flags']),
54
            $row['name'], $row['name'], $row['table'], $row['table']);
55
    }
56
}
57