Skip to content

Commit 3eafba8

Browse files
committed
sqlite: handle []byte larger than 1<<28
Requires a lttle care to do so while continuing to compile on 32-bit architectures. Fixes #45
1 parent 823b567 commit 3eafba8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sqlite.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,17 @@ func (stmt *Stmt) columnBytes(col int) []byte {
791791
return nil
792792
}
793793
n := stmt.ColumnLen(col)
794-
return (*[1 << 28]byte)(unsafe.Pointer(p))[:n:n]
794+
795+
slice := struct {
796+
data unsafe.Pointer
797+
len int
798+
cap int
799+
}{
800+
data: unsafe.Pointer(p),
801+
len: n,
802+
cap: n,
803+
}
804+
return *(*[]byte)(unsafe.Pointer(&slice))
795805
}
796806

797807
// ColumnType are codes for each of the SQLite fundamental datatypes:

0 commit comments

Comments
 (0)