Pra*_*ani 42 android android-logcat android-sqlite android-5.0-lollipop
我已经使用Android 5.0 Lollipop升级了我的Nexus 7,在此之前我的应用程序与SQLite数据库配合得很好但是现在每当我执行任何类型的查询时,它都会给我发送log cat错误,例如:
12-09 12:37:04.942: E/SQLiteLog(13041): (284) automatic index on area(server_id)
12-09 12:37:04.942: E/SQLiteLog(13041): (284) automatic index on account(area_id)
12-09 12:37:04.942: E/SQLiteLog(13041): (284) automatic index on staff_visit(account_id)
12-09 12:37:04.942: E/SQLiteLog(13041): (284) automatic index on ordertab(account_id)
12-09 12:37:04.960: E/SQLiteLog(13041): (284) automatic index on area(server_id)
12-09 12:37:04.960: E/SQLiteLog(13041): (284) automatic index on account(area_id)
12-09 12:37:04.960: E/SQLiteLog(13041): (284) automatic index on staff_visit(account_id)
12-09 12:37:04.960: E/SQLiteLog(13041): (284) automatic index on ordertab(account_id)
12-09 12:37:04.978: E/SQLiteLog(13041): (284) automatic index on area(server_id)
12-09 12:37:04.978: E/SQLiteLog(13041): (284) automatic index on account(area_id)
12-09 12:37:04.978: E/SQLiteLog(13041): (284) automatic index on staff_visit(account_id)
12-09 12:37:04.978: E/SQLiteLog(13041): (284) automatic index on ordertab(account_id)
Run Code Online (Sandbox Code Playgroud)
那么任何棒棒糖错误都是错误的吗?我是这么认为的,因为我在升级此操作系统之前和之后都没有更新我的代码.
laa*_*lto 71
在sqlite 3.7.17中引入了自动索引.具有此功能的sqlite版本仅包含在Android L开发人员预览中.这就是为什么你只在Lollipop上获得消息而不是更早.即使将其记录为错误,它也只是一条消息.
基本上,当您在非索引列上进行查找时,自动索引会发挥作用.sqlite假设有太多数据生成临时索引比原始查找便宜.
考虑为查询列添加显式永久索引CREATE INDEX.例如,在你之后CREATE TABLE:
CREATE INDEX indexname ON tablename(columnname);
Run Code Online (Sandbox Code Playgroud)
您可以tablename(columnname)从sqlite生成的autoindex消息中选择.
如果您只想恢复旧行为,则可以禁用自动索引
PRAGMA automatic_index=off;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17596 次 |
| 最近记录: |