The 1th way to invoke the storage engine is to invoke the new handler instance.
Before defining Handlerton in the storage engine source file, you must define a function header for function instantiation. Here are 1 examples from the CSV engine:
static handler* tina_create_handler(TABLE *table);
As you can see, the function accepts a pointer to the table that the handler is prepared to manage and returns the Handler object.
After defining the function header, use the function pointer in the 21st Handlerton element to name the function, indicating that the function is responsible for generating a new handler instance.
Examples of the MyISAM storage engine's instantiation functions are given below:
static handler *myisam_create_handler(TABLE *table)
{
return new ha_myisam(table);
}
The call then works with the storage engine's constructor. Here are 1 examples from the Federated storage Engine:
ha_federated::ha_federated(TABLE *table_arg)
:handler(&federated_hton, table_arg),
MySQL(0), stored_result(0), scan_flag(0),
ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0)
{}
Another example from the example storage engine is given below:
ha_example::ha_example(TABLE *table_arg)
:handler(&example_hton, table_arg)
{}
The additional elements in the federated example are additional initialization elements for handlers. The minimum required implementation is the handler () initialization shown in the example example.