summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc1
-rw-r--r--sql/item_cmpfunc.h79
-rw-r--r--sql/item_func.cc23
-rw-r--r--sql/item_func.h256
-rw-r--r--sql/item_geofunc.h33
-rw-r--r--sql/item_inetfunc.h4
-rw-r--r--sql/item_jsonfunc.cc7
-rw-r--r--sql/item_jsonfunc.h29
-rw-r--r--sql/item_strfunc.h8
-rw-r--r--sql/item_timefunc.h67
10 files changed, 306 insertions, 201 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 717a65489f6..b6c0fe9febe 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5519,6 +5519,7 @@ Item_func_regexp_instr::fix_length_and_dec()
re.init(cmp_collation.collation, 0, 1);
re.fix_owner(this, args[0], args[1]);
+ max_length= MY_INT32_NUM_DECIMAL_DIGITS; // See also Item_func_locate
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 6d604b3a2fc..5be8ab4f705 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -204,7 +204,12 @@ public:
Item_bool_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
Item_bool_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
+ const Type_handler *type_handler() const { return &type_handler_long; }
bool is_bool_type() { return true; }
+ Field *create_tmp_field(bool group, TABLE *table)
+ { return tmp_table_field_from_field_type(table); }
+ Field *create_field_for_create_select(TABLE *table)
+ { return tmp_table_field_from_field_type(table); }
virtual CHARSET_INFO *compare_collation() const { return NULL; }
void fix_length_and_dec() { decimals=0; max_length=1; }
uint decimal_precision() const { return 1; }
@@ -919,13 +924,13 @@ public:
};
-class Item_func_strcmp :public Item_int_func
+class Item_func_strcmp :public Item_long_func
{
String value1, value2;
DTCollation cmp_collation;
public:
Item_func_strcmp(THD *thd, Item *a, Item *b):
- Item_int_func(thd, a, b) {}
+ Item_long_func(thd, a, b) {}
longlong val_int();
uint decimal_precision() const { return 1; }
const char *func_name() const { return "strcmp"; }
@@ -946,14 +951,14 @@ struct interval_range
my_decimal dec;
};
-class Item_func_interval :public Item_int_func
+class Item_func_interval :public Item_long_func
{
Item_row *row;
bool use_decimal_comparison;
interval_range *intervals;
public:
Item_func_interval(THD *thd, Item_row *a):
- Item_int_func(thd, a), row(a), intervals(0)
+ Item_long_func(thd, a), row(a), intervals(0)
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
@@ -2661,12 +2666,19 @@ public:
};
-class Item_func_regexp_instr :public Item_int_func
+/*
+ In the corner case REGEXP_INSTR could return (2^32 + 1),
+ which would not fit into Item_long_func range.
+ But string lengths are limited with max_allowed_packet,
+ which cannot be bigger than 1024*1024*1024.
+*/
+class Item_func_regexp_instr :public Item_long_func
{
Regexp_processor_pcre re;
DTCollation cmp_collation;
public:
- Item_func_regexp_instr(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b)
+ Item_func_regexp_instr(THD *thd, Item *a, Item *b)
+ :Item_long_func(thd, a, b)
{}
void cleanup()
{
@@ -3130,6 +3142,61 @@ public:
{ return get_item_copy<Item_func_dyncol_exists>(thd, mem_root, this); }
};
+
+class Item_func_cursor_bool_attr: public Item_bool_func, public Cursor_ref
+{
+public:
+ Item_func_cursor_bool_attr(THD *thd, const LEX_CSTRING *name, uint offset)
+ :Item_bool_func(thd), Cursor_ref(name, offset)
+ { }
+ bool check_vcol_func_processor(void *arg)
+ {
+ return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC);
+ }
+ void print(String *str, enum_query_type query_type)
+ {
+ Cursor_ref::print_func(str, func_name());
+ }
+};
+
+
+class Item_func_cursor_isopen: public Item_func_cursor_bool_attr
+{
+public:
+ Item_func_cursor_isopen(THD *thd, const LEX_CSTRING *name, uint offset)
+ :Item_func_cursor_bool_attr(thd, name, offset) { }
+ const char *func_name() const { return "%ISOPEN"; }
+ longlong val_int();
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_cursor_isopen>(thd, mem_root, this); }
+};
+
+
+class Item_func_cursor_found: public Item_func_cursor_bool_attr
+{
+public:
+ Item_func_cursor_found(THD *thd, const LEX_CSTRING *name, uint offset)
+ :Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; }
+ const char *func_name() const { return "%FOUND"; }
+ longlong val_int();
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_cursor_found>(thd, mem_root, this); }
+};
+
+
+class Item_func_cursor_notfound: public Item_func_cursor_bool_attr
+{
+public:
+ Item_func_cursor_notfound(THD *thd, const LEX_CSTRING *name, uint offset)
+ :Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; }
+ const char *func_name() const { return "%NOTFOUND"; }
+ longlong val_int();
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_cursor_notfound>(thd, mem_root, this); }
+};
+
+
+
inline bool is_cond_or(Item *item)
{
if (item->type() != Item::COND_ITEM)
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 3461427331b..95015d4e074 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -632,7 +632,7 @@ String *Item_int_func::val_str(String *str)
void Item_func_connection_id::fix_length_and_dec()
{
- Item_int_func::fix_length_and_dec();
+ Item_long_func::fix_length_and_dec();
max_length= 10;
}
@@ -2709,6 +2709,14 @@ my_decimal *Item_func_min_max::val_decimal_native(my_decimal *dec)
}
+longlong Item_func_bit_length::val_int()
+{
+ DBUG_ASSERT(fixed == 1);
+ String *res= args[0]->val_str(&value);
+ return (null_value= !res) ? 0 : (longlong) res->length() * 8;
+}
+
+
longlong Item_func_octet_length::val_int()
{
DBUG_ASSERT(fixed == 1);
@@ -2745,13 +2753,6 @@ longlong Item_func_coercibility::val_int()
}
-void Item_func_locate::fix_length_and_dec()
-{
- max_length= MY_INT32_NUM_DECIMAL_DIGITS;
- agg_arg_charsets_for_comparison(cmp_collation, args, 2);
-}
-
-
longlong Item_func_locate::val_int()
{
DBUG_ASSERT(fixed == 1);
@@ -6624,14 +6625,14 @@ void Item_func_last_value::fix_length_and_dec()
}
-void Item_func_cursor_int_attr::print(String *str, enum_query_type query_type)
+void Cursor_ref::print_func(String *str, const char *func_name)
{
append_identifier(current_thd, str, m_cursor_name.str, m_cursor_name.length);
- str->append(func_name());
+ str->append(func_name);
}
-sp_cursor *Item_func_cursor_int_attr::get_open_cursor_or_error()
+sp_cursor *Cursor_ref::get_open_cursor_or_error()
{
THD *thd= current_thd;
sp_cursor *c= thd->spcont->get_cursor(m_cursor_offset);
diff --git a/sql/item_func.h b/sql/item_func.h
index baa80ede03f..f7cbc165951 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -715,6 +715,12 @@ class Item_num_op :public Item_func_numhybrid
class Item_int_func :public Item_func
{
public:
+ /*
+ QQ: shouldn't 20 characters be enough:
+ Max unsigned = 18,446,744,073,709,551,615 = 20 digits, 20 characters
+ Max signed = 9,223,372,036,854,775,807 = 19 digits, 19 characters
+ Min signed = -9,223,372,036,854,775,808 = 19 digits, 20 characters
+ */
Item_int_func(THD *thd): Item_func(thd)
{ collation.set_numeric(); fix_char_length(21); }
Item_int_func(THD *thd, Item *a): Item_func(thd, a)
@@ -737,82 +743,85 @@ public:
};
-class Item_func_cursor_int_attr: public Item_int_func
+class Item_long_func: public Item_int_func
{
-protected:
- LEX_CSTRING m_cursor_name;
- uint m_cursor_offset;
- class sp_cursor *get_open_cursor_or_error();
public:
- Item_func_cursor_int_attr(THD *thd, const LEX_CSTRING *name, uint offset)
- :Item_int_func(thd), m_cursor_name(*name), m_cursor_offset(offset)
- { }
- bool check_vcol_func_processor(void *arg)
- {
- return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC);
- }
- void print(String *str, enum_query_type query_type);
+ Item_long_func(THD *thd): Item_int_func(thd) { }
+ Item_long_func(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_long_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_long_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
+ Item_long_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
+ Item_long_func(THD *thd, Item_long_func *item) :Item_int_func(thd, item) {}
+ const Type_handler *type_handler() const { return &type_handler_long; }
+ Field *create_tmp_field(bool group, TABLE *table)
+ { return tmp_table_field_from_field_type(table); }
+ Field *create_field_for_create_select(TABLE *table)
+ { return tmp_table_field_from_field_type(table); }
+ void fix_length_and_dec() { max_length= 11; }
};
-class Item_func_cursor_isopen: public Item_func_cursor_int_attr
+class Item_longlong_func: public Item_int_func
{
public:
- Item_func_cursor_isopen(THD *thd, const LEX_CSTRING *name, uint offset)
- :Item_func_cursor_int_attr(thd, name, offset) { }
- const char *func_name() const { return "%ISOPEN"; }
- void fix_length_and_dec() { max_length= 1; }
- longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cursor_isopen>(thd, mem_root, this); }
+ Item_longlong_func(THD *thd): Item_int_func(thd) { }
+ Item_longlong_func(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_longlong_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_longlong_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
+ Item_longlong_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
+ Item_int_func(thd, a, b, c, d) {}
+ Item_longlong_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
+ Item_longlong_func(THD *thd, Item_longlong_func *item) :Item_int_func(thd, item) {}
+ const Type_handler *type_handler() const { return &type_handler_longlong; }
+ Field *create_tmp_field(bool group, TABLE *table)
+ { return tmp_table_field_from_field_type(table); }
+ Field *create_field_for_create_select(TABLE *table)
+ { return tmp_table_field_from_field_type(table); }
};
-class Item_func_cursor_found: public Item_func_cursor_int_attr
+class Cursor_ref
{
-public:
- Item_func_cursor_found(THD *thd, const LEX_CSTRING *name, uint offset)
- :Item_func_cursor_int_attr(thd, name, offset) { }
- const char *func_name() const { return "%FOUND"; }
- void fix_length_and_dec() { max_length= 1; maybe_null= true; }
- longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cursor_found>(thd, mem_root, this); }
+protected:
+ LEX_CSTRING m_cursor_name;
+ uint m_cursor_offset;
+ class sp_cursor *get_open_cursor_or_error();
+ Cursor_ref(const LEX_CSTRING *name, uint offset)
+ :m_cursor_name(*name), m_cursor_offset(offset)
+ { }
+ void print_func(String *str, const char *func_name);
};
-class Item_func_cursor_notfound: public Item_func_cursor_int_attr
-{
-public:
- Item_func_cursor_notfound(THD *thd, const LEX_CSTRING *name, uint offset)
- :Item_func_cursor_int_attr(thd, name, offset) { }
- const char *func_name() const { return "%NOTFOUND"; }
- void fix_length_and_dec() { max_length= 1; maybe_null= true; }
- longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cursor_notfound>(thd, mem_root, this); }
-};
-
-class Item_func_cursor_rowcount: public Item_func_cursor_int_attr
+class Item_func_cursor_rowcount: public Item_longlong_func,
+ public Cursor_ref
{
public:
Item_func_cursor_rowcount(THD *thd, const LEX_CSTRING *name, uint offset)
- :Item_func_cursor_int_attr(thd, name, offset) { }
+ :Item_longlong_func(thd), Cursor_ref(name, offset) { maybe_null= true; }
const char *func_name() const { return "%ROWCOUNT"; }
longlong val_int();
+ bool check_vcol_func_processor(void *arg)
+ {
+ return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC);
+ }
+ void print(String *str, enum_query_type query_type)
+ {
+ return Cursor_ref::print_func(str, func_name());
+ }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_cursor_rowcount>(thd, mem_root, this); }
};
-class Item_func_connection_id :public Item_int_func
+class Item_func_connection_id :public Item_long_func
{
longlong value;
public:
- Item_func_connection_id(THD *thd): Item_int_func(thd) {}
+ Item_func_connection_id(THD *thd): Item_long_func(thd) {}
const char *func_name() const { return "connection_id"; }
void fix_length_and_dec();
bool fix_fields(THD *thd, Item **ref);
@@ -1405,11 +1414,13 @@ private:
};
-class Item_func_sign :public Item_int_func
+class Item_func_sign :public Item_long_func
{
public:
- Item_func_sign(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_sign(THD *thd, Item *a): Item_long_func(thd, a) {}
const char *func_name() const { return "sign"; }
+ uint decimal_precision() const { return 1; }
+ void fix_length_and_dec() { fix_char_length(2); }
longlong val_int();
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_sign>(thd, mem_root, this); }
@@ -1573,11 +1584,11 @@ public:
};
-class Item_func_octet_length :public Item_int_func
+class Item_func_octet_length :public Item_long_func
{
String value;
public:
- Item_func_octet_length(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_octet_length(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "octet_length"; }
void fix_length_and_dec() { max_length=10; }
@@ -1585,22 +1596,26 @@ public:
{ return get_item_copy<Item_func_octet_length>(thd, mem_root, this); }
};
-class Item_func_bit_length :public Item_func_octet_length
+class Item_func_bit_length :public Item_longlong_func
{
+ String value;
public:
- Item_func_bit_length(THD *thd, Item *a): Item_func_octet_length(thd, a) {}
- longlong val_int()
- { DBUG_ASSERT(fixed == 1); return Item_func_octet_length::val_int()*8; }
+ Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {}
+ void fix_length_and_dec()
+ {
+ max_length= 11; // 0x100000000*8 = 34,359,738,368
+ }
+ longlong val_int();
const char *func_name() const { return "bit_length"; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_bit_length>(thd, mem_root, this); }
};
-class Item_func_char_length :public Item_int_func
+class Item_func_char_length :public Item_long_func
{
String value;
public:
- Item_func_char_length(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_char_length(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; }
@@ -1608,10 +1623,10 @@ public:
{ return get_item_copy<Item_func_char_length>(thd, mem_root, this); }
};
-class Item_func_coercibility :public Item_int_func
+class Item_func_coercibility :public Item_long_func
{
public:
- Item_func_coercibility(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_coercibility(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "coercibility"; }
void fix_length_and_dec() { max_length=10; maybe_null= 0; }
@@ -1623,29 +1638,42 @@ public:
{ return get_item_copy<Item_func_coercibility>(thd, mem_root, this); }
};
-class Item_func_locate :public Item_int_func
+
+/*
+ In the corner case LOCATE could return (4,294,967,296 + 1),
+ which would not fit into Item_long_func range.
+ But string lengths are limited with max_allowed_packet,
+ which cannot be bigger than 1024*1024*1024.
+*/
+class Item_func_locate :public Item_long_func
{
String value1,value2;
DTCollation cmp_collation;
public:
- Item_func_locate(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
- Item_func_locate(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
+ Item_func_locate(THD *thd, Item *a, Item *b)
+ :Item_long_func(thd, a, b) {}
+ Item_func_locate(THD *thd, Item *a, Item *b, Item *c)
+ :Item_long_func(thd, a, b, c) {}
const char *func_name() const { return "locate"; }
longlong val_int();
- void fix_length_and_dec();
+ void fix_length_and_dec()
+ {
+ max_length= MY_INT32_NUM_DECIMAL_DIGITS;
+ agg_arg_charsets_for_comparison(cmp_collation, args, 2);
+ }
virtual void print(String *str, enum_query_type query_type);
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_locate>(thd, mem_root, this); }
};
-class Item_func_field :public Item_int_func
+class Item_func_field :public Item_long_func
{
String value,tmp;
Item_result cmp_type;
DTCollation cmp_collation;
public:
- Item_func_field(THD *thd, List<Item> &list): Item_int_func(thd, list) {}
+ Item_func_field(THD *thd, List<Item> &list): Item_long_func(thd, list) {}
longlong val_int();
const char *func_name() const { return "field"; }
void fix_length_and_dec();
@@ -1654,11 +1682,11 @@ public:
};
-class Item_func_ascii :public Item_int_func
+class Item_func_ascii :public Item_long_func
{
String value;
public:
- Item_func_ascii(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_ascii(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; }
@@ -1666,18 +1694,19 @@ public:
{ return get_item_copy<Item_func_ascii>(thd, mem_root, this); }
};
-class Item_func_ord :public Item_int_func
+class Item_func_ord :public Item_long_func
{
String value;
public:
- Item_func_ord(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {}
+ void fix_length_and_dec() { fix_char_length(7); }
longlong val_int();
const char *func_name() const { return "ord"; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_ord>(thd, mem_root, this); }
};
-class Item_func_find_in_set :public Item_int_func
+class Item_func_find_in_set :public Item_long_func
{
String value,value2;
uint enum_value;
@@ -1685,7 +1714,7 @@ class Item_func_find_in_set :public Item_int_func
DTCollation cmp_collation;
public:
Item_func_find_in_set(THD *thd, Item *a, Item *b):
- Item_int_func(thd, a, b), enum_value(0) {}
+ Item_long_func(thd, a, b), enum_value(0) {}
longlong val_int();
const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec();
@@ -1695,11 +1724,11 @@ public:
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
-class Item_func_bit: public Item_int_func
+class Item_func_bit: public Item_longlong_func
{
public:
- Item_func_bit(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
- Item_func_bit(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_bit(THD *thd, Item *a, Item *b): Item_longlong_func(thd, a, b) {}
+ Item_func_bit(THD *thd, Item *a): Item_longlong_func(thd, a) {}
void fix_length_and_dec() { unsigned_flag= 1; }
virtual inline void print(String *str, enum_query_type query_type)
@@ -1731,10 +1760,10 @@ public:
{ return get_item_copy<Item_func_bit_and>(thd, mem_root, this); }
};
-class Item_func_bit_count :public Item_int_func
+class Item_func_bit_count :public Item_long_func
{
public:
- Item_func_bit_count(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_bit_count(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "bit_count"; }
void fix_length_and_dec() { max_length=2; }
@@ -1781,19 +1810,18 @@ public:
};
-class Item_func_last_insert_id :public Item_int_func
+class Item_func_last_insert_id :public Item_longlong_func
{
public:
- Item_func_last_insert_id(THD *thd): Item_int_func(thd) {}
- Item_func_last_insert_id(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_last_insert_id(THD *thd): Item_longlong_func(thd) {}
+ Item_func_last_insert_id(THD *thd, Item *a): Item_longlong_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "last_insert_id"; }
void fix_length_and_dec()
{
- unsigned_flag= TRUE;
+ unsigned_flag= true;
if (arg_count)
max_length= args[0]->max_length;
- unsigned_flag=1;
}
bool fix_fields(THD *thd, Item **ref);
bool check_vcol_func_processor(void *arg)
@@ -1805,11 +1833,11 @@ public:
};
-class Item_func_benchmark :public Item_int_func
+class Item_func_benchmark :public Item_long_func
{
public:
Item_func_benchmark(THD *thd, Item *count_expr, Item *expr):
- Item_int_func(thd, count_expr, expr)
+ Item_long_func(thd, count_expr, expr)
{}
longlong val_int();
const char *func_name() const { return "benchmark"; }
@@ -1827,10 +1855,11 @@ public:
void item_func_sleep_init(void);
void item_func_sleep_free(void);
-class Item_func_sleep :public Item_int_func
+class Item_func_sleep :public Item_long_func
{
public:
- Item_func_sleep(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {}
+ void fix_length_and_dec() { fix_char_length(1); }
bool const_item() const { return 0; }
const char *func_name() const { return "sleep"; }
table_map used_tables() const
@@ -2100,11 +2129,11 @@ public:
void mysql_ull_cleanup(THD *thd);
void mysql_ull_set_explicit_lock_duration(THD *thd);
-class Item_func_get_lock :public Item_int_func
+class Item_func_get_lock :public Item_long_func
{
String value;
public:
- Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_int_func(thd, a, b) {}
+ Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "get_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
@@ -2122,11 +2151,11 @@ class Item_func_get_lock :public Item_int_func
{ return get_item_copy<Item_func_get_lock>(thd, mem_root, this); }
};
-class Item_func_release_lock :public Item_int_func
+class Item_func_release_lock :public Item_long_func
{
String value;
public:
- Item_func_release_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_release_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "release_lock"; }
void fix_length_and_dec() { max_length= 1; maybe_null= 1;}
@@ -2146,15 +2175,16 @@ public:
/* replication functions */
-class Item_master_pos_wait :public Item_int_func
+class Item_master_pos_wait :public Item_longlong_func
{
String value;
public:
- Item_master_pos_wait(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_master_pos_wait(THD *thd, Item *a, Item *b)
+ :Item_longlong_func(thd, a, b) {}
Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c):
- Item_int_func(thd, a, b, c) {}
+ Item_longlong_func(thd, a, b, c) {}
Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c, Item *d):
- Item_int_func(thd, a, b, c, d) {}
+ Item_longlong_func(thd, a, b, c, d) {}
longlong val_int();
const char *func_name() const { return "master_pos_wait"; }
void fix_length_and_dec() { max_length=21; maybe_null=1;}
@@ -2167,15 +2197,17 @@ public:
};
-class Item_master_gtid_wait :public Item_int_func
+class Item_master_gtid_wait :public Item_long_func
{
String value;
public:
- Item_master_gtid_wait(THD *thd, Item *a): Item_int_func(thd, a) {}
- Item_master_gtid_wait(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_master_gtid_wait(THD *thd, Item *a)
+ :Item_long_func(thd, a) {}
+ Item_master_gtid_wait(THD *thd, Item *a, Item *b)
+ :Item_long_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "master_gtid_wait"; }
- void fix_length_and_dec() { max_length=10+1+10+1+20+1; maybe_null=0;}
+ void fix_length_and_dec() { max_length= 2; maybe_null=0;}
bool check_vcol_func_processor(void *arg)
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
@@ -2527,11 +2559,11 @@ public:
{ return get_item_copy<Item_func_bit_xor>(thd, mem_root, this); }
};
-class Item_func_is_free_lock :public Item_int_func
+class Item_func_is_free_lock :public Item_long_func
{
String value;
public:
- Item_func_is_free_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_is_free_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "is_free_lock"; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
@@ -2543,11 +2575,11 @@ public:
{ return get_item_copy<Item_func_is_free_lock>(thd, mem_root, this); }
};
-class Item_func_is_used_lock :public Item_int_func
+class Item_func_is_used_lock :public Item_long_func
{
String value;
public:
- Item_func_is_used_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_is_used_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "is_used_lock"; }
void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;}
@@ -2596,10 +2628,10 @@ public:
};
-class Item_func_row_count :public Item_int_func
+class Item_func_row_count :public Item_longlong_func
{
public:
- Item_func_row_count(THD *thd): Item_int_func(thd) {}
+ Item_func_row_count(THD *thd): Item_longlong_func(thd) {}
longlong val_int();
const char *func_name() const { return "row_count"; }
void fix_length_and_dec() { decimals= 0; maybe_null=0; }
@@ -2755,10 +2787,10 @@ public:
};
-class Item_func_found_rows :public Item_int_func
+class Item_func_found_rows :public Item_longlong_func
{
public:
- Item_func_found_rows(THD *thd): Item_int_func(thd) {}
+ Item_func_found_rows(THD *thd): Item_longlong_func(thd) {}
longlong val_int();
const char *func_name() const { return "found_rows"; }
void fix_length_and_dec() { decimals= 0; maybe_null=0; }
@@ -2771,10 +2803,10 @@ public:
};
-class Item_func_oracle_sql_rowcount :public Item_int_func
+class Item_func_oracle_sql_rowcount :public Item_longlong_func
{
public:
- Item_func_oracle_sql_rowcount(THD *thd): Item_int_func(thd) {}
+ Item_func_oracle_sql_rowcount(THD *thd): Item_longlong_func(thd) {}
longlong val_int();
const char *func_name() const { return "SQL%ROWCOUNT"; }
void print(String *str, enum_query_type query_type)
@@ -2790,10 +2822,10 @@ public:
};
-class Item_func_sqlcode: public Item_int_func
+class Item_func_sqlcode: public Item_long_func
{
public:
- Item_func_sqlcode(THD *thd): Item_int_func(thd) { }
+ Item_func_sqlcode(THD *thd): Item_long_func(thd) { }
longlong val_int();
const char *func_name() const { return "SQLCODE"; }
void print(String *str, enum_query_type query_type)
@@ -2816,10 +2848,10 @@ public:
void uuid_short_init();
-class Item_func_uuid_short :public Item_int_func
+class Item_func_uuid_short :public Item_longlong_func
{
public:
- Item_func_uuid_short(THD *thd): Item_int_func(thd) {}
+ Item_func_uuid_short(THD *thd): Item_longlong_func(thd) {}
const char *func_name() const { return "uuid_short"; }
longlong val_int();
void fix_length_and_dec()
@@ -2862,13 +2894,13 @@ public:
/* Implementation for sequences: NEXT VALUE FOR sequence and NEXTVAL() */
-class Item_func_nextval :public Item_int_func
+class Item_func_nextval :public Item_longlong_func
{
protected:
TABLE_LIST *table_list;
public:
Item_func_nextval(THD *thd, TABLE_LIST *table):
- Item_int_func(thd), table_list(table) {}
+ Item_longlong_func(thd), table_list(table) {}
longlong val_int();
const char *func_name() const { return "nextval"; }
void fix_length_and_dec()
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index cf6d9bb1360..cbd37fcf6d0 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -506,14 +506,14 @@ public:
{ return get_item_copy<Item_func_isempty>(thd, mem_root, this); }
};
-class Item_func_issimple: public Item_int_func
+class Item_func_issimple: public Item_long_func
{
Gcalc_heap collector;
Gcalc_function func;
Gcalc_scan_iterator scan_it;
String tmp;
public:
- Item_func_issimple(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_issimple(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_issimple"; }
void fix_length_and_dec() { decimals=0; max_length=2; }
@@ -522,10 +522,10 @@ public:
{ return get_item_copy<Item_func_issimple>(thd, mem_root, this); }
};
-class Item_func_isclosed: public Item_int_func
+class Item_func_isclosed: public Item_long_func
{
public:
- Item_func_isclosed(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_isclosed(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_isclosed"; }
void fix_length_and_dec() { decimals=0; max_length=2; }
@@ -544,11 +544,11 @@ public:
{ return get_item_copy<Item_func_isring>(thd, mem_root, this); }
};
-class Item_func_dimension: public Item_int_func
+class Item_func_dimension: public Item_long_func
{
String value;
public:
- Item_func_dimension(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_dimension(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_dimension"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -590,11 +590,11 @@ public:
};
-class Item_func_numgeometries: public Item_int_func
+class Item_func_numgeometries: public Item_long_func
{
String value;
public:
- Item_func_numgeometries(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_numgeometries(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_numgeometries"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -603,11 +603,11 @@ public:
};
-class Item_func_numinteriorring: public Item_int_func
+class Item_func_numinteriorring: public Item_long_func
{
String value;
public:
- Item_func_numinteriorring(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_numinteriorring(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_numinteriorrings"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -616,11 +616,11 @@ public:
};
-class Item_func_numpoints: public Item_int_func
+class Item_func_numpoints: public Item_long_func
{
String value;
public:
- Item_func_numpoints(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_numpoints(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_numpoints"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -663,11 +663,11 @@ public:
};
-class Item_func_srid: public Item_int_func
+class Item_func_srid: public Item_long_func
{
String value;
public:
- Item_func_srid(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_srid(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "srid"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
@@ -709,11 +709,12 @@ public:
#ifndef DBUG_OFF
-class Item_func_gis_debug: public Item_int_func
+class Item_func_gis_debug: public Item_long_func
{
public:
- Item_func_gis_debug(THD *thd, Item *a): Item_int_func(thd, a)
+ Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a)
{ null_value= false; }
+ void fix_length_and_dec() { fix_char_length(10); }
const char *func_name() const { return "st_gis_debug"; }
longlong val_int();
bool check_vcol_func_processor(void *arg)
diff --git a/sql/item_inetfunc.h b/sql/item_inetfunc.h
index 741b9f7d997..33586c29175 100644
--- a/sql/item_inetfunc.h
+++ b/sql/item_inetfunc.h
@@ -24,10 +24,10 @@
Item_func_inet_aton implements INET_ATON() SQL-function.
*************************************************************************/
-class Item_func_inet_aton : public Item_int_func
+class Item_func_inet_aton : public Item_longlong_func
{
public:
- Item_func_inet_aton(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_inet_aton(THD *thd, Item *a): Item_longlong_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "inet_aton"; }
void fix_length_and_dec()
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index fd5b4a98e0e..9e9b26e2119 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -390,7 +390,7 @@ longlong Item_func_json_valid::val_int()
void Item_func_json_exists::fix_length_and_dec()
{
- Item_int_func::fix_length_and_dec();
+ Item_bool_func::fix_length_and_dec();
maybe_null= 1;
path.set_constant_flag(args[1]->const_item());
}
@@ -890,7 +890,7 @@ void Item_func_json_contains::fix_length_and_dec()
maybe_null= 1;
if (arg_count > 2)
path.set_constant_flag(args[2]->const_item());
- Item_int_func::fix_length_and_dec();
+ Item_bool_func::fix_length_and_dec();
}
@@ -1135,7 +1135,7 @@ void Item_func_json_contains_path::fix_length_and_dec()
ooa_parsed= FALSE;
maybe_null= 1;
mark_constant_paths(paths, args+2, arg_count-2);
- Item_int_func::fix_length_and_dec();
+ Item_bool_func::fix_length_and_dec();
}
@@ -2050,6 +2050,7 @@ void Item_func_json_length::fix_length_and_dec()
if (arg_count > 1)
path.set_constant_flag(args[1]->const_item());
maybe_null= 1;
+ max_length= 10;
}
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index 394ed5f189a..4235bd3ea9f 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -40,27 +40,26 @@ public:
};
-class Item_func_json_valid: public Item_int_func
+class Item_func_json_valid: public Item_bool_func
{
protected:
String tmp_value;
public:
- Item_func_json_valid(THD *thd, Item *json) : Item_int_func(thd, json) {}
+ Item_func_json_valid(THD *thd, Item *json) : Item_bool_func(thd, json) {}
longlong val_int();
const char *func_name() const { return "json_valid"; }
void fix_length_and_dec()
{
- Item_int_func::fix_length_and_dec();
+ Item_bool_func::fix_length_and_dec();
maybe_null= 1;
}
- bool is_bool_type() { return true; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_json_valid>(thd, mem_root, this); }
};
-class Item_func_json_exists: public Item_int_func
+class Item_func_json_exists: public Item_bool_func
{
protected:
json_path_with_flags path;
@@ -68,9 +67,8 @@ protected:
public:
Item_func_json_exists(THD *thd, Item *js, Item *i_path):
- Item_int_func(thd, js, i_path) {}
+ Item_bool_func(thd, js, i_path) {}
const char *func_name() const { return "json_exists"; }
- bool is_bool_type() { return true; }
void fix_length_and_dec();
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_json_exists>(thd, mem_root, this); }
@@ -170,7 +168,7 @@ public:
};
-class Item_func_json_contains: public Item_int_func
+class Item_func_json_contains: public Item_bool_func
{
protected:
String tmp_js;
@@ -180,7 +178,7 @@ protected:
String tmp_val, *val;
public:
Item_func_json_contains(THD *thd, List<Item> &list):
- Item_int_func(thd, list) {}
+ Item_bool_func(thd, list) {}
const char *func_name() const { return "json_contains"; }
void fix_length_and_dec();
longlong val_int();
@@ -189,7 +187,7 @@ public:
};
-class Item_func_json_contains_path: public Item_int_func
+class Item_func_json_contains_path: public Item_bool_func
{
protected:
String tmp_js;
@@ -201,7 +199,7 @@ protected:
public:
Item_func_json_contains_path(THD *thd, List<Item> &list):
- Item_int_func(thd, list), tmp_paths(0) {}
+ Item_bool_func(thd, list), tmp_paths(0) {}
const char *func_name() const { return "json_contains_path"; }
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
@@ -290,7 +288,7 @@ public:
};
-class Item_func_json_length: public Item_int_func
+class Item_func_json_length: public Item_long_func
{
protected:
json_path_with_flags path;
@@ -298,7 +296,7 @@ protected:
String tmp_path;
public:
Item_func_json_length(THD *thd, List<Item> &list):
- Item_int_func(thd, list) {}
+ Item_long_func(thd, list) {}
const char *func_name() const { return "json_length"; }
void fix_length_and_dec();
longlong val_int();
@@ -307,13 +305,14 @@ public:
};
-class Item_func_json_depth: public Item_int_func
+class Item_func_json_depth: public Item_long_func
{
protected:
String tmp_js;
public:
- Item_func_json_depth(THD *thd, Item *js): Item_int_func(thd, js) {}
+ Item_func_json_depth(THD *thd, Item *js): Item_long_func(thd, js) {}
const char *func_name() const { return "json_depth"; }
+ void fix_length_and_dec() { max_length= 10; }
longlong val_int();
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_json_depth>(thd, mem_root, this); }
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 6e31d489574..6310d15b4e7 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1444,11 +1444,11 @@ public:
{ return get_item_copy<Item_func_weight_string>(thd, mem_root, this); }
};
-class Item_func_crc32 :public Item_int_func
+class Item_func_crc32 :public Item_long_func
{
String value;
public:
- Item_func_crc32(THD *thd, Item *a): Item_int_func(thd, a)
+ Item_func_crc32(THD *thd, Item *a): Item_long_func(thd, a)
{ unsigned_flag= 1; }
const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; }
@@ -1457,11 +1457,11 @@ public:
{ return get_item_copy<Item_func_crc32>(thd, mem_root, this); }
};
-class Item_func_uncompressed_length : public Item_int_func
+class Item_func_uncompressed_length : public Item_long_func
{
String value;
public:
- Item_func_uncompressed_length(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_uncompressed_length(THD *thd, Item *a): Item_long_func(thd, a) {}
const char *func_name() const{return "uncompressed_length";}
void fix_length_and_dec() { max_length=10; maybe_null= true; }
longlong val_int();
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index ced4bf4b31e..d09a573aa2d 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -33,10 +33,10 @@ enum date_time_format_types
bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval);
-class Item_func_period_add :public Item_int_func
+class Item_func_period_add :public Item_long_func
{
public:
- Item_func_period_add(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_func_period_add(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "period_add"; }
void fix_length_and_dec()
@@ -48,10 +48,10 @@ public:
};
-class Item_func_period_diff :public Item_int_func
+class Item_func_period_diff :public Item_long_func
{
public:
- Item_func_period_diff(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_func_period_diff(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "period_diff"; }
void fix_length_and_dec()
@@ -64,10 +64,10 @@ public:
};
-class Item_func_to_days :public Item_int_func
+class Item_func_to_days :public Item_long_func
{
public:
- Item_func_to_days(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_to_days(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "to_days"; }
void fix_length_and_dec()
@@ -89,10 +89,10 @@ public:
};
-class Item_func_to_seconds :public Item_int_func
+class Item_func_to_seconds :public Item_long_func
{
public:
- Item_func_to_seconds(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_to_seconds(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "to_seconds"; }
void fix_length_and_dec()
@@ -115,10 +115,10 @@ public:
};
-class Item_func_dayofmonth :public Item_int_func
+class Item_func_dayofmonth :public Item_long_func
{
public:
- Item_func_dayofmonth(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_dayofmonth(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "dayofmonth"; }
void fix_length_and_dec()
@@ -196,10 +196,10 @@ public:
};
-class Item_func_dayofyear :public Item_int_func
+class Item_func_dayofyear :public Item_long_func
{
public:
- Item_func_dayofyear(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_dayofyear(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "dayofyear"; }
void fix_length_and_dec()
@@ -219,10 +219,10 @@ public:
};
-class Item_func_hour :public Item_int_func
+class Item_func_hour :public Item_long_func
{
public:
- Item_func_hour(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_hour(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "hour"; }
void fix_length_and_dec()
@@ -242,10 +242,10 @@ public:
};
-class Item_func_minute :public Item_int_func
+class Item_func_minute :public Item_long_func
{
public:
- Item_func_minute(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_minute(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "minute"; }
void fix_length_and_dec()
@@ -265,10 +265,10 @@ public:
};
-class Item_func_quarter :public Item_int_func
+class Item_func_quarter :public Item_long_func
{
public:
- Item_func_quarter(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_quarter(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "quarter"; }
void fix_length_and_dec()
@@ -288,10 +288,10 @@ public:
};
-class Item_func_second :public Item_int_func
+class Item_func_second :public Item_long_func
{
public:
- Item_func_second(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_second(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "second"; }
void fix_length_and_dec()
@@ -311,11 +311,11 @@ public:
};
-class Item_func_week :public Item_int_func
+class Item_func_week :public Item_long_func
{
public:
- Item_func_week(THD *thd, Item *a): Item_int_func(thd, a) {}
- Item_func_week(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_func_week(THD *thd, Item *a): Item_long_func(thd, a) {}
+ Item_func_week(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "week"; }
void fix_length_and_dec()
@@ -338,10 +338,10 @@ public:
{ return get_item_copy<Item_func_week>(thd, mem_root, this); }
};
-class Item_func_yearweek :public Item_int_func
+class Item_func_yearweek :public Item_long_func
{
public:
- Item_func_yearweek(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_func_yearweek(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
longlong val_int();
const char *func_name() const { return "yearweek"; }
void fix_length_and_dec()
@@ -361,10 +361,10 @@ public:
};
-class Item_func_year :public Item_int_func
+class Item_func_year :public Item_long_func
{
public:
- Item_func_year(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_year(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "year"; }
enum_monotonicity_info get_monotonicity_info() const;
@@ -404,7 +404,7 @@ public:
{
return (odbc_type ? "dayofweek" : "weekday");
}
- const Type_handler *type_handler() const { return &type_handler_longlong; }
+ const Type_handler *type_handler() const { return &type_handler_long; }
void fix_length_and_dec()
{
decimals= 0;
@@ -1012,6 +1012,8 @@ class Item_extract :public Item_int_func
}
return true;
}
+ Field *create_tmp_field(bool group, TABLE *table)
+ { return tmp_table_field_from_field_type(table); }
Field *create_field_for_create_select(TABLE *table)
{ return tmp_table_field_from_field_type(table); }
@@ -1177,16 +1179,17 @@ public:
};
-class Item_func_microsecond :public Item_int_func
+class Item_func_microsecond :public Item_long_func
{
public:
- Item_func_microsecond(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_microsecond(THD *thd, Item *a): Item_long_func(thd, a) {}
longlong val_int();
const char *func_name() const { return "microsecond"; }
void fix_length_and_dec()
{
decimals=0;
maybe_null=1;
+ fix_char_length(6);
}
bool check_partition_func_processor(void *int_arg) {return FALSE;}
bool check_vcol_func_processor(void *arg) { return FALSE;}
@@ -1199,12 +1202,12 @@ public:
};
-class Item_func_timestamp_diff :public Item_int_func
+class Item_func_timestamp_diff :public Item_longlong_func
{
const interval_type int_type;
public:
Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg):
- Item_int_func(thd, a, b), int_type(type_arg) {}
+ Item_longlong_func(thd, a, b), int_type(type_arg) {}
const char *func_name() const { return "timestampdiff"; }
longlong val_int();
void fix_length_and_dec()