]> Cypherpunks repositories - gostls13.git/commit
database/sql: include SQL column name in Scan() error message
authorHaraldNordgren <haraldnordgren@gmail.com>
Sun, 7 Jan 2018 14:08:59 +0000 (15:08 +0100)
committerDaniel Theophanes <kardianos@gmail.com>
Tue, 13 Feb 2018 21:24:53 +0000 (21:24 +0000)
commit8da7706bb4dc609689fd69e196ddaa800908c31f
tree3d81ec8fcb5b40c6005e4f38013eeabaa0f7f637
parentc0b248c234e0a5e26d7dff77adf9a9f2a92a7a9c
database/sql: include SQL column name in Scan() error message

When 'convertAssign' gives an error, instead of giving just the index of
the failing column -- which is not always helpful, especially when there
are lots of columns in the query -- utilize 'rs.rowsi.Columns()' to
extract the underlying column name and include that in the error string:

    sql: Scan error on column index 0, name "some_column": ...

Fixes #23362

Change-Id: I0fe71ff3c25f4c0dd9fc6aa2c2da2360dd93e3e0
Reviewed-on: https://go-review.googlesource.com/86537
Reviewed-by: Harald Nordgren <haraldnordgren@gmail.com>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/database/sql/sql.go
src/database/sql/sql_test.go