Skip to content

Stale statements with DBInterface @prepare #301

@ghost

Description

I'm using an in-memory database for testing, with multiple test groups where the database is created/destroyed around each group's tests. I was also using some Stmt's created using @prepare from DBInterface. This was resulting in test failures with exceptions like

SQLite.SQLiteException("Statement 2 not found")

I believe the problem was that the Stmt's cached in DBInterface's PREPARED_STMTS were not freed when the test database was destroyed; trying to use them with a freshly created database failed because there was no corresponding _StmtId in the Sqlite.DB. At any rate, I rewrote my code to remove uses of @prepare, and the problem was solved.

Perhaps this is worth a warning in the Sqlite package's documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions