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

Method Next

src/objects/statement-iterator.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24StatementIterator::~StatementIterator() {}
25
26void StatementIterator::Next(NODE_ARGUMENTS info) {
27 assert(alive == true);
28 db_state->busy = true;
29 if (!logged) {
30 logged = true;
31 if (stmt->db->Log(OnlyIsolate, handle)) {
32 db_state->busy = false;
33 Throw();
34 return;
35 }
36 }
37 int status = sqlite3_step(handle);
38 db_state->busy = false;
39 if (status == SQLITE_ROW) {
40 UseIsolate;
41 UseContext;
42 info.GetReturnValue().Set(
43 NewRecord(isolate, ctx, Data::GetRowJS(isolate, ctx, handle, safe_ints, mode), db_state->addon, false)
44 );
45 } else {
46 if (status == SQLITE_DONE) Return(info);
47 else Throw();
48 }
49}
50
51void StatementIterator::Return(NODE_ARGUMENTS info) {
52 Cleanup();

Callers 1

NODE_METHODFunction · 0.80

Calls 2

GetRowJSFunction · 0.85
LogMethod · 0.80

Tested by

no test coverage detected