Skip to content

Change mysql_MYSQL_TYPE_TIMESTAMP2 and MYSQL_TYPE_TIMESTAMP to be def… #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions replication/row_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{
n = 4
t := binary.LittleEndian.Uint32(data)
if t == 0 {
v = formatZeroTime(0, 0)
v = nil
} else {
v = e.parseFracTime(fracTime{
Time: time.Unix(int64(t), 0),
Expand All @@ -1068,13 +1068,17 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{
})
}
case MYSQL_TYPE_TIMESTAMP2:
v, n, err = decodeTimestamp2(data, meta, e.timestampStringLocation)
v = e.parseFracTime(v)
if meta == 0 {
v = nil
} else {
v, n, err = decodeTimestamp2(data, meta, e.timestampStringLocation)
v = e.parseFracTime(v)
}
case MYSQL_TYPE_DATETIME:
n = 8
i64 := binary.LittleEndian.Uint64(data)
if i64 == 0 {
v = formatZeroTime(0, 0)
v = nil
} else {
d := i64 / 1000000
t := i64 % 1000000
Expand Down