gpt4 book ai didi

android - 在房间数据库中保存数据的存储限制是多少?

转载 作者:行者123 更新时间:2023-12-04 23:55:57 24 4
gpt4 key购买 nike

我有一个带有房间数据库的应用程序。我如何知道已达到数据存储的最大限制?如果应用程序超过该限制会发生什么。它会影响已经存储的数据还是只是停止添加新数据?

最佳答案

来自 docs

The Room persistence library provides an abstraction layer over SQLite

所以我假设房间的限制与 SQLite 相同.

来自 Limits In SQLite

Maximum Database Size

Every database consists of one or more "pages". Within a singledatabase, every page is the same size, but different database can havepage sizes that are powers of two between 512 and 65536, inclusive.The maximum size of a database file is 4294967294 pages. At themaximum page size of 65536 bytes, this translates into a maximumdatabase size of approximately 1.4e+14 bytes (281 terabytes, or 256tebibytes, or 281474 gigabytes or 256,000 gibibytes).

我怀疑您是否会达到此限制,但我相信您可以填满设备上的所有可用内存。

How would I know that the maximum limit of data storage is reached?

检查 this answer , 很详细

What happens if the app exceeds that limit

我真的认为这取决于您执行的操作,但是为了避免崩溃,您可以像链接的答案中那样事先检查内存来处理它。

关于android - 在房间数据库中保存数据的存储限制是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69018659/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com