diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_create.cc | 5 | ||||
-rw-r--r-- | sql/item_create.h | 1 | ||||
-rw-r--r-- | sql/item_func.h | 8 | ||||
-rw-r--r-- | sql/lex.h | 1 |
4 files changed, 15 insertions, 0 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index a9567414b0b..f07632984d9 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -200,6 +200,11 @@ Item *create_func_length(Item* a) return new Item_func_length(a); } +Item *create_func_bit_length(Item* a) +{ + return new Item_func_bit_length(a); +} + Item *create_func_char_length(Item* a) { return new Item_func_char_length(a); diff --git a/sql/item_create.h b/sql/item_create.h index 9318025cae8..580596505da 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -22,6 +22,7 @@ Item *create_func_ascii(Item* a); Item *create_func_asin(Item* a); Item *create_func_bin(Item* a); Item *create_func_bit_count(Item* a); +Item *create_func_bit_length(Item* a); Item *create_func_ceiling(Item* a); Item *create_func_char_length(Item* a); Item *create_func_connection_id(void); diff --git a/sql/item_func.h b/sql/item_func.h index d944ef6bc36..35fe699192f 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -501,6 +501,14 @@ public: void fix_length_and_dec() { max_length=10; } }; +class Item_func_bit_length :public Item_func_length +{ +public: + Item_func_bit_length(Item *a) :Item_func_length(a) {} + longlong val_int() { return Item_func_length::val_int()*8; } + const char *func_name() const { return "bit_length"; } +}; + class Item_func_char_length :public Item_int_func { String value; diff --git a/sql/lex.h b/sql/lex.h index 887fcb78754..704b9a81683 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -397,6 +397,7 @@ static SYMBOL sql_functions[] = { { "BIT_OR", SYM(BIT_OR),0,0}, { "BIT_AND", SYM(BIT_AND),0,0}, { "CEILING", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, + { "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)}, { "CHAR_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, { "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, { "COALESCE", SYM(COALESCE),0,0}, |