HandleBadNull handles the bad null error. When caller is LOAD DATA, `rowCntInLoadData` should be greater than 0 the error is ErrWarnNullToNotnull. Otherwise, the error is ErrColumnCantNull. If BadNullAsWarning is true, it will append the error as a warning, else return the error.
( ec errctx.Context, d *types.Datum, rowCntInLoadData uint64)
| 522 | // Otherwise, the error is ErrColumnCantNull. |
| 523 | // If BadNullAsWarning is true, it will append the error as a warning, else return the error. |
| 524 | func (c *Column) HandleBadNull( |
| 525 | ec errctx.Context, |
| 526 | d *types.Datum, |
| 527 | rowCntInLoadData uint64) error { |
| 528 | if err := c.CheckNotNull(d, rowCntInLoadData); err != nil { |
| 529 | if ec.HandleError(err) == nil { |
| 530 | *d = GetZeroValue(c.ToInfo()) |
| 531 | return nil |
| 532 | } |
| 533 | return err |
| 534 | } |
| 535 | return nil |
| 536 | } |
| 537 | |
| 538 | // IsPKHandleColumn checks if the column is primary key handle column. |
| 539 | func (c *Column) IsPKHandleColumn(tbInfo *model.TableInfo) bool { |