summaryrefslogtreecommitdiff
path: root/sql/item_sum.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/item_sum.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/item_sum.cc')
-rw-r--r--sql/item_sum.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 1c005cf60a9..168c68ad706 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1225,7 +1225,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2)
{
Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg;
Field **field = item->table->field;
- Field **field_end= field + item->table->fields;
+ Field **field_end= field + item->table->s->fields;
uint32 *lengths=item->field_lengths;
for (; field < field_end; ++field)
{
@@ -1344,15 +1344,15 @@ bool Item_sum_count_distinct::setup(THD *thd)
// no blobs, otherwise it would be MyISAM
- if (table->db_type == DB_TYPE_HEAP)
+ if (table->s->db_type == DB_TYPE_HEAP)
{
qsort_cmp2 compare_key;
void* cmp_arg;
// to make things easier for dump_leaf if we ever have to dump to MyISAM
- restore_record(table,default_values);
+ restore_record(table,s->default_values);
- if (table->fields == 1)
+ if (table->s->fields == 1)
{
/*
If we have only one field, which is the most common use of
@@ -1396,10 +1396,10 @@ bool Item_sum_count_distinct::setup(THD *thd)
{
bool all_binary = 1;
Field** field, **field_end;
- field_end = (field = table->field) + table->fields;
+ field_end = (field = table->field) + table->s->fields;
uint32 *lengths;
if (!(field_lengths=
- (uint32*) thd->alloc(sizeof(uint32) * table->fields)))
+ (uint32*) thd->alloc(sizeof(uint32) * table->s->fields)))
return 1;
for (key_length = 0, lengths=field_lengths; field < field_end; ++field)
@@ -1410,7 +1410,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
if (!(*field)->binary())
all_binary = 0; // Can't break loop here
}
- rec_offset = table->reclength - key_length;
+ rec_offset= table->s->reclength - key_length;
if (all_binary)
{
compare_key = (qsort_cmp2)simple_raw_key_cmp;
@@ -1781,7 +1781,7 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
String *res;
char *save_ptr= field->ptr;
uint offset= (uint) (save_ptr - record);
- DBUG_ASSERT(offset < item->table->reclength);
+ DBUG_ASSERT(offset < item->table->s->reclength);
field->ptr= (char *) key + offset;
res= field->val_str(&tmp,&tmp2);
item->result.append(*res);
@@ -2124,10 +2124,10 @@ bool Item_func_group_concat::setup(THD *thd)
table->file->extra(HA_EXTRA_NO_ROWS);
table->no_rows= 1;
- key_length= table->reclength;
+ key_length= table->s->reclength;
/* Offset to first result field in table */
- field_list_offset= table->fields - (list.elements - const_fields);
+ field_list_offset= table->s->fields - (list.elements - const_fields);
if (tree_mode)
delete_tree(tree);