Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.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
Database 文件室预打包数据库中的索引不工作_Database_Sqlite_Android Studio_Indexing_Android Room - Fatal编程技术网

Database 文件室预打包数据库中的索引不工作

Database 文件室预打包数据库中的索引不工作,database,sqlite,android-studio,indexing,android-room,Database,Sqlite,Android Studio,Indexing,Android Room,我在预先打包的数据库中有一个表,我使用此查询创建了该表的索引 CREATE INDEX index_less_equal_to_L ON entries_less_equal_to_L(entry_word); 我在我的房间里用这个 @Entity(tableName = "entries_less_equal_to_L", indices = {@Index("index_less_ equal_to_L"), @Index(value = "

我在预先打包的数据库中有一个表,我使用此查询创建了该表的索引

CREATE INDEX index_less_equal_to_L ON entries_less_equal_to_L(entry_word);
我在我的房间里用这个

@Entity(tableName = "entries_less_equal_to_L", indices = {@Index("index_less_ equal_to_L"), @Index(value = "entry_word")})
但它不起作用,让我看看这个 [生成错误输出]:


我做错了什么?

您试图创建两个索引,每个@Index对应一个

第一个将命名为index_less_uequal_to_L,但没有列,因此出现错误消息

第二个将使用生成的名称成功创建,并位于entry_word列上。索引的名称应符合以下要求:-

如果未设置,则文件室会将其设置为索引${tableName}连接并以其为前缀的列列表。因此,如果您有一个名为Foo的表,并且索引为{bar,baz},那么生成的索引名将是index_Foo_bar_baz

因此,您需要将这两者合并为一个索引

您可以使用u和等于_to L之间的空格,因为我假设这是一个键入错误

indices = {@Index(name = "index_less_equal_to_L",value = "entry_word")}


后者更灵活,因为它允许复合标记多个列。

这正是我需要的,谢谢!
indices = {Index(name ="index_less_equal_to_L",value = {"entry_word"})}