mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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).
This commit is contained in:
parent
33e904915e
commit
c18b1aea28
28 changed files with 161 additions and 61 deletions
|
@ -826,6 +826,14 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
bool int_and_float_native = true;
|
||||
if (mysql_options(H->server, MYSQLND_OPT_INT_AND_FLOAT_NATIVE, (const char *) &int_and_float_native)) {
|
||||
pdo_mysql_error(dbh);
|
||||
goto cleanup;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (vars[0].optval && mysql_options(H->server, MYSQL_SET_CHARSET_NAME, vars[0].optval)) {
|
||||
pdo_mysql_error(dbh);
|
||||
goto cleanup;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue