| Bug #47483 | SELECT UNION wrong length after prepare | ||
|---|---|---|---|
| Submitted: | 21 Sep 2009 14:05 | Modified: | 21 Sep 2009 19:59 |
| Reporter: | Ulf Wendel | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: C API (client library) | Severity: | S3 (Non-critical) |
| Version: | 5.1 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[21 Sep 2009 14:06]
Ulf Wendel
C test program
Attachment: statement_bind.c (text/x-csrc), 3.46 KiB.
[21 Sep 2009 19:59]
Sveta Smirnova
Thank you for the report. Verified as described.

Description: The C API returns the wrong column length for: SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR) after the prepare stage. It returns 3 although a string of the length 5 will be returned. The real length of 5 is not known before the query has been executed. Is that a bug or a feature? Please clearify. The query has caused bug http://bugs.php.net/bug.php?id=45019 . I would like to know if we need to teach PHP users to always call their PHP bind_result() function after execute() if using the MySQL Client Library. How to repeat: Compile attached C demo program.