summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-05-06 15:05:59 +0400
committerAlexander Barkov <bar@mariadb.org>2017-05-06 15:05:59 +0400
commit5a644e177f152af6904160259b5e0afac2307747 (patch)
tree825a60c592fa430cc78f38c866434674e768be35
parent9a360e97a29d928f232ff724b450bd9e04cbe6e5 (diff)
downloadmariadb-git-5a644e177f152af6904160259b5e0afac2307747.tar.gz
Adding "const" qualifier to Item::cols(), and to the "Item *cmp" parameter to Type_handler::make_const_item_for_comparison()
-rw-r--r--sql/item.h12
-rw-r--r--sql/item_row.h2
-rw-r--r--sql/item_subselect.cc6
-rw-r--r--sql/item_subselect.h14
-rw-r--r--sql/sql_type.cc14
-rw-r--r--sql/sql_type.h16
6 files changed, 32 insertions, 32 deletions
diff --git a/sql/item.h b/sql/item.h
index e483ddecd15..62668e3e8e6 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1604,7 +1604,7 @@ public:
virtual Item **this_item_addr(THD *thd, Item **addr_arg) { return addr_arg; }
// Row emulation
- virtual uint cols() { return 1; }
+ virtual uint cols() const { return 1; }
virtual Item* element_index(uint i) { return this; }
virtual bool element_index_by_name(uint *idx, const LEX_CSTRING &name) const
{
@@ -2236,7 +2236,7 @@ public:
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
- uint cols() { return this_item()->cols(); }
+ uint cols() const { return this_item()->cols(); }
Item* element_index(uint i) { return this_item()->element_index(i); }
Item** addr(uint i) { return this_item()->addr(i); }
bool check_cols(uint c);
@@ -2836,7 +2836,7 @@ public:
const Type_handler *type_handler() const { return &type_handler_row; }
Item_result result_type() const{ return ROW_RESULT ; }
Item_result cmp_type() const { return ROW_RESULT; }
- uint cols() { return arg_count; }
+ uint cols() const { return arg_count; }
bool element_index_by_name(uint *idx, const LEX_CSTRING &name) const;
Item* element_index(uint i) { return arg_count ? args[i] : this; }
Item** addr(uint i) { return arg_count ? args + i : NULL; }
@@ -4390,7 +4390,7 @@ public:
virtual Ref_Type ref_type() { return REF; }
// Row emulation: forwarding of ROW-related calls to ref
- uint cols()
+ uint cols() const
{
return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1;
}
@@ -4638,7 +4638,7 @@ public:
{ return orig_item->field_for_view_update(); }
/* Row emulation: forwarding of ROW-related calls to orig_item */
- uint cols()
+ uint cols() const
{ return result_type() == ROW_RESULT ? orig_item->cols() : 1; }
Item* element_index(uint i)
{ return result_type() == ROW_RESULT ? orig_item->element_index(i) : this; }
@@ -5854,7 +5854,7 @@ public:
enum Item_result result_type() const { return ROW_RESULT; }
- uint cols() { return item_count; }
+ uint cols() const { return item_count; }
Item *element_index(uint i) { return values[i]; }
Item **addr(uint i) { return (Item **) (values + i); }
bool check_cols(uint c);
diff --git a/sql/item_row.h b/sql/item_row.h
index 5084f042473..16232d4ac4c 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -114,7 +114,7 @@ public:
Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
bool eval_not_null_tables(void *opt_arg);
- uint cols() { return arg_count; }
+ uint cols() const { return arg_count; }
Item* element_index(uint i) { return args[i]; }
Item** addr(uint i) { return args + i; }
bool check_cols(uint c);
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index b38bdcb7d4f..919ff381b85 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1264,7 +1264,7 @@ Item* Item_singlerow_subselect::expr_cache_insert_transformer(THD *tmp_thd,
}
-uint Item_singlerow_subselect::cols()
+uint Item_singlerow_subselect::cols() const
{
return engine->cols();
}
@@ -4263,7 +4263,7 @@ int subselect_indexsubquery_engine::exec()
}
-uint subselect_single_select_engine::cols()
+uint subselect_single_select_engine::cols() const
{
//psergey-sj-backport: the following assert was gone in 6.0:
//DBUG_ASSERT(select_lex->join != 0); // should be called after fix_fields()
@@ -4272,7 +4272,7 @@ uint subselect_single_select_engine::cols()
}
-uint subselect_union_engine::cols()
+uint subselect_union_engine::cols() const
{
DBUG_ASSERT(unit->is_prepared()); // should be called after fix_fields()
return unit->types.elements;
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 4c4af25edf5..215b2073ce8 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -309,7 +309,7 @@ public:
const Type_handler *type_handler() const;
void fix_length_and_dec();
- uint cols();
+ uint cols() const;
Item* element_index(uint i) { return reinterpret_cast<Item*>(row[i]); }
Item** addr(uint i) { return (Item**)row + i; }
bool check_cols(uint c);
@@ -819,7 +819,7 @@ public:
caller should call exec() again for the new engine.
*/
virtual int exec()= 0;
- virtual uint cols()= 0; /* return number of columns in select */
+ virtual uint cols() const= 0; /* return number of columns in select */
virtual uint8 uncacheable()= 0; /* query is uncacheable */
virtual void exclude()= 0;
virtual bool may_be_null() { return maybe_null; };
@@ -856,7 +856,7 @@ public:
int prepare(THD *thd);
void fix_length_and_dec(Item_cache** row);
int exec();
- uint cols();
+ uint cols() const;
uint8 uncacheable();
void exclude();
table_map upper_select_const_tables();
@@ -891,7 +891,7 @@ public:
int prepare(THD *);
void fix_length_and_dec(Item_cache** row);
int exec();
- uint cols();
+ uint cols() const;
uint8 uncacheable();
void exclude();
table_map upper_select_const_tables();
@@ -949,7 +949,7 @@ public:
int prepare(THD *);
void fix_length_and_dec(Item_cache** row);
int exec();
- uint cols() { return 1; }
+ uint cols() const { return 1; }
uint8 uncacheable() { return UNCACHEABLE_DEPENDENT_INJECTED; }
void exclude();
table_map upper_select_const_tables() { return 0; }
@@ -1087,7 +1087,7 @@ public:
int prepare(THD *);
int exec();
void print(String *str, enum_query_type query_type);
- uint cols() { return materialize_engine->cols(); }
+ uint cols() const { return materialize_engine->cols(); }
uint8 uncacheable() { return materialize_engine->uncacheable(); }
table_map upper_select_const_tables() { return 0; }
bool no_rows() { return !tmp_table->file->stats.records; }
@@ -1370,7 +1370,7 @@ public:
int prepare(THD *thd_arg) { set_thd(thd_arg); return 0; }
int exec();
void fix_length_and_dec(Item_cache**) {}
- uint cols() { /* TODO: what is the correct value? */ return 1; }
+ uint cols() const { /* TODO: what is the correct value? */ return 1; }
uint8 uncacheable() { return UNCACHEABLE_DEPENDENT; }
void exclude() {}
table_map upper_select_const_tables() { return 0; }
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 645b88f5daf..ff7754aebfe 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -4236,7 +4236,7 @@ bool Type_handler::
/***************************************************************************/
Item *Type_handler_int_result::
- make_const_item_for_comparison(THD *thd, Item *item, Item *cmp) const
+ make_const_item_for_comparison(THD *thd, Item *item, const Item *cmp) const
{
longlong result= item->val_int();
if (item->null_value)
@@ -4247,7 +4247,7 @@ Item *Type_handler_int_result::
Item *Type_handler_real_result::
- make_const_item_for_comparison(THD *thd, Item *item, Item *cmp) const
+ make_const_item_for_comparison(THD *thd, Item *item, const Item *cmp) const
{
double result= item->val_real();
if (item->null_value)
@@ -4258,7 +4258,7 @@ Item *Type_handler_real_result::
Item *Type_handler_decimal_result::
- make_const_item_for_comparison(THD *thd, Item *item, Item *cmp) const
+ make_const_item_for_comparison(THD *thd, Item *item, const Item *cmp) const
{
my_decimal decimal_value;
my_decimal *result= item->val_decimal(&decimal_value);
@@ -4270,7 +4270,7 @@ Item *Type_handler_decimal_result::
Item *Type_handler_string_result::
- make_const_item_for_comparison(THD *thd, Item *item, Item *cmp) const
+ make_const_item_for_comparison(THD *thd, Item *item, const Item *cmp) const
{
StringBuffer<MAX_FIELD_WIDTH> tmp;
String *result= item->val_str(&tmp);
@@ -4284,7 +4284,7 @@ Item *Type_handler_string_result::
Item *Type_handler_time_common::
- make_const_item_for_comparison(THD *thd, Item *item, Item *cmp) const
+ make_const_item_for_comparison(THD *thd, Item *item, const Item *cmp) const
{
Item_cache_temporal *cache;
longlong value= item->val_time_packed();
@@ -4298,7 +4298,7 @@ Item *Type_handler_time_common::
Item *Type_handler_temporal_with_date::
- make_const_item_for_comparison(THD *thd, Item *item, Item *cmp) const
+ make_const_item_for_comparison(THD *thd, Item *item, const Item *cmp) const
{
Item_cache_temporal *cache;
longlong value= item->val_datetime_packed();
@@ -4312,7 +4312,7 @@ Item *Type_handler_temporal_with_date::
Item *Type_handler_row::
- make_const_item_for_comparison(THD *thd, Item *item, Item *cmp) const
+ make_const_item_for_comparison(THD *thd, Item *item, const Item *cmp) const
{
if (item->type() == Item::ROW_ITEM && cmp->type() == Item::ROW_ITEM)
{
diff --git a/sql/sql_type.h b/sql/sql_type.h
index ef145456eb5..1780d0d25c6 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -765,7 +765,7 @@ public:
*/
virtual Item *make_const_item_for_comparison(THD *thd,
Item *src,
- Item *cmp) const= 0;
+ const Item *cmp) const= 0;
virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const= 0;
virtual bool set_comparator_func(Arg_comparator *cmp) const= 0;
virtual bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
@@ -955,7 +955,7 @@ public:
DBUG_ASSERT(0);
return false;
}
- Item *make_const_item_for_comparison(THD *thd, Item *src, Item *cmp) const;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
bool set_comparator_func(Arg_comparator *cmp) const;
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
@@ -1158,7 +1158,7 @@ public:
SORT_FIELD_ATTR *attr) const;
bool Item_save_in_value(Item *item, st_value *value) const;
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *thd, Item *src, Item *cmp) const;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
bool set_comparator_func(Arg_comparator *cmp) const;
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
@@ -1223,7 +1223,7 @@ public:
return Item_send_str(item, protocol, buf);
}
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *thd, Item *src, Item *cmp) const;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
bool set_comparator_func(Arg_comparator *cmp) const;
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
@@ -1280,7 +1280,7 @@ public:
SORT_FIELD_ATTR *attr) const;
bool Item_save_in_value(Item *item, st_value *value) const;
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *thd, Item *src, Item *cmp) const;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
bool set_comparator_func(Arg_comparator *cmp) const;
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
@@ -1424,7 +1424,7 @@ public:
Item *source_expr, Item *source_const) const;
bool subquery_type_allows_materialization(const Item *inner,
const Item *outer) const;
- Item *make_const_item_for_comparison(THD *thd, Item *src, Item *cmp) const;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
bool set_comparator_func(Arg_comparator *cmp) const;
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
@@ -1717,7 +1717,7 @@ public:
String *print_item_value(THD *thd, Item *item, String *str) const;
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
Item **items, uint nitems) const;
- Item *make_const_item_for_comparison(THD *thd, Item *src, Item *cmp) const;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
bool set_comparator_func(Arg_comparator *cmp) const;
cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
@@ -1761,7 +1761,7 @@ public:
return Item_send_date(item, protocol, buf);
}
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
- Item *make_const_item_for_comparison(THD *thd, Item *src, Item *cmp) const;
+ Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
bool set_comparator_func(Arg_comparator *cmp) const;
cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;