diff options
Diffstat (limited to 'libgo/go/database/sql/convert.go')
-rw-r--r-- | libgo/go/database/sql/convert.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libgo/go/database/sql/convert.go b/libgo/go/database/sql/convert.go index 4924ac14e46..4afa2bef753 100644 --- a/libgo/go/database/sql/convert.go +++ b/libgo/go/database/sql/convert.go @@ -90,8 +90,8 @@ func convertAssign(dest, src interface{}) error { return nil } - if scanner, ok := dest.(ScannerInto); ok { - return scanner.ScanInto(src) + if scanner, ok := dest.(Scanner); ok { + return scanner.Scan(src) } dpv := reflect.ValueOf(dest) @@ -110,6 +110,14 @@ func convertAssign(dest, src interface{}) error { } switch dv.Kind() { + case reflect.Ptr: + if src == nil { + dv.Set(reflect.Zero(dv.Type())) + return nil + } else { + dv.Set(reflect.New(dv.Type().Elem())) + return convertAssign(dv.Interface(), src) + } case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: s := asString(src) i64, err := strconv.ParseInt(s, 10, dv.Type().Bits()) |