【问题标题】:using fmdb can't update blob type data使用 fmdb 无法更新 blob 类型数据
【发布时间】:2015-05-22 09:43:18
【问题描述】:

当我查询或删除或插入数据库时​​,FMDB 工作正常,但当我尝试更新时,它返回 YES,但实际上并没有改变任何东西。

这是更新数据的代码:(这不起作用)

 [_db executeUpdateWithFormat:@"UPDATE t_jewel_template SET data = %@ WHERE idstr = %@;", bookData, bookId];

这是插入数据的代码:(工作正常)

 [_db executeUpdateWithFormat:@"INSERT INTO t_jewel_template(data, idstr) VALUES(data, idstr);", bookData, bookId];

这是删除数据的代码:(工作正常)

 [_db executeUpdateWithFormat:@"DELETE FROM t_jewel_template WHERE idstr = %@;", bookId];

该表的架构是:

CREATE TABLE IF NOT EXISTS t_jewel_template (id integer PRIMARY KEY, data blob NOT NULL, idstr text NOT NULL);

【问题讨论】:

    标签: ios fmdb


    【解决方案1】:

    不要使用 executeUpdateWithFormat:(事实上,它将在 FMDB 3.0 中消失)。

    改为使用 executeUpdate: 和 ?占位符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-07-23
      • 2017-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多