Multi-layer parsing method for structured query statements, computer equipment and storage medium

By extracting the operation table name in the SQL statement and performing syntax conversion or query engine query, the problem of adapting the SQL statement to different database syntax is solved and the efficiency of database data processing is improved.

CN114756569BActive Publication Date: 2024-09-20BEIJING YOYO TIANYU SYST TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210300340.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-25
Publication Date
2024-09-20
Estimated Expiration
2042-03-25

AI Technical Summary

Technical Problem

The existing technology cannot implement one SQL statement to adapt to multiple databases with the syntax of multiple different SQL statements, resulting in low database data processing efficiency.

Method used

By extracting the operation table name in the SQL statement, it is judged whether it is a cross-database query. If so, it is sent to the query engine of the logical database for query; if not, the SQL statement is syntactically converted according to the query syntax of the target data source to obtain the appropriate query. Match the target SQL statement of the target data source.

Benefits of technology

It implements a SQL statement that can adapt to multiple database queries with the syntax of multiple different SQL statements, improves data processing efficiency, and avoids the need to adapt each SQL statement syntax separately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114756569B
    Figure CN114756569B
Patent Text Reader

Abstract

The present invention discloses a multi-layer parsing method, computer equipment and storage medium for structured query statements, including: extracting the name of an operation table according to an SQL statement; judging whether it is a cross-database query according to the name of the operation table; if it is a non-cross-database query, performing syntax conversion on the SQL statement according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source; if it is a cross-database query, sending the SQL statement to the query engine of the logical database. When a cross-database query occurs, the SQL statement is sent to the query engine of the logical database for query, and then a cross-database joint query can be performed on different data sources adapted to different SQL syntaxes. If it is a non-cross-database query, the SQL statement can be automatically converted into a target SQL statement adapted to the target data source, realizing a unified query of a heterogeneous data storage system in which a SQL statement is adapted to multiple different SQL syntaxes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to information processing technology, and in particular to a multi-layer parsing method, computer equipment and storage medium for structured query statements. Background Art

[0002] A database is a computer software system that stores and manages data according to data structures. With the development of databases, the types of databases are increasing, and different types of databases are adapted to different structured query language (SQL) statements. For the sake of convenience, SQL statements will be referred to as SQL statements in the following.

[0003] When the server is configured with multiple databases of different types, the client needs to use the SQL statements adapted to each database to initiate queries to the server. The server forwards the query statement to the search engine of the corresponding database and responds to the SQL statement.

[0004] It can be seen that when the database is configured with multiple databases that adapt to different SQL statement syntaxes, the user cannot perform operations such as data query from the above databases that adapt to different SQL statement syntaxes through a query statement, and the SQL statements of the databases are not unified. Summary of the invention

[0005] The present invention provides a multi-layer parsing method, computer equipment and storage medium for structured query statements, so as to realize access to multiple databases adapted to different SQL statement syntaxes using one SQL statement.

[0006] In a first aspect, an embodiment of the present invention provides a multi-layer parsing method for a structured query statement, comprising:

[0007] Extract the operation table name according to the SQL statement;

[0008] Determine whether it is a cross-database query based on the name of the operation table;

[0009] If it is a non-cross-database query, the SQL statement is replaced with a syntax according to the query syntax of the target data source to obtain a target SQL statement that is adapted to the target data source;

[0010] If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0011] In a second aspect, an embodiment of the present invention further provides a multi-layer parsing device for structured query statements, comprising:

[0012] Operation parsing module, used to extract the operation table name according to the SQL statement;

[0013] The syntax parsing module is used to determine whether it is a cross-database query based on the name of the operation table;

[0014] If it is a non-cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source;

[0015] If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0016] In a third aspect, an embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a multi-layer parsing method for structured query statements as provided in an embodiment of the present invention is implemented.

[0017] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute a multi-layer parsing method for a structured query statement as provided in an embodiment of the present invention.

[0018] The multi-layer parsing method of structured query statements provided by the embodiment of the present invention extracts the name of the operation table according to the SQL statement; determines whether it is a cross-database query according to the name of the operation table; if it is not a cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source; if it is a cross-database query, the SQL statement is sent to the query engine of the logical database. Compared with the current problem that a SQL statement cannot adapt to the database syntax of the SQL statement, and the database data processing efficiency is low, the embodiment of the present invention can extract the name of the operation table from the SQL statement, determine whether it is a cross-database query according to the name of the operation table, and the database accessed by the cross-database query adapts to different SQL statement syntaxes. When a cross-database query occurs, the SQL statement is sent to the query engine of the logical database for query. The logical database manages different data sources as logical tables, and can query different data sources adapted to different SQL statements. If it is a non-cross-database query, the target SQL statement adapted to the target data source can be obtained by performing syntax conversion. The SQL statement can be automatically converted into a target SQL statement adapted to the target data source without having to input SQL statement adaptation for the syntax of each SQL statement separately. This allows one SQL statement to adapt to multiple database queries with different SQL statement syntaxes. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a schematic diagram of the structure of a logical database provided by an embodiment of the present invention;

[0020] Figure 2is a flowchart of a multi-layer parsing method for structured query statements in Embodiment 1 of the present invention;

[0021] Figure 3 is a flowchart of a multi-layer parsing method for structured query statements in Embodiment 2 of the present invention;

[0022] Figure 4 is a flowchart of a multi-layer parsing method for structured query statements in Embodiment 3 of the present invention;

[0023] Figure 5 is a flowchart of a multi-layer parsing method for structured query statements in Embodiment 4 of the present invention;

