close statement when missing query arguments

fixes #1280
This commit is contained in:
Yasuhiro Matsumoto 2024-10-04 23:52:25 +09:00 committed by mattn
parent 846fea6c14
commit 82bc911e85
1 changed files with 1 additions and 0 deletions

View File

@ -929,6 +929,7 @@ func (c *SQLiteConn) query(ctx context.Context, query string, args []driver.Name
s.(*SQLiteStmt).cls = true
na := s.NumInput()
if len(args)-start < na {
s.Close()
return nil, fmt.Errorf("not enough args to execute query: want %d got %d", na, len(args)-start)
}
// consume the number of arguments used in the current