aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/database/sql/driver
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-07-22 18:15:38 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-07-22 18:15:38 +0000
commit22b955cca564a9a3a5b8c9d9dd1e295b7943c128 (patch)
treeabdbd898676e1f853fca2d7e031d105d7ebcf676 /libgo/go/database/sql/driver
parent9d04a3af4c6491536badf6bde9707c907e4d196b (diff)
downloadgcc-22b955cca564a9a3a5b8c9d9dd1e295b7943c128.zip
gcc-22b955cca564a9a3a5b8c9d9dd1e295b7943c128.tar.gz
gcc-22b955cca564a9a3a5b8c9d9dd1e295b7943c128.tar.bz2
libgo: update to go1.7rc3
Reviewed-on: https://go-review.googlesource.com/25150 From-SVN: r238662
Diffstat (limited to 'libgo/go/database/sql/driver')
-rw-r--r--libgo/go/database/sql/driver/driver.go10
-rw-r--r--libgo/go/database/sql/driver/types.go21
2 files changed, 10 insertions, 21 deletions
diff --git a/libgo/go/database/sql/driver/driver.go b/libgo/go/database/sql/driver/driver.go
index eca25f2..4dba85a 100644
--- a/libgo/go/database/sql/driver/driver.go
+++ b/libgo/go/database/sql/driver/driver.go
@@ -17,7 +17,7 @@ import "errors"
// float64
// bool
// []byte
-// string [*] everywhere except from Rows.Next.
+// string
// time.Time
type Value interface{}
@@ -144,7 +144,7 @@ type Stmt interface {
// any type to a driver Value.
type ColumnConverter interface {
// ColumnConverter returns a ValueConverter for the provided
- // column index. If the type of a specific column isn't known
+ // column index. If the type of a specific column isn't known
// or shouldn't be handled specially, DefaultValueConverter
// can be returned.
ColumnConverter(idx int) ValueConverter
@@ -154,7 +154,7 @@ type ColumnConverter interface {
type Rows interface {
// Columns returns the names of the columns. The number of
// columns of the result is inferred from the length of the
- // slice. If a particular column name isn't known, an empty
+ // slice. If a particular column name isn't known, an empty
// string should be returned for that entry.
Columns() []string
@@ -165,10 +165,6 @@ type Rows interface {
// the provided slice. The provided slice will be the same
// size as the Columns() are wide.
//
- // The dest slice may be populated only with
- // a driver Value type, but excluding string.
- // All string values must be converted to []byte.
- //
// Next should return io.EOF when there are no more rows.
Next(dest []Value) error
}
diff --git a/libgo/go/database/sql/driver/types.go b/libgo/go/database/sql/driver/types.go
index bc54784..e480e70 100644
--- a/libgo/go/database/sql/driver/types.go
+++ b/libgo/go/database/sql/driver/types.go
@@ -15,7 +15,7 @@ import (
//
// Various implementations of ValueConverter are provided by the
// driver package to provide consistent implementations of conversions
-// between drivers. The ValueConverters have several uses:
+// between drivers. The ValueConverters have several uses:
//
// * converting from the Value types as provided by the sql package
// into a database table's specific column type and making sure it
@@ -172,28 +172,21 @@ func (n NotNull) ConvertValue(v interface{}) (Value, error) {
}
// IsValue reports whether v is a valid Value parameter type.
-// Unlike IsScanValue, IsValue permits the string type.
func IsValue(v interface{}) bool {
- if IsScanValue(v) {
+ if v == nil {
return true
}
- if _, ok := v.(string); ok {
+ switch v.(type) {
+ case []byte, bool, float64, int64, string, time.Time:
return true
}
return false
}
-// IsScanValue reports whether v is a valid Value scan type.
-// Unlike IsValue, IsScanValue does not permit the string type.
+// IsScanValue is equivalent to IsValue.
+// It exists for compatibility.
func IsScanValue(v interface{}) bool {
- if v == nil {
- return true
- }
- switch v.(type) {
- case int64, float64, []byte, bool, time.Time:
- return true
- }
- return false
+ return IsValue(v)
}
// DefaultParameterConverter is the default implementation of