使用fmdb无法更新blob类型数据

问题描述 投票:0回答:1

当我查询或删除或插入数据库时​​,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个回答
1
投票

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

相反,使用executeUpdate:with?占位符。

© www.soinside.com 2019 - 2024. All rights reserved.