Simpl-Resultat/src-tauri
le king fu 89ee648629 fix(db): run every statement on one connection of the plugin's pool (#543)
tauri-plugin-sql opens each database with Pool::connect, a sqlx pool of
up to ten connections, and sqlx gives a connection back to its pool
through a spawned task. Two statements sent back to back made the pool
open a second connection and serve both in turn, so a transaction of
withTransaction was split: its BEGIN and first write on one connection,
a later write on the other, which waited for the first one's write lock
and failed with "database is locked" (code 5) after 5 s. Adding a keyword
from the right-click menu (six statements) and creating a sub-category
hit it; the 14 withTransaction call sites were exposed.

Right after Database.load, inside the exclusive section that opens a
profile, loadUnlocked now calls use_single_connection_pool, a new Tauri
command (db_pool_commands.rs) that replaces the plugin's DbPool::Sqlite
in DbInstances by a pool of one connection, never recycled, opened with
the plugin pool's own connect options, then closes the plugin's pool.
getDb() and withTransaction find the connection only once the switch
succeeded; a failed switch writes a folder-free Journal line, closes the
plugin's pool and fails the opening.

sqlx 0.8.6 becomes a direct dependency with features the plugin already
enables: Cargo.lock only gains the edge, no package.

test: reproduces #543. The Rust tests replay, on a real sqlx pool opened
like the plugin's, the statements of a keyword on one then two checked
transactions (one split) and of a sub-category: code 5 on the plugin's
pool, green after the swap (6 of 6 red on a no-op swap). db.test.ts pins
the place of the switch and its failure path.

Fixes #543

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:18:43 +00:00
..
capabilities feat: add Settings page with in-app updater support 2026-02-11 11:47:25 +00:00
icons feat(branding): replace default Tauri icon with custom design 2026-05-02 14:51:55 -04:00
src fix(db): run every statement on one connection of the plugin's pool (#543) 2026-11-14 01:18:43 +00:00
.gitignore Initial project scaffold: Tauri v2 + React + TypeScript + TailwindCSS v4 2026-02-07 11:05:11 +00:00
build.rs Initial project scaffold: Tauri v2 + React + TypeScript + TailwindCSS v4 2026-02-07 11:05:11 +00:00
Cargo.lock fix(db): run every statement on one connection of the plugin's pool (#543) 2026-11-14 01:18:43 +00:00
Cargo.toml fix(db): run every statement on one connection of the plugin's pool (#543) 2026-11-14 01:18:43 +00:00
tauri.conf.json chore: release v0.18.0 2026-11-10 19:30:24 -05:00