加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

SQLite数据库提供警告自动索引(列)升级Android L后

发布时间:2020-12-12 19:17:38 所属栏目:百科 来源:网络整理
导读:我已经升级了我的Nexus 7与Android 5.0 Lollipop,之前,我的应用程序运行良好与SQLite数据库,但现在每当我执行任何类型的查询,它给我log cat错误,如: 12-09 12:37:04.942: E/SQLiteLog(13041): (284) automatic index on area(server_id)12-09 12:37:04
我已经升级了我的Nexus 7与Android 5.0 Lollipop,之前,我的应用程序运行良好与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)

所以它是错误的任何棒棒糖错误?我认为是因为我没有更新我的代码之前和之后升级此操作系统。

Automatic indexing在sqlite 3.7.17中引入。有这个功能的sqlite的版本只有 included in Android L developer preview.这就是为什么你只在Lollipop但不是更早的消息。即使它被记录为错误,它只是一个消息。

基本上,自动索引在您对非索引列执行查找时起作用。 sqlite假设有这么多的数据,生成临时索引比原始查找便宜。

请考虑使用CREATE INDEX为查找列添加显式的永久索引。例如,在您的CREATE TABLE:

CREATE INDEX indexname ON tablename(columnname);

其中您可以从sqlite生成的自动索引消息中选择tablename(columnname)。

如果你只想要旧的行为回来,你可以禁用自动索引

PRAGMA automatic_index=off;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读