MySQL  8.0.18
Source Code Documentation
Instantiator functions

The Instantiator functions are used to call constructors and operator new on classes that implement SQL functions, basically, even though they don't have to be functions. More...

Classes

class  Bin_instantiator
 
class  Degrees_instantiator
 
class  Radians_instantiator
 
class  Oct_instantiator
 
class  Weekday_instantiator
 
class  Weekofyear_instantiator
 
class  Datediff_instantiator
 
class  Subtime_instantiator
 
class  Time_format_instantiator
 
class  Dayofweek_instantiator
 
class  From_unixtime_instantiator
 
class  Round_instantiator
 
class  Locate_instantiator
 
class  Srid_instantiator
 
class  Latitude_instantiator
 
class  Longitude_instantiator
 
class  X_instantiator
 
class  Y_instantiator
 
class  Yearweek_instantiator
 
class  Make_set_instantiator
 

Variables

static const auto MAX_ARGLIST_SIZE
 We use this to declare that a function takes an infinite number of arguments. More...
 

Detailed Description

The Instantiator functions are used to call constructors and operator new on classes that implement SQL functions, basically, even though they don't have to be functions.

This pattern has to be used because of the following reasons:

Because partial template specialization is used, the functions are implemented as class templates rather that functions templates.

Functions objects that can be created simply by calling the constructor of their respective Item_func class need only instantiate the first template below. Some functions do some special tricks before creating the function object, and in that case they need their own Instantiator. See for instance Bin_instantiator or Oct_instantiator here below for how to do that.

Keeping the templates in anonymous namespaces enables the compiler to inline more and hence keeps the generated code leaner.

Variable Documentation

◆ MAX_ARGLIST_SIZE

const auto MAX_ARGLIST_SIZE
static
Initial value:
=
std::numeric_limits<decltype(PT_item_list().elements())>::max()
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:96

We use this to declare that a function takes an infinite number of arguments.

The cryptic construction below gives us the greatest number that the return type of PT_item_list::elements() can take.

See also
Function_factory::create_func()