Skip to content

Commit

Permalink
fix: 修复不同库名sqlhash相同的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchuanchuan committed Jan 9, 2023
1 parent 3942cfd commit 9e5e44f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions session/osc.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ func (s *session) mysqlComputeSqlSha1(r *Record) {
return
}

buf := bytes.NewBufferString(r.DBName)

buf.WriteString(s.opt.Password)
buf.WriteString(s.opt.Host)
buf.WriteString(s.opt.User)
buf.WriteString(strconv.Itoa(s.opt.Port))
var buf strings.Builder
if r.DBName != "" {
buf.WriteString(r.DBName)
} else {
buf.WriteString(s.dbName)
}
buf.WriteString(strconv.Itoa(r.SeqNo))
buf.WriteString(s.opt.Host)
buf.WriteString(r.Sql)

r.Sqlsha1 = auth.EncodePassword(buf.String())
Expand Down

0 comments on commit 9e5e44f

Please sign in to comment.