[0024] Figure 6 It is a schematic diagram of the structure of a multi-layer parsing device for a structured query statement in Embodiment 6 of the present invention;

[0025] Figure 7 It is a schematic diagram of the structure of another multi-layer parsing device for structured query statements in Embodiment 6 of the present invention;

[0026] Figure 8 It is a structural diagram of a computer device in Embodiment 7 of the present invention. DETAILED DESCRIPTION

[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0028] The implementation of the embodiment of the present invention can be based on a logical database, which is connected to multiple data sources. The multiple data sources are multi-source heterogeneous data sources, including multiple different data storage types, data storage that adapts to the syntax of multiple different SQL statements, where the data source is a physical data source, and different physical data sources adapt to different structured query statement syntaxes, and the database types of different physical data sources are not the same. The logical database maps the structured forms of physical storage of different data sources or semi-structured data (also known as physical tables) that can be converted into structured forms to form a logical table. The mapping relationship between the logical table and the physical table is obtained. The fields in the logical table are the fields obtained by mapping the physical table. The logical table only contains the table name and field name of the physical table, and does not contain the field content.

[0029] The logical database establishes connections with multiple heterogeneous data sources and obtains the data source metadata of the data source. Mapping is performed according to the physical storage system in the connected data source to obtain the logical library. The logical library metadata is determined according to the logical library, and the logical library metadata includes the logical library. The data source metadata and the logical library metadata are stored in the memory cache.

[0030] For example, Figure 1 As shown, it is assumed that the data sources include data source A and data source B. Data source A includes form a1 and form a2, and data source B includes form b1 and form b2. The logical database maps form a1 to obtain form a1', and maps form b2 to obtain form b2'. The logical database stores the mapping relationship between form a1' and form a1 in data source A, and the mapping relationship between form b1' and form b1 in data source B. The query engine obtains metadata such as the logical table stored in the logical database and the association relationship between the logical table and the physical table, and obtains the field name in the physical table from the metadata. The SQL statement is replaced according to the obtained field name to obtain the query result.

[0031] Embodiment 1

[0032] Figure 2 This is a flowchart of a multi-layer parsing method for structured query statements provided in Embodiment 1 of the present invention. This embodiment is applicable to the case of querying data in a logical database containing multiple data sources. The method can be executed by a computer device for database management, which can be a server or a personal computer, etc. The method specifically includes the following steps:

[0033] Step 110: Extract the operation table name according to the SQL statement.

[0034] The user edits the SQL statement according to the grammar of the SQL statement according to the needs. The user can send a query request to the server running the multi-layer parsing method of the structured query statement provided by the embodiment of the present invention through the client, and the request carries the SQL statement edited by the user. After receiving the SQL statement, the server extracts the operation table name from the SQL statement.

[0035] Optionally, a character matching method may be used to determine the keywords in the SQL statement. The operation table name is extracted based on the position of the keyword. The keyword may be a commonly used keyword in SQL statements such as "FROM" and "JOIN". The keyword in the SQL statement may be obtained by character matching, and the continuous string that appears after the keyword may be used as the operation table name.

[0036] Furthermore, the data structure of the operation table name can be "library name.table name". The library name can be the data source name, and the table name is the name of the form in the data source. The same form name may exist in different data sources. The "library name.table name" method can more accurately distinguish the operation table name, avoid name duplication, and improve the uniqueness of the form name.

[0037] Optionally, if the operation table name does not contain a library name, the default logical library name to which the user has connected is concatenated to the operation table name, and then a search is performed in the logical library metadata cache to determine whether the operation table exists, so that the concatenated operation table name represents a valid form.

[0038] Furthermore, the operation table may be a logical table or a logical view. If the operation table is a logical table in the metadata of the logical library, continue to execute. If the operation table is a logical view in the metadata of the logical library, continue to find the logical table associated with the logical view, so as to serve as the basis for determining whether it is a cross-library query in the subsequent steps.

[0039] Step 120: Determine whether it is a cross-database query based on the name of the operation table.

[0040] The logical table in the logical database is associated with forms in different physical data sources. The operation table involved in the SQL statement can be a logical table. According to the data source to which the form associated with the logical table represented by the operation table name belongs, it can be determined whether it is a cross-database query. Exemplarily, if the logical table is associated with multiple different data sources, it is determined to be a cross-database query, and step 140 is executed. If the logical table is only associated with one or more forms in one data source, it is determined to be a non-cross-database query, and step 130 is executed.

[0041] Step 130: If it is a non-cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source.

[0042] The data source to which the form associated with the logical form belongs is the target data source. The syntax of the SQL statement may be the same as or different from the syntax of the SQL statement adapted by the target data source.

[0043] When the syntax of the SQL statement is the same as the syntax of the SQL statement adapted by the target data source, the SQL statement can be determined as the target SQL statement, and data query and feedback are performed according to the target SQL statement.

[0044] When the syntax of the SQL statement is different from the syntax of the SQL statement adapted by the target data source, the keywords used in the syntax of the SQL statement adapted by the target data source are different from the keywords used in the syntax of the SQL statement. According to a pre-configured keyword mapping relationship table, a keyword in the syntax of the SQL statement adapted by the target data source that has the same semantics as the keyword used in the syntax of the SQL statement can be determined, and the keyword can be replaced to obtain the target SQL statement.

[0045] When the syntax of the SQL statement is different from the syntax of the SQL statement adapted by the target data source, the function used by the syntax of the SQL statement adapted by the target data source is different from the function used by the syntax of the SQL statement. According to the pre-configured function mapping relationship table, a function similar to the function used in the syntax of the SQL statement in the syntax of the SQL statement adapted by the target data source can be determined, and according to the parameters and functional logic of the function, the syntax conversion of the function is implemented to obtain the target SQL statement.

