Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 58039ab

Browse files
authored
Merge pull request mattn#692 from mattn/fix-688
Fix 688
2 parents 3fa1c55 + 4731d0e commit 58039ab

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

‎sqlite3.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,9 +2062,8 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
20622062
}
20632063
dest[i] = t
20642064
default:
2065-
dest[i] = []byte(s)
2065+
dest[i] = s
20662066
}
2067-
20682067
}
20692068
}
20702069
return nil

‎sqlite3_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,26 @@ func TestAuthorizer(t *testing.T) {
16701670
}
16711671
}
16721672

1673+
func TestNonColumnString(t *testing.T) {
1674+
db, err := sql.Open("sqlite3", ":memory:")
1675+
if err != nil {
1676+
t.Fatal(err)
1677+
}
1678+
defer db.Close()
1679+
1680+
var x interface{}
1681+
if err := db.QueryRow("SELECT 'hello'").Scan(&x); err != nil {
1682+
t.Fatal(err)
1683+
}
1684+
s, ok := x.(string)
1685+
if !ok {
1686+
t.Fatalf("non-column string must return string but got %T", x)
1687+
}
1688+
if s != "hello" {
1689+
t.Fatalf("non-column string must return %q but got %q", "hello", s)
1690+
}
1691+
}
1692+
16731693
func TestNilAndEmptyBytes(t *testing.T) {
16741694
db, err := sql.Open("sqlite3", ":memory:")
16751695
if err != nil {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /