MCPcopy Create free account
hub / github.com/MariaDB/server / vers_setup_conds

Method vers_setup_conds

sql/sql_select.cc:1199–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1197}
1198
1199int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
1200{
1201 DBUG_ENTER("SELECT_LEX::vers_setup_conds");
1202 const bool update_conds= !skip_setup_conds(thd);
1203
1204 if (!versioned_tables)
1205 {
1206 for (TABLE_LIST *table= tables; table; table= table->next_local)
1207 {
1208 if (table->table && table->table->versioned())
1209 versioned_tables++;
1210 else if (table->vers_conditions.is_set() &&
1211 (table->is_non_derived() || !table->vers_conditions.used))
1212 {
1213 my_error(ER_VERS_NOT_VERSIONED, MYF(0), table->alias.str);
1214 DBUG_RETURN(-1);
1215 }
1216 }
1217 }
1218
1219 if (versioned_tables == 0)
1220 DBUG_RETURN(0);
1221
1222 /* For prepared statements we create items on statement arena,
1223 because they must outlive execution phase for multiple executions. */
1224 Query_arena_stmt on_stmt_arena(thd);
1225
1226 // find outer system_time
1227 SELECT_LEX *outer_slex= outer_select();
1228 TABLE_LIST* outer_table= NULL;
1229
1230 if (outer_slex)
1231 {
1232 TABLE_LIST* derived= master_unit()->derived;
1233 // inner SELECT may not be a derived table (derived == NULL)
1234 while (derived && outer_slex && !derived->vers_conditions.is_set())
1235 {
1236 derived= outer_slex->master_unit()->derived;
1237 outer_slex= outer_slex->outer_select();
1238 }
1239 if (derived && outer_slex)
1240 {
1241 DBUG_ASSERT(derived->vers_conditions.is_set());
1242 outer_table= derived;
1243 }
1244 }
1245
1246 bool is_select= false;
1247 bool use_sysvar= false;
1248 switch (thd->lex->sql_command)
1249 {
1250 case SQLCOM_SELECT:
1251 use_sysvar= true;
1252 /* fall through */
1253 case SQLCOM_CREATE_TABLE:
1254 case SQLCOM_INSERT_SELECT:
1255 case SQLCOM_REPLACE_SELECT:
1256 case SQLCOM_DELETE_MULTI:

Callers 4

prepare_innerMethod · 0.80
mysql_derived_prepareFunction · 0.80
prepareMethod · 0.80
prepare_innerMethod · 0.80

Calls 15

skip_setup_condsFunction · 0.85
my_errorFunction · 0.85
period_get_conditionFunction · 0.85
and_itemsFunction · 0.85
is_non_derivedMethod · 0.80
master_unitMethod · 0.80
is_viewMethod · 0.80
was_setMethod · 0.80
init_from_sysvarMethod · 0.80
check_unitsMethod · 0.80
is_stmt_executeMethod · 0.80
versionedMethod · 0.45

Tested by

no test coverage detected