diff options
author | unknown <monty@mysql.com> | 2005-01-06 13:00:13 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-01-06 13:00:13 +0200 |
commit | acf76e3b88b4ec294c8f63f0fb2a29f895228259 (patch) | |
tree | ed8b3e5bd637f4d9661ed2ba57849e7e56d5178a /sql/sql_view.cc | |
parent | bd365f76222e6263095e079ab9e634e88f06b7e1 (diff) | |
download | mariadb-git-acf76e3b88b4ec294c8f63f0fb2a29f895228259.tar.gz |
First stage of table definition cache
Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon)
Created Field::make_field() and made Field_num::make_field() to call this
Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead
Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer.
Renamed TABLE_SHARE->real_name to table_name
Renamed TABLE->table_name to alias
Renamed TABLE_LIST->real_name to table_name
include/myisam.h:
Added const before names
mysql-test/r/group_min_max.result:
Make results repeatable
mysql-test/t/group_min_max.test:
Make results repeatable
sql/field.cc:
Created Field::make_field() and made Field_num::make_field() to call this
Use TABLE_SHARE
Use sql_strmake() instead of sql_memdup() to simplify code
sql/field.h:
Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer.
Use TABLE_SHARE
sql/field_conv.cc:
Use TABLE_SHARE
sql/filesort.cc:
Use TABLE_SHARE
sql/ha_berkeley.cc:
Use TABLE_SHARE
sql/ha_heap.cc:
Use TABLE_SHARE
sql/ha_innodb.cc:
Use TABLE_SHARE
sql/ha_myisam.cc:
Use TABLE_SHARE
sql/ha_myisammrg.cc:
Use TABLE_SHARE
Change some pointer handling to use const char*
sql/ha_ndbcluster.cc:
Use TABLE_SHARE
sql/handler.cc:
Use TABLE_SHARE
sql/item.cc:
Use TABLE_SHARE
sql/item_func.cc:
Use TABLE_SHARE
sql/item_subselect.cc:
Use TABLE_SHARE
sql/item_sum.cc:
Use TABLE_SHARE
sql/key.cc:
Use TABLE_SHARE
sql/lock.cc:
Use TABLE_SHARE
sql/log_event.cc:
real_name -> table_name
sql/mysql_priv.h:
Use TABLE_SHARE
sql/opt_range.cc:
Use TABLE_SHARE
sql/opt_sum.cc:
Use TABLE_SHARE
sql/records.cc:
Use TABLE_SHARE
sql/repl_failsafe.cc:
real_name -> table_name
sql/slave.cc:
Use TABLE_SHARE
sql/sp.cc:
Use TABLE_SHARE
sql/sp_head.cc:
real_name -> table_name
sql/sql_acl.cc:
Use TABLE_SHARE
removed unnecessary assert
fixed indentation
changed some char * -> const char*
sql/sql_acl.h:
changed some char* -> const char*
sql/sql_base.cc:
Use TABLE_SHARE
sql/sql_cache.cc:
Use TABLE_SHARE
sql/sql_class.cc:
Use TABLE_SHARE
sql/sql_db.cc:
real_name -> table_name
sql/sql_delete.cc:
Use TABLE_SHARE
sql/sql_derived.cc:
Use TABLE_SHARE
sql/sql_handler.cc:
Use TABLE_SHARE
sql/sql_help.cc:
Use TABLE_SHARE
sql/sql_insert.cc:
Use TABLE_SHARE
sql/sql_load.cc:
Use TABLE_SHARE
sql/sql_parse.cc:
Use TABLE_SHARE
sql/sql_rename.cc:
real_name -> table_name
sql/sql_select.cc:
Use TABLE_SHARE
table->blob_fields now points to field offsets, not fields
tmp_table->table_name now points to alias name
sql/sql_show.cc:
Use TABLE_SHARE
sql/sql_table.cc:
Use TABLE_SHARE
sql/sql_test.cc:
Use TABLE_SHARE
sql/sql_trigger.cc:
Use TABLE_SHARE
sql/sql_udf.cc:
Use TABLE_SHARE
sql/sql_union.cc:
real_name -> table_name
sql/sql_update.cc:
Use TABLE_SHARE
sql/sql_view.cc:
Use TABLE_SHARE
sql/table.cc:
Split TABLE to TABLE and TABLE_SHARE
Changed blob_field to be field offsets instead of pointer to fields
Only initialize table->s->default_values with default record (not all table->record[#])
Some indentation changes
sql/table.h:
Split TABLE to TABLE and TABLE_SHARE
sql/tztime.cc:
real_name -> table_name
sql/unireg.cc:
Use TABLE_SHARE
sql/unireg.h:
Use TABLE_SHARE
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index bafb57c44b0..6680ea95561 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -118,7 +118,7 @@ bool mysql_create_view(THD *thd, if (check_some_access(thd, VIEW_ANY_ACL, tbl)) { my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), - "ANY", thd->priv_user, thd->host_or_ip, tbl->real_name); + "ANY", thd->priv_user, thd->host_or_ip, tbl->table_name); DBUG_RETURN(TRUE); } /* @@ -136,11 +136,11 @@ bool mysql_create_view(THD *thd, /* Make sure that all rights are loaded to the TABLE::grant field. - tbl->real_name will be correct name of table because VIEWs are + tbl->table_name will be correct name of table because VIEWs are not opened yet. */ fill_effective_table_privileges(thd, &tbl->grant, tbl->db, - tbl->real_name); + tbl->table_name); } } @@ -187,7 +187,7 @@ bool mysql_create_view(THD *thd, for (tbl= tables; tbl; tbl= tbl->next_global) { /* is this table temporary and is not view? */ - if (tbl->table->tmp_table != NO_TMP_TABLE && !tbl->view && + if (tbl->table->s->tmp_table != NO_TMP_TABLE && !tbl->view && !tbl->schema_table) { my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias); @@ -198,7 +198,7 @@ bool mysql_create_view(THD *thd, /* is this table view and the same view which we creates now? */ if (tbl->view && strcmp(tbl->view_db.str, view->db) == 0 && - strcmp(tbl->view_name.str, view->real_name) == 0) + strcmp(tbl->view_name.str, view->table_name) == 0) { my_error(ER_NO_SUCH_TABLE, MYF(0), tbl->view_db.str, tbl->view_name.str); res= TRUE; @@ -272,24 +272,24 @@ bool mysql_create_view(THD *thd, List_iterator_fast<Item> it(sl->item_list); Item *item; fill_effective_table_privileges(thd, &view->grant, db, - view->real_name); + view->table_name); while ((item= it++)) { Item_field *fld; uint priv= (get_column_grant(thd, &view->grant, db, - view->real_name, item->name) & + view->table_name, item->name) & VIEW_ANY_ACL); if ((fld= item->filed_for_view_update())) { /* Do we have more privileges on view field then underlying table field? */ - if (!fld->field->table->tmp_table && (~fld->have_privileges & priv)) + if (!fld->field->table->s->tmp_table && (~fld->have_privileges & priv)) { /* VIEW column has more privileges */ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), "create view", thd->priv_user, thd->host_or_ip, item->name, - view->real_name); + view->table_name); DBUG_RETURN(TRUE); } } @@ -404,7 +404,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, dir.length= strlen(dir_buff); file.str= file_buff; - file.length= (strxnmov(file_buff, FN_REFLEN, view->real_name, reg_ext, + file.length= (strxnmov(file_buff, FN_REFLEN, view->table_name, reg_ext, NullS) - file_buff); /* init timestamp */ if (!view->timestamp.str) @@ -435,7 +435,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, strncmp("VIEW", parser->type()->str, parser->type()->length)) { my_error(ER_WRONG_OBJECT, MYF(0), - (view->db ? view->db : thd->db), view->real_name, "VIEW"); + (view->db ? view->db : thd->db), view->table_name, "VIEW"); DBUG_RETURN(-1); } @@ -518,7 +518,7 @@ loop_out: !((TABLE_LIST*)lex->select_lex.table_list.first)->next_local && find_table_in_global_list(lex->query_tables->next_global, lex->query_tables->db, - lex->query_tables->real_name)) + lex->query_tables->table_name)) { view->updatable_view= 0; } @@ -526,7 +526,7 @@ loop_out: if (view->with_check != VIEW_CHECK_NONE && !view->updatable_view) { - my_error(ER_VIEW_NONUPD_CHECK, MYF(0), view->db, view->real_name); + my_error(ER_VIEW_NONUPD_CHECK, MYF(0), view->db, view->table_name); DBUG_RETURN(-1); } @@ -598,8 +598,8 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) */ table->view_db.str= table->db; table->view_db.length= table->db_length; - table->view_name.str= table->real_name; - table->view_name.length= table->real_name_length; + table->view_name.str= table->table_name; + table->view_name.length= table->table_name_length; /*TODO: md5 test here and warning if it is differ */ @@ -669,8 +669,8 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) TABLE_LIST *table= old_lex->proc_table; table->db= (char*)"mysql"; table->db_length= 5; - table->real_name= table->alias= (char*)"proc"; - table->real_name_length= 4; + table->table_name= table->alias= (char*)"proc"; + table->table_name_length= 4; table->cacheable_table= 1; old_lex->add_to_query_tables(table); } @@ -889,13 +889,13 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) for (view= views; view; view= view->next_local) { strxnmov(path, FN_REFLEN, mysql_data_home, "/", view->db, "/", - view->real_name, reg_ext, NullS); + view->table_name, reg_ext, NullS); (void) unpack_filename(path, path); VOID(pthread_mutex_lock(&LOCK_open)); if (access(path, F_OK) || (type= (mysql_frm_type(path) != FRMTYPE_VIEW))) { char name[FN_REFLEN]; - my_snprintf(name, sizeof(name), "%s.%s", view->db, view->real_name); + my_snprintf(name, sizeof(name), "%s.%s", view->db, view->table_name); if (thd->lex->drop_if_exists) { push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, @@ -905,7 +905,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) continue; } if (type) - my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->real_name, "VIEW"); + my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW"); else my_error(ER_BAD_TABLE_ERROR, MYF(0), name); goto err; @@ -998,7 +998,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view) if (view->belong_to_view) view= view->belong_to_view; trans= view->field_translation; - key_info_end= (key_info= table->key_info)+ table->keys; + key_info_end= (key_info= table->key_info)+ table->s->keys; elements_in_view= view->view->select_lex.item_list.elements; DBUG_ASSERT(table != 0 && view->field_translation != 0); |