Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Doctrine\DBAL\Driver\SQLite3;
4
 
5
use Doctrine\DBAL\Driver\FetchUtils;
6
use Doctrine\DBAL\Driver\Result as ResultInterface;
7
use SQLite3Result;
8
 
9
use const SQLITE3_ASSOC;
10
use const SQLITE3_NUM;
11
 
12
final class Result implements ResultInterface
13
{
14
    private ?SQLite3Result $result;
15
    private int $changes;
16
 
17
    /** @internal The result can be only instantiated by its driver connection or statement. */
18
    public function __construct(SQLite3Result $result, int $changes)
19
    {
20
        $this->result  = $result;
21
        $this->changes = $changes;
22
    }
23
 
24
    /** @inheritdoc */
25
    public function fetchNumeric()
26
    {
27
        if ($this->result === null) {
28
            return false;
29
        }
30
 
31
        return $this->result->fetchArray(SQLITE3_NUM);
32
    }
33
 
34
    /** @inheritdoc */
35
    public function fetchAssociative()
36
    {
37
        if ($this->result === null) {
38
            return false;
39
        }
40
 
41
        return $this->result->fetchArray(SQLITE3_ASSOC);
42
    }
43
 
44
    /** @inheritdoc */
45
    public function fetchOne()
46
    {
47
        return FetchUtils::fetchOne($this);
48
    }
49
 
50
    /** @inheritdoc */
51
    public function fetchAllNumeric(): array
52
    {
53
        return FetchUtils::fetchAllNumeric($this);
54
    }
55
 
56
    /** @inheritdoc */
57
    public function fetchAllAssociative(): array
58
    {
59
        return FetchUtils::fetchAllAssociative($this);
60
    }
61
 
62
    /** @inheritdoc */
63
    public function fetchFirstColumn(): array
64
    {
65
        return FetchUtils::fetchFirstColumn($this);
66
    }
67
 
68
    public function rowCount(): int
69
    {
70
        return $this->changes;
71
    }
72
 
73
    public function columnCount(): int
74
    {
75
        if ($this->result === null) {
76
            return 0;
77
        }
78
 
79
        return $this->result->numColumns();
80
    }
81
 
82
    public function free(): void
83
    {
84
        if ($this->result === null) {
85
            return;
86
        }
87
 
88
        $this->result->finalize();
89
        $this->result = null;
90
    }
91
}