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

Method Next

src/objects/statement-iterator.cpp:22–43  ·  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 FdVfs::BeginOperation();
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