Call the MySQL storage engine by calling a new handler instance

Source: Internet
Author: User
Tags header

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.