diff options
author | unknown <bell@laptop.sanja.is.com.ua> | 2003-10-12 17:56:05 +0300 |
---|---|---|
committer | unknown <bell@laptop.sanja.is.com.ua> | 2003-10-12 17:56:05 +0300 |
commit | 1d17fd7d51f7100038eaa5fb4cb372c785a44010 (patch) | |
tree | 2d243d69c4c8bafa98d2f0bd9b6ed43fea552637 /sql | |
parent | bc8f801bf0f239b85ee95ea5410915f0f5424fc1 (diff) | |
download | mariadb-git-1d17fd7d51f7100038eaa5fb4cb372c785a44010.tar.gz |
fixed printability of Items (all items except subselects)
(SCRUM) (WL#1274)
sql/item.cc:
fixed printability of Items
sql/item.h:
fixed printability of Items
sql/item_cmpfunc.cc:
fixed printability of Items
sql/item_cmpfunc.h:
fixed printability of Items
sql/item_func.cc:
fixed printability of Items
sql/item_func.h:
fixed printability of Items
sql/item_geofunc.h:
added DBUG_ASSERT to catch error in debuging timw
sql/item_row.cc:
fixed printability of Items
sql/item_row.h:
fixed printability of Items
sql/item_strfunc.cc:
fixed printability of Items
sql/item_strfunc.h:
fixed printability of Items
sql/item_sum.cc:
fixed printability of Items
sql/item_sum.h:
fixed printability of Items
sql/item_timefunc.cc:
fixed printability of Items
sql/item_timefunc.h:
layout fixed
fixed printability of Items
sql/item_uniq.h:
fixed printability of Items
sql/sql_yacc.yy:
layout fixed
correct convertion to String
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 16 | ||||
-rw-r--r-- | sql/item.h | 12 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 54 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 8 | ||||
-rw-r--r-- | sql/item_func.cc | 38 | ||||
-rw-r--r-- | sql/item_func.h | 8 | ||||
-rw-r--r-- | sql/item_geofunc.h | 3 | ||||
-rw-r--r-- | sql/item_row.cc | 12 | ||||
-rw-r--r-- | sql/item_row.h | 1 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 8 | ||||
-rw-r--r-- | sql/item_strfunc.h | 9 | ||||
-rw-r--r-- | sql/item_sum.cc | 33 | ||||
-rw-r--r-- | sql/item_sum.h | 2 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 78 | ||||
-rw-r--r-- | sql/item_timefunc.h | 24 | ||||
-rw-r--r-- | sql/item_uniq.h | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 31 |
17 files changed, 302 insertions, 37 deletions
diff --git a/sql/item.cc b/sql/item.cc index 4de4951cb51..ccca858c4c0 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -474,9 +474,19 @@ String *Item_real::val_str(String *str) void Item_string::print(String *str) { - str->append('\''); - str->append(full_name()); - str->append('\''); + str->append('_'); + str->append(collation.collation->csname); + if (varbin) + { + str->append(' '); + str->append(full_name()); + } + else + { + str->append('\''); + str->append(full_name()); + str->append('\''); + } } bool Item_null::eq(const Item *item, bool binary_cmp) const diff --git a/sql/item.h b/sql/item.h index a126a61e32e..5e6df464fb3 100644 --- a/sql/item.h +++ b/sql/item.h @@ -449,9 +449,11 @@ public: class Item_string :public Item { + bool varbin; public: Item_string(const char *str,uint length, CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) + :varbin(0) { collation.set(cs, dv); str_value.set(str,length,cs); @@ -461,6 +463,7 @@ public: } Item_string(const char *name_par, const char *str, uint length, CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) + :varbin(0) { collation.set(cs, dv); str_value.set(str,length,cs); @@ -494,6 +497,7 @@ public: } String *const_string() { return &str_value; } inline void append(char *str, uint length) { str_value.append(str, length); } + inline void set_varbin_name(char *nm) { name= nm; varbin= 1; } void print(String *str); }; @@ -646,7 +650,7 @@ public: bool get_date(TIME *ltime, bool fuzzydate); void print(String *str) { - str->append("ref_null_helper("); + str->append("<ref_null_helper>("); if (ref && *ref) (*ref)->print(str); else @@ -664,6 +668,12 @@ public: :Item_ref_null_helper(master, &store, table_name_par, field_name_par), store(item) {} + void print(String *str) + { + str->append("<null_helper>("); + store->print(str); + str->append(')'); + } }; /* diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 4e6301d2626..23b322ebd01 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -704,6 +704,18 @@ longlong Item_func_between::val_int() return 0; } + +void Item_func_between::print(String *str) +{ + str->append('('); + args[0]->print(str); + str->append(" between "); + args[1]->print(str); + str->append(" and "); + args[2]->print(str); + str->append(')'); +} + void Item_func_ifnull::fix_length_and_dec() { @@ -1097,7 +1109,27 @@ void Item_func_case::fix_length_and_dec() void Item_func_case::print(String *str) { - str->append("case "); // Not yet complete + str->append("(case "); + if (first_expr_num != -1) + { + args[first_expr_num]->print(str); + str->append(' '); + } + for (uint i=0 ; i < ncases ; i+=2) + { + str->append("when "); + args[i]->print(str); + str->append(" then "); + args[i+1]->print(str); + str->append(' '); + } + if (else_expr_num != -1) + { + str->append("else "); + args[else_expr_num]->print(str); + str->append(' '); + } + str->append("end)"); } /* @@ -1504,8 +1536,15 @@ void Item_func_in::fix_length_and_dec() void Item_func_in::print(String *str) { str->append('('); - Item_func::print(str); - str->append(')'); + args[0]->print(str); + str->append(" IN ("); + for (uint i=1 ; i < arg_count ; i++) + { + if (i > 1) + str->append(','); + args[i]->print(str); + } + str->append("))"); } @@ -1866,12 +1905,21 @@ void Item_is_not_null_test::update_used_tables() } } + longlong Item_func_isnotnull::val_int() { return args[0]->is_null() ? 0 : 1; } +void Item_func_isnotnull::print(String *str) +{ + str->append('('); + args[0]->print(str); + str->append(" is not null)"); +} + + longlong Item_func_like::val_int() { String* res = args[0]->val_str(&tmp_value1); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 42b73c48606..ab03782b168 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -105,7 +105,7 @@ public: Item_in_optimizer return NULL, else it evaluate Item_in_subselect. */ longlong val_int(); - const char *func_name() const { return "IN_OPTIMIZER"; } + const char *func_name() const { return "<in_optimizer>"; } Item_cache **get_cache() { return &cache; } }; @@ -262,6 +262,7 @@ public: enum Functype functype() const { return BETWEEN; } const char *func_name() const { return "between"; } void fix_length_and_dec(); + void print(String *str); }; @@ -704,7 +705,7 @@ public: {} enum Functype functype() const { return ISNOTNULLTEST_FUNC; } longlong val_int(); - const char *func_name() const { return "is_not_null_test"; } + const char *func_name() const { return "<is_not_null_test>"; } void update_used_tables(); }; @@ -722,6 +723,7 @@ public: const char *func_name() const { return "isnotnull"; } optimize_type select_optimize() const { return OPTIMIZE_NULL; } table_map not_null_tables() const { return 0; } + void print(String *str); }; @@ -775,6 +777,7 @@ public: longlong val_int(); bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref); const char *func_name() const { return "regex"; } + void print(String *str) { print_op(str); } }; #else @@ -785,6 +788,7 @@ public: Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b) {} longlong val_int() { return 0;} const char *func_name() const { return "regex"; } + void print(String *str) { print_op(str); } }; #endif /* USE_REGEX */ diff --git a/sql/item_func.cc b/sql/item_func.cc index bc7c95d8929..5b3e6aa3139 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -462,6 +462,24 @@ String *Item_num_op::val_str(String *str) } +void Item_func_signed::print(String *str) +{ + str->append("cast("); + args[0]->print(str); + str->append("as signed)"); + +} + + +void Item_func_unsigned::print(String *str) +{ + str->append("cast("); + args[0]->print(str); + str->append("as unsigned)"); + +} + + double Item_func_plus::val() { double value=args[0]->val()+args[1]->val(); @@ -2762,6 +2780,26 @@ double Item_func_match::val() DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, record, 0)); } +void Item_func_match::print(String *str) +{ + str->append("(match "); + List_iterator_fast<Item> li(fields); + Item *item; + bool first= 1; + while ((item= li++)) + { + if (first) + first= 0; + else + str->append(','); + item->print(str); + } + str->append(" against ("); + args[0]->print(str); + if (mode == FT_BOOL) + str->append(" in boolean mode"); + str->append("))"); +} longlong Item_func_bit_xor::val_int() { diff --git a/sql/item_func.h b/sql/item_func.h index 8086e65786d..2e275c1a3f7 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -214,6 +214,7 @@ public: longlong val_int() { return args[0]->val_int(); } void fix_length_and_dec() { max_length=args[0]->max_length; unsigned_flag=0; } + void print(String *str); }; @@ -225,6 +226,7 @@ public: longlong val_int() { return args[0]->val_int(); } void fix_length_and_dec() { max_length=args[0]->max_length; unsigned_flag=1; } + void print(String *str); }; @@ -662,6 +664,7 @@ public: longlong val_int(); const char *func_name() const { return "|"; } void fix_length_and_dec() { unsigned_flag=1; } + void print(String *str) { print_op(str); } }; class Item_func_bit_and :public Item_int_func @@ -671,6 +674,7 @@ public: longlong val_int(); const char *func_name() const { return "&"; } void fix_length_and_dec() { unsigned_flag=1; } + void print(String *str) { print_op(str); } }; class Item_func_bit_count :public Item_int_func @@ -689,6 +693,7 @@ public: longlong val_int(); const char *func_name() const { return "<<"; } void fix_length_and_dec() { unsigned_flag=1; } + void print(String *str) { print_op(str); } }; class Item_func_shift_right :public Item_int_func @@ -697,6 +702,7 @@ public: Item_func_shift_right(Item *a,Item *b) :Item_int_func(a,b) {} longlong val_int(); const char *func_name() const { return ">>"; } + void print(String *str) { print_op(str); } }; class Item_func_bit_neg :public Item_int_func @@ -996,6 +1002,7 @@ public: bool eq(const Item *, bool binary_cmp) const; longlong val_int() { return val()!=0.0; } double val(); + void print(String *str); bool fix_index(); void init_search(bool no_order); @@ -1031,6 +1038,7 @@ public: longlong val_int(); const char *func_name() const { return "^"; } void fix_length_xor_dec() { unsigned_flag=1; } + void print(String *str) { print_op(str); } }; class Item_func_is_free_lock :public Item_int_func diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 79e45cca26f..72dc6620f3b 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -118,6 +118,7 @@ public: case SP_EXTERIORRING: return "exteriorring"; default: + DBUG_ASSERT(0); // Should never happened return "spatial_decomp_unknown"; } } @@ -142,6 +143,7 @@ public: case SP_INTERIORRINGN: return "interiorringn"; default: + DBUG_ASSERT(0); // Should never happened return "spatial_decomp_n_unknown"; } } @@ -210,6 +212,7 @@ public: case SP_OVERLAPS_FUNC: return "overlaps"; default: + DBUG_ASSERT(0); // Should never happened return "sp_unknown"; } } diff --git a/sql/item_row.cc b/sql/item_row.cc index fcc6e5192ec..89b38c8a753 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -118,6 +118,18 @@ bool Item_row::check_cols(uint c) return 0; } +void Item_row::print(String *str) +{ + str->append('('); + for (uint i= 0; i < arg_count; i++) + { + if (i) + str->append(','); + items[i]->print(str); + } + str->append(')'); +} + bool Item_row::walk(Item_processor processor, byte *arg) { for (uint i= 0; i < arg_count; i++) diff --git a/sql/item_row.h b/sql/item_row.h index 6dd955ed426..a09bd1a2c31 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -68,6 +68,7 @@ public: bool const_item() const { return const_item_cache; }; enum Item_result result_type() const { return ROW_RESULT; } void update_used_tables(); + void print(String *str); bool walk(Item_processor processor, byte *arg); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c8ee64dc707..80767fb8866 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2269,6 +2269,14 @@ String *Item_func_hex::val_str(String *str) } +void Item_func_binary::print(String *str) +{ + str->append("cast("); + args[0]->print(str); + str->append("as binary)"); +} + + #include <my_dir.h> // For my_stat String *Item_load_file::val_str(String *str) diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index b82dacb4fe0..51dff0fbaf2 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -120,6 +120,7 @@ public: Item_func_reverse(Item *a) :Item_str_func(a) {} String *val_str(String *); void fix_length_and_dec(); + const char *func_name() const { return "reverse"; } }; @@ -324,10 +325,12 @@ public: Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {} String *val_str(String *); void fix_length_and_dec() { maybe_null=1; max_length = 13; } + const char *func_name() const { return "ecrypt"; } }; #include "sql_crypt.h" + class Item_func_encode :public Item_str_func { protected: @@ -337,13 +340,16 @@ public: Item_str_func(a),sql_crypt(seed) {} String *val_str(String *); void fix_length_and_dec(); + const char *func_name() const { return "encode"; } }; + class Item_func_decode :public Item_func_encode { public: Item_func_decode(Item *a, char *seed): Item_func_encode(a,seed) {} String *val_str(String *); + const char *func_name() const { return "decode"; } }; @@ -520,7 +526,6 @@ class Item_func_binary :public Item_str_func { public: Item_func_binary(Item *a) :Item_str_func(a) {} - const char *func_name() const { return "binary"; } String *val_str(String *a) { String *tmp=args[0]->val_str(a); @@ -534,7 +539,7 @@ public: collation.set(&my_charset_bin); max_length=args[0]->max_length; } - void print(String *str) { print_op(str); } + void print(String *str); }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 967abbc5ab8..b61c19f994d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1343,6 +1343,14 @@ longlong Item_sum_count_distinct::val_int() return table->file->records; } + +void Item_sum_count_distinct::print(String *str) +{ + str->append("count(distinct "); + args[0]->print(str); + str->append(')'); +} + /**************************************************************************** ** Functions to handle dynamic loadable aggregates ** Original source by: Alexis Mikhailov <root@medinf.chuvashia.su> @@ -1936,3 +1944,28 @@ String* Item_func_group_concat::val_str(String* str) } return &result; } + +void Item_func_group_concat::print(String *str) +{ + str->append("group concat("); + if (distinct) + str->append(" distinct "); + for (uint i= 0; i < arg_count; i++) + { + if (i) + str->append(','); + args[i]->print(str); + } + if (arg_count_order) + { + for (uint i= 0 ; i < arg_count_order ; i++) + { + if (i) + str->append(','); + (*order[i]->item)->print(str); + } + } + str->append(" seperator \'"); + str->append(*separator); + str->append("\')"); +} diff --git a/sql/item_sum.h b/sql/item_sum.h index d6184bcdbac..36b38c22e08 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -238,6 +238,7 @@ class Item_sum_count_distinct :public Item_sum_int void make_unique(); Item *copy_or_same(THD* thd); void no_rows_in_result() {} + void print(String *str); }; @@ -736,4 +737,5 @@ class Item_func_group_concat : public Item_sum String* val_str(String* str); Item *copy_or_same(THD* thd); void no_rows_in_result() {} + void print(String *str); }; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 31ce2ad9cdc..511e372e40a 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1359,6 +1359,35 @@ longlong Item_date_add_interval::val_int() ((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second; } +static const char *interval_names[]= +{ + "year", "month", "day", "hour", "minute", + "second", "microsecond", "year_month", + "day_hour", "day_minute", "day_second", + "hour_minute", "hour_second", "minute_second", + "day_microsecond", "hour_microsecond", + "minute_microsecond", "second_microsecond" +}; + +void Item_date_add_interval::print(String *str) +{ + str->append('('); + args[0]->print(str); + str->append(date_sub_interval?" - interval ":" + interval "); + args[1]->print(str); + str->append(interval_names[int_type]); + str->append(')'); +} + +void Item_extract::print(String *str) +{ + str->append("extract("); + str->append(interval_names[int_type]); + str->append(' '); + args[0]->print(str); + str->append(')'); +} + void Item_extract::fix_length_and_dec() { value.alloc(32); // alloc buffer @@ -1467,10 +1496,31 @@ bool Item_extract::eq(const Item *item, bool binary_cmp) const void Item_typecast::print(String *str) { - str->append("CAST("); + str->append("cast("); args[0]->print(str); - str->append(" AS "); - str->append(func_name()); + str->append(" as "); + str->append(cast_type()); + str->append(')'); +} + +void Item_char_typecast::print(String *str) +{ + str->append("cast("); + args[0]->print(str); + str->append(" as char"); + if (cast_length >= 0) + { + str->append('('); + char buff[10]; + snprintf(buff, 10, "%d", cast_length); + str->append(buff); + str->append(')'); + } + if (cast_cs) + { + str->append(" charset "); + str->append(cast_cs->name); + } str->append(')'); } @@ -1740,6 +1790,28 @@ null_date: return 0; } + +void Item_func_add_time::print(String *str) +{ + if (is_date) + { + DBUG_ASSERT(sign > 0); + str->append("timestamp("); + } + else + { + if (sign > 0) + str->append("addtime("); + else + str->append("subtime("); + } + args[0]->print(str); + str->append(','); + args[0]->print(str); + str->append(')'); +} + + /* TIMEDIFF(t,s) is a time function that calculates the time value between a start and end time. diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 6dcf7d00ce1..123a9cd32dd 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -544,13 +544,13 @@ public: enum interval_type { INTERVAL_YEAR, INTERVAL_MONTH, INTERVAL_DAY, INTERVAL_HOUR, INTERVAL_MINUTE, - INTERVAL_SECOND, INTERVAL_MICROSECOND ,INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, - INTERVAL_DAY_MINUTE, INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, - INTERVAL_HOUR_SECOND, INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, - INTERVAL_HOUR_MICROSECOND, INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND + INTERVAL_SECOND, INTERVAL_MICROSECOND ,INTERVAL_YEAR_MONTH, + INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE, INTERVAL_DAY_SECOND, + INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND, INTERVAL_MINUTE_SECOND, + INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND, + INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND }; - class Item_date_add_interval :public Item_date_func { const interval_type int_type; @@ -568,6 +568,7 @@ public: double val() { return (double) val_int(); } longlong val_int(); bool get_date(TIME *res,bool fuzzy_date); + void print(String *str); }; @@ -583,6 +584,7 @@ class Item_extract :public Item_int_func const char *func_name() const { return "extract"; } void fix_length_and_dec(); bool eq(const Item *item, bool binary_cmp) const; + void print(String *str); }; @@ -590,7 +592,6 @@ class Item_typecast :public Item_str_func { public: Item_typecast(Item *a) :Item_str_func(a) {} - const char *func_name() const { return "char"; } String *val_str(String *a) { String *tmp=args[0]->val_str(a); @@ -604,6 +605,7 @@ public: collation.set(default_charset()); max_length=args[0]->max_length; } + virtual const char* cast_type() const= 0; void print(String *str); }; @@ -617,8 +619,10 @@ class Item_char_typecast :public Item_typecast public: Item_char_typecast(Item *a, int length_arg, CHARSET_INFO *cs_arg) :Item_typecast(a), cast_length(length_arg), cast_cs(cs_arg) {} + const char* cast_type() const { return "char"; }; String *val_str(String *a); void fix_length_and_dec(); + void print(String *str); }; @@ -628,7 +632,7 @@ public: Item_date_typecast(Item *a) :Item_typecast(a) {} String *val_str(String *str); bool get_date(TIME *ltime, bool fuzzy_date); - const char *func_name() const { return "date"; } + const char *cast_type() const { return "date"; } enum_field_types field_type() const { return MYSQL_TYPE_DATE; } Field *tmp_table_field(TABLE *t_arg) { @@ -643,7 +647,7 @@ public: Item_time_typecast(Item *a) :Item_typecast(a) {} String *val_str(String *str); bool get_time(TIME *ltime); - const char *func_name() const { return "time"; } + const char *cast_type() const { return "time"; } enum_field_types field_type() const { return MYSQL_TYPE_TIME; } Field *tmp_table_field(TABLE *t_arg) { @@ -657,7 +661,7 @@ class Item_datetime_typecast :public Item_typecast public: Item_datetime_typecast(Item *a) :Item_typecast(a) {} String *val_str(String *str); - const char *func_name() const { return "datetime"; } + const char *cast_type() const { return "datetime"; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } Field *tmp_table_field(TABLE *t_arg) { @@ -694,7 +698,6 @@ public: Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg) :Item_str_func(a, b), is_date(type_arg) { sign= neg_arg ? -1 : 1; } String *val_str(String *str); - const char *func_name() const { return "addtime"; } enum_field_types field_type() const { return cached_field_type; } void fix_length_and_dec(); @@ -711,6 +714,7 @@ public: return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin)); return (new Field_string(max_length, maybe_null, name, t_arg, &my_charset_bin)); } + void print(String *str); }; class Item_func_timediff :public Item_str_func diff --git a/sql/item_uniq.h b/sql/item_uniq.h index 9b370b70181..2101fc4e45a 100644 --- a/sql/item_uniq.h +++ b/sql/item_uniq.h @@ -29,6 +29,7 @@ public: :Item_real_func(list) {} double val() { return 0.0; } void fix_length_and_dec() { decimals=0; max_length=6; } + void print(String *str) { str->append("0.0"); } }; @@ -54,4 +55,5 @@ public: { return new Item_sum_unique_users(thd, *this); } + void print(String *str) { str->append("0.0"); } }; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 81a59196e3c..ebe05ec565f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2879,17 +2879,19 @@ opt_gconcat_separator: opt_gorder_clause: - /* empty */ - { - LEX *lex=Lex; - lex->gorder_list = NULL; - } - | order_clause - { - LEX *lex=Lex; - lex->gorder_list= (SQL_LIST*) sql_memdup((char*) &lex->current_select->order_list,sizeof(st_sql_list)); - lex->current_select->order_list.empty(); - }; + /* empty */ + { + LEX *lex=Lex; + lex->gorder_list = NULL; + } + | order_clause + { + LEX *lex=Lex; + lex->gorder_list= + (SQL_LIST*) sql_memdup((char*) &lex->current_select->order_list, + sizeof(st_sql_list)); + lex->current_select->order_list.empty(); + }; in_sum_expr: @@ -4289,8 +4291,11 @@ literal: { Item *tmp= new Item_varbinary($2.str,$2.length); String *str= tmp ? tmp->val_str((String*) 0) : (String*) 0; - $$ = new Item_string(str ? str->ptr() : "", str ? str->length() : - 0, Lex->charset); + Item_string *item = new Item_string(str ? str->ptr() : "", + str ? str->length() : + 0, Lex->charset); + item->set_varbin_name(tmp->name); + $$= item; } | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } |