關於MySQL的boolean和tinyint(1)


原文:http://blog.csdn.net/woshixuye/article/details/7089508

 

 

MySQL保存boolean值時用1代表TRUE,0代表FALSE。boolean在mysql里的類型為tinyint(1)。MySQL里有四個常量:true,false,TRUE,FALSE分別代表1,0,1,0。

 

create table test

(
   id int primary key,
   bl boolean

)

 

這樣是可以創建成功。查看建表后的語句會發現,mysql把它替換成tinyint(1)。在pojo里直接定義該屬性為布爾值即可:private Boolean status


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM