Closed winfredLIN closed 3 weeks ago
issue https://github.com/actiontech/dms/issues/318
在gorm代码中 gorm.io/gorm/statement.go: 235 添加变量时,如果切片或数组为空时,会添加 (NULL) 在上述语句中,表现为 in (NULL),则不会产生错误SQL
default: switch rv := reflect.ValueOf(v); rv.Kind() { case reflect.Slice, reflect.Array: if rv.Len() == 0 { writer.WriteString("(NULL)") } else if rv.Type().Elem() == reflect.TypeOf(uint8(0)) { stmt.Vars = append(stmt.Vars, v) stmt.DB.Dialector.BindVarTo(writer, stmt, v) } else { writer.WriteByte('(') for i := 0; i < rv.Len(); i++ { if i > 0 { writer.WriteByte(',') } stmt.AddVar(writer, rv.Index(i).Interface()) } writer.WriteByte(')') }
issue https://github.com/actiontech/dms/issues/318
改动
影响面
在gorm代码中 gorm.io/gorm/statement.go: 235 添加变量时,如果切片或数组为空时,会添加 (NULL) 在上述语句中,表现为 in (NULL),则不会产生错误SQL