mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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
This commit is contained in:
@@ -232,7 +232,7 @@ cleanup:
|
||||
|
||||
delete select;
|
||||
transactional_table= table->file->has_transactions();
|
||||
log_delayed= (transactional_table || table->tmp_table);
|
||||
log_delayed= (transactional_table || table->s->tmp_table);
|
||||
/*
|
||||
We write to the binary log even if we deleted no row, because maybe the
|
||||
user is using this command to ensure that a table is clean on master *and
|
||||
@@ -307,7 +307,7 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
|
||||
}
|
||||
if (unique_table(table_list, table_list->next_global))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
select_lex->fix_prepare_information(thd, conds);
|
||||
@@ -366,7 +366,7 @@ bool mysql_multi_delete_prepare(THD *thd)
|
||||
check_key_in_view(thd, target_tbl->correspondent_table))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
|
||||
target_tbl->real_name, "DELETE");
|
||||
target_tbl->table_name, "DELETE");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/*
|
||||
@@ -381,10 +381,10 @@ bool mysql_multi_delete_prepare(THD *thd)
|
||||
{
|
||||
if (un->first_select()->linkage != DERIVED_TABLE_TYPE &&
|
||||
un->check_updateable(target_tbl->correspondent_table->db,
|
||||
target_tbl->correspondent_table->real_name))
|
||||
target_tbl->correspondent_table->table_name))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0),
|
||||
target_tbl->correspondent_table->real_name);
|
||||
target_tbl->correspondent_table->table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
@@ -445,7 +445,7 @@ multi_delete::initialize_tables(JOIN *join)
|
||||
tbl->used_keys.clear_all();
|
||||
if (tbl->file->has_transactions())
|
||||
log_delayed= transactional_tables= 1;
|
||||
else if (tbl->tmp_table != NO_TMP_TABLE)
|
||||
else if (tbl->s->tmp_table != NO_TMP_TABLE)
|
||||
log_delayed= 1;
|
||||
else
|
||||
normal_tables= 1;
|
||||
@@ -717,19 +717,19 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
/* If it is a temporary table, close and regenerate it */
|
||||
if (!dont_send_ok && (table_ptr=find_temporary_table(thd,table_list->db,
|
||||
table_list->real_name)))
|
||||
table_list->table_name)))
|
||||
{
|
||||
TABLE *table= *table_ptr;
|
||||
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
|
||||
db_type table_type=table->db_type;
|
||||
strmov(path,table->path);
|
||||
db_type table_type= table->s->db_type;
|
||||
strmov(path, table->s->path);
|
||||
*table_ptr= table->next; // Unlink table from list
|
||||
close_temporary(table,0);
|
||||
*fn_ext(path)=0; // Remove the .frm extension
|
||||
ha_create_table(path, &create_info,1);
|
||||
// We don't need to call invalidate() because this table is not in cache
|
||||
if ((error= (int) !(open_temporary_table(thd, path, table_list->db,
|
||||
table_list->real_name, 1))))
|
||||
table_list->table_name, 1))))
|
||||
(void) rm_temporary_table(table_type, path);
|
||||
/*
|
||||
If we return here we will not have logged the truncation to the bin log
|
||||
@@ -739,7 +739,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
}
|
||||
|
||||
(void) sprintf(path,"%s/%s/%s%s",mysql_data_home,table_list->db,
|
||||
table_list->real_name,reg_ext);
|
||||
table_list->table_name,reg_ext);
|
||||
fn_format(path,path,"","",4);
|
||||
|
||||
if (!dont_send_ok)
|
||||
@@ -748,7 +748,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
if ((table_type=get_table_type(path)) == DB_TYPE_UNKNOWN)
|
||||
{
|
||||
my_error(ER_NO_SUCH_TABLE, MYF(0),
|
||||
table_list->db, table_list->real_name);
|
||||
table_list->db, table_list->table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (!ha_supports_generate(table_type))
|
||||
|
Reference in New Issue
Block a user