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