aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/database/sql/sql.go
diff options
context:
space:
mode:
authorJulien Schmidt <google@julienschmidt.com>2013-03-25 17:43:30 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2013-03-25 17:43:30 -0700
commit5e74f5029b15decee67095532a5c60cb98bbea52 (patch)
tree9b121706fee2fb95b5a9390654178fa19fb7ff7f /src/pkg/database/sql/sql.go
parent4529c047b852772eb380499926c1c4e1c42da625 (diff)
downloadgo-5e74f5029b15decee67095532a5c60cb98bbea52.tar.xz
database/sql: optimized []byte copy + []byte(nil) -> *interface fix
Make the copy directly in the convert switch instead of an extra loop. Also stops converting nil-[]byte to zero-[]byte when assigning to *interface R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7962044
Diffstat (limited to 'src/pkg/database/sql/sql.go')
-rw-r--r--src/pkg/database/sql/sql.go18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/pkg/database/sql/sql.go b/src/pkg/database/sql/sql.go
index 236e2c095d..d89aa59792 100644
--- a/src/pkg/database/sql/sql.go
+++ b/src/pkg/database/sql/sql.go
@@ -1301,24 +1301,6 @@ func (rs *Rows) Scan(dest ...interface{}) error {
return fmt.Errorf("sql: Scan error on column index %d: %v", i, err)
}
}
- for _, dp := range dest {
- b, ok := dp.(*[]byte)
- if !ok {
- continue
- }
- if *b == nil {
- // If the []byte is now nil (for a NULL value),
- // don't fall through to below which would
- // turn it into a non-nil 0-length byte slice
- continue
- }
- if _, ok = dp.(*RawBytes); ok {
- continue
- }
- clone := make([]byte, len(*b))
- copy(clone, *b)
- *b = clone
- }
return nil
}