| 1157 | } |
| 1158 | |
| 1159 | int SELECT_LEX::period_setup_conds(THD *thd, TABLE_LIST *tables) |
| 1160 | { |
| 1161 | DBUG_ENTER("SELECT_LEX::period_setup_conds"); |
| 1162 | const bool update_conds= !skip_setup_conds(thd); |
| 1163 | |
| 1164 | Query_arena backup; |
| 1165 | Query_arena *arena= thd->activate_stmt_arena_if_needed(&backup); |
| 1166 | |
| 1167 | DBUG_ASSERT(!tables->next_local && tables->table); |
| 1168 | |
| 1169 | Item *result= NULL; |
| 1170 | for (TABLE_LIST *table= tables; table; table= table->next_local) |
| 1171 | { |
| 1172 | if (!table->table) |
| 1173 | continue; |
| 1174 | vers_select_conds_t &conds= table->period_conditions; |
| 1175 | if (!table->table->s->period.name.streq_safe(conds.name)) |
| 1176 | { |
| 1177 | my_error(ER_PERIOD_NOT_FOUND, MYF(0), conds.name.str); |
| 1178 | if (arena) |
| 1179 | thd->restore_active_arena(arena, &backup); |
| 1180 | DBUG_RETURN(-1); |
| 1181 | } |
| 1182 | |
| 1183 | if (update_conds) |
| 1184 | { |
| 1185 | conds.period= &table->table->s->period; |
| 1186 | result= and_items(thd, result, |
| 1187 | period_get_condition(thd, table, this, &conds, true)); |
| 1188 | } |
| 1189 | } |
| 1190 | if (update_conds) |
| 1191 | where= and_items(thd, where, result); |
| 1192 | |
| 1193 | if (arena) |
| 1194 | thd->restore_active_arena(arena, &backup); |
| 1195 | |
| 1196 | DBUG_RETURN(0); |
| 1197 | } |
| 1198 | |
| 1199 | int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables) |
| 1200 | { |
no test coverage detected