Skip to content

Commit 906498a

Browse files
committed
countParams now returns count=-1 on error
1 parent e9a8992 commit 906498a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,14 @@ func countParams(queryStmt *sql.Stmt) (int, error) {
280280
// This is weird
281281
// queryStmt is prepared (compiled) so it is valid
282282
// but yet there was an error executing queryStmt
283-
return 0, fmt.Errorf("Cannot extract params count from query error: %v", err)
283+
return -1, fmt.Errorf("Cannot extract params count from query error: %v", err)
284284
}
285285
count, err := strconv.Atoi(regexSubmatches[0][1])
286286
if err != nil {
287287
// This is even weirder
288288
// The regex is \p{N}+ (unicode number sequence) and there was a match,
289289
// but converting it from string to int returned an error
290-
return 0, fmt.Errorf(`Cannot convert \p{N}+ regex to int: %v`, err)
290+
return -1, fmt.Errorf(`Cannot convert \p{N}+ regex to int: %v`, err)
291291
}
292292
return count, nil
293293
}

0 commit comments

Comments
 (0)