| 3068 | } |
| 3069 | |
| 3070 | static void drop_temp_tables(SP sp) |
| 3071 | { |
| 3072 | int expire = 0; |
| 3073 | tmptbl_info_t *tbl; |
| 3074 | char drop_sql[128]; |
| 3075 | struct sqlclntstate *clnt = sp->clnt; |
| 3076 | clnt->skip_peer_chk = 1; |
| 3077 | LIST_FOREACH(tbl, &sp->tmptbls, entries) { |
| 3078 | int rc; |
| 3079 | char n1[MAXTABLELEN], n2[MAXTABLELEN]; |
| 3080 | two_part_tbl_name(tbl->name, n1, n2); |
| 3081 | sprintf(drop_sql, "DROP TABLE temp.\"%s\"", n2); |
| 3082 | sqlite3_stmt *stmt; |
| 3083 | rc = lua_prepare_sql_with_temp_ddl(sp, drop_sql, &stmt); |
| 3084 | if (rc) { |
| 3085 | logmsg(LOGMSG_FATAL, "lua_prepare_sql_with_temp_ddl rc:%d sql:%s\n", |
| 3086 | rc, drop_sql); |
| 3087 | expire = 1; |
| 3088 | continue; |
| 3089 | } |
| 3090 | do { |
| 3091 | rc = sqlite3_step(stmt); |
| 3092 | } while (rc == SQLITE_ROW); |
| 3093 | sqlite3_finalize(stmt); |
| 3094 | if (rc != SQLITE_DONE) { |
| 3095 | expire = 1; |
| 3096 | logmsg(LOGMSG_FATAL, "sqlite3_step rc:%d sql:%s\n", rc, drop_sql); |
| 3097 | } |
| 3098 | } |
| 3099 | clnt->skip_peer_chk = 0; |
| 3100 | if (expire) { |
| 3101 | sp->thd->dbopen_gen = -1; |
| 3102 | } |
| 3103 | } |
| 3104 | |
| 3105 | // SP ready to run again |
| 3106 | static void reset_sp(SP sp) |
no test coverage detected