Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a windowSizeBytes parameter to AndroidSqliteDriver #4804

Merged
merged 2 commits into from Nov 23, 2023

Conversation

BoD
Copy link
Contributor

@BoD BoD commented Nov 10, 2023

Android has the concept of a cursor window, where a query will try to preemptively load data up to a certain size (by default 2MB). However if individual rows are too big to fit that size, a SQLiteBlobTooBigException will be thrown.

A few issues where this happens:

More context about CursorWindow in this blog post.

Since Android 28+ this can be mitigated by controlling the window size. This PR adds the ability to pass this value to AndroidSqliteDriver.

windowSizeBytes != null &&
cursor is AbstractWindowedCursor
) {
cursor.window = CursorWindow(null, windowSizeBytes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this line into another class so that its code verification is deferred unless needed.

You can read about why here: https://github.com/androidx/androidx/blob/androidx-main/docs/api_guidelines/compat.md#checking-device-sdk-version-compat-sdk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 535c0d8

@JakeWharton JakeWharton merged commit 01ea7ae into cashapp:master Nov 23, 2023
7 checks passed
hfhbd pushed a commit that referenced this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants