Passed
Push — main ( af1024...b746de )
by Thierry
02:04
created

ConnectionTrait::affectedRows()   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
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Lagdo\DbAdmin\Driver;
4
5
use Lagdo\DbAdmin\Driver\Entity\ConfigEntity;
6
use Lagdo\DbAdmin\Driver\Entity\TableFieldEntity;
7
8
use Lagdo\DbAdmin\Driver\Db\StatementInterface;
9
10
trait ConnectionTrait
11
{
12
    /**
13
     * Get the server description
14
     *
15
     * @return string
16
     */
17
    public function serverInfo()
18
    {
19
        return $this->connection->serverInfo();
20
    }
21
22
    /**
23
     * Get the driver extension
24
     *
25
     * @return string
26
     */
27
    public function extension()
28
    {
29
        return $this->connection->extension();
30
    }
31
32
    /**
33
     * Sets the client character set
34
     *
35
     * @param string $charset
36
     *
37
     * @return bool
38
     */
39
    public function setCharset(string $charset)
40
    {
41
        return $this->connection->setCharset($charset);
42
    }
43
44
    /**
45
     * Return a quoted string
46
     *
47
     * @param string $string
48
     *
49
     * @return string
50
     */
51
    public function quote(string $string)
52
    {
53
        return $this->connection->quote($string);
54
    }
55
56
    /**
57
     * Execute a query on the current database
58
     *
59
     * @param string $query
60
     * @param bool $unbuffered
61
     *
62
     * @return StatementInterface|bool
63
     */
64
    public function query(string $query, bool $unbuffered = false)
65
    {
66
        return $this->connection->query($query, $unbuffered);
67
    }
68
69
    /**
70
     * Get the number of rows affected by the last query
71
     *
72
     * @return integer
73
     */
74
    public function affectedRows()
75
    {
76
        return $this->connection->affectedRows();
77
    }
78
79
    /**
80
     * Execute a query on the current database and fetch the specified field
81
     *
82
     * @param string $query
83
     * @param int $field
84
     *
85
     * @return mixed
86
     */
87
    public function result(string $query, int $field = -1)
88
    {
89
        return $this->connection->result($query, $field);
90
    }
91
92
    /**
93
     * Execute a query on the current database and store the result
94
     *
95
     * @param string $query
96
     *
97
     * @return bool
98
     */
99
    public function multiQuery(string $query)
100
    {
101
        return $this->connection->multiQuery($query);
102
    }
103
104
    /**
105
     * Get the result saved by the multiQuery() method
106
     *
107
     * @return StatementInterface|null
108
     */
109
    public function storedResult()
110
    {
111
        return $this->connection->storedResult();
112
    }
113
114
    /**
115
     * Get the next row set of the last query
116
     *
117
     * @return bool
118
     */
119
    public function nextResult()
120
    {
121
        return $this->connection->nextResult();
122
    }
123
124
    /**
125
     * Convert value returned by database to actual value
126
     *
127
     * @param string|resource|null $value
128
     * @param TableFieldEntity $field
129
     *
130
     * @return string
131
     */
132
    public function value($value, TableFieldEntity $field)
133
    {
134
        return $this->connection->value($value, $field);
135
    }
136
}
137