diff --git a/go/logic/applier.go b/go/logic/applier.go index 951addb..7e526b9 100644 --- a/go/logic/applier.go +++ b/go/logic/applier.go @@ -854,31 +854,32 @@ func (this *Applier) ApplyDMLEventQuery(dmlEvent *binlog.BinlogDMLEvent) error { return err } - // TODO The below is commented, and is in preparation for transactional writes on the ghost tables. + // TODO The below is in preparation for transactional writes on the ghost tables. // Such writes would be, for example: // - prepended with sql_mode setup + // - prepended with time zone setup // - prepended with SET SQL_LOG_BIN=0 // - prepended with SET FK_CHECKS=0 // etc. // - // Current known problem: https://github.com/golang/go/issues/9373 -- bitint unsigned values, not supported in database/sql + // a known problem: https://github.com/golang/go/issues/9373 -- bitint unsigned values, not supported in database/sql + // is solved by silently converting unsigned bigints to string values. // - // err = func() error { - // tx, err := this.db.Begin() - // if err != nil { - // return err - // } - // if _, err := tx.Exec(query, args...); err != nil { - // return err - // } - // if err := tx.Commit(); err != nil { - // return err - // } - // return nil - // }() + err = func() error { + tx, err := this.db.Begin() + if err != nil { + return err + } + if _, err := tx.Exec(query, args...); err != nil { + return err + } + if err := tx.Commit(); err != nil { + return err + } + return nil + }() - _, err = sqlutils.Exec(this.db, query, args...) if err == nil { atomic.AddInt64(&this.migrationContext.TotalDMLEventsApplied, 1) } diff --git a/go/sql/builder.go b/go/sql/builder.go index 6c2e4b2..7c670a9 100644 --- a/go/sql/builder.go +++ b/go/sql/builder.go @@ -47,7 +47,7 @@ func fixArgType(arg interface{}, isUnsigned bool) interface{} { return uint32(i) } if i, ok := arg.(int64); ok { - return uint64(i) + return strconv.FormatUint(uint64(i), 10) } if i, ok := arg.(int); ok { return uint(i)