-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: insertOrReplaceObject与isAutoIncrement的语义 #63
Comments
自增的主键也可以用不自增的方式插入的,因此需设置 |
好的,在主键设置isAutoIncrement = yes后,记录已存在后,需要更新,但是调用insertOrReplaceObject方法后,依然会插入一行记录,请问这个问题怎么解决? |
insertOrReplaceObject对于不存在的会进行插入,已存在的则是覆盖。请参考:http://www.sqlite.org/lang_insert.html |
对插入的对象,当对象的主键在数据库中已存在,但是在设置isAutoIncrement = yes后,依然会插入一条新的记录 |
这样不会起到更新的作用 |
自增不会管当前对象的主键,相当于INSERT INTO myTable (NULL, "value"); 你可以用 |
好的,可能你没有理解我说的意思,我这边再测试测试。谢谢回答 |
如果是更新,则设置 |
意思就是使用 |
|
对。 |
好的👌 |
insertOrReplaceObject
与isAutoIncrement
的语义
insertOrReplaceObject
与isAutoIncrement
的语义
@LongTimeNoSeee 在RingoD的2017年30号修改吗,是否解决了主键自增与insertOrReplaceObject冲突的问题,目前我pod引用最新的代码还是只能插入一条数据。 |
@ymsheng Do not reply on a closed issue |
在数据库对应的模型里面代码:
WCDB_SYNTHESIZE_COLUMN(Student, snu, "s_number")
WCDB_PRIMARY_AUTO_INCREMENT(Student, snu)
为什么在数据库中,没有显示主键的自动增长?
The text was updated successfully, but these errors were encountered: