added support for data truncation (bind_result) for MySQL 5.0.5

This commit is contained in:
Georg Richter 2005-04-20 12:50:13 +00:00
parent 9d2de24ab5
commit 649a8b18ef
2 changed files with 10 additions and 2 deletions

View File

@ -561,8 +561,11 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_RPL_SLAVE", MYSQL_RPL_SLAVE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_RPL_ADMIN", MYSQL_RPL_ADMIN, CONST_CS | CONST_PERSISTENT);
/* bind blob support */
/* bind support */
REGISTER_LONG_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT);
#ifdef MYSQL_DATA_TRUNCATION
REGISTER_LONG_CONSTANT("MYSQLI_DATA_TRUNCATION", MYSQL_DATA_TRUNCATION, CONST_CS | CONST_PERSISTENT);
#endif
/* reporting */
REGISTER_LONG_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT);

View File

@ -606,7 +606,12 @@ PHP_FUNCTION(mysqli_stmt_fetch)
memset(stmt->result.buf[i].val, 0, stmt->result.buf[i].buflen);
}
}
if (!(ret = mysql_stmt_fetch(stmt->stmt))) {
ret = mysql_stmt_fetch(stmt->stmt);
#ifdef MYSQL_DATA_TRUNCATED
if (!ret || ret == MYSQL_DATA_TRUNCATED) {
#else
if (!ret || ret == MYSQL_DATA_TRUNCATED) {
#endif
for (i = 0; i < stmt->result.var_cnt; i++) {
if (stmt->result.vars[i]->type == IS_STRING && stmt->result.vars[i]->value.str.len) {
efree(stmt->result.vars[i]->value.str.val);