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

Function lua_end_step

lua/sp.c:2282–2320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2280}
2281
2282static void lua_end_step(struct sqlclntstate *clnt, SP sp,
2283 sqlite3_stmt *pStmt)
2284{
2285 Vdbe *pVdbe = (Vdbe*)pStmt;
2286
2287 /* Check whether fingerprint has already been computed. */
2288 if ((pVdbe == NULL) || (pVdbe->fingerprint_added == 1)) {
2289 return;
2290 }
2291
2292 if (sp != NULL) {
2293 const char *zNormSql = sqlite3_normalized_sql(pStmt);
2294
2295 if (zNormSql != NULL) {
2296 double cost = 0.0;
2297 int64_t prepMs = 0;
2298 int64_t timeMs;
2299 int64_t time = comdb2_time_epochms();
2300
2301 clnt_query_cost(sp->thd, &cost, &prepMs);
2302 timeMs = time - pVdbe->luaStartTime + prepMs;
2303
2304 unsigned char fingerprint[FINGERPRINTSZ];
2305 add_fingerprint(clnt, pStmt, sqlite3_sql(pStmt), zNormSql, cost,
2306 timeMs, prepMs, pVdbe->luaRows, NULL, fingerprint, 1); // TODO: Make work for query plans
2307 if (clnt->rawnodestats)
2308 add_fingerprint_to_rawstats(clnt->rawnodestats, fingerprint, cost, pVdbe->luaRows, timeMs);
2309
2310 clnt->spcost.cost += cost;
2311 clnt->spcost.time += timeMs;
2312 clnt->spcost.prepTime += prepMs;
2313 clnt->spcost.rows += pVdbe->luaRows;
2314
2315 pVdbe->fingerprint_added = 1;
2316 }
2317
2318 restore_thd_cost_and_reset(sp->thd, pVdbe);
2319 }
2320}
2321
2322static void lua_end_all_step(struct sqlclntstate *clnt, SP sp)
2323{

Callers 11

create_temp_tableFunction · 0.85
lua_sql_stepFunction · 0.85
lua_end_all_stepFunction · 0.85
dbtable_insertFunction · 0.85
dbtable_copyfromFunction · 0.85
dbstmt_freeFunction · 0.85
dbstmt_execFunction · 0.85
dbstmt_emitFunction · 0.85
dbstmt_closeFunction · 0.85
db_csvcopyFunction · 0.85
db_execFunction · 0.85

Calls 7

sqlite3_normalized_sqlFunction · 0.85
clnt_query_costFunction · 0.85
sqlite3_sqlFunction · 0.85
comdb2_time_epochmsFunction · 0.50
add_fingerprintFunction · 0.50

Tested by

no test coverage detected