【问题标题】:Is it possible to use Android Room Database to create an R*Tree table?是否可以使用 Android Room Database 创建 R*Tree 表?
【发布时间】:2021-10-16 07:24:11
【问题描述】:

我想继续使用 Room,但我认为无法创建使用 rtree 的实体。有 @FTS3 和 @FTS4 注释,但我看到的 RTree 没有。是否可以使用 R-Tree 创建实体?

我正在尝试使用此代码进行迁移,但我仍然没有 Room 的实体...

val TABLE_CREATE = "CREATE VIRTUAL TABLE if not exists my_table_name USING rtree(" +
       "row_id," +          // Primary key
       "minX, maxX," +      // Minimum and maximum X coordinate
       "minY, maxY" +       // Minimum and maximum Y coordinate
");"
db.execSQL(TABLE_CREATE)

【问题讨论】:

    标签: android database entity android-room r-tree


    【解决方案1】:

    我认为目前不可能在 Room 中使用 RTree。

    要使用 RTree,您需要使用 -DSQLITE_ENABLE_RTREE=1 选项编译的 SQLite 分发版。

    Room 是 SQLite 上的一个抽象层,它与 Android 设备一起分发,我相信它没有启用 RTree(如果是的话,我猜@RTree 注释将可用)。

    例如如果你尝试使用 API 31,你会得到:-

    E/SQLiteLog: (1) statement aborts at 28: [CREATE VIRTUAL TABLE rtree1 USING rtree(id,minX,maxX,minY,maxY);] no such module: rtree
    

    即rtree 未启用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 2018-05-18
      • 1970-01-01
      • 2019-12-18
      • 2021-11-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多