Skip to content

Commit

Permalink
Merge pull request #644 from akalin/fix-pointer-conversion
Browse files Browse the repository at this point in the history
Clean up blob to byte slice conversion
  • Loading branch information
mattn committed Nov 21, 2018
2 parents 0a64ab2 + 2364b28 commit c880439
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions sqlite3.go
Expand Up @@ -2027,13 +2027,8 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
dest[i] = nil
continue
}
n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i)))
switch dest[i].(type) {
default:
slice := make([]byte, n)
copy(slice[:], (*[1 << 30]byte)(p)[0:n])
dest[i] = slice
}
n := C.sqlite3_column_bytes(rc.s.s, C.int(i))
dest[i] = C.GoBytes(p, n)
case C.SQLITE_NULL:
dest[i] = nil
case C.SQLITE_TEXT:
Expand Down

0 comments on commit c880439

Please sign in to comment.