@@ -28,11 +28,6 @@ class PostgreSqlSwooleExtConnection extends Connection
28
28
{
29
29
use PostgreSqlSwooleExtManagesTransactions;
30
30
31
- /**
32
- * @var PostgreSQL
33
- */
34
- protected mixed $ pdo ;
35
-
36
31
protected int $ fetchMode = SW_PGSQL_ASSOC ;
37
32
38
33
/**
@@ -110,8 +105,8 @@ public function select(string $query, array $bindings = [], bool $useReadPdo = t
110
105
111
106
$ result = $ statement ->execute ($ this ->prepareBindings ($ bindings ));
112
107
113
- if ($ result === false || ! empty ($ this -> pdo ->error )) {
114
- throw new QueryException ($ query , [], new Exception ($ this -> pdo ->error ));
108
+ if ($ result === false || ! empty ($ statement ->error )) {
109
+ throw new QueryException ($ query , [], new Exception ($ statement ->error ));
115
110
}
116
111
117
112
return $ statement ->fetchAll ($ this ->fetchMode ) ?: [];
@@ -153,7 +148,7 @@ public function queryAll(string $query, array $bindings = []): array
153
148
154
149
$ result = $ statement ->execute ($ bindings );
155
150
if (! $ result ) {
156
- throw new QueryException ($ query , [], new Exception ($ this -> pdo ->error ));
151
+ throw new QueryException ($ query , [], new Exception ($ statement ->error ));
157
152
}
158
153
159
154
return $ statement ->fetchAll (SW_PGSQL_ASSOC );
@@ -227,9 +222,11 @@ protected function prepare(string $query, bool $useReadPdo = true): PostgreSQLSt
227
222
$ query = $ this ->str_replace_once ('? ' , '$ ' . $ num ++, $ query );
228
223
}
229
224
230
- $ statement = $ this ->getPdoForSelect ($ useReadPdo )->prepare ($ query );
225
+ /** @var PostgreSQL $pdo */
226
+ $ pdo = $ this ->getPdoForSelect ($ useReadPdo );
227
+ $ statement = $ pdo ->prepare ($ query );
231
228
if (! $ statement ) {
232
- throw new QueryException ($ query , [], new Exception ($ this -> pdo ->error ));
229
+ throw new QueryException ($ query , [], new Exception ($ pdo ->error ));
233
230
}
234
231
235
232
return $ statement ;
0 commit comments