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

Method xColumn

src/util/custom-table.cpp:264–279  ·  view source on GitHub ↗

This method extracts some column from the cursor's current row.

Source from the content-addressed store, hash-verified

262
263 // This method extracts some column from the cursor's current row.
264 static int xColumn(sqlite3_vtab_cursor* _cursor, sqlite3_context* invocation, int column) {
265 Cursor* cursor = Cursor::Upcast(_cursor);
266 CustomTable* self = cursor->GetVTab()->parent;
267 TempDataConverter temp_data_converter(self);
268 Napi::Env env = self->env;
269 Napi::HandleScope scope(env);
270
271 Napi::Array row = cursor->row.Value();
272 Napi::Value maybeColumnValue = SafeGetElement(env, row, (uint32_t)column);
273 if (maybeColumnValue.IsEmpty()) {
274 temp_data_converter.PropagateJSError(NULL);
275 } else {
276 Data::ResultValueFromJS(env, invocation, maybeColumnValue, &temp_data_converter);
277 }
278 return temp_data_converter.status;
279 }
280
281 // This method outputs the rowid of the cursor's current row.
282 static int xRowid(sqlite3_vtab_cursor* cursor, sqlite_int64* output) {

Callers

nothing calls this directly

Calls 4

SafeGetElementFunction · 0.85
ResultValueFromJSFunction · 0.85
GetVTabMethod · 0.80
PropagateJSErrorMethod · 0.45

Tested by

no test coverage detected