Commit ca463b53 authored by Aleksey Midenkov's avatar Aleksey Midenkov

SQL: optimized build fix on view/derived

parent 669fd1d9
...@@ -748,7 +748,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) ...@@ -748,7 +748,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
// Leading versioning table specified explicitly // Leading versioning table specified explicitly
// (i.e. if at least one system field is selected) // (i.e. if at least one system field is selected)
TABLE_LIST *expli_table= NULL; TABLE_LIST *expli_table= NULL;
const LString_i *impli_start, *impli_end; LEX_CSTRING impli_start, impli_end;
Item_field *expli_start= NULL, *expli_end= NULL; Item_field *expli_start= NULL, *expli_end= NULL;
for (TABLE_LIST *table= sl->table_list.first; table; table= table->next_local) for (TABLE_LIST *table= sl->table_list.first; table; table= table->next_local)
...@@ -761,8 +761,8 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) ...@@ -761,8 +761,8 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
if (!impli_table) if (!impli_table)
{ {
impli_table= table; impli_table= table;
impli_start= &table_start; impli_start= table_start;
impli_end= &table_end; impli_end= table_end;
} }
/* Implicitly add versioning fields if needed */ /* Implicitly add versioning fields if needed */
...@@ -809,7 +809,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) ...@@ -809,7 +809,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
else else
expli_table= table; expli_table= table;
expli_start= fld; expli_start= fld;
impli_end= &table_end; impli_end= table_end;
} }
else if (table_end == fld->field_name) else if (table_end == fld->field_name)
{ {
...@@ -833,7 +833,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) ...@@ -833,7 +833,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
else else
expli_table= table; expli_table= table;
expli_end= fld; expli_end= fld;
impli_start= &table_start; impli_start= table_start;
} }
} // while ((item= it++)) } // while ((item= it++))
} // for (TABLE_LIST *table) } // for (TABLE_LIST *table)
...@@ -844,9 +844,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) ...@@ -844,9 +844,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
if (impli_table) if (impli_table)
{ {
Query_arena_stmt on_stmt_arena(thd); Query_arena_stmt on_stmt_arena(thd);
if (!expli_start && (res= sl->vers_push_field(thd, impli_table, *impli_start))) if (!expli_start && (res= sl->vers_push_field(thd, impli_table, impli_start)))
goto exit; goto exit;
if (!expli_end && (res= sl->vers_push_field(thd, impli_table, *impli_end))) if (!expli_end && (res= sl->vers_push_field(thd, impli_table, impli_end)))
goto exit; goto exit;
if (impli_table->vers_conditions) if (impli_table->vers_conditions)
......
...@@ -7441,6 +7441,7 @@ Item *LEX::make_item_func_replace(THD *thd, ...@@ -7441,6 +7441,7 @@ Item *LEX::make_item_func_replace(THD *thd,
bool SELECT_LEX::vers_push_field(THD *thd, TABLE_LIST *table, const LEX_CSTRING field_name) bool SELECT_LEX::vers_push_field(THD *thd, TABLE_LIST *table, const LEX_CSTRING field_name)
{ {
DBUG_ASSERT(field_name.str);
Item_field *fld= new (thd->mem_root) Item_field(thd, &context, Item_field *fld= new (thd->mem_root) Item_field(thd, &context,
table->db, table->alias, &field_name); table->db, table->alias, &field_name);
if (!fld) if (!fld)
......
...@@ -466,7 +466,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -466,7 +466,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
// Leading versioning table specified explicitly // Leading versioning table specified explicitly
// (i.e. if at least one system field is selected) // (i.e. if at least one system field is selected)
TABLE_LIST *expli_table= NULL; TABLE_LIST *expli_table= NULL;
const LString_i *impli_start, *impli_end; LEX_CSTRING impli_start, impli_end;
Item_field *expli_start= NULL, *expli_end= NULL; Item_field *expli_start= NULL, *expli_end= NULL;
for (TABLE_LIST *table= tables; table; table= table->next_local) for (TABLE_LIST *table= tables; table; table= table->next_local)
...@@ -496,8 +496,8 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -496,8 +496,8 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
if (!impli_table) if (!impli_table)
{ {
impli_table= table; impli_table= table;
impli_start= &table_start; impli_start= table_start;
impli_end= &table_end; impli_end= table_end;
} }
/* Implicitly add versioning fields if needed */ /* Implicitly add versioning fields if needed */
...@@ -546,7 +546,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -546,7 +546,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
else else
expli_table= table; expli_table= table;
expli_start= fld; expli_start= fld;
impli_end= &table_end; impli_end= table_end;
} }
else if (table_end == fld->field_name) else if (table_end == fld->field_name)
{ {
...@@ -571,7 +571,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -571,7 +571,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
else else
expli_table= table; expli_table= table;
expli_end= fld; expli_end= fld;
impli_start= &table_start; impli_start= table_start;
} }
} // while ((item= it++)) } // while ((item= it++))
} // for (TABLE_LIST *table) } // for (TABLE_LIST *table)
...@@ -581,9 +581,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -581,9 +581,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
if (impli_table) if (impli_table)
{ {
if (!expli_start && sl->vers_push_field(thd, impli_table, *impli_start)) if (!expli_start && sl->vers_push_field(thd, impli_table, impli_start))
goto err; goto err;
if (!expli_end && sl->vers_push_field(thd, impli_table, *impli_end)) if (!expli_end && sl->vers_push_field(thd, impli_table, impli_end))
goto err; goto err;
} }
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment