MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luatable_emit

Function luatable_emit

lua/sp.c:2403–2422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2401
2402static int l_send_back_row(Lua, sqlite3_stmt *, int);
2403static int luatable_emit(Lua L)
2404{
2405 int cols;
2406 SP sp = getsp(L);
2407 sqlite3_stmt *stmt = get_sqlrow_stmt(L);
2408 if (stmt) {
2409 cols = column_count(NULL, stmt);
2410 } else if (sp->parent->ntypes) {
2411 push_clnt_cols(L, sp);
2412 lua_pop(L, 1);
2413 cols = lua_gettop(L);
2414 } else {
2415 return luaL_error(L, "attempt to emit row without defining columns");
2416 }
2417 /* NC: Should we iterate over all the rows here and call lua_end_step()
2418 (like dbstmt_emit()) ? */
2419 int rc = l_send_back_row(L, stmt, cols);
2420 lua_pushinteger(L, rc);
2421 return 1;
2422}
2423
2424static int dbtable_insert(Lua lua)
2425{

Callers 1

db_emit_intFunction · 0.85

Calls 7

get_sqlrow_stmtFunction · 0.85
column_countFunction · 0.85
push_clnt_colsFunction · 0.85
lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
l_send_back_rowFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected