Skip to content

fix: correct inconsistent error message in Exec vs Query (#1395)#1401

Open
vigneshakaviki wants to merge 1 commit into
mattn:masterfrom
vigneshakaviki:fix/issue-1395
Open

fix: correct inconsistent error message in Exec vs Query (#1395)#1401
vigneshakaviki wants to merge 1 commit into
mattn:masterfrom
vigneshakaviki:fix/issue-1395

Conversation

@vigneshakaviki

@vigneshakaviki vigneshakaviki commented Jun 2, 2026

Copy link
Copy Markdown

Summary

  • Fixed inconsistent error message reporting in Exec and Query methods
  • Both methods validate argument count but reported different values
  • Now both report remaining args count after start offset

Root Cause

Query reported len(args)-start correctly, but Exec reported full len(args)

Changes

  • sqlite3.go line 965: Changed to report len(args)-start instead of len(args)
  • Aligns error messages between Exec and Query validation

Test Plan

  • Error messages now consistent between methods
  • Reports correct argument count in errors
  • All argument validation tests pass

…#1395)

Exec and Query share the same multi-statement loop and error check, but
reported different 'got' argument counts in error messages:
- Exec: reported len(args) (total args)
- Query: reported len(args)-start (remaining args)

Both check the same condition (len(args)-start < na), so both should report
the same 'got' value. The correct value is len(args)-start since that's what's
compared against the required args.

Fixes mattn#1395

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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.

2 participants