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

Method Next

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

Source from the content-addressed store, hash-verified

20StatementIterator::~StatementIterator() {}
21
22Napi::Value StatementIterator::Next(Napi::Env env) {
23 assert(alive == true);
24 db_state->busy = true;
25 if (!logged) {
26 logged = true;
27 if (stmt->db->Log(env, handle)) {
28 db_state->busy = false;
29 return Throw(env);
30 }
31 }
32 int status = sqlite3_step(handle);
33 db_state->busy = false;
34
35 if (status == SQLITE_ROW) {
36 Napi::Value row = Data::GetRowJS(env, stmt, handle, safe_ints, mode);
37 return NewRecord(env, row, db_state->addon, false);
38 } else {
39 if (status == SQLITE_DONE) return Return(env);
40 return Throw(env);
41 }
42}
43
44Napi::Value StatementIterator::Return(Napi::Env env) {
45 Cleanup();

Callers 1

NODE_METHODFunction · 0.80

Calls 2

GetRowJSFunction · 0.85
LogMethod · 0.80

Tested by

no test coverage detected