From c18b1aea289e8ed6edb3f6e6a135018976a034c6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 15 Dec 2020 17:07:27 +0100 Subject: PDO MySQL: Use native types for results Previously, PDO MySQL only fetched data as native int/float if native prepared statements were used. This patch updates PDO to have the same behavior for emulated prepared statements, and thus removes the largest remaining discrepancy between these two modes. Note that PDO already has a ATTR_STRINGIFY_FETCHES option to control whether native types are desired or not. The previous output can be restored by enabling this option. Most of the tests make use of that option, because this allows the tests to work under libmysqlclient as well, which currently always returns string results (independently of whether native or emulated PS are used). --- ext/pdo_mysql/php_pdo_mysql_int.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'ext/pdo_mysql/php_pdo_mysql_int.h') diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index 553437829e..e83ac735dc 100644 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -120,12 +120,6 @@ typedef struct { pdo_mysql_db_handle *H; MYSQL_RES *result; const MYSQL_FIELD *fields; - MYSQL_ROW current_data; -#ifdef PDO_USE_MYSQLND - const size_t *current_lengths; -#else - unsigned long *current_lengths; -#endif pdo_mysql_error_info einfo; #ifdef PDO_USE_MYSQLND MYSQLND_STMT *stmt; @@ -137,10 +131,14 @@ typedef struct { #ifndef PDO_USE_MYSQLND my_bool *in_null; zend_ulong *in_length; -#endif PDO_MYSQL_PARAM_BIND *bound_result; my_bool *out_null; zend_ulong *out_length; + MYSQL_ROW current_data; + unsigned long *current_lengths; +#else + zval *current_row; +#endif unsigned max_length:1; /* Whether all result sets have been fully consumed. * If this flag is not set, they need to be consumed during destruction. */ -- cgit v1.2.1