从我的create table脚本中,我将hasMultipleColors字段定义为BIT:
hasMultipleColors BIT NOT NULL,
Run Code Online (Sandbox Code Playgroud)
运行INSERT时,不会为此或其他BIT字段抛出警告,但选择行会显示所有BIT值都为空.
手动尝试从命令行更新这些记录会产生奇怪的效果 - 显示记录匹配并更改(如果适用),但仍然始终显示为空白.
服务器版本:5.5.24-0ubuntu0.12.04.1(Ubuntu)
mysql> update pumps set hasMultipleColors = 1 where id = 1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> select hasMultipleColors from pumps where id = 1;
+-------------------+
| hasMultipleColors |
+-------------------+
| |
+-------------------+
1 row in set (0.00 sec)
mysql> update pumps set hasMultipleColors = b'0' where id = 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 …Run Code Online (Sandbox Code Playgroud)