Description:
Short TINYINT columns work as expected.
Long TINYINT columns forget ZEROFILL flag in prepared statement protocol.
Medium TINYINT columns are not displayed at all.
How to repeat:
- Run mysqltest with text protocol with a tinyint(30) column:
echo "drop table if exists t1; create table t1 (a tinyint(30) zerofill); insert into t1 values (1),(2); select * From t1; exit;" | ./mysqltest test
The numbers are correctly displayed with 29 leading zeros:
000000000000000000000000000001
000000000000000000000000000002
- Run mysqltest with ps protocol with a tinyint(30) column:
echo "drop table if exists t1; create table t1 (a tinyint(30) zerofill); insert into t1 values (1),(2); select * From t1; exit;" | ./mysqltest --ps-protocol test
The number is not padded with zeros anymore:
1
2
This is a wrong result. Expected result - the same to the previous one.
- Run mysqltest with ps protocol with a short tinyint(5) column:
echo "drop table if exists t1; create table t1 (a tinyint(5) zerofill); insert into t1 values (1),(2); select * From t1; exit;" | ./mysqltest --ps-protocol test
A short number is correctly displayed with leading zeros:
00001
00002
- Run mysqltest with ps protocol with a medium size column: tinyint(10)
echo "drop table if exists t1; create table t1 (a tinyint(10) zerofill); insert into t1 values (1),(2); select * From t1; exit;" | ./mysqltest --ps-protocol test
mysqltest: At line 1: fetch didn't end with MYSQL_NO_DATA from statement: 0
Error is returned.
Expected result is:
0000000001
0000000002
Suggested fix:
- Make prepared protocol return leading zeros, similar to text protocol.
- Fix MYSQL_NO_DATA error