|
6 | 6 | use Amp\Postgres\PostgresStatement; |
7 | 7 | use Amp\Postgres\PostgresTransaction; |
8 | 8 | use Amp\Sql\Common\PooledTransaction; |
9 | | -use Amp\Sql\Result; |
10 | | -use Amp\Sql\Statement; |
11 | 9 |
|
12 | 10 | /** |
13 | 11 | * @internal |
14 | 12 | * @extends PooledTransaction<PostgresResult, PostgresStatement, PostgresTransaction> |
15 | 13 | */ |
16 | 14 | final class PostgresPooledTransaction extends PooledTransaction implements PostgresTransaction |
17 | 15 | { |
18 | | - protected function createStatement(Statement $statement, \Closure $release): PostgresStatement |
19 | | - { |
20 | | - \assert($statement instanceof PostgresStatement); |
21 | | - return new PostgresPooledStatement($statement, $release); |
22 | | - } |
23 | | - |
24 | | - protected function createResult(Result $result, \Closure $release): PostgresResult |
25 | | - { |
26 | | - \assert($result instanceof PostgresResult); |
27 | | - return new PostgresPooledResult($result, $release); |
28 | | - } |
29 | | - |
30 | | - /** |
31 | | - * @param \Closure():void $release |
32 | | - */ |
33 | | - public function __construct(private readonly PostgresTransaction $transaction, \Closure $release) |
34 | | - { |
35 | | - parent::__construct($transaction, $release); |
36 | | - } |
37 | | - |
38 | | - /** |
39 | | - * Changes return type to this library's Result type. |
40 | | - */ |
41 | | - public function query(string $sql): PostgresResult |
42 | | - { |
43 | | - return parent::query($sql); |
44 | | - } |
45 | | - |
46 | | - /** |
47 | | - * Changes return type to this library's Statement type. |
48 | | - */ |
49 | | - public function prepare(string $sql): PostgresStatement |
50 | | - { |
51 | | - return parent::prepare($sql); |
52 | | - } |
53 | | - |
54 | | - /** |
55 | | - * Changes return type to this library's Result type. |
56 | | - */ |
57 | | - public function execute(string $sql, array $params = []): PostgresResult |
58 | | - { |
59 | | - return parent::execute($sql, $params); |
60 | | - } |
61 | | - |
62 | | - public function notify(string $channel, string $payload = ""): PostgresResult |
63 | | - { |
64 | | - return $this->transaction->notify($channel, $payload); |
65 | | - } |
66 | | - |
67 | | - public function quoteString(string $data): string |
68 | | - { |
69 | | - return $this->transaction->quoteString($data); |
70 | | - } |
71 | | - |
72 | | - public function quoteName(string $name): string |
73 | | - { |
74 | | - return $this->transaction->quoteName($name); |
75 | | - } |
| 16 | + use PostgresTransactionDelegate; |
76 | 17 |
|
77 | | - public function escapeByteA(string $data): string |
| 18 | + protected function getTransaction(): PostgresTransaction |
78 | 19 | { |
79 | | - return $this->transaction->escapeByteA($data); |
| 20 | + return $this->transaction; |
80 | 21 | } |
81 | 22 | } |
0 commit comments