Skip to content

SQLite in-memory test databases and FOR_UPDATE

Choose a tag to compare

@bw19 bw19 released this 22 Mar 04:43
· 40 commits to main since this release

Fix: SQLite in-memory test databases

  • Changed the default SQLite data source from :memory: to file:?mode=memory&cache=shared so that multiple connections share the same in-memory database.
  • Removed the special-case that skipped setDatabaseInDataSourceName for SQLite; it now follows the same code path as other drivers.
  • Updated the comment to clarify that SQLite in-memory databases are automatically freed when all connections close.

New: FOR_UPDATE() virtual function

Added a FOR_UPDATE() virtual function for portable row-level locking in SELECT statements.

SELECT * FROM users WHERE id=? FOR_UPDATE()

Expands per driver:

  • MySQL / PostgreSQL — FOR UPDATE
  • MSSQL — WITH (UPDLOCK, ROWLOCK)
  • SQLite — empty string (transaction-level locking is sufficient)