diff options
author | Sinisa@sinisa.nasamreza.org <> | 2002-12-24 13:58:07 +0200 |
---|---|---|
committer | Sinisa@sinisa.nasamreza.org <> | 2002-12-24 13:58:07 +0200 |
commit | 5988ae5ca590dcecaee0158ed8e9699f274e30d9 (patch) | |
tree | 47e3ffaa6aba38ec5904fb7bcd002fa92b377664 /sql | |
parent | 4158538dc7bf80f3e3d9965b18dd98632d91b905 (diff) | |
download | mariadb-git-5988ae5ca590dcecaee0158ed8e9699f274e30d9.tar.gz |
Many fixes.
I still have to make a test case for :
UPDATE from sub-select with derived table
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_cache.cc | 2 | ||||
-rw-r--r-- | sql/sql_derived.cc | 9 | ||||
-rw-r--r-- | sql/sql_parse.cc | 1 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 26 |
5 files changed, 26 insertions, 14 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index aa0f5824b4e..1cfbbf74da6 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1062,6 +1062,8 @@ void Query_cache::invalidate(THD *thd, TABLE_LIST *tables_used, for (; tables_used; tables_used=tables_used->next) { DBUG_ASSERT(!using_transactions || tables_used->table!=0); + if (tables_used->derived) + continue; if (using_transactions && tables_used->table->file->has_transactions()) /* diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index f7d845e9e36..54179a5e25c 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -168,14 +168,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) tables->table_list->table=tables->table; // to fix a problem in EXPLAIN } else - { - if (is_union) - unit->exclude(); - else - sl->exclude(); - } + unit->exclude(); t->db=(char *)""; - t->derived=(SELECT_LEX *)0; // just in case ... + t->derived=(SELECT_LEX *)1; // just in case ... table->file->info(HA_STATUS_VARIABLE); } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f3636f0b1bb..553b9a1fe43 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3001,6 +3001,7 @@ mysql_init_query(THD *thd) lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list); lex->olap=lex->describe=0; lex->derived_tables= false; + lex->lock_option=TL_UNLOCK; thd->check_loops_counter= thd->select_number= lex->select_lex.select_number= 1; thd->free_list= 0; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ebade0111b0..8ea357e65f2 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1469,7 +1469,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, end= int10_to_str((long) thd->query_id, buff, 10); break; case SHOW_RPL_STATUS: - end= int10_to_str((long) rpl_status_type[(int)rpl_status], buff, 10); + end= strmov(buff, rpl_status_type[(int)rpl_status]); break; case SHOW_SLAVE_RUNNING: { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 55f165c0739..f90376601df 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1668,12 +1668,17 @@ select_init: '(' SELECT_SYM select_part2 ')' { LEX *lex= Lex; - SELECT_LEX_NODE * sel= lex->current_select; + SELECT_LEX * sel= lex->current_select->select_lex(); if (sel->set_braces(1)) { send_error(lex->thd, ER_SYNTAX_ERROR); YYABORT; } + if (sel->linkage == UNION_TYPE && !sel->master_unit()->first_select()->braces) + { + send_error(lex->thd, ER_SYNTAX_ERROR); + YYABORT; + } /* select in braces, can't contain global parameters */ sel->master_unit()->global_parameters= sel->master_unit(); @@ -1683,11 +1688,17 @@ select_init2: select_part2 { LEX *lex= Lex; + SELECT_LEX * sel= lex->current_select->select_lex(); if (lex->current_select->set_braces(0)) { send_error(lex->thd, ER_SYNTAX_ERROR); YYABORT; } + if (sel->linkage == UNION_TYPE && sel->master_unit()->first_select()->braces) + { + send_error(lex->thd, ER_SYNTAX_ERROR); + YYABORT; + } } union_clause ; @@ -1695,6 +1706,7 @@ select_init2: select_part2: { LEX *lex=Lex; + SELECT_LEX * sel= lex->current_select->select_lex(); if (lex->current_select == &lex->select_lex) lex->lock_option= TL_READ; /* Only for global SELECT */ mysql_init_select(lex); @@ -2509,7 +2521,9 @@ join_table: lex->current_select= unit->outer_select(); if (!($$= lex->current_select-> add_table_to_list(lex->thd, new Table_ident(unit), $5, 0, - lex->lock_option))) + lex->lock_option,(List<String> *)0, + (List<String> *)0))) + YYABORT; }; @@ -3187,16 +3201,16 @@ table_wild_list: | table_wild_list ',' table_wild_one {}; table_wild_one: - ident opt_wild + ident opt_wild opt_table_alias { - if (!Select->add_table_to_list(YYTHD, new Table_ident($1), NULL, 1, + if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3, 1, Lex->lock_option)) YYABORT; } - | ident '.' ident opt_wild + | ident '.' ident opt_wild opt_table_alias { if (!Select->add_table_to_list(YYTHD, new Table_ident($1, $3, 0), - NULL, 1, Lex->lock_option)) + $5, 1, Lex->lock_option)) YYABORT; } ; |