Merge pull request #644 from akalin/fix-pointer-conversion

Clean up blob to byte slice conversion
fix-688
mattn 2018-11-22 01:47:23 +09:00 committed by GitHub
commit c880439687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -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: