Closed coltoneshaw closed 11 months ago
An important note, I open this same DB in SQLiteStudio, and it works fine without problems. So, it has to be an order of operations thing in my end but i'm having no luck finding it out.
Interesting, I disabled journal_mode = WAL
and it seems to work like expected. Any ideas?
It seems to have something to do with connecting to the database at any point from a third party tool, like SQLiteStudio.
error: SqliteError: database disk image is malformed
I posted over in the library too, because it could be an issue there.
One other observation I've noticed is that when connecting it creates the .db-shm
and .db-wal
files, then closing the connection via SQLiteStudio
it deletes those files, leaving me with just .db
. However, when closing via db.close()
via electron / better-sqlite it does not remove those files.
Okay, final observation, and probably rules to an issue with how i'm using better-sql or just an issue in the library here.
I've made it so the database is properly closed, meaning all .db-*
files are removed when closing, just like how SQLiteStudio does it. When the application goes to reopen the database, it always fails with a disk malformed error if those .db-*
files do not exist.
If I disable journal_mode = WAL
it all seems to work fine. However, I have a need to keep that enabled for performance.
Found the issue is related to mmap_size
not being supported
Glad you went ahead and reported the issue in the upstream library where the problem actually lies. People rarely do that.
SQLiteStudio has been known to have issues with WAL mode in previous releases where it depended on a problematic release of sqlite3mc.
This issue could be related: https://github.com/pawelsalawa/sqlitestudio/issues/4171
I know this is probably a me thing, but i'm not able to find a solution to this.
I can encrypt the database properly with
key=''
and it loads and read in my application successfully. I then close the app, reopen it, input the database password, then open the database. Once i've opened this database, all the queries fail.What am I doing wrong?
Here is me opening the database for the second time. Every query is like this.
I'm opening it with the below class: