For sets and enums length is already precalculated

This commit is contained in:
2018-11-11 14:47:33 +01:00
parent 8cbca43cf7
commit b1e0b061f0
2 changed files with 8 additions and 8 deletions
+1 -4
View File
@@ -9,7 +9,6 @@ import (
"github.com/localhots/bocadillo/mysql"
"github.com/localhots/bocadillo/tools"
"github.com/localhots/pretty"
)
// RowsEvent contains a Rows Event.
@@ -253,16 +252,14 @@ func (e *RowsEvent) decodeValue(buf *tools.Buffer, ct mysql.ColumnType, meta uin
buf.Skip(n)
return v
case mysql.ColumnTypeSet:
length = int(meta & 0xFF)
nbits := length * 8
v, n := mysql.DecodeBit(buf.Cur(), nbits, length)
pretty.Println("Decoding set", buf.Cur(), nbits, length, "-->", v)
buf.Skip(n)
return v
// Stuff
case mysql.ColumnTypeEnum:
return buf.ReadVarLen64(int(meta & 0xFF))
return buf.ReadVarLen64(length)
// Unsupported
case mysql.ColumnTypeDecimal: