mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-5.6'
* PHP-5.6:
Add NEWS
Add NEWS
Patch commit d9f85373e3
by moving the float_to_double function to a header file.
Fix for bugs #68114 (Build fails on OS X due to undefined symbols) and #68657 (Reading 4 byte floats with Mysqli and libmysqlclient has rounding errors).
5.5.22 now
Conflicts:
ext/mysqli/mysqli_api.c
This commit is contained in:
commit
961da40809
6 changed files with 106 additions and 88 deletions
|
@ -33,6 +33,7 @@
|
|||
#include "zend_smart_str.h"
|
||||
#include "php_mysqli_structs.h"
|
||||
#include "mysqli_priv.h"
|
||||
#include "ext/mysqlnd/mysql_float_to_double.h"
|
||||
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
|
@ -413,8 +414,17 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un
|
|||
col_type = (stmt->stmt->fields) ? stmt->stmt->fields[ofs].type : MYSQL_TYPE_STRING;
|
||||
|
||||
switch (col_type) {
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
stmt->result.buf[ofs].type = IS_DOUBLE;
|
||||
stmt->result.buf[ofs].buflen = sizeof(float);
|
||||
|
||||
stmt->result.buf[ofs].val = (char *)emalloc(sizeof(float));
|
||||
bind[ofs].buffer_type = MYSQL_TYPE_FLOAT;
|
||||
bind[ofs].buffer = stmt->result.buf[ofs].val;
|
||||
bind[ofs].is_null = &stmt->result.is_null[ofs];
|
||||
break;
|
||||
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
stmt->result.buf[ofs].type = IS_DOUBLE;
|
||||
stmt->result.buf[ofs].buflen = sizeof(double);
|
||||
|
||||
|
@ -1021,8 +1031,22 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
|
|||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
ZVAL_DOUBLE(result, *(double *)stmt->result.buf[i].val);
|
||||
{
|
||||
double dval;
|
||||
if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_FLOAT) {
|
||||
#ifndef NOT_FIXED_DEC
|
||||
# define NOT_FIXED_DEC 31
|
||||
#endif
|
||||
dval = mysql_float_to_double(*(float *)stmt->result.buf[i].val,
|
||||
(stmt->stmt->fields[i].decimals >= NOT_FIXED_DEC) ? -1 :
|
||||
stmt->stmt->fields[i].decimals);
|
||||
} else {
|
||||
dval = *((double *)stmt->result.buf[i].val);
|
||||
}
|
||||
|
||||
ZVAL_DOUBLE(result, dval);
|
||||
break;
|
||||
}
|
||||
case IS_STRING:
|
||||
if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_LONGLONG
|
||||
#if MYSQL_VERSION_ID > 50002
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue