Skip to content

Commit fc62b51

Browse files
author
ffffwh
committed
improve understandability
1 parent 394c1ac commit fc62b51

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

drivers/mysql/mysql/binlog/binlog_reader.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,12 @@ func (b *BinlogReader) handleEvent(ev *replication.BinlogEvent, entriesChannel c
474474
b.hasBeginQuery = true
475475
} else {
476476
if strings.ToUpper(query) == "COMMIT" || !b.hasBeginQuery {
477-
skipExpandSyntax := !b.mysqlContext.ExpandSyntaxSupport && skipQueryEvent(query)
477+
var skipExpandSyntax bool
478+
if b.mysqlContext.ExpandSyntaxSupport {
479+
skipExpandSyntax = false
480+
} else {
481+
skipExpandSyntax = isExpandSyntaxQuery(query)
482+
}
478483

479484
ddlInfo, err := resolveDDLSQL(currentSchema, query, b.skipQueryDDL)
480485

@@ -1086,7 +1091,7 @@ func (b *BinlogReader) skipQueryDDL(schema string, tableName string) bool {
10861091
}
10871092
}
10881093

1089-
func skipQueryEvent(sql string) bool {
1094+
func isExpandSyntaxQuery(sql string) bool {
10901095
sql = strings.ToLower(sql)
10911096

10921097
if strings.HasPrefix(sql, "flush privileges") {

drivers/mysql/mysql/mysqlconfig/types.go

+3
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ func (c *Column) ConvertArg(arg interface{}) interface{} {
9494
// string, charset conversion
9595
if encoding, ok := charsetEncodingMap[c.Charset]; ok {
9696
arg, _, _ = transform.String(encoding.NewDecoder(), v)
97+
// converting to utf8 encoding
98+
} else {
99+
// no convertion
97100
}
98101
return arg
99102
}

0 commit comments

Comments
 (0)