Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQLite数据库在<;表_name>;(列)升级Android L后_Android_Android Sqlite_Android 5.0 Lollipop_Android Logcat - Fatal编程技术网

SQLite数据库在<;表_name>;(列)升级Android L后

SQLite数据库在<;表_name>;(列)升级Android L后,android,android-sqlite,android-5.0-lollipop,android-logcat,Android,Android Sqlite,Android 5.0 Lollipop,Android Logcat,我已经用Android 5.0棒棒糖升级了Nexus 7,之前我的应用程序与SQLite数据库配合得很好,但现在每当我执行任何类型的查询时,它都会给我log cat error类似: 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

我已经用Android 5.0棒棒糖升级了Nexus 7,之前我的应用程序与SQLite数据库配合得很好,但现在每当我执行任何类型的查询时,它都会给我log cat error类似:

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)
那么这是棒棒糖的错误吗?我这么认为是因为我在升级这个操作系统之前和之后都没有更新我的代码。

是在sqlite 3.7.17中引入的。仅提供了具有此功能的sqlite版本。这就是为什么你只在棒棒糖上得到信息,而不是更早。即使它被记录为一个错误,它实际上只是一条消息

基本上,当您在非索引列上进行查找时,自动索引将发挥作用。sqlite假设数据太多,生成临时索引比原始查找便宜

考虑使用
CREATE INDEX
为查找列添加明确的永久索引。例如,在
创建表之后

CREATE INDEX indexname ON tablename(columnname);
您可以从sqlite生成的自动索引消息中选择
tablename(columnname)

如果您只是想恢复旧的行为,可以使用禁用自动索引

PRAGMA automatic_index=off;

这是我调查这个问题时的头条帖子。虽然我有一个C#项目,它可能与OP无关,但我认为它可能对某些人还是有帮助的

对于那些想知道为什么消息会不断出现的人,尽管索引是显式创建的;可能您的查询使用了不同的排序规则

我有一个带有文本列的表和一个带有where语句的select查询,其中where语句指定
where name=@var1 COLLATE NOCASE
。这触发了警告,因为我创建的索引是默认排序规则


因此,重写index或create table语句,为该列指定nocase,会使警告消失。

谢谢@laalto,如果我什么都不做,那么会出现任何错误吗?那么,哪种方法对它们进行索引更好。这有问题吗?@MuhammadBabar取决于数据量和读写比例。我不明白的是,尽管我已经在该表列上创建了索引,但为什么我一直收到这些消息……我讨厌开发人员无法理解错误日志的含义。。。它弄脏了我的logcat输出!它最多应该是一个信息日志或警告…顺便说一句,自动索引很好,提高了查询性能。虽然很奇怪,因为我已经为我的搜索或联接列手动创建了索引,但仍然在创建自动索引。