trying something...

This commit is contained in:
Shlomi Noach 2019-01-01 11:39:43 +02:00
parent f25d0b1a3c
commit 0be91ba0f2
2 changed files with 6 additions and 8 deletions

View File

@ -1002,7 +1002,6 @@ func (this *Applier) ApplyDMLEventQuery(dmlEvent *binlog.BinlogDMLEvent) error {
return err
}
sessionQuery := `SET
SESSION time_zone = '+00:00',
sql_mode = CONCAT(@@session.sql_mode, ',STRICT_ALL_TABLES')
`
if _, err := tx.Exec(sessionQuery); err != nil {
@ -1047,7 +1046,6 @@ func (this *Applier) ApplyDMLEventQueries(dmlEvents [](*binlog.BinlogDMLEvent))
}
sessionQuery := `SET
SESSION time_zone = '+00:00',
sql_mode = CONCAT(@@session.sql_mode, ',STRICT_ALL_TABLES')
`
if _, err := tx.Exec(sessionQuery); err != nil {

View File

@ -434,7 +434,9 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{
}
case MYSQL_TYPE_TIMESTAMP2:
v, n, err = decodeTimestamp2(data, meta, e.timestampStringLocation)
fmt.Printf("============= v0: %+v\n", v)
v = e.parseFracTime(v)
fmt.Printf("============= v1: %+v\n", v)
case MYSQL_TYPE_DATETIME:
n = 8
i64 := binary.LittleEndian.Uint64(data)
@ -753,16 +755,14 @@ func decodeDatetime2(data []byte, dec uint16) (interface{}, int, error) {
minute := int((hms >> 6) % (1 << 6))
hour := int((hms >> 12))
if frac != 0 {
return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d.%06d", year, month, day, hour, minute, second, frac), n, nil // commented by Shlomi Noach. Yes I know about `git blame`
}
return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second), n, nil // commented by Shlomi Noach. Yes I know about `git blame`
/* commented by Shlomi Noach. Yes I know about `git blame`
// if frac != 0 {
// return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d.%06d", year, month, day, hour, minute, second, frac), n, nil // commented by Shlomi Noach. Yes I know about `git blame`
// }
// return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second), n, nil // commented by Shlomi Noach. Yes I know about `git blame`
return fracTime{
Time: time.Date(year, time.Month(month), day, hour, minute, second, int(frac*1000), time.UTC),
Dec: int(dec),
}, n, nil
*/
}
const TIMEF_OFS int64 = 0x800000000000