File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -3879,6 +3879,11 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
3879
3879
switch (entry_type ) {
3880
3880
case PHP_PG_ASYNC_IS_BUSY :
3881
3881
PQconsumeInput (pgsql );
3882
+ /* PQisBusy
3883
+ * Returns 1 if a command is busy, that is, PQgetResult would block waiting for input.
3884
+ * A 0 return indicates that PQgetResult can be called with assurance of not blocking.
3885
+ * https://www.postgresql.org/docs/current/libpq-async.html#LIBPQ-PQISBUSY
3886
+ */
3882
3887
RETVAL_BOOL (PQisBusy (pgsql ));
3883
3888
break ;
3884
3889
case PHP_PG_ASYNC_REQUEST_CANCEL : {
@@ -3887,10 +3892,15 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
3887
3892
int rc ;
3888
3893
3889
3894
c = PQgetCancel (pgsql );
3890
- rc = PQcancel (c , err , sizeof (err );
3895
+ rc = PQcancel (c , err , sizeof (err ));
3896
+ /* PQcancel
3897
+ * The return value of PQcancel is 1 if the cancel request was successfully dispatched and 0 if not.
3898
+ * If not, errbuf is filled with an explanatory error message.
3899
+ * errbuf must be a char array of size errbufsize (the recommended size is 256 bytes).
3900
+ * https://www.postgresql.org/docs/current/libpq-cancel.html#LIBPQ-PQCANCEL
3901
+ */
3891
3902
RETVAL_BOOL (rc );
3892
- if (rc < 0 ) {
3893
- RETVAL_FALSE ;
3903
+ if (rc == 0 ) {
3894
3904
zend_error (E_WARNING , "cannot cancel the query: %s" , err );
3895
3905
}
3896
3906
while ((pgsql_result = PQgetResult (pgsql ))) {
You can’t perform that action at this time.
0 commit comments