MYSQL tinyint(1) 布尔

Mysql官方参考文档关于布尔类型的说明:

BOOL, BOOLEAN

These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered true:

-------------------------------------------------------------------

mysql中,假设数据表ts_attach的字段isDel的类型是tinyint(1):

update ts_attach set isDel=false; 与 update ts_attach set isDel=0; 等价

update ts_attach set isDel=true; 与 update ts_attach set isDel=1; 等价

-------------------------------------------------------------------

mysql数据库tinyint(1)类型,jdbc编程时,

用getByte()读取数据是真实的数值,

如果使用getObject(),则返回的是true(非0)、false(0)。

//如果需要获取真实数值,可加如下判断

if(resultSetMetaData.getColumnType(i)==Types.BIT){

columnValue = resultSet.getByte(j+1);

}

-------------------------------------------

补充说明:synonyms 中文意思“同义词”

http://huangqiqing123.iteye.com/blog/1668437

猜你喜欢

转载自huangqiqing123.iteye.com/blog/1668437