Sqlite中存储Boolean和boolean对象,分别使用boolean和text类型,sqliteboolean
sqlite中数据类型:
http://www.runoob.com/sqlite/sqlite-data-types.html
Boolean 数据类型
SQLite 没有单独的 Boolean 存储类。相反,布尔值被存储为整数 0(false)和 1(true)。
今天 存储布尔型数据时,看使用什么方式合适,记录下。
| SQLite保存类型 \ Bean使用类型 | Boolean | boolean |
|---|---|---|
| boolean | 存:value.put("isFat", entity.isFat); 取: person.isFat = cursor.getString(cursor.getColumnIndex("isFat")).equals("1"); |
同前 |
| text | 存: value.put("isFatB", entity.isFat.toString()); 取:person.isFatB = Boolean.valueOf(cursor.getString(cursor.getColumnIndex("isFatB"))); |
存:value.put("isTallB", String.valueOf(entity.isTall)); 取:同前 |
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。