File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 655
655
<referencedFunction name =" pg_field_type" />
656
656
<referencedFunction name =" pg_free_result" />
657
657
<referencedFunction name =" pg_get_result" />
658
+ <referencedFunction name =" pg_last_error" />
658
659
<referencedFunction name =" pg_num_fields" />
659
660
<referencedFunction name =" pg_result_error_field" />
660
661
<referencedFunction name =" pg_send_execute" />
661
662
<referencedFunction name =" pg_send_prepare" />
663
+ <referencedFunction name =" pg_send_query" />
662
664
<referencedFunction name =" pg_version" />
663
665
</errorLevel >
664
666
</PossiblyInvalidArgument >
Original file line number Diff line number Diff line change 17
17
use function pg_escape_bytea ;
18
18
use function pg_escape_literal ;
19
19
use function pg_get_result ;
20
+ use function pg_last_error ;
20
21
use function pg_result_error ;
21
22
use function pg_send_prepare ;
23
+ use function pg_send_query ;
22
24
use function pg_version ;
23
25
use function sprintf ;
24
26
use function uniqid ;
@@ -67,7 +69,18 @@ public function prepare(string $sql): Statement
67
69
68
70
public function query (string $ sql ): Result
69
71
{
70
- return $ this ->prepare ($ sql )->execute ();
72
+ if (@pg_send_query ($ this ->connection , $ sql ) !== true ) {
73
+ throw new Exception (pg_last_error ($ this ->connection ));
74
+ }
75
+
76
+ $ result = @pg_get_result ($ this ->connection );
77
+ assert ($ result !== false );
78
+
79
+ if ((bool ) pg_result_error ($ result )) {
80
+ throw Exception::fromResult ($ result );
81
+ }
82
+
83
+ return new Result ($ result );
71
84
}
72
85
73
86
/** {@inheritdoc} */
@@ -82,7 +95,7 @@ public function quote($value, $type = ParameterType::STRING)
82
95
83
96
public function exec (string $ sql ): int
84
97
{
85
- return $ this ->prepare ($ sql)-> execute ( )->rowCount ();
98
+ return $ this ->query ($ sql )->rowCount ();
86
99
}
87
100
88
101
/** {@inheritdoc} */
You can’t perform that action at this time.
0 commit comments