mariadb/plugin/func_test
Oleg Smirnov 405613ebb5 MDEV-34490 get_copy() and build_clone() may return an instance of an ancestor class instead of a copy/clone
The `Item` class methods `get_copy()`, `build_clone()`, and `clone_item()`
face an issue where they may be defined in a descendant class
(e.g., `Item_func`) but not in a further descendant (e.g., `Item_func_child`).
This can lead to scenarios where `build_clone()`, when operating on an
instance of `Item_func_child` with a pointer to the base class (`Item`),
returns an instance of `Item_func` instead of `Item_func_child`.

Since this limitation cannot be resolved at compile time, this commit
introduces runtime type checks for the copy/clone operations.
A debug assertion will now trigger in case of a type mismatch.

`get_copy()`, `build_clone()`, and `clone_item()` are no more virtual,
but virtual `do_get_copy()`, `do_build_clone()`, and `do_clone_item()`
are added to the protected section of the class `Item`.

Additionally, const qualifiers have been added to certain methods
to enhance code reliability.

Reviewer: Oleksandr Byelkin <sanja@mariadb.com>
2024-07-15 18:25:57 +07:00
..
mysql-test/func_test Part1: MDEV-20837 Add MariaDB_FUNCTION_PLUGIN 2019-10-16 21:40:30 +04:00
CMakeLists.txt MDEV-20764 Add MariaDB_FUNCTION_COLLECTION_PLUGIN 2019-10-07 11:31:32 +04:00
plugin.cc MDEV-34490 get_copy() and build_clone() may return an instance of an ancestor class instead of a copy/clone 2024-07-15 18:25:57 +07:00