]> Cypherpunks repositories - gostls13.git/commit
database/sql: check if src is nil before converting to string
authorDaniel Theophanes <kardianos@gmail.com>
Fri, 26 Apr 2019 18:09:51 +0000 (11:09 -0700)
committerDaniel Theophanes <kardianos@gmail.com>
Fri, 26 Apr 2019 19:59:11 +0000 (19:59 +0000)
commit1805f425ada8184b53175fd166b5fec7c02850a4
treec8ec701a0289cf681afd706e6de3985bba68be3c
parent2ae5e7f9bf0267dbc9c6f3f88ae0f6197bfe70ef
database/sql: check if src is nil before converting to string

A nil src (NULL database value) will result in a "nil" string,
which will never parse correctly in a ParseInt or similar
numeric conversion. The resulting error is confusing. Check
for a nil src prior to converting the value to string
if the resulting string will be parsed after that.

Closes #31274

Change-Id: I90f12cceff00fbbfdd3e343b04fa7e2596390e6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/174177
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/database/sql/convert.go
src/database/sql/sql_test.go