[0046] Step 140: If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0047] If it is a cross-database query, such as Figure 1 As shown, the SQL statement is sent to the query engine of the logical database. The query engine can perform data query between multiple different data sources based on the logical table.

[0048] The logical database is connected to multiple query engines, and a coordinator engine and multiple executor engines are determined from the multiple query engines. The coordinator engine parses the SQL statement to obtain the form name and field name involved in the SQL statement. The physical table corresponding to the form name and the position of the field name in the physical table are determined based on the metadata of the logical library.

[0049] The query plan can be determined based on the executor engine that is compatible with the data source. The query plan can also be determined based on the carrying capacity of the query engine. The query plan includes the logical tables, fields, and query contents of the SQL statements that the executor engine needs to query. The coordinator engine assigns the query tasks to the executor engines through scheduling. The executor engine uses a driver that matches the data source type to access the data source and scan the data based on the data source type; the scanned data is extracted to the memory of the executor engine. Exemplarily, the executor engine determines the driver that is compatible with the data source based on the type of data source. For example, use JDBC or ODBC to connect to a data source of a relational database such as Oracle to scan the data. Use an API driver to connect to a data source of a NoSQL database to scan the data. The data scanning user copies the field contents in the physical table related to the SQL statement to the local executor engine.

[0050] Multiple executor engines involved in cross-database query interact with each other and send feedback results to the collaborator engine for aggregation to obtain aggregated feedback results. Multiple executor engines that process the same batch of query tasks can exchange local data as exchange data after data scanning. Each executor engine aggregates data based on the data obtained from data scanning and data exchange. Query is performed based on the aggregated data to obtain feedback results. Each executor engine sends its own query results to the coordinator engine, which aggregates the feedback results to obtain aggregated feedback results.

[0051] In addition, based on business scenarios, you can extract several fields from multiple tables distributed in different physical libraries as result fields, or perform aggregation analysis based on the original fields to form result fields, and combine the above result fields to form a logical view. Establish an association model based on the logical table, take one of the tables as the main table, and perform relationship analysis or aggregation analysis on it with other tables to obtain the SQL query statement of the model. Based on the SQL query statement of the association model, create a logical view under the logical library, and directly query the logical view through the SQL statement to obtain the result.

[0052] The multi-layer parsing method of structured query statements provided by the embodiment of the present invention extracts the name of the operation table according to the SQL statement; determines whether it is a cross-database query according to the name of the operation table; if it is not a cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source; if it is a cross-database query, the SQL statement is sent to the query engine of the logical database. Compared with the current problem that a database in which an SQL statement cannot adapt to the syntax of the SQL statement and the database data processing efficiency is low, the embodiment of the present invention can extract the name of the operation table from the SQL statement, determine whether it is a cross-database query according to the name of the operation table, and the database accessed by the cross-database query adapts to different SQL statement syntaxes. When a cross-database query occurs, the SQL statement is sent to the query engine of the logical database for query, and the logical database manages different data sources as logical tables, and can then query different data sources adapted to different SQL statements. If it is a non-cross-database query, the target SQL statement adapted to the target data source can be obtained by performing syntax conversion. The SQL statement can be automatically converted into a target SQL statement adapted to the target data source without having to input SQL statement adaptation for the syntax of each SQL statement separately. This allows one SQL statement to adapt to multiple database queries with different SQL statement syntaxes.

[0053] Embodiment 2

[0054] Figure 3A flowchart of a multi-layer parsing method for a structured query statement provided in the second embodiment of the present invention, as a further explanation of the above embodiment, includes:

[0055] Step 210: Extract the operation type according to the SQL statement.

[0056] The SQL statement can be identified, and the operation type can be extracted by identifying the SQL statement through character matching. Exemplarily, the SQL statement is read in sequence from the starting character string excluding comments in the SQL statement, and the read character string is matched with the preset operation type character string. If the match is successful, the operation type represented by the matched operation type character string is used as the operation type of the SQL statement.

[0057] Step 220: Determine whether the operation type matches the preset type.

[0058] The preset type may be an operation type included in a data manipulation language (DML). In an SQL statement, a data manipulation language is a set of instructions for performing data access operations on a database object, such as an insert operation INSERT, an update operation UPDATE, a delete operation DELETE, etc. The preset types include: an insert operation, a delete operation, an update operation, a sort operation, or a search operation.

[0059] If the operation type is the same as the preset type, it is determined that the operation type matches the preset type. If the operation type matches the preset type, step 230 is performed. If the operation type is not the same as the preset type, it is determined that the operation type does not match the preset type, and the process ends.

[0060] Step 230: If the operation type matches the preset type, extract the operation table name according to the SQL statement.

[0061] If the operation type matches the preset type, the step of extracting the operation table name according to the SQL statement may be implemented with reference to the description in the above embodiment.

[0062] Furthermore, after extracting the operation table name according to the SQL statement, it also includes:

[0063] User authority authentication is performed based on the operation type, operation table name, and user authority information in the cache.

[0064] A key-value pair (operation type, operation table name) is formed according to the operation type and the operation table name. User permission information includes the permissions that the user can operate, and may include description information of the operation type and operation table name that the user can operate. According to each key-value pair and the user's permission information, it is determined whether the user has the operation permission for the operation type of the operation table name. In addition, the logical library metadata can also be stored in the cache to further improve the data reading speed. The logical library metadata includes: logical library, logical table, logical view, and the mapping relationship between the logical table and the physical table.

