types: nil/null should be regarded as value instead of type (#19157)
This commit is contained in:
@ -430,9 +430,11 @@ func (d *Datum) GetValue() interface{} {
|
||||
|
||||
// SetValueWithDefaultCollation sets any kind of value.
|
||||
func (d *Datum) SetValueWithDefaultCollation(val interface{}) {
|
||||
switch x := val.(type) {
|
||||
case nil:
|
||||
if val == nil {
|
||||
d.SetNull()
|
||||
return
|
||||
}
|
||||
switch x := val.(type) {
|
||||
case bool:
|
||||
if x {
|
||||
d.SetInt64(1)
|
||||
@ -478,9 +480,11 @@ func (d *Datum) SetValueWithDefaultCollation(val interface{}) {
|
||||
|
||||
// SetValue sets any kind of value.
|
||||
func (d *Datum) SetValue(val interface{}, tp *types.FieldType) {
|
||||
switch x := val.(type) {
|
||||
case nil:
|
||||
if val == nil {
|
||||
d.SetNull()
|
||||
return
|
||||
}
|
||||
switch x := val.(type) {
|
||||
case bool:
|
||||
if x {
|
||||
d.SetInt64(1)
|
||||
|
||||
Reference in New Issue
Block a user