Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; babashka/ffi repository.
:deps {io.github.babashka/ffi
{:git/url "https://github.com/babashka/ffi"
:git/sha "40fcd2784b94a062e98b4de29431450e852c57ca"}}
:git/sha "e4700ac76a61f7f3a7755fafa5784a2f86f6d137"}}
:aliases
{:test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner
Expand Down
6 changes: 3 additions & 3 deletions src/babashka/sqlite.clj
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
^bytes [n p]
(if (pos? n)
;; a pointer from C has size 0; give it the blob's size first
(ffi/read-bytes (ffi/reinterpret p n) n)
(ffi/read-array (ffi/reinterpret p n) :byte n)
(byte-array 0)))

;; sqlite types values per cell, not per column
Expand All @@ -166,7 +166,7 @@
(bytes? v) (with-open [arena (ffi/confined-arena)]
(let [n (alength ^bytes v)
p (ffi/alloc arena (max n 1))]
(ffi/write-bytes p v)
(ffi/write-array p :byte v)
(c-bind-blob stmt i p n sqlite-transient)))
:else (throw (ex-info (str "sqlite3: cannot bind " (type v))
{:value v})))]
Expand Down Expand Up @@ -227,7 +227,7 @@
(bytes? v) (with-open [arena (ffi/confined-arena)]
(let [n (alength ^bytes v)
p (ffi/alloc arena (max n 1))]
(ffi/write-bytes p v)
(ffi/write-array p :byte v)
(c-result-blob ctx p n sqlite-transient)))
:else (c-result-error ctx (str "cannot return " (type v) " from a function") -1)))

Expand Down
Loading