[0065] If the authorization authentication is successful, then execute step 240. If the authentication is unsuccessful, then exit and feed back the authentication result to the user.

[0066] Among them, user permission information can be stored in the cache, thereby achieving fast permission authentication.

[0067] Step 240: Determine whether it is a cross-database query based on the name of the operation table.

[0068] Step 250: If it is a non-cross-database query, keyword replacement and function conversion are performed on the SQL statement according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source.

[0069] Step 260: If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0070] The multi-layer parsing method of structured query statements provided by the embodiment of the present invention can determine whether to continue to respond to SQL statements based on the operation type of the SQL statements. In addition, user authority authentication can also be performed through the key-value pair of (operation type, operation table name). By configuring the preset type and user authority, the SQL statements and the data content that the user can operate can be effectively controlled, thereby improving security and controllability of data access.

[0071] Embodiment 3

[0072] Figure 4 The flowchart of a multi-layer parsing method for a structured query statement provided in the third embodiment of the present invention is as a further explanation of the above embodiment. The embodiment of the present invention adds a field parsing process based on the above embodiment, which is used to extract the accessed table field information from the SQL statement and perform table field permission verification. The method includes:

[0073] Step 310: Extract the operation table name according to the SQL statement.

[0074] Step 320: Read the pre-configured field permission variables.

[0075] As an environment variable when the logical database is running, the field permission variable is a global variable, which can be configured dynamically.

[0076] The value of the field permission variable can be the first value or the second value. The first value can be "TRUE" and the second value can be "FALSE". The first value is used to indicate that field extraction is allowed. The second value indicates that field extraction is not allowed. Field extraction includes the generation and traversal of the abstract syntax tree, which takes a certain amount of time. Therefore, when field permission authentication is not required, the field permission variable can be configured to the second value. By configuring the field permission variable, custom configuration of field authentication can be achieved, improving ease of use.

[0077] Step 330: If the field authority variable is the first value, perform field parsing according to the SQL statement to determine the target field, and perform user authority authentication according to the target field, the operation type of the SQL statement, and the user authority information in the buffer.

[0078] The target field is a field contained in each form. The SQL statement can be parsed by means of an abstract syntax tree, and the target field can be quickly identified from the abstract syntax tree. After determining the target field, a key-value pair (operation type, target field) is formed according to the operation type and the target field. User permission information includes the permissions that the user can operate, which can include the description information of the operation type and field information that the user can operate. Based on each key-value pair and the user's permission information, it is determined whether the user has the operation permission for the operation type of the target field.

[0079] If the authority authentication is successful, then execute step 340. If the authentication is unsuccessful, then exit and feed back the authentication result to the user.

[0080] Optionally, perform field parsing according to the SQL statement to determine the target field, which can be implemented in the following ways:

[0081] Convert the SQL statement to obtain a first abstract syntax tree; traverse the nodes in the first abstract syntax tree in turn; if the first node currently traversed is the parent node of the field name node, continue traversing; if the first node currently traversed is the field name node, extract the target field in the field name node; if the first node currently traversed is not the parent node of the field name node and is not a field name node, return to the last traversed node and continue traversing.

[0082] Abstract Syntax Tree (AST) is a tree data structure used in the SQL statement parsing process. A unified SQL syntax parser can be created through a custom syntax description file, and the unified SQL syntax parser can convert the string of SQL statements into a standard tree data structure. Among them, the unified SQL syntax parser is a parser configured for the logical database, and can generate SQL syntax based on the custom syntax description file.

[0083] The SQL statement is converted by a unified SQL syntax parser to obtain a first abstract syntax tree. After the first abstract syntax tree is determined, field extraction can be performed by a field extraction visitor method.

[0084] The field extraction visitor method includes: if the first node currently traversed is the parent node of the field name node, continue traversing; if the first node currently traversed is the field name node, extract the target field in the field name node; if the first node currently traversed is not the parent node of the field name node and is not a field name node, return to the last traversed node to continue traversing.

[0085] The first node is a node of the first abstract syntax tree currently being traversed. Starting from the root node of the first abstract syntax tree, the abstract syntax tree is traversed in depth first.

[0086] Step 340: If the field permission variable is the second value, the field name is not extracted, and syntax replacement parsing is performed according to the SQL statement.

[0087] Step 350: Determine whether it is a cross-database query based on the name of the operation table.

[0088] Step 360: If it is a non-cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source.

[0089] Step 370: If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0090] The multi-layer parsing method for structured query statements provided by the embodiment of the present invention can quickly and accurately extract the target fields in the SQL statement by constructing and traversing the abstract syntax tree, thereby improving the efficiency of field extraction and thus improving the response speed of user field authority authentication. The unified SQL syntax parser can generate a unified SQL syntax through configuration, so that the logical database can be compatible with a variety of different databases.

[0091] Embodiment 4

[0092] Figure 5A flowchart of a multi-layer parsing method for a structured query statement provided in the fourth embodiment of the present invention, as a further explanation of the above embodiment, includes:

[0093] Step 410: extract the operation table name according to the SQL statement.

[0094] Step 420: Determine the data source to which the physical table belongs according to the mapping relationship between the operation table name and the physical table; if the data sources are different, determine it as a cross-database query; if the data sources are the same, determine it as a non-cross-database query.

[0095] When determining whether it is a cross-database query, the operation table can be a logical table, and the logical table is associated with multiple physical tables. The physical table can be a form that actually records data, and the form is located in a storage address of the data source. Therefore, the data source to which the physical table associated with the operation table belongs can be determined through the mapping relationship.

