| 6761 | } |
| 6762 | |
| 6763 | static 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 | |
| 6783 | static int begin_sp(struct sqlclntstate *clnt, char **err) |
| 6784 | { |
no test coverage detected