diff options
author | unknown <bell@sanja.is.com.ua> | 2005-01-19 18:23:24 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2005-01-19 18:23:24 +0200 |
commit | 1d71b90e1a2bca80d0035c1ae711d04348894126 (patch) | |
tree | 1277687b5475afc8c5a00f7a2c0fbcccb08bf1f7 /sql | |
parent | 27e8ac47fc169f28278ba642c16d54d3dc52125a (diff) | |
parent | 957a5cb45e0695be9d5063c1c8be1c8721bc0244 (diff) | |
download | mariadb-git-1d71b90e1a2bca80d0035c1ae711d04348894126.tar.gz |
merge
sql/table.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_acl.cc | 3 | ||||
-rw-r--r-- | sql/sql_parse.cc | 14 | ||||
-rw-r--r-- | sql/table.cc | 17 |
3 files changed, 30 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index bcad0e627f4..5f7d51ffe07 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5516,6 +5516,9 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, /* global privileges */ grant->privilege= thd->master_access; + if (!thd->priv_user) + return; // it is slave + /* db privileges */ grant->privilege|= acl_get(thd->host, thd->ip, thd->priv_user, db, 0); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b7a75a0bdd6..13e7a9c7fab 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4059,7 +4059,12 @@ unsent_create_error: } case SQLCOM_CREATE_VIEW: { - res= mysql_create_view(thd, thd->lex->create_view_mode); + if (!(res= mysql_create_view(thd, thd->lex->create_view_mode)) && + mysql_bin_log.is_open()) + { + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); + mysql_bin_log.write(&qinfo); + } break; } case SQLCOM_DROP_VIEW: @@ -4067,7 +4072,12 @@ unsent_create_error: if (check_table_access(thd, DROP_ACL, all_tables, 0) || end_active_trans(thd)) goto error; - res= mysql_drop_view(thd, first_table, thd->lex->drop_mode); + if (!(res= mysql_drop_view(thd, first_table, thd->lex->drop_mode)) && + mysql_bin_log.is_open()) + { + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); + mysql_bin_log.write(&qinfo); + } break; } case SQLCOM_CREATE_TRIGGER: diff --git a/sql/table.cc b/sql/table.cc index a030da95db4..ff8841fc8ca 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1695,6 +1695,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds, Field_translator *transl; SELECT_LEX *select= &view->select_lex; SELECT_LEX *current_select_save= thd->lex->current_select; + byte *main_table_list_save= thd->lex->select_lex.table_list.first; Item *item; TABLE_LIST *tbl; List_iterator_fast<Item> it(select->item_list); @@ -1717,8 +1718,13 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds, if (field_translation) { DBUG_PRINT("info", ("there are already translation table")); - /* prevent look up in SELECTs tree */ + /* + prevent look up in SELECTs tree, and emulate main table list by + ancestor table list for subquery processing + */ thd->lex->current_select= &thd->lex->select_lex; + thd->lex->select_lex.table_list.first= (byte *)ancestor; + thd->lex->select_lex.no_wrap_view_item= 1; thd->set_query_id= 1; /* this view was prepared already on previous PS/SP execution */ @@ -1763,8 +1769,13 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds, DBUG_RETURN(1); } - /* prevent look up in SELECTs tree */ + /* + prevent look up in SELECTs tree, and emulate main table list by ancestor + table list for subquery processing + */ thd->lex->current_select= &thd->lex->select_lex; + thd->lex->select_lex.table_list.first= (byte *)ancestor; + thd->lex->select_lex.no_wrap_view_item= 1; /* @@ -1909,6 +1920,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds, ok: thd->lex->select_lex.no_wrap_view_item= save_wrapper; thd->lex->current_select= current_select_save; + thd->lex->select_lex.table_list.first= main_table_list_save; thd->set_query_id= save_set_query_id; thd->allow_sum_func= save_allow_sum_func; DBUG_RETURN(0); @@ -1923,6 +1935,7 @@ err: } thd->lex->select_lex.no_wrap_view_item= save_wrapper; thd->lex->current_select= current_select_save; + thd->lex->select_lex.table_list.first= main_table_list_save; thd->set_query_id= save_set_query_id; thd->allow_sum_func= save_allow_sum_func; DBUG_RETURN(1); |