Commit 0466c250 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-tmp_field-4.1
parents dc636603 334841d9
...@@ -140,7 +140,7 @@ class Item { ...@@ -140,7 +140,7 @@ class Item {
virtual double val()=0; virtual double val()=0;
virtual longlong val_int()=0; virtual longlong val_int()=0;
virtual String *val_str(String*)=0; virtual String *val_str(String*)=0;
virtual Field *tmp_table_field() { return 0; } virtual Field *get_tmp_table_field() { return 0; }
virtual Field *tmp_table_field(TABLE *t_arg) { return 0; } virtual Field *tmp_table_field(TABLE *t_arg) { return 0; }
virtual const char *full_name() const { return name ? name : "???"; } virtual const char *full_name() const { return name ? name : "???"; }
virtual double val_result() { return val(); } virtual double val_result() { return val(); }
...@@ -267,7 +267,7 @@ class Item_field :public Item_ident ...@@ -267,7 +267,7 @@ class Item_field :public Item_ident
{ {
return field->type(); return field->type();
} }
Field *tmp_table_field() { return result_field; } Field *get_tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) { return result_field; } Field *tmp_table_field(TABLE *t_arg) { return result_field; }
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,bool fuzzydate);
bool get_date_result(TIME *ltime,bool fuzzydate); bool get_date_result(TIME *ltime,bool fuzzydate);
...@@ -546,7 +546,7 @@ class Item_result_field :public Item /* Item with result field */ ...@@ -546,7 +546,7 @@ class Item_result_field :public Item /* Item with result field */
Item(thd, item), result_field(item.result_field) Item(thd, item), result_field(item.result_field)
{} {}
~Item_result_field() {} /* Required with gcc 2.95 */ ~Item_result_field() {} /* Required with gcc 2.95 */
Field *tmp_table_field() { return result_field; } Field *get_tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) { return result_field; } Field *tmp_table_field(TABLE *t_arg) { return result_field; }
table_map used_tables() const { return 1; } table_map used_tables() const { return 1; }
virtual void fix_length_and_dec()=0; virtual void fix_length_and_dec()=0;
......
...@@ -1460,7 +1460,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, ...@@ -1460,7 +1460,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
for (uint i= 0; i < item->arg_count_field; i++) for (uint i= 0; i < item->arg_count_field; i++)
{ {
Item *field_item= item->args[i]; Item *field_item= item->args[i];
Field *field= field_item->tmp_table_field(); Field *field= field_item->get_tmp_table_field();
if (field) if (field)
{ {
uint offset= field->abs_offset; uint offset= field->abs_offset;
...@@ -1491,7 +1491,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) ...@@ -1491,7 +1491,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
{ {
ORDER *order_item= item->order[i]; ORDER *order_item= item->order[i];
Item *item= *order_item->item; Item *item= *order_item->item;
Field *field= item->tmp_table_field(); Field *field= item->get_tmp_table_field();
if (field) if (field)
{ {
uint offset= field->abs_offset; uint offset= field->abs_offset;
...@@ -1542,7 +1542,7 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)), ...@@ -1542,7 +1542,7 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
Item *show_item= group_concat_item->args[i]; Item *show_item= group_concat_item->args[i];
if (!show_item->const_item()) if (!show_item->const_item())
{ {
Field *f= show_item->tmp_table_field(); Field *f= show_item->get_tmp_table_field();
char *sv= f->ptr; char *sv= f->ptr;
f->ptr= (char *)key + f->abs_offset; f->ptr= (char *)key + f->abs_offset;
String *res= f->val_str(&tmp,&tmp2); String *res= f->val_str(&tmp,&tmp2);
...@@ -1709,7 +1709,7 @@ bool Item_func_group_concat::add() ...@@ -1709,7 +1709,7 @@ bool Item_func_group_concat::add()
Item *show_item= args[i]; Item *show_item= args[i];
if (!show_item->const_item()) if (!show_item->const_item())
{ {
Field *f= show_item->tmp_table_field(); Field *f= show_item->get_tmp_table_field();
if (!f->is_null()) if (!f->is_null())
{ {
record_is_null= FALSE; record_is_null= FALSE;
......
...@@ -327,7 +327,6 @@ class Item_date :public Item_func ...@@ -327,7 +327,6 @@ class Item_date :public Item_func
max_length=10*default_charset()->mbmaxlen; max_length=10*default_charset()->mbmaxlen;
} }
int save_in_field(Field *to, bool no_conversions); int save_in_field(Field *to, bool no_conversions);
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_date(maybe_null, name, t_arg, default_charset())); return (new Field_date(maybe_null, name, t_arg, default_charset()));
...@@ -342,7 +341,6 @@ class Item_date_func :public Item_str_func ...@@ -342,7 +341,6 @@ class Item_date_func :public Item_str_func
Item_date_func(Item *a) :Item_str_func(a) {} Item_date_func(Item *a) :Item_str_func(a) {}
Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {} Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_datetime(maybe_null, name, t_arg, default_charset())); return (new Field_datetime(maybe_null, name, t_arg, default_charset()));
...@@ -366,7 +364,6 @@ class Item_func_curtime :public Item_func ...@@ -366,7 +364,6 @@ class Item_func_curtime :public Item_func
longlong val_int() { return value; } longlong val_int() { return value; }
String *val_str(String *str); String *val_str(String *str);
void fix_length_and_dec(); void fix_length_and_dec();
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_time(maybe_null, name, t_arg, default_charset())); return (new Field_time(maybe_null, name, t_arg, default_charset()));
...@@ -533,7 +530,6 @@ class Item_func_sec_to_time :public Item_str_func ...@@ -533,7 +530,6 @@ class Item_func_sec_to_time :public Item_str_func
} }
enum_field_types field_type() const { return MYSQL_TYPE_TIME; } enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
const char *func_name() const { return "sec_to_time"; } const char *func_name() const { return "sec_to_time"; }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_time(maybe_null, name, t_arg, default_charset())); return (new Field_time(maybe_null, name, t_arg, default_charset()));
...@@ -634,7 +630,6 @@ class Item_date_typecast :public Item_typecast ...@@ -634,7 +630,6 @@ class Item_date_typecast :public Item_typecast
bool get_date(TIME *ltime, bool fuzzy_date); bool get_date(TIME *ltime, bool fuzzy_date);
const char *func_name() const { return "date"; } const char *func_name() const { return "date"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATE; } enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_date(maybe_null, name, t_arg, default_charset())); return (new Field_date(maybe_null, name, t_arg, default_charset()));
...@@ -650,7 +645,6 @@ class Item_time_typecast :public Item_typecast ...@@ -650,7 +645,6 @@ class Item_time_typecast :public Item_typecast
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
const char *func_name() const { return "time"; } const char *func_name() const { return "time"; }
enum_field_types field_type() const { return MYSQL_TYPE_TIME; } enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_time(maybe_null, name, t_arg, default_charset())); return (new Field_time(maybe_null, name, t_arg, default_charset()));
...@@ -665,7 +659,6 @@ class Item_datetime_typecast :public Item_typecast ...@@ -665,7 +659,6 @@ class Item_datetime_typecast :public Item_typecast
String *val_str(String *str); String *val_str(String *str);
const char *func_name() const { return "datetime"; } const char *func_name() const { return "datetime"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_datetime(maybe_null, name, t_arg, default_charset())); return (new Field_datetime(maybe_null, name, t_arg, default_charset()));
...@@ -684,7 +677,6 @@ class Item_func_makedate :public Item_str_func ...@@ -684,7 +677,6 @@ class Item_func_makedate :public Item_str_func
decimals=0; decimals=0;
max_length=8*MY_CHARSET_BIN_MB_MAXLEN; max_length=8*MY_CHARSET_BIN_MB_MAXLEN;
} }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_date(maybe_null, name, t_arg, &my_charset_bin)); return (new Field_date(maybe_null, name, t_arg, &my_charset_bin));
...@@ -711,7 +703,6 @@ class Item_func_add_time :public Item_str_func ...@@ -711,7 +703,6 @@ class Item_func_add_time :public Item_str_func
Change this when we support Change this when we support
microseconds in TIME/DATETIME microseconds in TIME/DATETIME
*/ */
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
if (cached_field_type == MYSQL_TYPE_TIME) if (cached_field_type == MYSQL_TYPE_TIME)
...@@ -735,7 +726,6 @@ class Item_func_timediff :public Item_str_func ...@@ -735,7 +726,6 @@ class Item_func_timediff :public Item_str_func
decimals=0; decimals=0;
max_length=17*MY_CHARSET_BIN_MB_MAXLEN; max_length=17*MY_CHARSET_BIN_MB_MAXLEN;
} }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
...@@ -755,7 +745,6 @@ class Item_func_maketime :public Item_str_func ...@@ -755,7 +745,6 @@ class Item_func_maketime :public Item_str_func
decimals=0; decimals=0;
max_length=8*MY_CHARSET_BIN_MB_MAXLEN; max_length=8*MY_CHARSET_BIN_MB_MAXLEN;
} }
Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin)); return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
......
...@@ -4789,7 +4789,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -4789,7 +4789,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->algorithm= HA_KEY_ALG_UNDEF; keyinfo->algorithm= HA_KEY_ALG_UNDEF;
for (; group ; group=group->next,key_part_info++) for (; group ; group=group->next,key_part_info++)
{ {
Field *field=(*group->item)->tmp_table_field(); Field *field=(*group->item)->get_tmp_table_field();
bool maybe_null=(*group->item)->maybe_null; bool maybe_null=(*group->item)->maybe_null;
key_part_info->null_bit=0; key_part_info->null_bit=0;
key_part_info->field= field; key_part_info->field= field;
...@@ -6057,7 +6057,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), ...@@ -6057,7 +6057,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
Item *item= *group->item; Item *item= *group->item;
if (item->maybe_null) if (item->maybe_null)
{ {
Field *field=item->tmp_table_field(); Field *field=item->get_tmp_table_field();
field->ptr[-1]= (byte) (field->is_null() ? 1 : 0); field->ptr[-1]= (byte) (field->is_null() ? 1 : 0);
} }
} }
...@@ -6926,7 +6926,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having) ...@@ -6926,7 +6926,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
Item *item; Item *item;
while ((item=it++)) while ((item=it++))
{ {
if (item->tmp_table_field() && ! item->const_item()) if (item->get_tmp_table_field() && ! item->const_item())
field_count++; field_count++;
} }
...@@ -7162,7 +7162,7 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length) ...@@ -7162,7 +7162,7 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length)
pos->field= ((Item_field*) (*order->item))->field; pos->field= ((Item_field*) (*order->item))->field;
else if (order->item[0]->type() == Item::SUM_FUNC_ITEM && else if (order->item[0]->type() == Item::SUM_FUNC_ITEM &&
!order->item[0]->const_item()) !order->item[0]->const_item())
pos->field= ((Item_sum*) order->item[0])->tmp_table_field(); pos->field= ((Item_sum*) order->item[0])->get_tmp_table_field();
else if (order->item[0]->type() == Item::COPY_STR_ITEM) else if (order->item[0]->type() == Item::COPY_STR_ITEM)
{ // Blob patch { // Blob patch
pos->item= ((Item_copy_string*) (*order->item))->item; pos->item= ((Item_copy_string*) (*order->item))->item;
...@@ -7759,7 +7759,7 @@ calc_group_buffer(JOIN *join,ORDER *group) ...@@ -7759,7 +7759,7 @@ calc_group_buffer(JOIN *join,ORDER *group)
join->group= 1; join->group= 1;
for (; group ; group=group->next) for (; group ; group=group->next)
{ {
Field *field=(*group->item)->tmp_table_field(); Field *field=(*group->item)->get_tmp_table_field();
if (field) if (field)
{ {
if (field->type() == FIELD_TYPE_BLOB) if (field->type() == FIELD_TYPE_BLOB)
...@@ -8103,7 +8103,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array, ...@@ -8103,7 +8103,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
{ {
item_field= item->get_tmp_table_item(thd); item_field= item->get_tmp_table_item(thd);
} }
else if ((field= item->tmp_table_field())) else if ((field= item->get_tmp_table_field()))
{ {
if (item->type() == Item::SUM_FUNC_ITEM && field->table->group) if (item->type() == Item::SUM_FUNC_ITEM && field->table->group)
item_field= ((Item_sum*) item)->result_item(field); item_field= ((Item_sum*) item)->result_item(field);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment