Skip to content

fix(sqlite): Save fails as read-only and the database stops opening after edits #989

Description

@ZhuchkaTriplesix

Summary

After editing data in a SQLite table, Save fails or the same database stops opening:

  1. Save fails with attempt to write a readonly database (code 8). Reproduced in the real app: Demo Playground → users → edit a cell → Save → Apply.
  2. The database "does not open" afterwards. Closing any pooled session (the Save session is idle-closed 4 s after Save, the SQL editor, Disconnect in the tree) closes the file for every other open view of the same database.

Cause

SqliteConnection.connect uses sqflite's default singleInstance: true, so opening the same path again returns the first Database. The pool's separate readOnly / tableWrite / readWrite sessions therefore share one handle: a Save session reuses the read-only browse handle, and closing any session closes the shared handle. In addition, Table Browser keeps its browse lease forever and shows Not connected when that session was closed (e.g. after Disconnect) instead of re-acquiring it.

Also (editing UX)

  • Table Browser showed two sets of edit controls (header: badge / Revert / Save; grid toolbar: Revert All / badge / Save Changes). While dirty, the header set pushed DDL / Refresh / Prev / Next off-screen.
  • Save errors were shown as raw driver exceptions (SqfliteFfiException(sqlite_error: 8, , SqliteException(8)…).
  • Toast read 1 change(s) saved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingdata-gridInteractive data grid, cell editor, filtering, groupingssqliteSQLite database driver and workspaceuxUser experience, keyboard shortcuts and interactions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions