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

Method BindArray

src/util/binder.cpp:95–114  ·  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

93 // Binds each value in the array or throws an appropriate error.
94 // The number of successfully bound parameters is returned.
95 int BindArray(Napi::Env env, Napi::Array arr) {
96 uint32_t length = arr.Length();
97 if (length > INT_MAX) {
98 Fail(ThrowRangeError, env, "Too many parameter values were provided");
99 return 0;
100 }
101 int len = static_cast<int>(length);
102 for (int i = 0; i < len; ++i) {
103 Napi::Value value = SafeGetElement(env, arr, static_cast<uint32_t>(i));
104 if (value.IsEmpty()) {
105 Fail(NULL, env, NULL);
106 return i;
107 }
108 BindValue(env, value, NextAnonIndex());
109 if (!success) {
110 return i;
111 }
112 }
113 return len;
114 }
115
116 // Binds all named parameters using the values found in the given object.
117 // The number of successfully bound parameters is returned.

Callers

nothing calls this directly

Calls 1

SafeGetElementFunction · 0.85

Tested by

no test coverage detected