0

FMDB is working fine when I query or delete or insert database but when I try to update it returns me YES in return but actually does not change any thing.

This is the code for updating data:(this doesn't work)

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

This is the code for inserting data:(work fine)

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

This is the code for deleting data:(work fine)

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

The table is schema is:

CREATE TABLE IF NOT EXISTS t_jewel_template (id integer PRIMARY KEY, data blob NOT NULL, idstr text NOT NULL);
Cœur
  • 37,241
  • 25
  • 195
  • 267
Dongqing
  • 1
  • 1

1 Answers1

1

Don't use executeUpdateWithFormat: (and in fact, it'll be going away in FMDB 3.0).

Instead, use executeUpdate: with ? placeholders.

ccgus
  • 2,906
  • 23
  • 18