Skip to content
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

在我的表里有数据的情况下,增加字段不成功, #23

Closed
TakeNotes2019 opened this issue Apr 20, 2017 · 2 comments
Closed

Comments

@TakeNotes2019
Copy link

restoreData()方法里面 转移数据的时候,抛出异常,
android.database.sqlite.SQLiteConstraintException: 表.增加的字段 may not be NULL (code 19)
数据转移失败,新表为空 ,temp表 未删除, 如何解决 啊 大神!!!!!

@jact-hz
Copy link

jact-hz commented Apr 21, 2017

你开启debug看看报什么错
我这面报的错
加上compile 'net.zetetic:android-database-sqlcipher:3.5.6'
这个库成功了。但是包会增加8M 好些个.so文件

@yuweiguocn
Copy link
Owner

yuweiguocn commented Apr 26, 2017

@836986836 抱歉,来晚了 ,你可以看看这个 greenrobot/greenDAO#17
这个是由于greenDAO 3.0 生成的字段添加了非空约束。字段的类型设置为基本类型(如:int)默认会添加非空约束,字段类型设置为对象类型(如:Integer)默认不会添加非空约束,而且最终生成的sql会使用对象类型。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants