From eec96dd25ed31d174a9888f0ed83b5f64e74c95f Mon Sep 17 00:00:00 2001 From: starainrt Date: Sat, 29 Apr 2023 12:26:54 +0800 Subject: [PATCH] add more info --- parse.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/parse.go b/parse.go index 8899e02..81c582f 100644 --- a/parse.go +++ b/parse.go @@ -91,7 +91,17 @@ func parseBinlogDetail(r io.Reader, f func(Transaction)) error { for { headBuf := make([]byte, replication.EventHeaderSize) if _, err = io.ReadFull(r, headBuf); err == io.EOF { - if tx.EndPos != 0 { + idx := 0 + for k, v := range tx.Txs { + if v.SqlType != "query" && len(tx.sqlOrigin) > idx { + v.Sql = tx.sqlOrigin[idx] + idx++ + } + tx.RowsCount += v.RowCount + tx.Txs[k] = v + } + tx.Size = tx.EndPos - tx.StartPos + if f != nil { f(tx) } return nil