Rebuilding secondary indexes on Android #72
Issue moved from old Cordova SQLite repo, created by @phydiux.
First off, thank you for Nano-SQL!
I'm having an issue specifically related to Android and secondary indexes on tables that I define. I've recreated the issue on an example app, and I'm hoping that you can shed some light on whether it's a developer issue or a legit bug in cordova-Nano-SQLite.
In summary, when I define a table that has an index on a secondary column, on Android it runs fine the first time the app is launched and as long as there is no data in the table. When I populate that table, then kill and re-launch the app, the app throws an exception in the _NanoSQLStorage.prototype.rebuildIndexes function.
The project I put together is located here: https://github.com/phydiux/NanoSQLTest - The readme on this project shows a summary of what's happening (basically, this write-up) and a screenshot of what I'm seeing in Chrome's inspection tool (in Windows) for the app running on Android. The code should be complete enough to be able to clone, build, run and see this issue on an Android device. This is affecting another app that I'm working on that is a bit more complex, and so getting an understanding about what's going on would be very helpful for me. Thanks!
The text was updated successfully, but these errors were encountered:
The same problem happens in Windows UWP, too.
After looking into your code, I found that there is a promise racing when calling database/storage.ts:rebuildIndexes from line 235 of
Because every table even
That's the source of the problem.
Well, the simplest way to avoid this problem is setting
However, if you want to solve it, maybe you should call
It works. ^_^