ccgus / fmdb

A Cocoa / Objective-C wrapper around SQLite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I encountered an issue where using UPDATE fails to update, but using INSERT OR REPLACE doesn't.

zhangyutao12 opened this issue · comments

Hi, while using FMDB, I encountered an issue where I'm using a child thread and FMDatabaseQueue to execute a piece of SQL within a transaction. First, I check locally for existence, then decide whether to update or insert. The problem I'm facing is that during the update process, everything seems fine in the middle, but the data isn't successfully executed,If I replace UPDATE with INSERT OR REPLACE, I don't encounter this issue

image

23:22:09.635 [1] [2023-12-24 23:22:09.635]-[+[MOADBHelper getDatabaseQueue]_block_invoke -31]-数据库:<CXDatabase: 0x28335fde0> executeQuery: select mobile from imSessionUserInfoTable WHERE owner = '0' and displayName = 'cs_包奇锋' and tableIndex = '1100000148018701501121' LIMIT 1

2023-12-24 23:22:11.083205+0800 <CXDatabase: 0x28335fde0> executeUpdate: UPDATE imSessionUserInfoTable SET groupVersion = 10034 WHERE tableIndex = 1100000148018701501121

23:22:11.084 [1] [2023-12-24 23:22:11.083]-[+[MOADBHelper getDatabaseQueue]_block_invoke -31]-数据库:<CXDatabase: 0x28335fde0> executeUpdate: UPDATE imSessionUserInfoTable SET groupVersion = 10034 WHERE tableIndex = 1100000148018701501121

23:22:11.086 [1] [2023-12-24 23:22:11.086]-[-[MOADataBaseManager(User) insertIMSesstionUsers:andGroupID:andNewGroupVersion:]_block_invoke -92]-IM--[db changes] = 0

Could you please help me figure out the reasons behind this phenomenon? Thank you

sqlite3_step" returns "SQLITE_DONE", and the number of changes obtained from "[db changes]" is 0