[0096] If the data sources are different, it is determined to be a cross-database query, and step 430 is executed. If the data sources are the same, it is determined to be a non-cross-database query, and step 440 is executed.

[0097] Step 430: If it is a non-cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source.

[0098] Optionally, step 430, performing syntax conversion on the SQL statement according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source, can be implemented as follows:

[0099] Step 431: Convert according to the SQL statement to obtain a second abstract syntax tree.

[0100] The SQL statement is converted by a unified SQL syntax parser to obtain a second abstract syntax tree. After the second abstract syntax tree is determined, the generation and configuration of the unified SQL syntax parser can refer to the description of step 330.

[0101] Step 432: replace the keyword node content in the second abstract syntax tree according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statement of the target data source.

[0102] The mapping relationship is used to generate a mapping relationship between the syntax of the unified SQL statement and the keyword of the syntax of the SQL statement adapted to the target data source. The two keywords with the mapping relationship have the same functions. In the second abstract syntax tree, the content of the keyword node is the keyword, and the keyword is replaced based on the above mapping relationship, which can accurately identify the keyword and quickly replace the keyword.

[0103] The function node content in the second abstract syntax tree is subjected to syntax conversion according to the mapping relationship between the unified SQL function predefined by the logical database and the function of the target data source SQL statement, including replacement of the function name and adjustment of the function parameters.

[0104] The function mapping relationship is used to generate a function matching relationship between the syntax of a unified SQL statement and the syntax of an SQL statement adapted to the target data source. The two functions with a mapping relationship have the same functions. In the second abstract syntax tree, the function node content is a function, and the function conversion is performed based on the above mapping relationship, which can accurately identify the function and quickly convert the function.

[0105] Step 433: Determine the target SQL statement according to the replaced second abstract syntax tree.

[0106] The unified SQL syntax parser can convert the replaced second abstract syntax tree into the target SQL statement string. The node content that has not been modified in the second abstract syntax tree will be retained, including the SQL syntax of the data source such as Hint comments. It can be connected to the logical database without changing the original technical implementation of the data source. Hint is used to achieve penetration and use the database native SQL for data access functions.

[0107] Optionally, step 432 replaces the keyword node content in the second abstract syntax tree according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statement of the target data source, and performs syntax conversion on the function node content in the second abstract syntax tree according to the mapping relationship between the unified SQL function predefined by the logical database and the function of the SQL statement of the target data source, including replacement of the function name and adjustment of the function parameters. It can be implemented as follows:

[0108] The nodes in the second abstract syntax tree are traversed in sequence; if the second node currently traversed is a keyword node, the keyword in the keyword node is obtained; according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statement of the target data source, it is determined whether the keyword belongs to the syntax of the unified SQL statement or the syntax of the SQL statement of the target data source; if the keyword belongs to the syntax of the unified SQL statement, according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statements of each data source, the keyword is converted into a target keyword adapted for the target data source.

[0109] When replacing a keyword, it is necessary to determine whether the keyword needs to be replaced based on the mapping relationship between the grammatical keywords of the unified SQL statement predefined by the logical database and the grammatical keywords of the SQL statement of the target data source. If the keyword belongs to the mapping relationship, the target keyword that the keyword matches is determined based on the mapping direction of the mapping relationship. If the keyword does not belong to the mapping relationship, it means that the keyword is an illegal keyword, and the process ends with a keyword error feedback.

[0110] The nodes in the second abstract syntax tree are traversed in sequence; if the second node currently traversed is a function node, the function in the function node is obtained; according to the mapping relationship between the syntax function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source, it is determined whether the function belongs to the syntax of the unified SQL statement or the syntax of the SQL statement of the target data source; if the function belongs to the syntax of the unified SQL statement, according to the mapping relationship between the syntax function of the unified SQL statement predefined by the logical database and the syntax function of the SQL statement of each data source, the function is converted into a target function adapted to the target data source.

[0111] When converting a function, it is necessary to determine whether the function needs to be converted based on the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source. If the function belongs to the mapping relationship, the target function that the function matches is determined according to the mapping direction of the mapping relationship. If the function does not belong to the mapping relationship, it means that the function is an illegal function, ends, and feedback function error.

[0112] Step 440: If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0113] The multi-layer parsing method for structured query statements provided by the embodiment of the present invention can quickly determine the keywords in the SQL statement through the second abstract syntax tree. According to the mapping relationship between the grammatical keywords of the unified SQL statement predefined by the logical database and the grammatical keywords of the SQL statement of the target data source, and the mapping relationship between the functions of the unified SQL statement predefined by the logical database and the functions of the SQL statement of the target data source, the keywords and functions are accurately replaced and converted. By determining the target SQL statement according to the second abstract syntax tree after the grammatical conversion, the reverse generation of SQL statements is realized, the target SQL statement adapts to the syntax of the SQL statement of the target data source, supports hint penetration of single database SQL operations, can retain the native SQL access capability of the physical data source, and improve the single database access performance.

[0114] Embodiment 5

[0115] Embodiment 4 of the present invention provides a multi-layer parsing method for structured query statements, as an implementation of the above embodiment, including:

[0116] Step 501: Extract the operation type according to the SQL statement.

[0117] Step 502: Determine whether the operation type matches the preset type.

[0118] Step 503: If the operation type matches the preset type, extract the operation table name according to the SQL statement.

[0119] Step 504: Perform user authority authentication based on the operation type, the operation table name, and the user authority information in the buffer area.

[0120] Step 505: Extract the operation table name according to the SQL statement.

[0121] Step 506: Read the pre-configured field permission variables.

