Skip to content

Commit cde6bee

Browse files
committed
Formalize return type to zend_result
1 parent 3891818 commit cde6bee

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

UPGRADING.INTERNALS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ PHP 8.1 INTERNALS UPGRADE NOTES
8383
of char* for the optional sequence/table name.
8484
- The php_pdo_str_tolower_dup() PDO_API has been removed use zend_str_tolower_dup()
8585
or zend_string_tolower_ex().
86+
87+
c. ext/pgsql
88+
- The php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(),
89+
php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() have
90+
had their return type formalized to zend_result.

ext/pgsql/pgsql.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4225,7 +4225,7 @@ PHP_FUNCTION(pg_flush)
42254225
* table_name must not be empty
42264226
* TODO: Add meta_data cache for better performance
42274227
*/
4228-
PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, bool extended)
4228+
PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, bool extended)
42294229
{
42304230
PGresult *pg_result;
42314231
char *src, *tmp_name, *tmp_name2 = NULL;
@@ -4550,7 +4550,7 @@ static int php_pgsql_add_quotes(zval *src, bool should_free)
45504550
/* {{{ php_pgsql_convert
45514551
* check and convert array values (fieldname=>value pair) for sql
45524552
*/
4553-
PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt)
4553+
PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt)
45544554
{
45554555
zend_string *field = NULL;
45564556
zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val;
@@ -5299,13 +5299,13 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
52995299
/* }}} */
53005300

53015301
/* {{{ php_pgsql_insert */
5302-
PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql)
5302+
PHP_PGSQL_API zend_result php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql)
53035303
{
53045304
zval *val, converted;
53055305
char buf[256];
53065306
char *tmp;
53075307
smart_str querystr = {0};
5308-
int ret = FAILURE;
5308+
zend_result ret = FAILURE;
53095309
zend_string *fld;
53105310

53115311
assert(pg_link != NULL);
@@ -5564,11 +5564,11 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
55645564
/* }}} */
55655565

55665566
/* {{{ php_pgsql_update */
5567-
PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, zend_ulong opt, zend_string **sql)
5567+
PHP_PGSQL_API zend_result php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, zend_ulong opt, zend_string **sql)
55685568
{
55695569
zval var_converted, ids_converted;
55705570
smart_str querystr = {0};
5571-
int ret = FAILURE;
5571+
zend_result ret = FAILURE;
55725572

55735573
assert(pg_link != NULL);
55745574
assert(table != NULL);
@@ -5673,11 +5673,11 @@ PHP_FUNCTION(pg_update)
56735673
/* }}} */
56745674

56755675
/* {{{ php_pgsql_delete */
5676-
PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql)
5676+
PHP_PGSQL_API zend_result php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql)
56775677
{
56785678
zval ids_converted;
56795679
smart_str querystr = {0};
5680-
int ret = FAILURE;
5680+
zend_result ret = FAILURE;
56815681

56825682
assert(pg_link != NULL);
56835683
assert(table != NULL);
@@ -5808,11 +5808,11 @@ PHP_PGSQL_API void php_pgsql_result2array(PGresult *pg_result, zval *ret_array,
58085808
/* }}} */
58095809

58105810
/* {{{ php_pgsql_select */
5811-
PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, long result_type, zend_string **sql)
5811+
PHP_PGSQL_API zend_result php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, long result_type, zend_string **sql)
58125812
{
58135813
zval ids_converted;
58145814
smart_str querystr = {0};
5815-
int ret = FAILURE;
5815+
zend_result ret = FAILURE;
58165816
PGresult *pg_result;
58175817

58185818
assert(pg_link != NULL);

ext/pgsql/php_pgsql.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ PHP_FUNCTION(pg_select);
176176
#define PGSQL_DML_ESCAPE (1<<12) /* No convert, but escape only */
177177

178178
/* exported functions */
179-
PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, bool extended);
180-
PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt);
181-
PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, zend_ulong opt, zend_string **sql);
182-
PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, zend_ulong opt , zend_string **sql);
183-
PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, zend_ulong opt, zend_string **sql);
184-
PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, zend_ulong opt, long fetch_option, zend_string **sql );
179+
PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, bool extended);
180+
PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt);
181+
PHP_PGSQL_API zend_result php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, zend_ulong opt, zend_string **sql);
182+
PHP_PGSQL_API zend_result php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, zend_ulong opt , zend_string **sql);
183+
PHP_PGSQL_API zend_result php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, zend_ulong opt, zend_string **sql);
184+
PHP_PGSQL_API zend_result php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, zend_ulong opt, long fetch_option, zend_string **sql );
185185
PHP_PGSQL_API void php_pgsql_result2array(PGresult *pg_result, zval *ret_array, long fetch_option);
186186

187187
/* internal functions */

0 commit comments

Comments
 (0)