Bug #29930 | Incorrect docs of MYSQL_FIELD | ||
---|---|---|---|
Submitted: | 20 Jul 2007 12:13 | Modified: | 23 Jan 2008 18:45 |
Reporter: | Andrey Hristov | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S3 (Non-critical) |
Version: | 5.0 bk, 5.1 bk | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[20 Jul 2007 12:13]
Andrey Hristov
[20 Jul 2007 12:45]
Sveta Smirnova
Thank you for the report. Verified as described.
[20 Jul 2007 22:17]
Jim Winstead
This bug report is either wrong, or it is a server bug. MYSQL_FIELD::length should *always* be the display length of the field, regardless of type. Anything else will break things like Connector/ODBC. Fixing this for MYSQL_FIELD::length was Bug #13601. Here's what I get with 5.1.20: mysql> create table t1 (a bit(3)); Query OK, 0 rows affected (0.02 sec) mysql> insert into t1 values (b'001'), (b'100'); Query OK, 2 rows affected (0.03 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> select * from t1 -> ; Field 1: `a` Catalog: `def` Database: `test` Table: `t1` Org_table: `t1` Type: BIT Collation: binary (63) Length: 3 Max_length: 1 Decimals: 0 Flags: UNSIGNED +------+ | a | +------+ | | | | +------+ 2 rows in set (0.00 sec) mysql> prepare xyz from "select * from t1"; Query OK, 0 rows affected (0.00 sec) Statement prepared mysql> execute xyz; Field 1: `a` Catalog: `def` Database: `test` Table: `t1` Org_table: `t1` Type: BIT Collation: binary (63) Length: 3 Max_length: 1 Decimals: 0 Flags: UNSIGNED +------+ | a | +------+ | | | | +------+ 2 rows in set (0.00 sec)
[23 Jan 2008 18:45]
Jim Winstead
As agreed by Andrey, this is not a bug. The documentation is correct, and the output of the server agrees with this.