[0122] Step 507: If the field permission variable is the first value, perform field parsing according to the SQL statement to determine the target field.

[0123] Step 508: Perform user authority authentication based on the target field, the operation type of the SQL statement, and the user authority information in the buffer area.

[0124] If the authority authentication is passed, execute step 510.

[0125] Step 509: If the field permission variable is the second value, jump to step 510.

[0126] Step 510: Determine whether it is a cross-database query based on the name of the operation table.

[0127] Step 511: If it is a non-cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source.

[0128] Step 512: If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0129] Embodiment 6

[0130] Figure 6 A structural schematic diagram of a multi-layer parsing device for a structured query statement is provided for embodiment 6 of the present invention, which is suitable for querying data in a logical database containing multiple data sources. The device can be executed by a computer device for database management, and includes: an operation parsing module 610 and a grammar parsing module 620.

[0131] An operation parsing module 610 is used to extract the operation table name according to the SQL statement;

[0132] Syntax parsing module 620, used to determine whether it is a cross-database query according to the operation table name;

[0133] If it is a non-cross-database query, the SQL statement is converted according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source;

[0134] If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0135] Based on the above implementation, the operation analysis module 610 is further used for:

[0136] Extract the operation type based on the SQL statement;

[0137] Determine whether the operation type matches a preset type, where the preset type includes: insert operation, delete operation, modify operation, sort operation or search operation;

[0138] If the operation type matches the preset type, the operation table name is extracted according to the SQL statement.

[0139] Based on the above implementation, the operation analysis module 610 is further used for:

[0140] User authority authentication is performed based on the operation type, operation table name, and user authority information in the cache.

[0141] like Figure 7 As shown, based on the above implementation, a field parsing module 630 is further included. The field parsing module 630 is used to:

[0142] Read pre-configured field permission variables;

[0143] If the field permission variable is the first value, perform field parsing according to the SQL statement to determine the target field;

[0144] If the field permission variable is the second value, determine whether it is a cross-database query based on the operation table name.

[0145] Based on the above implementation, the field parsing module 630 is used to:

[0146] Convert the SQL statement to obtain a first abstract syntax tree;

[0147] Traversing the nodes in the first abstract syntax tree in turn;

[0148] If the first node currently traversed is the parent node of the field name node, continue traversing;

[0149] If the first node currently traversed is a field name node, extract the target field in the field name node;

[0150] If the first node currently traversed is not the parent node of the field name node and is not a field name node, return to the last traversed node to continue traversal.

[0151] Based on the above implementation, the field parsing module 630 is used to:

[0152] User authority authentication is performed based on the target field, the operation type of the SQL statement, and the user authority information in the cache.

[0153] Based on the above implementation, the syntax parsing module 620 is used to:

[0154] According to the mapping relationship between the operation table name and the physical table, determine the data source to which the physical table belongs;

[0155] If the data sources are different, it is determined to be a cross-database query;

[0156] If the data sources are the same, it is determined to be a non-cross-database query.

[0157] Based on the above implementation, the syntax parsing module 620 is used to:

[0158] Convert according to the SQL statement to obtain a second abstract syntax tree;

[0159] Replacing the keyword node content in the second abstract syntax tree according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statement of the target data source;

[0160] Converting the function node content in the second abstract syntax tree according to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source;

[0161] The target SQL statement is determined according to the replaced second abstract syntax tree.

[0162] Based on the above implementation, the syntax parsing module 620 is used to:

[0163] Traversing the nodes in the second abstract syntax tree in sequence;

[0164] If the second node currently traversed is a keyword node, obtain the keyword in the keyword node;

[0165] According to the mapping relationship between the grammatical keywords of the unified SQL statement predefined by the logical database and the grammatical keywords of the SQL statement of the target data source, it is determined whether the keyword belongs to the grammar of the unified SQL statement or the grammar of the SQL statement of the target data source;

[0166] If the keyword belongs to the syntax of the unified SQL statement, the keyword is converted into a target keyword adapted to the target data source according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statements of each data source.

[0167] If the second node currently traversed is a function node, obtain the function in the function node;

[0168] According to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source, it is determined whether the function belongs to the syntax of the unified SQL statement or the syntax of the SQL statement of the target data source;

[0169] If the function belongs to the syntax of the unified SQL statement, the function is converted into a target function adapted to the target data source according to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of each data source.

[0170] The multi-layer parsing device for structured query statements provided by the embodiment of the present invention, the operation parsing module 610 extracts the name of the operation table according to the SQL statement; the syntax parsing module 620 determines whether it is a cross-database query according to the name of the operation table; if it is not a cross-database query, the SQL statement is replaced with keywords and converted into functions according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source; if it is a cross-database query, the SQL statement is sent to the query engine of the logical database. Compared with the current problem that a database in which an SQL statement cannot adapt to the syntax of the SQL statement and the database data processing efficiency is low, the embodiment of the present invention can extract the name of the operation table from the SQL statement, determine whether it is a cross-database query according to the name of the operation table, and the database accessed by the cross-database query adapts to different SQL statement syntaxes. When a cross-database query occurs, the SQL statement is sent to the query engine of the logical database for query, and the logical database manages different data sources as logical tables, and can query different data sources adapted to different SQL statements. If it is a non-cross-database query, the target SQL statement that adapts to the target data source can be obtained by performing keyword replacement and function conversion. The SQL statement can be automatically converted into a target SQL statement that adapts to the target data source. There is no need to enter the SQL statement for each SQL statement syntax separately, so that one SQL statement can adapt to multiple database queries with different SQL statement syntaxes.

