This commit is contained in:
Lunny Xiao 2021-08-08 17:08:49 +08:00
parent edb2ff9c20
commit f1f1b1d92f
2 changed files with 10 additions and 1 deletions

View File

@ -1145,7 +1145,13 @@ func (d *damengDriver) Scan(ctx *ScanContext, rows *core.Rows, types []*sql.Colu
if replaced { if replaced {
switch t := scanResults[i].(type) { switch t := scanResults[i].(type) {
case *dmClobScanner: case *dmClobScanner:
if err := convert.Assign(vv[i], t.data, ctx.DBLocation, ctx.UserLocation); err != nil { var d interface{}
if t.valid {
d = t.data
} else {
d = nil
}
if err := convert.Assign(vv[i], d, ctx.DBLocation, ctx.UserLocation); err != nil {
return err return err
} }
default: default:

View File

@ -524,6 +524,9 @@ func (session *Session) convertBeanField(col *schemas.Column, fieldValue *reflec
if !ok { if !ok {
return fmt.Errorf("cannot convert %#v as bytes", scanResult) return fmt.Errorf("cannot convert %#v as bytes", scanResult)
} }
if data == nil {
return nil
}
return structConvert.FromDB(data) return structConvert.FromDB(data)
} }
} }