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

Function GetExpandedRowJS

src/util/data.cpp:80–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 }
79
80 v8::Local<v8::Value> GetExpandedRowJS(v8::Isolate* isolate, v8::Local<v8::Context> ctx, sqlite3_stmt* handle, bool safe_ints) {
81 v8::Local<v8::Object> row = v8::Object::New(isolate);
82 int column_count = sqlite3_column_count(handle);
83 for (int i = 0; i < column_count; ++i) {
84 const char* table_raw = sqlite3_column_table_name(handle, i);
85 v8::Local<v8::String> table = InternalizedFromUtf8(isolate, table_raw == NULL ? "$" : table_raw, -1);
86 v8::Local<v8::String> column = InternalizedFromUtf8(isolate, sqlite3_column_name(handle, i), -1);
87 v8::Local<v8::Value> value = Data::GetValueJS(isolate, handle, i, safe_ints);
88 if (row->HasOwnProperty(ctx, table).FromJust()) {
89 row->Get(ctx, table).ToLocalChecked().As<v8::Object>()->Set(ctx, column, value).FromJust();
90 } else {
91 v8::Local<v8::Object> nested = v8::Object::New(isolate);
92 row->Set(ctx, table, nested).FromJust();
93 nested->Set(ctx, column, value).FromJust();
94 }
95 }
96 return row;
97 }
98
99#if !defined(NODE_MODULE_VERSION) || NODE_MODULE_VERSION < 127
100

Callers 1

GetRowJSFunction · 0.85

Calls 2

InternalizedFromUtf8Function · 0.85
GetValueJSFunction · 0.85

Tested by

no test coverage detected