Android sqlite 数据库中可以嵌套集合吗?

are nested sets possible in Android sqlite database?

我有一个问题,我正在制作一个包含相册和文件的项目。它使用文件树结构并与 Laravel 上的网站 运行 同步。该网站使用嵌套集作为数据结构。

是否可以在 android 和 SQLite 中使用嵌套集? 如果可行,怎么做?

如果没有,有人知道不同的解决方案吗?

嵌套集不在data types directly supported by SQLite中。

可能可以使用规范化的数据库模式来存储集合及其值,但查询它们需要递归 CTEs,这在 Android 随附的大多数 SQLite 版本中不受支持.

嵌套集是一种用于在关系数据库中对层次结构进行建模的编码技术。它与特殊类型的数据库支持或递归的 SQL 扩展无关。它是应用程序级别的东西,它适用于任何关系数据库,就像任何其他索引整数列一样。 SQLite也不例外

Wikipedia's article is a good overview. Specifically for SQL queries, I wrote a Python library called Fangorn for nestsed sets trees that supports MySQL and SQLite. It shouldn't be hard to extract the queries for certain operations from this module,并在 Java DAO 中使用。