-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use alternative fix to set the sqlite CursorWindow size to 50mb
- Loading branch information
Showing
4 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
.yarn/patches/react-native-sqlite-storage-npm-6.0.1-8369d747bd.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
diff --git a/platforms/android/src/main/java/org/pgsqlite/SQLitePlugin.java b/platforms/android/src/main/java/org/pgsqlite/SQLitePlugin.java | ||
index 4f2391b..f7cc433 100644 | ||
--- a/platforms/android/src/main/java/org/pgsqlite/SQLitePlugin.java | ||
+++ b/platforms/android/src/main/java/org/pgsqlite/SQLitePlugin.java | ||
@@ -8,11 +8,14 @@ | ||
package org.pgsqlite; | ||
|
||
import android.annotation.SuppressLint; | ||
+import android.database.AbstractWindowedCursor; | ||
import android.database.Cursor; | ||
+import android.database.CursorWindow; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.database.sqlite.SQLiteException; | ||
import android.database.sqlite.SQLiteStatement; | ||
import android.content.Context; | ||
+import android.os.Build; | ||
import android.util.Base64; | ||
|
||
import java.io.Closeable; | ||
@@ -808,6 +811,17 @@ public class SQLitePlugin extends ReactContextBaseJavaModule { | ||
throw ex; | ||
} | ||
|
||
+ // To try to fix the error "Row too big to fit into CursorWindow" when using sqlite binary bundled with the device | ||
+ // https://github.com/andpor/react-native-sqlite-storage/issues/364#issuecomment-526423153 | ||
+ // https://github.com/laurent22/joplin/issues/1767#issuecomment-515617991 | ||
+ | ||
+ if (cur != null && Build.VERSION.SDK_INT >= 28) { | ||
+ CursorWindow cw = new CursorWindow(null, 50 * 1024 * 1024); | ||
+ AbstractWindowedCursor ac = (AbstractWindowedCursor) cur; | ||
+ ac.setWindow(cw); | ||
+ cur = ac; | ||
+ } | ||
+ | ||
// If query result has rows | ||
if (cur != null && cur.moveToFirst()) { | ||
WritableArray rowsArrayResult = Arguments.createArray(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,7 @@ | |
"[email protected]": "patch:react-native@npm%3A0.74.1#./.yarn/patches/react-native-npm-0.74.1-754c02ae9e.patch", | ||
"[email protected]": "patch:rn-fetch-blob@npm%3A0.12.0#./.yarn/patches/rn-fetch-blob-npm-0.12.0-cf02e3c544.patch", | ||
"[email protected]": "patch:app-builder-lib@npm%3A26.0.0-alpha.7#./.yarn/patches/app-builder-lib-npm-26.0.0-alpha.7-e1b3dca119.patch", | ||
"[email protected]": "patch:app-builder-lib@npm%3A24.13.3#./.yarn/patches/app-builder-lib-npm-24.13.3-86a66c0bf3.patch" | ||
"[email protected]": "patch:app-builder-lib@npm%3A24.13.3#./.yarn/patches/app-builder-lib-npm-24.13.3-86a66c0bf3.patch", | ||
"[email protected]": "patch:react-native-sqlite-storage@npm%3A6.0.1#./.yarn/patches/react-native-sqlite-storage-npm-6.0.1-8369d747bd.patch" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters