MCPcopy Create free account
hub / github.com/WiseLibs/better-sqlite3 / BindArray

Method BindArray

src/util/binder.cpp:79–99  ·  view source on GitHub ↗

Binds each value in the array or throws an appropriate error. The number of successfully bound parameters is returned.

Source from the content-addressed store, hash-verified

77 // Binds each value in the array or throws an appropriate error.
78 // The number of successfully bound parameters is returned.
79 int BindArray(v8::Isolate* isolate, v8::Local<v8::Array> arr) {
80 UseContext;
81 uint32_t length = arr->Length();
82 if (length > INT_MAX) {
83 Fail(ThrowRangeError, "Too many parameter values were provided");
84 return 0;
85 }
86 int len = static_cast<int>(length);
87 for (int i = 0; i < len; ++i) {
88 v8::MaybeLocal<v8::Value> maybeValue = arr->Get(ctx, i);
89 if (maybeValue.IsEmpty()) {
90 Fail(NULL, NULL);
91 return i;
92 }
93 BindValue(isolate, maybeValue.ToLocalChecked(), NextAnonIndex());
94 if (!success) {
95 return i;
96 }
97 }
98 return len;
99 }
100
101 // Binds all named parameters using the values found in the given object.
102 // The number of successfully bound parameters is returned.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected