Refactor PGSQL extension to use zend_string*

* Prevents some unnecessary strlen() computation
 * Use interned "NULL"
 * Certain PGSQL_API functions now accept zend_string* instead of char*

Closes GH-6792
This commit is contained in:
George Peter Banyard 2021-03-22 03:39:34 +00:00
parent 0ffb4a5c9d
commit 612609e1bd
No known key found for this signature in database
GPG key ID: D49A095D7329F6DC
3 changed files with 194 additions and 213 deletions

View file

@ -100,3 +100,6 @@ PHP 8.1 INTERNALS UPGRADE NOTES
- The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(),
php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() have had
their return type formalized to zend_result.
- The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(),
php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() now accept a
zend_string* instead of a char* for the table name.

File diff suppressed because it is too large Load diff

View file

@ -176,12 +176,12 @@ PHP_FUNCTION(pg_select);
#define PGSQL_DML_ESCAPE (1<<12) /* No convert, but escape only */
/* exported functions */
PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, bool extended);
PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt);
PHP_PGSQL_API zend_result php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, zend_ulong opt, zend_string **sql);
PHP_PGSQL_API zend_result php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, zend_ulong opt , zend_string **sql);
PHP_PGSQL_API zend_result php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, zend_ulong opt, zend_string **sql);
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 );
PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const zend_string *table_name, zval *meta, bool extended);
PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const zend_string *table_name, const zval *values, zval *result, zend_ulong opt);
PHP_PGSQL_API zend_result php_pgsql_insert(PGconn *pg_link, const zend_string *table, zval *values, zend_ulong opt, zend_string **sql);
PHP_PGSQL_API zend_result php_pgsql_update(PGconn *pg_link, const zend_string *table, zval *values, zval *ids, zend_ulong opt , zend_string **sql);
PHP_PGSQL_API zend_result php_pgsql_delete(PGconn *pg_link, const zend_string *table, zval *ids, zend_ulong opt, zend_string **sql);
PHP_PGSQL_API zend_result php_pgsql_select(PGconn *pg_link, const zend_string *table, zval *ids, zval *ret_array, zend_ulong opt, long fetch_option, zend_string **sql );
PHP_PGSQL_API void php_pgsql_result2array(PGresult *pg_result, zval *ret_array, long fetch_option);
/* internal functions */