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

Function clone_temp_tables

lua/sp.c:6763–6781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6761}
6762
6763static void clone_temp_tables(SP sp)
6764{
6765 sqlite3 *src = getdb(sp->parent);
6766 if (!src) return;
6767 tmptbl_info_t *tmp;
6768 LIST_FOREACH(tmp, &sp->tmptbls, entries) {
6769 strbuf *sql = strbuf_new();
6770 const char *create = tmp->sql;
6771 create += sizeof("CREATE TABLE");
6772 strbuf_appendf(sql, "CREATE TEMP TABLE %s", create);
6773 sp->clnt->skip_peer_chk = 1;
6774 sqlite3_stmt *stmt;
6775 lua_prepare_sql_with_temp_ddl(sp, strbuf_buf(sql), &stmt);
6776 clone_temp_table(stmt, &tmp->tbl);
6777 sqlite3_finalize(stmt);
6778 sp->clnt->skip_peer_chk = 0;
6779 strbuf_free(sql);
6780 }
6781}
6782
6783static int begin_sp(struct sqlclntstate *clnt, char **err)
6784{

Callers 1

exec_thread_intFunction · 0.85

Calls 7

clone_temp_tableFunction · 0.85
sqlite3_finalizeFunction · 0.85
strbuf_newFunction · 0.50
strbuf_appendfFunction · 0.50
strbuf_bufFunction · 0.50
strbuf_freeFunction · 0.50

Tested by

no test coverage detected