[0171] The multi-layer parsing device for structured query statements provided in the embodiment of the present invention can execute the multi-layer parsing method for structured query statements provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0172] Embodiment 7

[0173] Figure 8 A schematic diagram of the structure of a computer device provided in Embodiment 7 of the present invention is shown in FIG. Figure 8 As shown, the computer device includes a processor 70, a memory 71, an input device 72 and an output device 73; the number of processors 70 in the computer device can be one or more. Figure 7 A processor 70 is taken as an example; the processor 70, memory 71, input device 72 and output device 73 in the computer device can be connected by a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0174] The memory 71, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the multi-layer parsing method of structured query statements in the embodiment of the present invention (for example, the operation parsing module 610, the syntax parsing module 620 and the field parsing module 630 in the multi-layer parsing device of structured query statements). The processor 70 executes various functional applications and data processing of the computer device by running the software programs, instructions and modules stored in the memory 71, that is, realizes the above-mentioned multi-layer parsing method of structured query statements.

[0175] The memory 71 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 71 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 71 may further include a memory remotely arranged relative to the processor 70, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0176] The input device 72 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the computer device. The output device 73 may include a display device such as a display screen.

[0177] Embodiment 8

[0178] Embodiment 8 of the present invention further provides a storage medium containing computer executable instructions, and when the computer executable instructions are executed by a computer processor, they are used to execute a multi-layer parsing method for a structured query statement, the method comprising:

[0179] Extract the operation table name according to the SQL statement;

[0180] Determine whether it is a cross-database query based on the name of the operation table;

[0181] If it is a non-cross-database query, the SQL statement is replaced with keywords and functions are converted according to the query syntax of the target data source to obtain a target SQL statement that is adapted to the target data source;

[0182] If it is a cross-database query, the SQL statement is sent to the query engine of the logical database.

[0183] Based on the above implementation, before extracting the operation table name according to the SQL statement, the method further includes:

[0184] Extract the operation type based on the SQL statement;

[0185] Determine whether the operation type matches a preset type, where the preset type includes: insert operation, delete operation, modify operation, sort operation or search operation;

[0186] If the operation type matches the preset type, the operation table name is extracted according to the SQL statement.

[0187] Based on the above implementation, after extracting the operation table name according to the SQL statement, the method further includes:

[0188] User authority authentication is performed based on the operation type, operation table name, and user authority information in the cache.

[0189] Based on the above implementation, after extracting the operation table name according to the SQL statement, the method further includes:

[0190] Read pre-configured field permission variables;

[0191] If the field permission variable is the first value, perform field parsing according to the SQL statement to determine the target field;

[0192] If the field permission variable is the second value, determine whether it is a cross-database query based on the operation table name.

[0193] Based on the above implementation, field parsing is performed according to the SQL statement to determine the target field, including:

[0194] Convert the SQL statement to obtain a first abstract syntax tree;

[0195] Traversing the nodes in the first abstract syntax tree in turn;

[0196] If the first node currently traversed is the parent node of the field name node, continue traversing;

[0197] If the first node currently traversed is a field name node, extract the target field in the field name node;

[0198] If the first node currently traversed is not the parent node of the field name node and is not a field name node, return to the last traversed node to continue traversal.

[0199] Based on the above implementation, after performing field parsing according to the SQL statement and determining the target field, the method further includes:

[0200] User authority authentication is performed based on the target field, the operation type of the SQL statement, and the user authority information in the cache.

[0201] Based on the above implementation, judging whether it is a cross-database query according to the name of the operation table includes:

[0202] According to the mapping relationship between the operation table name and the physical table, determine the data source to which the physical table belongs;

[0203] If the data sources are different, it is determined to be a cross-database query;

[0204] If the data sources are the same, it is determined to be a non-cross-database query.

[0205] Based on the above implementation, keyword replacement and function conversion are performed on the SQL statement according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source, including:

[0206] Convert according to the SQL statement to obtain a second abstract syntax tree;

[0207] Replacing the keyword node content in the second abstract syntax tree according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statement of the target data source;

[0208] Converting the function node content in the second abstract syntax tree according to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source;

[0209] The target SQL statement is determined according to the replaced and converted second abstract syntax tree.

[0210] On the basis of the above implementation, the keyword node content in the second abstract syntax tree is replaced according to the mapping relationship between the grammatical keywords of the unified SQL statement predefined by the logical database and the grammatical keywords of the SQL statement of the target data source, and the function content in the second abstract syntax tree is converted according to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source, including:

[0211] Traversing the nodes in the second abstract syntax tree in sequence;

[0212] If the second node currently traversed is a keyword node, obtain the keyword in the keyword node;

[0213] According to the mapping relationship between the grammatical keywords of the unified SQL statement predefined by the logical database and the grammatical keywords of the SQL statement of the target data source, it is determined whether the keyword belongs to the grammar of the unified SQL statement or the grammar of the SQL statement of the target data source;

[0214] If the keyword belongs to the syntax of the unified SQL statement, the keyword is converted into a target keyword adapted to the target data source according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statements of each data source.

[0215] If the second node currently traversed is a function node, obtain the function in the function node;

[0216] According to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source, it is determined whether the function belongs to the syntax of the unified SQL statement or the syntax of the SQL statement of the target data source;

[0217] If the function belongs to the syntax of the unified SQL statement, the function is converted into a target function adapted to the target data source according to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of each data source.

[0218] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided by an embodiment of the present invention are not limited to the above method operations, and can also execute related operations in the multi-layer parsing method of structured query statements provided by any embodiment of the present invention.

