Definition of MySQL function in source code

Source: Internet
Author: User
Tags function definition mysql query time and date

Daniel's Blue

MySQL provides a richer SQL statement to support the main features that MySQL provides. Inside the database, how does MySQL know which objects to handle and what to do with it?

If we enter an SQL statement, MySQL may report a syntax error or an object does not exist, such as error prompts, these hints can be broadly divided into 2 categories, such as parsing user commands such as syntax errors, a class is for semantic inspection, such as object does not exist. In fact, there are other types such as permission to check, but these are not related to this article, and simple so ignore MO attachment here.

These 2 kinds of error hints, actually can correspond to MySQL 2 important files, this is from the source point of view.

First of all, sql_yacc.yy files to help MySQL solve how to know what to do with things.

Second, item.h this file to help MySQL solve how to know which objects to handle.

From the point of view of code, this paper simply parses item.h this file.

An object that MySQL can handle from the file name

MySQL can handle the various objects, as well as the relationship between objects, can be recognized from the following file.

1 item.h: The Total object definition class, which defines the ' item ' class as the Total object class, since then, many subclasses are defined in this file to enrich and develop the objects that MySQL can handle. However, this class inherits from the ' Parse_tree_node ' class, which makes the object and lexical parsing associated, which is not a detailed explanation.

2 item_cmpfunc.h: Defines the ' Item_bool_func ' class, inherits from the ' Item_int_func ' class, and Item_int_func inherits from the Item_func,item_func class inherits from the item class. The ' Item_bool_func ' class is primarily used to support comparison operations such as equals, greater than, less than, in, between, NULL, and so on.

3 item_create.h: Create interface for user-defined functions.

4 item_func.h: Defines the Item_func class, inherited from the item class, to support various function operations. such as the absolute value, the length, the remainder and so on. Many subclasses are also defined in this document to enrich and develop the objects that MySQL can handle.

5 item_geofunc.h: Spatial object Processing related functions.

6 item_inetfunc.h: Defines the processing of IPv4, IP6.

7 Item_row.h: A row-valued function definition that supports operations similar to the following:

(A, B, c) > (10, 10, 30)

(A, b, c) = (select C, D, E, from T1 where x=12)

(A, B, c) In ((1,2,2), (3,4,5), (6,7,8)

(A, B, c) In (select C, D, E, from T1)

8 item_strfunc.h: Defines the processing functions for character types (mainly character types, and some other types, such as the processing of Make_set functions but the return value is a character type). such as some character set related processing, left blank space, string substitution, and so on.

9 Item_subselect.h: Although the subquery can be optimized, that is, the object inside the subquery needs to be decomposed, but the MySQL query is treated as an object, and the object associated with the auxiliary sub-query is also defined in this file.

Item_sum.h: Defines the processing of aggregation functions. Includes Min and Max, but typically these 2 functions are optimized using an index.

Item_timefunc.h: Defines the processing function for the time and date.

Item_xmlfunc.h: A handler function that defines the XML type data.

In particular, in this article, the term "defining time and date processing function", in addition to the meaning of the function in programming, more refers to the "function", that is, the database provides the ability to process time and date. Other similar.

Definition of MySQL function in source code

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.