Skip to content

Commit

Permalink
Return ErrBadConn in Prepare (go-sql-driver#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
methane authored and tz70s committed Sep 5, 2020
1 parent 83916e2 commit 0d5df0a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ func (mc *mysqlConn) Prepare(query string) (driver.Stmt, error) {
// Send command
err := mc.writeCommandPacketStr(comStmtPrepare, query)
if err != nil {
return nil, mc.markBadConn(err)
// STMT_PREPARE is safe to retry. So we can return ErrBadConn here.
errLog.Print(err)
return nil, driver.ErrBadConn
}

stmt := &mysqlStmt{
Expand Down

0 comments on commit 0d5df0a

Please sign in to comment.