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:
@@ -146,7 +146,7 @@ void udf_init()
|
||||
new_thd->db_length=5;
|
||||
|
||||
bzero((gptr) &tables,sizeof(tables));
|
||||
tables.alias= tables.real_name= (char*) "func";
|
||||
tables.alias= tables.table_name= (char*) "func";
|
||||
tables.lock_type = TL_READ;
|
||||
tables.db=new_thd->db;
|
||||
|
||||
@@ -168,7 +168,7 @@ void udf_init()
|
||||
char *dl_name= get_field(&mem, table->field[2]);
|
||||
bool new_dl=0;
|
||||
Item_udftype udftype=UDFTYPE_FUNCTION;
|
||||
if (table->fields >= 4) // New func table
|
||||
if (table->s->fields >= 4) // New func table
|
||||
udftype=(Item_udftype) table->field[3]->val_int();
|
||||
|
||||
if (!(tmp = add_udf(&name,(Item_result) table->field[1]->val_int(),
|
||||
@@ -429,16 +429,16 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db= (char*) "mysql";
|
||||
tables.real_name= tables.alias= (char*) "func";
|
||||
tables.table_name= tables.alias= (char*) "func";
|
||||
/* Allow creation of functions even if we can't open func table */
|
||||
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
|
||||
goto err;
|
||||
|
||||
restore_record(table,default_values); // Default values for fields
|
||||
restore_record(table, s->default_values); // Default values for fields
|
||||
table->field[0]->store(u_d->name.str, u_d->name.length, system_charset_info);
|
||||
table->field[1]->store((longlong) u_d->returns);
|
||||
table->field[2]->store(u_d->dl,(uint) strlen(u_d->dl), system_charset_info);
|
||||
if (table->fields >= 4) // If not old func format
|
||||
if (table->s->fields >= 4) // If not old func format
|
||||
table->field[3]->store((longlong) u_d->type);
|
||||
error = table->file->write_row(table->record[0]);
|
||||
|
||||
@@ -488,7 +488,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db=(char*) "mysql";
|
||||
tables.real_name= tables.alias= (char*) "func";
|
||||
tables.table_name= tables.alias= (char*) "func";
|
||||
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
|
||||
goto err;
|
||||
if (!table->file->index_read_idx(table->record[0],0,(byte*) udf_name->str,
|
||||
|
Reference in New Issue
Block a user