Skip to content

Commit 9e43b63

Browse files
committed
store json as string
1 parent a51d9de commit 9e43b63

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

replication/row_event.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ import (
99
"strconv"
1010
"time"
1111

12-
. "github.com/go-mysql-org/go-mysql/mysql"
1312
"github.com/pingcap/errors"
1413
"github.com/shopspring/decimal"
1514
"github.com/siddontang/go-log/log"
1615
"github.com/siddontang/go/hack"
16+
17+
. "github.com/go-mysql-org/go-mysql/mysql"
1718
)
1819

1920
var errMissingTableMapEvent = errors.New("invalid table id, no corresponding table map event")
@@ -1138,7 +1139,11 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{
11381139
// Refer: https://github.com/shyiko/mysql-binlog-connector-java/blob/master/src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/AbstractRowsEventDataDeserializer.java#L404
11391140
length = int(FixedLengthInt(data[0:meta]))
11401141
n = length + int(meta)
1141-
v, err = e.decodeJsonBinary(data[meta:n])
1142+
var d []byte
1143+
d, err = e.decodeJsonBinary(data[meta:n])
1144+
if err == nil {
1145+
v = hack.String(d)
1146+
}
11421147
case MYSQL_TYPE_GEOMETRY:
11431148
// MySQL saves Geometry as Blob in binlog
11441149
// Seem that the binary format is SRID (4 bytes) + WKB, outer can use

0 commit comments

Comments
 (0)