Summary
SqliteConnection.execute treats startsWith('with'|'pragma'|select|explain|values) as a read-only query: skips the Dart StateError on a read-only connection and uses rawQuery. WITH … INSERT and PRAGMA journal_mode=WAL are writes. The file may still be SQLITE_OPEN_READONLY (engine rejects), so the Dart guard is not the real boundary — and on a RW connection WITH wrongly goes through rawQuery.
Scope
- Classify after stripping comments: first keyword of the first statement.
- WITH is read-only only if the statement is a SELECT CTE, not DML.
- PRAGMA that assigns (e.g. journal_mode=) is a write.
- Tests: read-only connection rejects WITH x AS (SELECT 1) INSERT …; PRAGMA busy_timeout still allowed.
Out of scope
- Full SQL parser. Comment-strip + first keyword is enough.
Reactions are currently unavailable
Summary
SqliteConnection.execute treats startsWith('with'|'pragma'|select|explain|values) as a read-only query: skips the Dart StateError on a read-only connection and uses rawQuery. WITH … INSERT and PRAGMA journal_mode=WAL are writes. The file may still be SQLITE_OPEN_READONLY (engine rejects), so the Dart guard is not the real boundary — and on a RW connection WITH wrongly goes through rawQuery.
Scope
Out of scope