Skip to content

Commit

Permalink
sqlite: handle []byte larger than 1<<28
Browse files Browse the repository at this point in the history
Requires a lttle care to do so while continuing to compile
on 32-bit architectures.

Fixes #45
  • Loading branch information
crawshaw committed Dec 19, 2018
1 parent 823b567 commit 3eafba8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,17 @@ func (stmt *Stmt) columnBytes(col int) []byte {
return nil
}
n := stmt.ColumnLen(col)
return (*[1 << 28]byte)(unsafe.Pointer(p))[:n:n]

slice := struct {
data unsafe.Pointer
len int
cap int
}{
data: unsafe.Pointer(p),
len: n,
cap: n,
}
return *(*[]byte)(unsafe.Pointer(&slice))
}

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

0 comments on commit 3eafba8

Please sign in to comment.