mysql设置boolean型会转为tinyint(1)
在我本地的mysql上,我插入一个true,会自动转为1,插入到数据库,但是在我服务器上却不行。
不知道是版本问题还是配置问题,请教一下大神
高洛峰2017-04-17 16:28:44
Is it true that when assigning a value, it is treated as a string with quotes?
ringa_lee2017-04-17 16:28:44
If you write the SQL
statement directly, it is better to write 0,1...
INSERT INTO ... VALUES(1);
迷茫2017-04-17 16:28:44
As a programmer, you should be very sensitive to true/false, non-0 is true
阿神2017-04-17 16:28:44
BOOLEAN is equivalent to TINYINT(1)
These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered true
Use ENUM('false', 'true') NOT NULL DEFAULT 'false'
to store true