Skip to content

Refresh statement metadata after SQLite repreparation - #598

Merged
SRombauts merged 4 commits into
masterfrom
fix-statement-metadata-reprepare
Oct 24, 2026
Merged

SRombauts merged 4 commits into
masterfrom
fix-statement-metadata-reprepare

Conversation

@SRombauts

Copy link
Copy Markdown
Owner

Fix stale column counts and name-to-index mappings when sqlite3_step() automatically reprepares a statement after schema changes. Detect SQLITE_STMTSTATUS_REPREPARE, refresh both caches without changing the public API, and add regression tests covering renamed/reordered columns, count changes, empty results, and moved statements.

Automatic SQLite repreparation can change result-column names or
counts, leaving Statement caches stale. Refresh them whenever
sqlite3_step() reports a reprepare and cover schema-change cases.
Record the automatic repreparation cache fix in PR #598.
@coveralls

coveralls commented Oct 18, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 99.72% (+0.004%) from 99.716% — fix-statement-metadata-reprepare into master

@SRombauts SRombauts self-assigned this Oct 18, 2026
@SRombauts SRombauts added the bug label Oct 18, 2026
SRombauts added a commit that referenced this pull request Oct 23, 2026
Backport `Statement::getColumnTableName()` and `Column::getTableName()`
from #594 to the C++11 maintenance branch (fixes #555 for the 3.x line).
Both remain guarded by `SQLITE_ENABLE_COLUMN_METADATA`.

Add unit tests and extend the Meson consumer test introduced by #600. No
#598 reprepare-cache fix, new SQLite API requirement, or
reprepare-specific regression test. CI validation is pending.
Query SQLITE_STMTSTATUS_REPREPARE once per step instead of twice.
Carry the cached counter through move construction and extend the
reprepare regression test to cover a move after recompilation.
Document that schema changes can leave cached metadata stale until
SQLite automatically reprepares the statement during execution.
@SRombauts
SRombauts merged commit 55cb402 into master Oct 24, 2026
72 checks passed
@SRombauts
SRombauts deleted the fix-statement-metadata-reprepare branch October 24, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants