return a clear error for set TEXT type as compare condition

This commit is contained in:
Lunny Xiao 2021-10-20 09:11:35 +08:00
parent 2c064b6da6
commit 94ac175648
1 changed files with 9 additions and 4 deletions

View File

@ -827,10 +827,6 @@ func (statement *Statement) buildConds2(table *schemas.Table, bean interface{},
continue
}
if statement.dialect.URI().DBType == schemas.MSSQL && (col.SQLType.Name == schemas.Text ||
col.SQLType.IsBlob() || col.SQLType.Name == schemas.TimeStampz) {
continue
}
if col.IsJSON {
continue
}
@ -862,6 +858,15 @@ func (statement *Statement) buildConds2(table *schemas.Table, bean interface{},
continue
}
if statement.dialect.URI().DBType == schemas.MSSQL && (col.SQLType.Name == schemas.Text ||
col.SQLType.IsBlob() || col.SQLType.Name == schemas.TimeStampz) {
if utils.IsValueZero(fieldValue) {
continue
}
return nil, fmt.Errorf("column %s is a TEXT type which cannot be as compare condition", col.Name)
}
requiredField := useAllCols
if b, ok := getFlagForColumn(mustColumnMap, col); ok {
if b {