I am using
MySQL Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
I have a column with type as BIT(1)
mysql> desc abc;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| b | bit(1) | YES | | NULL | |
| v | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
I inserted rows with values 0 and 1
But when I display the contents of the table, instead of 0, nothing is displayed. In the place of 1, ☺ is displayed.
mysql> select * from abc ;
+------+-------+
| b | v |
+------+-------+
| ☺ | true |
| | false |
| ☺ | true |
| ☺ | true |
| | false |
| | false |
| | false |
| | false |
+------+-------+
But even though the display is messed up, it works fine.
mysql> select count(*) from abc where b=1;
+----------+
| count(*) |
+----------+
| 3 |
+----------+
1 row in set (0.05 sec)
So basically, internally it is stored properly. But while displaying, it is showing the corresponding ascii character for 0 and 1.
Any clue on whether this is how it will normally behave or is there something I can do about it?
MySQL Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
I have a column with type as BIT(1)
mysql> desc abc;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| b | bit(1) | YES | | NULL | |
| v | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
I inserted rows with values 0 and 1
But when I display the contents of the table, instead of 0, nothing is displayed. In the place of 1, ☺ is displayed.
mysql> select * from abc ;
+------+-------+
| b | v |
+------+-------+
| ☺ | true |
| | false |
| ☺ | true |
| ☺ | true |
| | false |
| | false |
| | false |
| | false |
+------+-------+
But even though the display is messed up, it works fine.
mysql> select count(*) from abc where b=1;
+----------+
| count(*) |
+----------+
| 3 |
+----------+
1 row in set (0.05 sec)
So basically, internally it is stored properly. But while displaying, it is showing the corresponding ascii character for 0 and 1.
Any clue on whether this is how it will normally behave or is there something I can do about it?