It appears that Cursors in android can only hold up to 1 MB of data.
What would be the most efficient way to pull the maximum number of rows from a table in a SQLite database that stays under the 1 MB limit?
It appears that Cursors in android can only hold up to 1 MB of data.
What would be the most efficient way to pull the maximum number of rows from a table in a SQLite database that stays under the 1 MB limit?
I don't think there's a hard and fast way to determine the right limit, but I looked in the CursorWindow documentation and found that copyStringToBuffer (int row, int column, CharArrayBuffer buffer)
seems promising as CharArrayBuffer has a integer field called sizeCopied and the method copyStringToBuffer
takes the text at the specified row and column. Maybe you can get the size from the buffer and add for each row and column you have? If you're using SQLiteCursor, you can use setWindow(CursorWindow window)
to set your own window.
You can put LIMIT clause, so that rows are fetched in parts.