sqlite: bind ArrayBuffer

PR-URL: https://github.com/nodejs/node/pull/62061
Fixes: https://github.com/nodejs/node/issues/61396
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
This commit is contained in:
mike-git374 authored and GitHub committed 2026-08-05 22:43:40 +02:00
1 parent 02f46304d0
commit 62acd4888c
2 files changed
+75 -3

No files matched your search

+6 -3
View File
@@ -235,7 +235,8 @@ void JSValueToSQLiteResult(Isolate* isolate,
} else if (value->IsString()) {
Utf8Value val(isolate, value.As<String>());
sqlite3_result_text(ctx, *val, val.length(), SQLITE_TRANSIENT);
} else if (value->IsArrayBufferView()) {
} else if (value->IsArrayBufferView() || value->IsArrayBuffer() ||
value->IsSharedArrayBuffer()) {
ArrayBufferViewContents<uint8_t> buf(value);
sqlite3_result_blob(ctx, buf.data(), buf.length(), SQLITE_TRANSIENT);
} else if (value->IsBigInt()) {
@@ -2665,7 +2666,8 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
int anon_idx = 1;
int anon_start = 0;
if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) {
if (args[0]->IsObject() && !args[0]->IsArrayBufferView() &&
!args[0]->IsArrayBuffer() && !args[0]->IsSharedArrayBuffer()) {
Local<Object> obj = args[0].As<Object>();
Local<Context> context = Isolate::GetCurrent()->GetCurrentContext();
Local<Array> keys;
@@ -2791,7 +2793,8 @@ bool StatementSync::BindValue(const Local<Value>& value, const int index) {
}
} else if (value->IsNull()) {
r = sqlite3_bind_null(statement_, index);
} else if (value->IsArrayBufferView()) {
} else if (value->IsArrayBufferView() || value->IsArrayBuffer() ||
value->IsSharedArrayBuffer()) {
ArrayBufferViewContents<uint8_t> buf(value);
r = sqlite3_bind_blob64(statement_,
index,