(raw *RawV4Event)
| 203 | } |
| 204 | |
| 205 | func (p *baseRowsEventParser) parseRowsHeader(raw *RawV4Event) ( |
| 206 | id uint64, |
| 207 | flags uint16, |
| 208 | extraInfo []byte, |
| 209 | width int, |
| 210 | remaining []byte, |
| 211 | err error) { |
| 212 | |
| 213 | if p.context == nil { |
| 214 | return 0, 0, nil, 0, nil, &TableContextNotSetError{ |
| 215 | errors.New("Table context not set"), |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | data := raw.FixedLengthData() |
| 220 | |
| 221 | id = LittleEndian.Uint48(data) |
| 222 | |
| 223 | if id != p.context.TableId() { |
| 224 | return 0, 0, nil, 0, nil, errors.Newf( |
| 225 | "mismatch table id (event: %d; context: %d name: %s)", |
| 226 | id, |
| 227 | p.context.TableId(), |
| 228 | p.context.TableName()) |
| 229 | } |
| 230 | |
| 231 | flags = LittleEndian.Uint16(data[6:]) |
| 232 | |
| 233 | remaining = raw.VariableLengthData() |
| 234 | |
| 235 | if p.version == mysql_proto.RowsEventVersion_V1 { |
| 236 | extraInfo = nil |
| 237 | } else { |
| 238 | extraInfoBlobLen := LittleEndian.Uint16(data[8:]) |
| 239 | extraInfo, remaining, err = p.parseExtraInfoBlob( |
| 240 | extraInfoBlobLen, |
| 241 | remaining) |
| 242 | if err != nil { |
| 243 | return 0, 0, nil, 0, nil, err |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | w, remaining, err := readFieldLength(remaining) |
| 248 | if err != nil { |
| 249 | return 0, 0, nil, 0, nil, err |
| 250 | } |
| 251 | |
| 252 | if w > uint64(p.context.NumColumns()) { |
| 253 | return 0, 0, nil, 0, nil, errors.Newf( |
| 254 | "row width (%d / %d) greater than # of columns (%d) in table %s", |
| 255 | w, |
| 256 | width, |
| 257 | p.context.NumColumns(), |
| 258 | string(p.context.TableName())) |
| 259 | } |
| 260 | |
| 261 | return id, flags, extraInfo, int(w), remaining, nil |
| 262 | } |
no test coverage detected