Skip to content

Commit

Permalink
Merge pull request #74 from xhit/fix-issue73
Browse files Browse the repository at this point in the history
Don't get pointer of inexistent index when data is empty binding []byte
  • Loading branch information
akhilravuri1 authored Jun 2, 2020
2 parents 59457a4 + aaa266b commit 2e9e76f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion param.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ func (p *Parameter) BindValue(h api.SQLHSTMT, idx int, v driver.Value) error {
b := make([]byte, len(d))
copy(b, d)
p.Data = b
buf = unsafe.Pointer(&b[0])
if len(d) > 0 {
buf = unsafe.Pointer(&b[0])
}
buflen = api.SQLLEN(len(b))
plen = p.StoreStrLen_or_IndPtr(buflen)
size = api.SQLULEN(len(b))
Expand Down

0 comments on commit 2e9e76f

Please sign in to comment.