-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDBPassToLowerLayerTrait.php
More file actions
110 lines (89 loc) · 2.88 KB
/
DBPassToLowerLayerTrait.php
File metadata and controls
110 lines (89 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
namespace Squirrel\Queries;
use Squirrel\Connection\ConnectionInterface;
/**
* Default implementation of all DBRawInterface functions to pass them to lower layer
*/
trait DBPassToLowerLayerTrait
{
private DBRawInterface $lowerLayer;
public function transaction(callable $func, mixed ...$arguments): mixed
{
return $this->lowerLayer->transaction($func, ...$arguments);
}
public function inTransaction(): bool
{
return $this->lowerLayer->inTransaction();
}
public function select(string|array $query, array $vars = []): DBSelectQueryInterface
{
return $this->lowerLayer->select($query, $vars);
}
public function fetch(DBSelectQueryInterface $selectQuery): ?array
{
return $this->lowerLayer->fetch($selectQuery);
}
public function clear(DBSelectQueryInterface $selectQuery): void
{
$this->lowerLayer->clear($selectQuery);
}
public function fetchOne(string|array $query, array $vars = []): ?array
{
return $this->lowerLayer->fetchOne($query, $vars);
}
public function fetchAll(string|array $query, array $vars = []): array
{
return $this->lowerLayer->fetchAll($query, $vars);
}
public function fetchAllAndFlatten(string|array $query, array $vars = []): array
{
return $this->lowerLayer->fetchAllAndFlatten($query, $vars);
}
public function insert(
string $table,
array $row = [],
string $autoIncrement = '',
): ?string {
return $this->lowerLayer->insert($table, $row, $autoIncrement);
}
public function insertOrUpdate(
string $table,
array $row = [],
array $index = [],
?array $update = null,
): void {
$this->lowerLayer->insertOrUpdate($table, $row, $index, $update);
}
public function update(string $table, array $changes, array $where = []): int
{
return $this->lowerLayer->update($table, $changes, $where);
}
public function delete(string $table, array $where = []): int
{
return $this->lowerLayer->delete($table, $where);
}
public function change(string $query, array $vars = []): int
{
return $this->lowerLayer->change($query, $vars);
}
public function quoteIdentifier(string $identifier): string
{
return $this->lowerLayer->quoteIdentifier($identifier);
}
public function quoteExpression(string $expression): string
{
return $this->lowerLayer->quoteExpression($expression);
}
public function setTransaction(bool $inTransaction): void
{
$this->lowerLayer->setTransaction($inTransaction);
}
public function getConnection(): ConnectionInterface
{
return $this->lowerLayer->getConnection();
}
public function setLowerLayer(DBRawInterface $lowerLayer): void
{
$this->lowerLayer = $lowerLayer;
}
}