Skip to content

Commit fabcfd6

Browse files
committed
Formalize return type to zend_result for PGSQL_API functions
1 parent 6eb23e2 commit fabcfd6

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

UPGRADING.INTERNALS

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ PHP 8.1 INTERNALS UPGRADE NOTES
1212
a. ext/hash
1313
b. ext/pdo
1414
c. ext/standard
15+
d. ext/pgsql
1516

1617
========================
1718
1. Internal API changes
@@ -94,3 +95,8 @@ PHP 8.1 INTERNALS UPGRADE NOTES
9495
c. ext/standard
9596
- The PHP API php_fputcsv() now takes an extra zend_string* argument at the end
9697
for a custom EOL sequence, passing NULL provides the old default of "\n".
98+
99+
d. ext/pgsql
100+
- The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(),
101+
php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() have had
102+
their return type formalized to zend_result.

ext/pgsql/pgsql.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -4231,7 +4231,7 @@ PHP_FUNCTION(pg_flush)
42314231
* table_name must not be empty
42324232
* TODO: Add meta_data cache for better performance
42334233
*/
4234-
PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, bool extended)
4234+
PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, bool extended)
42354235
{
42364236
PGresult *pg_result;
42374237
char *src, *tmp_name, *tmp_name2 = NULL;
@@ -4556,7 +4556,7 @@ static int php_pgsql_add_quotes(zval *src, bool should_free)
45564556
/* {{{ php_pgsql_convert
45574557
* check and convert array values (fieldname=>value pair) for sql
45584558
*/
4559-
PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt)
4559+
PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt)
45604560
{
45614561
zend_string *field = NULL;
45624562
zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val;
@@ -5306,13 +5306,13 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
53065306
/* }}} */
53075307

53085308
/* {{{ php_pgsql_insert */
5309-
PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql)
5309+
PHP_PGSQL_API zend_result php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql)
53105310
{
53115311
zval *val, converted;
53125312
char buf[256];
53135313
char *tmp;
53145314
smart_str querystr = {0};
5315-
int ret = FAILURE;
5315+
zend_result ret = FAILURE;
53165316
zend_string *fld;
53175317

53185318
ZEND_ASSERT(pg_link != NULL);
@@ -5572,11 +5572,11 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
55725572
/* }}} */
55735573

55745574
/* {{{ php_pgsql_update */
5575-
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)
5575+
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)
55765576
{
55775577
zval var_converted, ids_converted;
55785578
smart_str querystr = {0};
5579-
int ret = FAILURE;
5579+
zend_result ret = FAILURE;
55805580

55815581
ZEND_ASSERT(pg_link != NULL);
55825582
ZEND_ASSERT(table != NULL);
@@ -5682,11 +5682,11 @@ PHP_FUNCTION(pg_update)
56825682
/* }}} */
56835683

56845684
/* {{{ php_pgsql_delete */
5685-
PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql)
5685+
PHP_PGSQL_API zend_result php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql)
56865686
{
56875687
zval ids_converted;
56885688
smart_str querystr = {0};
5689-
int ret = FAILURE;
5689+
zend_result ret = FAILURE;
56905690

56915691
ZEND_ASSERT(pg_link != NULL);
56925692
ZEND_ASSERT(table != NULL);
@@ -5819,11 +5819,11 @@ PHP_PGSQL_API void php_pgsql_result2array(PGresult *pg_result, zval *ret_array,
58195819
/* }}} */
58205820

58215821
/* {{{ php_pgsql_select */
5822-
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)
5822+
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)
58235823
{
58245824
zval ids_converted;
58255825
smart_str querystr = {0};
5826-
int ret = FAILURE;
5826+
zend_result ret = FAILURE;
58275827
PGresult *pg_result;
58285828

58295829
ZEND_ASSERT(pg_link != NULL);

ext/pgsql/php_pgsql.h

+6-6
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)