Passed
Push — main ( af7fe2...46179f )
by Thierry
01:51 queued 14s
created

ConnectionTrait::info()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
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
     * Execute a query on the current database
46
     *
47
     * @param string $query
48
     * @param bool $unbuffered
49
     *
50
     * @return StatementInterface|bool
51
     */
52
    public function query(string $query, bool $unbuffered = false)
53
    {
54
        return $this->connection->query($query, $unbuffered);
55
    }
56
57
    /**
58
     * Execute a query on the current database and fetch the specified field
59
     *
60
     * @param string $query
61
     * @param int $field
62
     *
63
     * @return mixed
64
     */
65
    public function result(string $query, int $field = -1)
66
    {
67
        return $this->connection->result($query, $field);
68
    }
69
70
    /**
71
     * Get the next row set of the last query
72
     *
73
     * @return bool
74
     */
75
    public function nextResult()
76
    {
77
        return $this->connection->nextResult();
78
    }
79
80
    /**
81
     * Execute a query on the current database and store the result
82
     *
83
     * @param string $query
84
     *
85
     * @return bool
86
     */
87
    public function multiQuery(string $query)
88
    {
89
        return $this->connection->multiQuery($query);
90
    }
91
92
    /**
93
     * Get the result saved by the multiQuery() method
94
     *
95
     * @return StatementInterface|bool
96
     */
97
    public function storedResult()
98
    {
99
        return $this->connection->storedResult();
100
    }
101
102
    /**
103
     * Convert value returned by database to actual value
104
     *
105
     * @param string|resource|null $value
106
     * @param TableFieldEntity $field
107
     *
108
     * @return string
109
     */
110
    public function value($value, TableFieldEntity $field)
111
    {
112
        return $this->connection->value($value, $field);
113
    }
114
}
115