Skip to content

fix(Data): clear bindings in Statement::addBinding() to allow reuse #5220#5223

Merged
matejk merged 1 commit intomainfrom
5220-statement-addBinding-reset
Feb 25, 2026
Merged

fix(Data): clear bindings in Statement::addBinding() to allow reuse #5220#5223
matejk merged 1 commit intomainfrom
5220-statement-addBinding-reset

Conversation

@matejk
Copy link
Copy Markdown
Contributor

@matejk matejk commented Feb 24, 2026

Summary

  • Statement::addBinding(container, reset=true) only reset _bound flags via resetBinding() but did not clear the bindings vector, causing new bindings to accumulate on each call
  • Second and subsequent execute() calls failed due to mismatch between placeholder count and binding count
  • Fix: also call bindings().clear() when reset=true, so the old bindings are removed before new ones are added

Closes #5220

Test plan

  • Added testAddBindingReuse test that exercises the exact scenario from the issue (prepare once, addBinding + execute multiple times)
  • All 99 SQLite tests pass

@matejk matejk requested a review from aleks-f February 24, 2026 16:57
@matejk matejk merged commit 4dcf40d into main Feb 25, 2026
102 checks passed
@matejk matejk deleted the 5220-statement-addBinding-reset branch February 25, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poco::Data::Statement should not be in ST_DONE state after a addBinding() call

2 participants