return a clear error for set TEXT type as compare condition #2062

Merged
lunny merged 2 commits from lunny/fix_get_mssql into master 2022-04-23 09:19:37 +00:00
Showing only changes of commit 94ac175648 - Show all commits

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 {