summaryrefslogtreecommitdiff
path: root/sql/ha_myisammrg.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-01-06 13:00:13 +0200
committerunknown <monty@mysql.com>2005-01-06 13:00:13 +0200
commitacf76e3b88b4ec294c8f63f0fb2a29f895228259 (patch)
treeed8b3e5bd637f4d9661ed2ba57849e7e56d5178a /sql/ha_myisammrg.cc
parentbd365f76222e6263095e079ab9e634e88f06b7e1 (diff)
downloadmariadb-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/ha_myisammrg.cc')
-rw-r--r--sql/ha_myisammrg.cc41
1 files changed, 21 insertions, 20 deletions
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index 744128faf69..4cd39660728 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -67,15 +67,15 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
myrg_extra(file,HA_EXTRA_WAIT_LOCK,0);
- if (table->reclength != mean_rec_length && mean_rec_length)
+ if (table->s->reclength != mean_rec_length && mean_rec_length)
{
DBUG_PRINT("error",("reclength: %d mean_rec_length: %d",
- table->reclength, mean_rec_length));
+ table->s->reclength, mean_rec_length));
goto err;
}
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
/* Merge table has more than 2G rows */
- if (table->crashed)
+ if (table->s->crashed)
goto err;
#endif
return (0);
@@ -241,14 +241,14 @@ void ha_myisammrg::info(uint flag)
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
if ((info.records >= (ulonglong) 1 << 32) ||
(info.deleted >= (ulonglong) 1 << 32))
- table->crashed=1;
+ table->s->crashed= 1;
#endif
data_file_length=info.data_file_length;
errkey = info.errkey;
- table->keys_in_use.set_prefix(table->keys);
- table->db_options_in_use = info.options;
- table->is_view=1;
- mean_rec_length=info.reclength;
+ table->s->keys_in_use.set_prefix(table->s->keys);
+ table->s->db_options_in_use= info.options;
+ table->s->is_view= 1;
+ mean_rec_length= info.reclength;
block_size=0;
update_time=0;
#if SIZEOF_OFF_T > 4
@@ -258,10 +258,10 @@ void ha_myisammrg::info(uint flag)
#endif
if (flag & HA_STATUS_CONST)
{
- if (table->key_parts && info.rec_per_key)
+ if (table->s->key_parts && info.rec_per_key)
memcpy((char*) table->key_info[0].rec_per_key,
(char*) info.rec_per_key,
- sizeof(table->key_info[0].rec_per_key)*table->key_parts);
+ sizeof(table->key_info[0].rec_per_key)*table->s->key_parts);
}
}
@@ -361,7 +361,7 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
goto err;
split_file_name(open_table->table->filename, &db, &name);
- if (!(ptr->real_name= thd->strmake(name.str, name.length)))
+ if (!(ptr->table_name= thd->strmake(name.str, name.length)))
goto err;
if (db.length && !(ptr->db= thd->strmake(db.str, db.length)))
goto err;
@@ -388,35 +388,36 @@ err:
int ha_myisammrg::create(const char *name, register TABLE *form,
HA_CREATE_INFO *create_info)
{
- char buff[FN_REFLEN],**table_names,**pos;
+ char buff[FN_REFLEN];
+ const char **table_names, **pos;
TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first;
THD *thd= current_thd;
DBUG_ENTER("ha_myisammrg::create");
- if (!(table_names= (char**) thd->alloc((create_info->merge_list.elements+1)*
- sizeof(char*))))
+ if (!(table_names= (const char**)
+ thd->alloc((create_info->merge_list.elements+1) * sizeof(char*))))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
for (pos= table_names; tables; tables= tables->next_local)
{
- char *table_name;
+ const char *table_name;
TABLE **tbl= 0;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
- tbl= find_temporary_table(thd, tables->db, tables->real_name);
+ tbl= find_temporary_table(thd, tables->db, tables->table_name);
if (!tbl)
{
uint length= my_snprintf(buff,FN_REFLEN,"%s%s/%s",
mysql_real_data_home,
- tables->db, tables->real_name);
+ tables->db, tables->table_name);
if (!(table_name= thd->strmake(buff, length)))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
else
- table_name=(*tbl)->path;
+ table_name= (*tbl)->s->path;
*pos++= table_name;
}
*pos=0;
DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
- (const char **) table_names,
+ table_names,
create_info->merge_insert_method,
(my_bool) 0));
}
@@ -436,7 +437,7 @@ void ha_myisammrg::append_create_info(String *packet)
packet->append(" UNION=(",8);
MYRG_TABLE *open_table,*first;
- current_db= table->table_cache_key;
+ current_db= table->s->db;
db_length= strlen(current_db);
for (first=open_table=file->open_tables ;