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

Method Next

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

Source from the content-addressed store, hash-verified

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

Callers 1

NODE_METHODFunction · 0.80

Calls 2

GetRowJSFunction · 0.85
LogMethod · 0.80

Tested by

no test coverage detected