Skip to content

Commit

Permalink
mysqldef: remove fsp codec, set out manually.
Browse files Browse the repository at this point in the history
  • Loading branch information
siddontang committed Sep 7, 2015
1 parent 6b0dce0 commit 0e6346e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
17 changes: 0 additions & 17 deletions mysqldef/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ func (t Time) Marshal() ([]byte, error) {
return nil, errors.Trace(err)
}

// append fsp to the end
b = append(b, byte(t.Fsp))

return b, nil
}

Expand All @@ -175,20 +172,6 @@ func (t *Time) Unmarshal(b []byte) error {
// UnmarshalInLocation decodes the binary data
// into Time with a specific time Location.
func (t *Time) UnmarshalInLocation(b []byte, loc *time.Location) error {
if len(b) < 1 {
return errors.Errorf("insufficient bytes to unmarshal time")
}

// Get fsp
fsp, err := checkFsp(int(int8(b[len(b)-1])))
if err != nil {
return errors.Trace(err)
}

t.Fsp = fsp

b = b[:len(b)-1]

if err := t.Time.UnmarshalBinary(b); err != nil {
return errors.Trace(err)
}
Expand Down
1 change: 1 addition & 0 deletions mysqldef/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ func (s *testTimeSuite) TestCodec(c *C) {

var dest Time
dest.Type = TypeDatetime
dest.Fsp = MaxFsp
err = dest.Unmarshal(b)
c.Assert(err, IsNil)
c.Assert(dest.String(), Equals, test)
Expand Down

0 comments on commit 0e6346e

Please sign in to comment.