Android cursor maximum size

It seems that cursors in android can only store up to 1 MB of data.

What would be the most efficient way to print the maximum number of rows from a table in a SQLite database that is under a 1 MB limit?

+6
source share
2 answers

I don’t think there is a hard and fast way to determine the correct limit, but I looked in the CursorWindow documentation and found that copyStringToBuffer (int row, int column, CharArrayBuffer buffer) seems promising since CharArrayBuffer has an integer field called sizeCopied and the copyStringToBuffer method accepts text in the specified row and column. Maybe you can get the size from the buffer and add for each row and column that you have? If you are using SQLiteCursor, you can use setWindow(CursorWindow window) to set your own window.

0
source

You can put a LIMIT clause to extract rows in parts.

-1
source

Source: https://habr.com/ru/post/918785/


All Articles