@@ -2015,10 +2015,7 @@ PHP_FUNCTION(pg_fetch_all)
20152015
20162016 pgsql_result = pg_result -> result ;
20172017 array_init (return_value );
2018- if (php_pgsql_result2array (pgsql_result , return_value , result_type ) == FAILURE ) {
2019- zend_array_destroy (Z_ARR_P (return_value ));
2020- RETURN_FALSE ;
2021- }
2018+ php_pgsql_result2array (pgsql_result , return_value , result_type );
20222019}
20232020/* }}} */
20242021
@@ -5796,7 +5793,7 @@ PHP_FUNCTION(pg_delete)
57965793/* }}} */
57975794
57985795/* {{{ php_pgsql_result2array */
5799- PHP_PGSQL_API int php_pgsql_result2array (PGresult * pg_result , zval * ret_array , long result_type )
5796+ PHP_PGSQL_API void php_pgsql_result2array (PGresult * pg_result , zval * ret_array , long result_type )
58005797{
58015798 zval row ;
58025799 char * field_name ;
@@ -5805,9 +5802,7 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array, l
58055802 uint32_t i ;
58065803 assert (Z_TYPE_P (ret_array ) == IS_ARRAY );
58075804
5808- if ((pg_numrows = PQntuples (pg_result )) <= 0 ) {
5809- return FAILURE ;
5810- }
5805+ pg_numrows = PQntuples (pg_result );
58115806 for (pg_row = 0 ; pg_row < pg_numrows ; pg_row ++ ) {
58125807 array_init (& row );
58135808 for (i = 0 , num_fields = PQnfields (pg_result ); i < num_fields ; i ++ ) {
@@ -5834,7 +5829,6 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array, l
58345829 }
58355830 add_index_zval (ret_array , pg_row , & row );
58365831 }
5837- return SUCCESS ;
58385832}
58395833/* }}} */
58405834
@@ -5877,7 +5871,8 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array, l
58775871
58785872 pg_result = PQexec (pg_link , ZSTR_VAL (querystr .s ));
58795873 if (PQresultStatus (pg_result ) == PGRES_TUPLES_OK ) {
5880- ret = php_pgsql_result2array (pg_result , ret_array , result_type );
5874+ php_pgsql_result2array (pg_result , ret_array , result_type );
5875+ ret = SUCCESS ;
58815876 } else {
58825877 php_error_docref (NULL , E_NOTICE , "Failed to execute '%s'" , ZSTR_VAL (querystr .s ));
58835878 }
0 commit comments