我想将图像保存在数据库中,但我不确定一件事
我在扩展 SQLiteOpenHelper 的类上有这个方法
public boolean insertDemo(byte[] a, byte[] b, byte[] c, byte d) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put("id", 1);
cv.put("demo1", a);
cv.put("demo2", b);
cv.put("demo3", c);
cv.put("demo4", d);
db.insert("demo_tb", null, cv);
return true;
}
我的问题是,数据类型应该是什么?目前我有
db.execSQL("create table demo_tb"+"(id integer primary key,demo1 text,demo2 text,demo3 text,demo4 text)");
in the onCreate
method.
为了将图像保存在 sqlite 数据库中,您应该使用BLOB
表中该列的数据类型。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)