喜欢技术的前端
喜欢技术的前端
  • 发布:2020-03-23 10:27
  • 更新:2022-11-11 17:17
  • 阅读:1451

sqlite 存储怎样存对象呢,报错1404

分类:HTML5+

这是建表时:
'create table if not exists '+_this.tableName+'("chat_type" CHAR(40),"chat_id" CHAR(40),"type" INT(11),"time" INT(11),"user_info" CHAR(255),"content" BLOB)';

插入时:
"insert into "+_this.tableName+' values("422b17d4f5a827809bbcce38d6e683f6", "5e71da4b96dc89272833a0e4", 6,1584519755,"user_info",{"content":1})',

报错 :

插入 failed: {"code":-1404,"message":"android.database.sqlite.SQLiteException: unrecognized token: \"{\" (code 1): , while compiling: insert into chat_messages values(\"422b17d4f5a827809bbcce38d6e683f6\", \"5e71da4b96dc89272833a0e4\", 6,1584519755,\"user_info\",{\"content\":1})

2020-03-23 10:27 负责人:无 分享
已邀请:
phoeniix

phoeniix - Hello World

请问你解决了吗?

  • 喜欢技术的前端 (作者)

    存之前转JSON.stringify(),取出来JSON.parse()为对象

    2022-07-29 16:03

树下的老大爷

树下的老大爷

记得JSON.stringify()之后用 单引号括起来

要回复问题请先登录注册