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)
38793879 switch (entry_type ) {
38803880 case PHP_PG_ASYNC_IS_BUSY :
38813881 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+ */
38823887 RETVAL_BOOL (PQisBusy (pgsql ));
38833888 break ;
38843889 case PHP_PG_ASYNC_REQUEST_CANCEL : {
@@ -3887,10 +3892,15 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
38873892 int rc ;
38883893
38893894 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+ */
38913902 RETVAL_BOOL (rc );
3892- if (rc < 0 ) {
3893- RETVAL_FALSE ;
3903+ if (rc == 0 ) {
38943904 zend_error (E_WARNING , "cannot cancel the query: %s" , err );
38953905 }
38963906 while ((pgsql_result = PQgetResult (pgsql ))) {
You can’t perform that action at this time.
0 commit comments