Commit 94280237 authored by Daniel Theophanes's avatar Daniel Theophanes Committed by Brad Fitzpatrick

database/sql: add note to Scanner that the database owns values

It was unclear that users must copy values out of the src value
for value types like []byte.

Fixes #24492

Change-Id: I99ad61e0ad0075b9efc5ee4e0d067f752f91b8fa
Reviewed-on: https://go-review.googlesource.com/108535Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 4122319e
......@@ -301,6 +301,10 @@ type Scanner interface {
//
// An error should be returned if the value cannot be stored
// without loss of information.
//
// Reference types such as []byte are only valid until the next call to Scan
// and should not be retained. Their underlying memory is owned by the driver.
// If retention is necessary, copy their values before the next call to Scan.
Scan(src interface{}) error
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment