Bug #33086 | mysql_stmt_fetch_column does not update bind buffer on blob data | ||
---|---|---|---|
Submitted: | 8 Dec 2007 15:25 | Modified: | 26 Jun 2009 16:06 |
Reporter: | John Millaway | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S2 (Serious) |
Version: | 5.0.51 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | mysql_stmt_fetch_column MYSQL_DATA_TRUNCATED MYSQL_TYPE_BLOB |
[8 Dec 2007 15:25]
John Millaway
[8 Dec 2007 18:10]
Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 5.0.45 or 5.0.51, and inform about the results.
[8 Dec 2007 21:38]
John Millaway
Fails on 5.0.51.
[1 Feb 2008 13:54]
Stefan Bähring
Hello, I discover the same problem. Is there any progress? Is it really a bug?
[1 Feb 2008 18:17]
John Millaway
Yes, this is a serious bug. It's MySQL's dirty little secret: MySQL can't handle BLOBs in a scalable manner. If you look into the PHP source code, you'll see that PHP does the worst of all possible things: calls mysql_store_results(). The take-away message is: don't use BLOBs in MySQL unless you can fit the entire result set in memory (possibly multiple times over, allowing for any copies that your platform layer introduces.)
[1 May 2008 0:47]
Sovande Ulv
I got the same bug in version 5.1.22 on OS X for both MYSQL_TYPE_STRING and MYSQL_TYPE_BLOB. Glad to hear if someone has a workaround other than storing the full result set on the client which just isn't feasible if one want this to scale.
[3 May 2008 18:15]
Sovande Ulv
Actually the example program has a bug. Instead of rc = mysql_stmt_fetch_column (stmt, bind, 1, 0); it should say rc = mysql_stmt_fetch_column (stmt, &bind[1], 1, 0); Though there is still some "funky" problems with mysql_stmt_fetch_column() but that is for another bug report
[26 Jun 2009 16:04]
Valeriy Kravchuk
Complete test case that proves bug is NOT repeatable in 5.0.84
Attachment: bug33086.c (text/plain), 2.68 KiB.
[26 Jun 2009 16:06]
Valeriy Kravchuk
With complete (and fixed, based on last comment) test case uploaded as a separate file I've got with 5.0.84 on Mac OS X: valeriy-kravchuks-macbook-pro:5.0 openxs$ gcc -o bug33086 `$CFG --cflags` -DDEBUG bug33086.c `$CFG --libs` bug33086.c: In function 'example': bug33086.c:20: warning: incompatible implicit declaration of built-in function 'strlen' bug33086.c:44: warning: incompatible implicit declaration of built-in function 'memset' valeriy-kravchuks-macbook-pro:5.0 openxs$ ./bug33086 Server: 5.0.84, client: 5.0.84 Blob length: 4, data[0]: x So, no assertion failures, length is correct and data were really fetched. Everything works as expected.