[0219] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0220] It is worth noting that in the embodiment of the multi-layer parsing device for the above-mentioned structured query statement, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0221] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A multi-layer parsing method for structured query statements, characterized in that: include: Extract the operation table name according to the SQL statement; Determine whether it is a cross-database query according to the name of the operation table; If it is a non-cross-database query, the SQL statement is converted into a syntax according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source; If it is a cross-database query, the SQL statement is sent to the query engine of the logical database; Wherein, judging whether it is a cross-database query according to the name of the operation table includes: According to the mapping relationship between the operation table name and the physical table, determine the data source to which the physical table belongs; If the data sources are different, it is determined to be a cross-database query; If the data sources are the same, it is determined to be a non-cross-database query; The step of converting the SQL statement according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source includes: Convert the SQL statement to obtain a second abstract syntax tree. Replacing the keyword node content in the second abstract syntax tree according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statement of the target data source; Performing syntax conversion on the function node content in the second abstract syntax tree according to the mapping relationship between the unified SQL function predefined in the logical database and the function of the target data source SQL statement, wherein the syntax conversion includes replacing the function name and adjusting the function parameters; The target SQL statement is determined according to the second abstract syntax tree after the syntax conversion.

2. The method according to claim 1, characterized in that Before extracting the operation table name according to the SQL statement, it also includes: Extract the operation type based on the SQL statement; Determine whether the operation type matches a preset type, where the preset type includes: insert operation, delete operation, modify operation, sort operation or search operation; If the operation type matches the preset type, the operation table name is extracted according to the SQL statement.

3. The method according to claim 2, characterized in that After extracting the operation table name according to the SQL statement, it also includes: The user's authority authentication is performed according to the operation type, the operation table name and the user authority information in the buffer area.

4. The method according to claim 1, characterized in that After extracting the operation table name according to the SQL statement, it also includes: Read pre-configured field permission variables; If the field permission variable is the first value, perform field parsing according to the SQL statement to determine the target field; perform user permission authentication according to the target field, the operation type of the SQL statement and the user permission information in the buffer area; If the field permission variable is the second value, whether it is a cross-database query is determined according to the operation table name.

5. The method according to claim 4, characterized in that Perform field parsing according to the SQL statement to determine the target field, including: Convert the SQL statement according to a predefined unified SQL statement grammar to obtain a first abstract syntax tree; Traversing the nodes in the first abstract syntax tree in sequence; If the first node currently traversed is the parent node of the field name node, continue traversing; If the first node currently traversed is a field name node, extract the target field in the field name node; If the first node currently traversed is not the parent node of the field name node and is not a field name node, return to the last traversed node to continue traversal.

6. The method according to claim 1, characterized in that The replacing and converting the keyword node contents in the second abstract syntax tree according to the mapping relationship between the grammatical keywords of the unified SQL statement predefined by the logical database and the grammatical keywords of the SQL statement of the target data source and the mapping relationship between the unified SQL function and the SQL function of the target data source includes: Traversing the nodes in the second abstract syntax tree in sequence; If the second node currently traversed is a keyword node, obtain the keyword in the keyword node; According to the mapping relationship between the syntax keywords of the unified SQL statement predefined in the logical database and the syntax keywords of the SQL statement of the target data source, it is determined whether the keyword belongs to the syntax of the unified SQL statement or the syntax of the SQL statement of the target data source; If the keyword belongs to the syntax of the unified SQL statement, convert the keyword into a target keyword adapted to the target data source according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statements of each data source; If the second node currently traversed is a function node, obtain the function in the function node; According to the mapping relationship between the function of the unified SQL statement predefined by the logical database and the function of the SQL statement of the target data source, it is determined whether the function belongs to the syntax of the unified SQL statement or the syntax of the SQL statement of the target data source; If the function belongs to the syntax of a unified SQL statement, the function node content in the second abstract syntax tree is converted into a syntax according to the mapping relationship between the unified SQL function predefined in the logical database and the function of the SQL statement of the target data source, including replacement of the function name and adjustment of function parameters, to adapt it to the function of the target data source.

7. A multi-layer parsing device for structured query statements, characterized in that: include: Operation parsing module, used to extract the operation table name according to the SQL statement; A syntax parsing module, used to determine whether it is a cross-database query according to the name of the operation table; If it is a non-cross-database query, the SQL statement is converted into a syntax according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source; If it is a cross-database query, the SQL statement is sent to the query engine of the logical database; Wherein, judging whether it is a cross-database query according to the name of the operation table includes: According to the mapping relationship between the operation table name and the physical table, determine the data source to which the physical table belongs; If the data sources are different, it is determined to be a cross-database query; If the data sources are the same, it is determined to be a non-cross-database query; The step of converting the SQL statement according to the query syntax of the target data source to obtain a target SQL statement adapted to the target data source includes: Convert the SQL statement to obtain a second abstract syntax tree. Replacing the keyword node content in the second abstract syntax tree according to the mapping relationship between the syntax keywords of the unified SQL statement predefined by the logical database and the syntax keywords of the SQL statement of the target data source; Performing syntax conversion on the function node content in the second abstract syntax tree according to the mapping relationship between the unified SQL function predefined in the logical database and the function of the target data source SQL statement, wherein the syntax conversion includes replacing the function name and adjusting the function parameters; The target SQL statement is determined according to the second abstract syntax tree after the syntax conversion.

8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the multi-layer parsing method of the structured query statement as described in any one of claims 1-6 is implemented.

9. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the multi-layer parsing method of the structured query statement as described in any one of claims 1 to 6 when executed by a computer processor.