On Jun 25, 2006, at 8:03 AM, Gwynne wrote:
Ilia and I have been bouncing back and forth on bug #37671 (MySQLi extension fails to recognize BIT columns)[1] between "yes it's fixed", "no it isn't!" for some time now. I'm curious which one of us the experience of others agrees with. Ilia seems to be able to get a working result with the current PHP_5_2 code, while I can't. Can anyone share some insight into this?

[1] http://bugs.php.net/bug.php?id=37671

I hate to bring this up again, but with 5.2 heading towards RC1 and no answers in sight, I really would like a resolution here. I've been patching my PHP builds ever since I switched to MySQL 5 databases just for this issue. The solution I'm using is at the end of this message (the same patch works against PHP_5_2 and HEAD; this one specifically was run against HEAD. It requires only a tiny modification to work against php_5_1_4, which is what I'm using now; against 5_1_4 there's no need to - out the incorrect handling). It seems to work in 100% of cases I've tested. The current code in 5_2 and HEAD, which folds it into LONG types, does NOT work correctly. Can someone please either commit something like this or tell me why they refuse to?


--- mysqli_api.c        12 Jul 2006 10:15:30 -0000      1.129
+++ mysqli_api.c        13 Jul 2006 16:29:00 -0000
@@ -294,9 +294,6 @@
                        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 @@
                                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; // MYSQL_TYPE_LONGLONG; 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;
@@ -695,7 +695,11 @@
ZVAL_DOUBLE(stmt- >result.vars[i], *(double *)stmt->result.buf[i].val);
                                                break;
                                        case IS_STRING:
- if (stmt->stmt->bind [i].buffer_type == MYSQL_TYPE_LONGLONG) { + if (stmt->stmt->bind [i].buffer_type == MYSQL_TYPE_LONGLONG
+#if MYSQL_VERSION_ID > 50002
+ || stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_BIT
+#endif
+                                               ) {
my_bool uns= (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? 1:0; llval= * (my_ulonglong *) stmt->result.buf[i].val;
#if SIZEOF_LONG==8

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to