greenDAO icon indicating copy to clipboard operation
greenDAO copied to clipboard

How does Greendao's insertOrReplace method avoid changing the corresponding value in the database when some filelds of the object are null?

Open windfallsheng opened this issue 4 years ago • 1 comments

当对象的一些属性为null时,greendao的insertOrReplace方法怎么避免修改数据库里对应的值? EN:How does Greendao's insertOrReplace method avoid changing the corresponding value in the database when some filelds of the object are null?

windfallsheng avatar Jun 04 '20 11:06 windfallsheng

This is the SQLite command used: https://github.com/greenrobot/greenDAO/blob/0cce6c004181eeec9b900c9bd2ef47d7f0c23893/DaoCore/src/main/java/org/greenrobot/greendao/internal/TableStatements.java#L67

According to https://www.sqlite.org/lang_conflict.html this means if an entity/row with this key exists, it will be deleted first before the given entity/row is inserted.

greenrobot-team avatar Jun 22 '20 06:06 greenrobot-team