diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-03-12 13:40:52 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-03-12 13:40:52 +0400 |
commit | ba3573cae8f0d269452cc6213f1a8243e455830e (patch) | |
tree | e70ce47a61392beb911a2856b34f84634fb534ac /sql | |
parent | a71e2d23bd08ca041a953df44f2235a8ef20bfcc (diff) | |
download | mariadb-git-ba3573cae8f0d269452cc6213f1a8243e455830e.tar.gz |
Clean-up:
- Renaming Item::is_bool_func() to is_bool_type(), to avoid assumption
that the item is an Item_func derivant.
- Deriving Item_func_spatial_rel from Item_bool_func rather than Item_int_func
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 3 | ||||
-rw-r--r-- | sql/item_geofunc.cc | 4 | ||||
-rw-r--r-- | sql/item_geofunc.h | 4 | ||||
-rw-r--r-- | sql/item_xmlfunc.cc | 12 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 |
6 files changed, 11 insertions, 16 deletions
diff --git a/sql/item.h b/sql/item.h index 4a57be8e9ce..24ae105421b 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1123,7 +1123,7 @@ public: */ virtual void set_result_field(Field *field) {} virtual bool is_result_field() { return 0; } - virtual bool is_bool_func() { return 0; } + virtual bool is_bool_type() { return false; } virtual void save_in_result_field(bool no_conversions) {} /* set value of aggregate function in case of no rows for grouping were found diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 65dbc6265d0..685e9105aa3 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -128,7 +128,7 @@ public: Item_bool_func(Item *a, Item *b, Item *c) :Item_int_func(a, b, c) {} Item_bool_func(List<Item> &list) :Item_int_func(list) { } Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {} - bool is_bool_func() { return 1; } + bool is_bool_type() { return true; } void fix_length_and_dec() { decimals=0; max_length=1; } uint decimal_precision() const { return 1; } }; @@ -847,7 +847,6 @@ public: longlong int_op(); String *str_op(String *str); my_decimal *decimal_op(my_decimal *); - bool is_bool_func() { return false; } void fix_length_and_dec(); uint decimal_precision() const { return m_args0_copy->decimal_precision(); } const char *func_name() const { return "nullif"; } diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index e67ab9115e9..7e8edbc8e7d 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -1001,14 +1001,14 @@ longlong Item_func_spatial_mbr_rel::val_int() Item_func_spatial_rel::Item_func_spatial_rel(Item *a,Item *b, enum Functype sp_rel) : - Item_int_func(a,b), collector() + Item_bool_func(a,b), collector() { spatial_rel = sp_rel; } Item_func_spatial_rel::Item_func_spatial_rel(Item *a,Item *b, Item *mask) : - Item_int_func(a,b,mask), spatial_rel(SP_RELATE_FUNC) + Item_bool_func(a,b,mask), spatial_rel(SP_RELATE_FUNC) {} diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 64863ed7d18..7ba2d0487bc 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -294,7 +294,7 @@ public: }; -class Item_func_spatial_rel: public Item_int_func +class Item_func_spatial_rel: public Item_bool_func { enum Functype spatial_rel; Gcalc_heap collector; @@ -317,9 +317,7 @@ public: Item_func::print(str, query_type); } - void fix_length_and_dec() { maybe_null= 1; } bool is_null() { (void) val_int(); return null_value; } - bool is_bool_func() { return 1; } uint decimal_precision() const { return 1; } optimize_type select_optimize() const { return OPTIMIZE_OP; } }; diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index f8bf7cbf93a..24441cd80e8 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -392,7 +392,7 @@ class Item_bool :public Item_int public: Item_bool(int32 i): Item_int(i) {} const char *func_name() const { return "xpath_bool"; } - bool is_bool_func() { return 1; } + bool is_bool_type() { return true; } }; @@ -402,15 +402,14 @@ public: * a node-set is true if and only if it is non-empty * a string is true if and only if its length is non-zero */ -class Item_xpath_cast_bool :public Item_int_func +class Item_xpath_cast_bool :public Item_bool_func { String *pxml; String tmp_value; public: Item_xpath_cast_bool(Item *a, String *pxml_arg) - :Item_int_func(a), pxml(pxml_arg) {} + :Item_bool_func(a), pxml(pxml_arg) {} const char *func_name() const { return "xpath_cast_bool"; } - bool is_bool_func() { return 1; } longlong val_int() { if (args[0]->type() == XPATH_NODESET) @@ -568,7 +567,6 @@ public: :Item_bool_func(nodeset,cmpfunc), pxml(p) {} enum Type type() const { return XPATH_NODESET_CMP; }; const char *func_name() const { return "xpath_nodeset_to_const_comparator"; } - bool is_bool_func() { return 1; } bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); @@ -823,7 +821,7 @@ String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset) flt->pos, size); int index= (int) (args[1]->val_int()) - 1; - if (index >= 0 && (flt->pos == (uint) index || args[1]->is_bool_func())) + if (index >= 0 && (flt->pos == (uint) index || args[1]->is_bool_type())) ((XPathFilter*)nodeset)->append_element(flt->num, pos++); } return nodeset; @@ -1732,7 +1730,7 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath) xpath->item= nodeset2bool(xpath, xpath->item); - if (xpath->item->is_bool_func()) + if (xpath->item->is_bool_type()) { xpath->context= new Item_nodeset_func_predicate(prev_context, xpath->item, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index dcf79183ecf..0837a70fb0c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8755,7 +8755,7 @@ Item *negate_expression(THD *thd, Item *expr) /* it is NOT(NOT( ... )) */ Item *arg= ((Item_func *) expr)->arguments()[0]; enum_parsing_place place= thd->lex->current_select->parsing_place; - if (arg->is_bool_func() || place == IN_WHERE || place == IN_HAVING) + if (arg->is_bool_type() || place == IN_WHERE || place == IN_HAVING) return arg; /* if it is not boolean function then we have to emulate value of |