欢迎投稿

今日深度:

Sqlite中存储Boolean和boolean对象,分别使用boolean和text类型,sqliteboolean

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));
        
取:同前






www.htsjk.Com true http://www.htsjk.com/SQLite/32938.html NewsArticle Sqlite中存储Boolean和boolean对象,分别使用boolean和text类型,sqliteboolean sqlite中数据类型: http://www.runoob.com/sqlite/sqlite-data-types.html Boolean 数据类型 SQLite 没有单独的 Boolean 存储类。相反,布...
相关文章
    暂无相关文章
评论暂时关闭