esp32-idf-sqlite3
esp32-idf-sqlite3 copied to clipboard
Inserts fail with PSRAM
if I execute a lot of inserts (800-6000) in a table I get the error 'database disk image is malformed'. This happens if the table has an Index, the table needs to have an index due to the execution time of the select query. The error 'database disk image is malformed' happens only when I use the PSRAM of the ESP32. I have:
build_flags = -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
To use psram what I did was open all the files in the library and replace each "malloc" with "ps_malloc" and each "realloc" with "ps_realloc". This works, I can see that the consumption of the library passed to the PSRAM
The database can be recovered with a reindex, but this query works only using external tools, if it is run from the ESP32 I get the error 'disk i / o error'
Other than the suggestion that you could try WITHOUT ROWID feature of SQLite, I don't have any other solution.