react-native-nitro-sqlite icon indicating copy to clipboard operation
react-native-nitro-sqlite copied to clipboard

use cacheDir for setting TMPDIR env to solve android 12 issue

Open SebastianSingle99 opened this issue 2 years ago • 2 comments

sqlite3.c tries to use the TMPDIR environment variable which resolves to /data/user/0/<app-id>/cache except for Android 12 devices. I'm not sure if this is a bug in android, but it leads to this error message:

WebSQL threw an error [Error: [react-native-quick-sqlite] SQL execution error: disk I/O error

  • related sql error code 10 - io Error
  • extended sql error 6410 , see https://www.sqlite.org/rescode.html#ioerr_gettemppath

sqlite cannot write the temporary file, because it cannot find a valid file path.

This pull requests overwrites the TMPDIR variable explicitly with the cache directory. Any other ideas or solutions are welcome.

SebastianSingle99 avatar Oct 16 '23 09:10 SebastianSingle99

I noticed this exact problem as well and had to configure the temp store to be in memory. I think this problem has existed even before the ownership transition.

PRAGMA temp_store = memory;

gegana avatar Oct 19 '23 18:10 gegana

I noticed this exact problem as well and had to configure the temp store to be in memory. I think this problem has existed even before the ownership transition.

PRAGMA temp_store = memory;

Yes, its a know problem with the same workaround in different libraries. On android, TEMP STORE is set to temp.

EduFrazao avatar Oct 23 '23 19:10 EduFrazao