aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hill <dhill@conformal.com>2013-08-02 00:41:09 -0400
committerDavid Hill <dhill@conformal.com>2013-08-02 00:41:09 -0400
commitecc4ab4956c9fe3e80a50de54e5ac89fd3663936 (patch)
tree73b62895749b9e54a162ef5cb52fd6385cc42d06
parentMerge pull request #64 from wei2912/patch-2 (diff)
downloadgolite-ecc4ab4956c9fe3e80a50de54e5ac89fd3663936.tar.gz
golite-ecc4ab4956c9fe3e80a50de54e5ac89fd3663936.tar.xz
call sqlite3_column_blob() before sqlite3_column_bytes()
sqlite3 documentation states sqlite3_column_blob could modify the the content and recommends the "safest and easiest" policy is to invoke sqlite3_column_blob() followed by sqlite3_column_bytes() from: http://www.sqlite.org/c3ref/column_blob.html
-rw-r--r--sqlite3.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlite3.go b/sqlite3.go
index fa2d84a..11bfba4 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -373,8 +373,8 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
case C.SQLITE_FLOAT:
dest[i] = float64(C.sqlite3_column_double(rc.s.s, C.int(i)))
case C.SQLITE_BLOB:
- n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i)))
p := C.sqlite3_column_blob(rc.s.s, C.int(i))
+ n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i)))
switch dest[i].(type) {
case sql.RawBytes:
dest[i] = (*[1 << 30]byte)(unsafe.Pointer(p))[0:n]