Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ static COMMANDS commands[] = {
{ "ADDTIME", 0, 0, 0, ""},
{ "AES_ENCRYPT", 0, 0, 0, ""},
{ "AES_DECRYPT", 0, 0, 0, ""},
{ "ANY_VALUE", 0, 0, 0, ""},
{ "AREA", 0, 0, 0, ""},
{ "ASIN", 0, 0, 0, ""},
{ "ASBINARY", 0, 0, 0, ""},
Expand Down
19 changes: 19 additions & 0 deletions sql/item_cmpfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,8 @@ class Item_func_interval :public Item_long_func
class Item_func_coalesce :public Item_func_case_expression
{
public:
Item_func_coalesce(THD *thd, Item *a):
Item_func_case_expression(thd, a) {}
Item_func_coalesce(THD *thd, Item *a, Item *b):
Item_func_case_expression(thd, a, b) {}
Item_func_coalesce(THD *thd, List<Item> &list):
Expand Down Expand Up @@ -1289,6 +1291,23 @@ class Item_func_coalesce :public Item_func_case_expression
};


class Item_func_any_value final :public Item_func_coalesce
{
public:
Item_func_any_value(THD *thd, Item *a):
Item_func_coalesce(thd, a) {}
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("any_value") };
return name;
}
Comment thread
jaeheonshim marked this conversation as resolved.

protected:
Item *shallow_copy(THD *thd) const override
{ return get_item_copy<Item_func_any_value>(thd, this); }
};


/*
Case abbreviations that aggregate its result field type by two arguments:
IFNULL(arg1, arg2)
Expand Down
23 changes: 23 additions & 0 deletions sql/item_create.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,19 @@ class Create_func_aes_decrypt : public Create_native_func
};


class Create_func_any_value : public Create_func_arg1
{
public:
Item *create_1_arg(THD *thd, Item *arg1) override;

static Create_func_any_value s_singleton;

protected:
Create_func_any_value() = default;
~Create_func_any_value() override = default;
};


class Create_func_kdf : public Create_native_func
{
public:
Expand Down Expand Up @@ -3252,6 +3265,15 @@ Create_func_aes_decrypt::create_native(THD *thd, const LEX_CSTRING *name,
}


Create_func_any_value Create_func_any_value::s_singleton;

Item*
Create_func_any_value::create_1_arg(THD *thd, Item *arg1)
{
return new (thd->mem_root) Item_func_any_value(thd, arg1);
}


Create_func_kdf Create_func_kdf::s_singleton;

Item*
Expand Down Expand Up @@ -6330,6 +6352,7 @@ const Native_func_registry func_array[] =
{ { STRING_WITH_LEN("ADD_MONTHS") }, BUILDER(Create_func_addmonths)},
{ { STRING_WITH_LEN("AES_DECRYPT") }, BUILDER(Create_func_aes_decrypt)},
{ { STRING_WITH_LEN("AES_ENCRYPT") }, BUILDER(Create_func_aes_encrypt)},
{ { STRING_WITH_LEN("ANY_VALUE") }, BUILDER(Create_func_any_value)},
{ { STRING_WITH_LEN("ASIN") }, BUILDER(Create_func_asin)},
{ { STRING_WITH_LEN("ATAN") }, BUILDER(Create_func_atan)},
{ { STRING_WITH_LEN("ATAN2") }, BUILDER(Create_func_atan)},
Expand Down