mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
VIEW
two TABLE_LIST copy eliminated include/mysqld_error.h: errors of view libmysqld/Makefile.am: new view file mysql-test/r/connect.result: SHOW TABLE show type of table mysql-test/r/ctype_recoding.result: SHOW TABLE show type of table mysql-test/r/drop.result: SHOW TABLE show type of table mysql-test/r/grant.result: new two privileges (CRETEA|SHOW VIEW) mysql-test/r/lowercase_table.result: SHOW TABLE show type of table mysql-test/r/ps_1general.result: SHOW TABLE show type of table mysql-test/r/rename.result: SHOW TABLE show type of table mysql-test/r/rpl000009.result: SHOW TABLE show type of table mysql-test/r/rpl_error_ignored_table.result: SHOW TABLE show type of table mysql-test/r/select.result: SHOW TABLE show type of table mysql-test/r/system_mysql_db.result: SHOW TABLE show type of table new two privileges (CRETEA|SHOW VIEW) mysql-test/t/system_mysql_db_fix.test: removing all system tables scripts/mysql_fix_privilege_tables.sql: new two privileges (CRETEA|SHOW VIEW) sql/Makefile.am: new VIEW related file sql/ha_myisammrg.cc: two TABLE_LIST copy eliminated sql/item.cc: VIEW sql/item.h: VIEW sql/item_subselect.cc: VIEW sql/item_subselect.h: VIEW sql/lex.h: VIEW sql/lock.cc: VIEW sql/mysql_priv.h: VIEW sql/mysqld.cc: VIEW new parameter - sql_updatable_view_key sql/opt_sum.cc: two TABLE_LIST copy eliminated sql/set_var.cc: new parameter - sql_updatable_view_key sql/share/czech/errmsg.txt: errors messages of views sql/share/danish/errmsg.txt: errors messages of views sql/share/dutch/errmsg.txt: errors messages of views sql/share/english/errmsg.txt: errors messages of views sql/share/estonian/errmsg.txt: errors messages of views sql/share/french/errmsg.txt: errors messages of views sql/share/german/errmsg.txt: errors messages of views sql/share/greek/errmsg.txt: errors messages of views sql/share/hungarian/errmsg.txt: errors messages of views sql/share/italian/errmsg.txt: errors messages of views sql/share/japanese/errmsg.txt: errors messages of views sql/share/korean/errmsg.txt: errors messages of views sql/share/norwegian-ny/errmsg.txt: errors messages of views sql/share/norwegian/errmsg.txt: errors messages of views sql/share/polish/errmsg.txt: errors messages of views sql/share/portuguese/errmsg.txt: errors messages of views sql/share/romanian/errmsg.txt: errors messages of views sql/share/russian/errmsg.txt: errors messages of views sql/share/serbian/errmsg.txt: errors messages of views sql/share/slovak/errmsg.txt: errors messages of views sql/share/spanish/errmsg.txt: errors messages of views sql/share/swedish/errmsg.txt: errors messages of views sql/share/ukrainian/errmsg.txt: errors messages of views sql/slave.cc: two TABLE_LIST copy eliminated sql/sp.cc: VIEW sql/sql_acl.cc: VIEW sql/sql_acl.h: VIEW sql/sql_base.cc: VIEW sql/sql_cache.cc: two TABLE_LIST copy eliminated sql/sql_class.h: VIEW sql/sql_db.cc: two TABLE_LIST copy eliminated sql/sql_delete.cc: VIEW sql/sql_derived.cc: VIEW sql/sql_handler.cc: two TABLE_LIST copy eliminated sql/sql_help.cc: two TABLE_LIST copy eliminated sql/sql_insert.cc: VIEW sql/sql_lex.cc: VIEW sql/sql_lex.h: VIEW sql/sql_load.cc: VIEW sql/sql_olap.cc: VIEW sql/sql_parse.cc: two TABLE_LIST copy eliminated VIEW sql/sql_prepare.cc: VIEW sql/sql_rename.cc: two TABLE_LIST copy eliminated sql/sql_select.cc: VIEW sql/sql_show.cc: VIEW sql/sql_table.cc: VIEW sql/sql_union.cc: VIEW sql/sql_update.cc: VIEW sql/sql_yacc.yy: VIEW sql/table.cc: VIEW sql/table.h: VIEW sql/tztime.cc: two TABLE_LIST copy eliminated sql/unireg.h: VIEW tests/client_test.c: VIEW
This commit is contained in:
@ -89,7 +89,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
||||
}
|
||||
|
||||
}
|
||||
error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary, 0);
|
||||
error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0);
|
||||
|
||||
err:
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
@ -134,8 +134,8 @@ int mysql_rm_table_part2_with_lock(THD *thd,
|
||||
thd->mysys_var->current_cond= &COND_refresh;
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
||||
error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary,
|
||||
dont_log_query);
|
||||
error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 1,
|
||||
dont_log_query);
|
||||
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
|
||||
@ -157,6 +157,7 @@ int mysql_rm_table_part2_with_lock(THD *thd,
|
||||
if_exists If set, don't give an error if table doesn't exists.
|
||||
In this case we give an warning of level 'NOTE'
|
||||
drop_temporary Only drop temporary tables
|
||||
drop_view Allow to delete VIEW .frm
|
||||
dont_log_query Don't log the query
|
||||
|
||||
TODO:
|
||||
@ -176,7 +177,8 @@ int mysql_rm_table_part2_with_lock(THD *thd,
|
||||
*/
|
||||
|
||||
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
bool drop_temporary, bool dont_log_query)
|
||||
bool drop_temporary, bool drop_view,
|
||||
bool dont_log_query)
|
||||
{
|
||||
TABLE_LIST *table;
|
||||
char path[FN_REFLEN], *alias;
|
||||
@ -188,7 +190,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
if (lock_table_names(thd, tables))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
for (table=tables ; table ; table=table->next)
|
||||
for (table= tables; table; table= table->next_local)
|
||||
{
|
||||
char *db=table->db;
|
||||
mysql_ha_close(thd, table, /*dont_send_ok*/ 1, /*dont_lock*/ 1);
|
||||
@ -216,7 +218,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
strxmov(path, mysql_data_home, "/", db, "/", alias, reg_ext, NullS);
|
||||
(void) unpack_filename(path,path);
|
||||
}
|
||||
if (drop_temporary || access(path,F_OK))
|
||||
if (drop_temporary || access(path,F_OK) ||
|
||||
(!drop_view && mysql_frm_type(path) != FRMTYPE_TABLE))
|
||||
{
|
||||
if (if_exists)
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
@ -1333,7 +1336,7 @@ make_unique_key_name(const char *field_name,KEY *start,KEY *end)
|
||||
****************************************************************************/
|
||||
|
||||
TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||
const char *db, const char *name,
|
||||
TABLE_LIST *create_table,
|
||||
List<create_field> *extra_fields,
|
||||
List<Key> *keys,
|
||||
List<Item> *items,
|
||||
@ -1373,21 +1376,24 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||
}
|
||||
/* create and lock table */
|
||||
/* QQ: This should be done atomic ! */
|
||||
if (mysql_create_table(thd,db,name,create_info,*extra_fields,
|
||||
*keys,0,1,select_field_count)) // no logging
|
||||
if (mysql_create_table(thd, create_table->db, create_table->real_name,
|
||||
create_info, *extra_fields, *keys, 0, 1,
|
||||
select_field_count)) // no logging
|
||||
DBUG_RETURN(0);
|
||||
if (!(table=open_table(thd,db,name,name,(bool*) 0)))
|
||||
if (!(table= open_table(thd, create_table, 0, (bool*) 0)))
|
||||
{
|
||||
quick_rm_table(create_info->db_type,db,table_case_name(create_info,name));
|
||||
quick_rm_table(create_info->db_type, create_table->db,
|
||||
table_case_name(create_info, create_table->real_name));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
table->reginfo.lock_type=TL_WRITE;
|
||||
if (!((*lock)=mysql_lock_tables(thd,&table,1)))
|
||||
if (!((*lock)= mysql_lock_tables(thd, &table,1)))
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
hash_delete(&open_cache,(byte*) table);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
quick_rm_table(create_info->db_type,db,table_case_name(create_info, name));
|
||||
quick_rm_table(create_info->db_type, create_table->db,
|
||||
table_case_name(create_info, create_table->real_name));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
table->file->extra(HA_EXTRA_WRITE_CACHE);
|
||||
@ -1736,7 +1742,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
mysql_ha_close(thd, tables, /*dont_send_ok*/ 1, /*dont_lock*/ 1);
|
||||
for (table = tables; table; table = table->next)
|
||||
for (table= tables; table; table= table->next_local)
|
||||
{
|
||||
char table_name[NAME_LEN*2+2];
|
||||
char* db = (table->db) ? table->db : thd->db;
|
||||
@ -1875,8 +1881,9 @@ send_result_message:
|
||||
reopen the table and do ha_innobase::analyze() on it.
|
||||
*/
|
||||
close_thread_tables(thd);
|
||||
TABLE_LIST *save_next= table->next;
|
||||
table->next= 0;
|
||||
TABLE_LIST *save_next_local= table->next_local,
|
||||
*save_next_global= table->next_global;
|
||||
table->next_local= table->next_global= 0;
|
||||
result_code= mysql_recreate_table(thd, table, 0);
|
||||
close_thread_tables(thd);
|
||||
if (!result_code) // recreation went ok
|
||||
@ -1886,7 +1893,8 @@ send_result_message:
|
||||
result_code= 0; // analyze went ok
|
||||
}
|
||||
result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
|
||||
table->next= save_next;
|
||||
table->next_local= save_next_local;
|
||||
table->next_global= save_next_global;
|
||||
goto send_result_message;
|
||||
}
|
||||
|
||||
@ -2100,9 +2108,9 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
bzero((gptr)&src_tables_list, sizeof(src_tables_list));
|
||||
src_tables_list.db= table_ident->db.str ? table_ident->db.str : thd->db;
|
||||
src_tables_list.real_name= table_ident->table.str;
|
||||
src_tables_list.next= 0;
|
||||
|
||||
if (lock_and_wait_for_table_name(thd, &src_tables_list))
|
||||
goto err;
|
||||
@ -3004,7 +3012,13 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
DBUG_RETURN(error);
|
||||
|
||||
if (table->tmp_table)
|
||||
new_table=open_table(thd,new_db,tmp_name,tmp_name,0);
|
||||
{
|
||||
TABLE_LIST tbl;
|
||||
bzero((void*) &tbl, sizeof(tbl));
|
||||
tbl.db= new_db;
|
||||
tbl.real_name= tbl.alias= tmp_name;
|
||||
new_table= open_table(thd, &tbl, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
char path[FN_REFLEN];
|
||||
@ -3438,7 +3452,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
|
||||
if (protocol->send_fields(&field_list, 1))
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
for (table= tables; table; table= table->next)
|
||||
for (table= tables; table; table= table->next_local)
|
||||
{
|
||||
char table_name[NAME_LEN*2+2];
|
||||
TABLE *t;
|
||||
|
Reference in New Issue
Block a user