diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-08-04 22:13:59 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-08-04 22:13:59 +0000 |
commit | 305f59769658ad30fd629b9f234bcc15f119452a (patch) | |
tree | e779cd19679ec532573cb22f5b99ccbb9a9242a9 | |
parent | 8e4334159ce6077c4526ed0465f79632186cf51c (diff) | |
download | php-git-305f59769658ad30fd629b9f234bcc15f119452a.tar.gz |
Improved fix for bug #37671
-rw-r--r-- | ext/mysqli/mysqli_api.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index d8b0b683a2..0d377fd844 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -294,9 +294,6 @@ PHP_FUNCTION(mysqli_stmt_bind_result) case MYSQL_TYPE_LONG: case MYSQL_TYPE_INT24: case MYSQL_TYPE_YEAR: -#if MYSQL_VERSION_ID > 50002 - case MYSQL_TYPE_BIT: -#endif convert_to_long_ex(args[i]); stmt->result.buf[ofs].type = IS_LONG; /* don't set stmt->result.buf[ofs].buflen to 0, we used ecalloc */ @@ -308,10 +305,13 @@ PHP_FUNCTION(mysqli_stmt_bind_result) break; case MYSQL_TYPE_LONGLONG: +#if MYSQL_VERSION_ID > 50002 + case MYSQL_TYPE_BIT: +#endif stmt->result.buf[ofs].type = IS_STRING; stmt->result.buf[ofs].buflen = sizeof(my_ulonglong); stmt->result.buf[ofs].val = (char *)emalloc(stmt->result.buf[ofs].buflen); - bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG; + bind[ofs].buffer_type = col_type; bind[ofs].buffer = stmt->result.buf[ofs].val; bind[ofs].is_null = &stmt->result.is_null[ofs]; bind[ofs].buffer_length = stmt->result.buf[ofs].buflen; @@ -715,7 +715,14 @@ PHP_FUNCTION(mysqli_stmt_fetch) } else { ZVAL_LONG(stmt->result.vars[i], llval); } - } else { + } +#if MYSQL_VERSION_ID > 50002 + else if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_BIT) { + llval = *(my_ulonglong *)stmt->result.buf[i].val; + ZVAL_LONG(stmt->result.vars[i], llval); + } +#endif + else { ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, stmt->result.buf[i].buflen, 1); } break; |