From 6b6ce1e160b85f420373db96b6898e9f32e502b7 Mon Sep 17 00:00:00 2001 From: Pau Freixes Date: Fri, 2 Feb 2024 17:47:38 +0100 Subject: [PATCH] Return ErrBadCon when buffer is in wrong state during interpolation --- connection.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connection.go b/connection.go index 660b2b0e0..9b805c39e 100644 --- a/connection.go +++ b/connection.go @@ -209,8 +209,9 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin buf, err := mc.buf.takeCompleteBuffer() if err != nil { // can not take the buffer. Something must be wrong with the connection + // is safe to retry and will help to recycle the TCP. So we can return ErrBadConn here mc.cfg.Logger.Print(err) - return "", ErrInvalidConn + return "", driver.ErrBadConn } buf = buf[:0] argPos := 0