forked from mirror/go-sqlite3
commit
58039ab376
|
@ -2062,9 +2062,8 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
|||
}
|
||||
dest[i] = t
|
||||
default:
|
||||
dest[i] = []byte(s)
|
||||
dest[i] = s
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -1670,6 +1670,26 @@ func TestAuthorizer(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestNonColumnString(t *testing.T) {
|
||||
db, err := sql.Open("sqlite3", ":memory:")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
var x interface{}
|
||||
if err := db.QueryRow("SELECT 'hello'").Scan(&x); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s, ok := x.(string)
|
||||
if !ok {
|
||||
t.Fatalf("non-column string must return string but got %T", x)
|
||||
}
|
||||
if s != "hello" {
|
||||
t.Fatalf("non-column string must return %q but got %q", "hello", s)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNilAndEmptyBytes(t *testing.T) {
|
||||
db, err := sql.Open("sqlite3", ":memory:")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue