wcdb
wcdb copied to clipboard
iOS如何写数据库有数据就更新没有数据就插入的sql
使用的是oc,如果写sql可以使用如下如下sql满足需求
INSERT INTO user(userId,userName,userAge,userSex) VALUES(1,"qyf",22,"nv") ON DUPLICATE KEY UPDATE userName="qinyufeng",userAge=24,userSex="女"
如果用wcdb应该如何写
It's called "upsert clause", which it's a new feature in SQLite.
It's not supported in released WCDB version. However, you can try it in pre_v1.1.0
branch. https://github.com/Tencent/wcdb/blob/pre_v1.1.0/apple/objc/winq/identifier/Upsert.hpp
Please try the latest version.