Skip to content

Commit 0456c89

Browse files
committed
combine IsArrayBuffer IsSharedArrayBuffer IsArrayBufferView
1 parent 446a513 commit 0456c89

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/node_sqlite.cc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void JSValueToSQLiteResult(Isolate* isolate,
198198
} else if (value->IsString()) {
199199
Utf8Value val(isolate, value.As<String>());
200200
sqlite3_result_text(ctx, *val, val.length(), SQLITE_TRANSIENT);
201-
} else if (value->IsArrayBufferView()) {
201+
} else if (value->IsArrayBuffer() || value->IsSharedArrayBuffer() || value->IsArrayBufferView()) {
202202
ArrayBufferViewContents<uint8_t> buf(value);
203203
sqlite3_result_blob(ctx, buf.data(), buf.length(), SQLITE_TRANSIENT);
204204
} else if (value->IsBigInt()) {
@@ -2286,20 +2286,13 @@ bool StatementSync::BindValue(const Local<Value>& value, const int index) {
22862286
}
22872287
} else if (value->IsNull()) {
22882288
r = sqlite3_bind_null(statement_, index);
2289-
} else if (value->IsArrayBufferView()) {
2289+
} else if (value->IsArrayBuffer() || value->IsSharedArrayBuffer() || value->IsArrayBufferView()) {
22902290
ArrayBufferViewContents<uint8_t> buf(value);
22912291
r = sqlite3_bind_blob64(statement_,
22922292
index,
22932293
buf.data(),
22942294
static_cast<sqlite3_uint64>(buf.length()),
22952295
SQLITE_TRANSIENT);
2296-
} else if (value->IsArrayBuffer()) {
2297-
Local<ArrayBuffer> ab = value.As<ArrayBuffer>();
2298-
r = sqlite3_bind_blob64(statement_,
2299-
index,
2300-
ab->Data(),
2301-
static_cast<sqlite3_uint64>(ab->ByteLength()),
2302-
SQLITE_TRANSIENT);
23032296
} else if (value->IsBigInt()) {
23042297
bool lossless;
23052298
int64_t as_int = value.As<BigInt>()->Int64Value(&lossless);

0 commit comments

Comments
 (0)