mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
fixed bigint conversion on windows platforms
This commit is contained in:
parent
e25a1dccac
commit
0944a47107
@ -705,10 +705,10 @@ PHP_FUNCTION(mysqli_stmt_fetch)
|
||||
#endif
|
||||
char tmp[22];
|
||||
/* even though lval is declared as unsigned, the value
|
||||
* may be negative. Therefor we cannot use %llu and must
|
||||
* use %lld.
|
||||
* may be negative. Therefor we cannot use MYSQLI_LLU_SPEC and must
|
||||
* use MYSQLI_LL_SPEC.
|
||||
*/
|
||||
sprintf((char *)&tmp, (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? "%llu":"%lld", llval);
|
||||
sprintf((char *)&tmp, (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval);
|
||||
ZVAL_STRING(stmt->result.vars[i], tmp, 1);
|
||||
} else {
|
||||
ZVAL_LONG(stmt->result.vars[i], llval);
|
||||
@ -1859,7 +1859,7 @@ PHP_FUNCTION(mysqli_stmt_errno)
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
|
||||
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_INITIALIZED);
|
||||
|
||||
RETURN_LONG(mysql_stmt_errno(stmt->stmt));
|
||||
}
|
||||
@ -1875,7 +1875,7 @@ PHP_FUNCTION(mysqli_stmt_error)
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
|
||||
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_INITIALIZED);
|
||||
|
||||
RETURN_STRING((char *)mysql_stmt_error(stmt->stmt),1);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ static int __func(mysqli_object *obj, zval **retval TSRMLS_DC) \
|
||||
ZVAL_LONG(*retval, l);\
|
||||
} else { \
|
||||
char ret[40]; \
|
||||
sprintf(ret, "%llu", (my_ulonglong)l); \
|
||||
sprintf(ret, MYSQLI_LLU_SPEC, (my_ulonglong)l); \
|
||||
ZVAL_STRING(*retval, ret, 1); \
|
||||
} \
|
||||
}\
|
||||
@ -176,7 +176,7 @@ static int link_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC)
|
||||
ZVAL_LONG(*retval, rc);
|
||||
} else {
|
||||
char ret[40];
|
||||
sprintf(ret, "%llu", (my_ulonglong) rc);
|
||||
sprintf(ret, MYSQLI_LLU_SPEC, (my_ulonglong) rc);
|
||||
ZVAL_STRING(*retval, ret, 1);
|
||||
}
|
||||
}
|
||||
@ -295,7 +295,7 @@ static int stmt_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC)
|
||||
ZVAL_LONG(*retval, rc);
|
||||
} else {
|
||||
char ret[40];
|
||||
sprintf(ret, "%llu", (my_ulonglong) rc);
|
||||
sprintf(ret, MYSQLI_LLU_SPEC, (my_ulonglong) rc);
|
||||
ZVAL_STRING(*retval, ret, 1);
|
||||
}
|
||||
}
|
||||
|
@ -118,8 +118,12 @@ typedef struct {
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_MYSQLI_API __declspec(dllexport)
|
||||
#define MYSQLI_LLU_SPEC "%I64u"
|
||||
#define MYSQLI_LL_SPEC "%I64d"
|
||||
#else
|
||||
#define PHP_MYSQLI_API
|
||||
#define MYSQLI_LLU_SPEC "%llu"
|
||||
#define MYSQLI_LL_SPEC "%lld"
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
|
Loading…
Reference in New Issue
Block a user