Cross-database architecture sql semantic analysis and recognition replacement method for credential and credential adaptation

Through the SQL semantic analysis and identification replacement method of cross-database architecture, the dynamic SQL parsing adaptation engine is used to adapt the information and innovation database application, which solves the problems of large adaptation range, high difficulty and low efficiency in the existing technology, and achieves dynamic sensorless compatibility and efficient adaptation.

CN119669523APending Publication Date: 2025-03-21TIANJIN TIANDY DIGITAL TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411739754.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

The existing Xinchuang database adaptation methods have problems such as large adaptation range, many manpower requirements, high implementation difficulty, low efficiency, non-versatile, long cycle, uncontrollable and poor adaptability to business development.

Method used

The SQL semantic analysis and recognition replacement method of cross-database architecture is adopted to adapt the information-creation database application through the dynamic SQL parsing adaptation engine. This method includes obtaining the original SQL statement, identifying the target database type, parsing the SQL statement as an abstract syntax tree, performing SQL syntax semantic analysis, dynamically replacing SQL statements, and executing new SQL statements through interceptors or active calls.

Benefits of technology

It realizes dynamic insensitive compatibility across database architectures, reduces adaptation difficulty and cost, improves adaptation efficiency and business adaptability, and solves the problems of uncommon adaptation and long cycles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669523A_ABST
    Figure CN119669523A_ABST
Patent Text Reader

Abstract

The invention relates to a cross-database architecture sql semantic analysis and recognition replacement method for credential and credential adaptation. The method comprises the steps of obtaining an original sql statement; identifying a use target database type used by the system and retrieving existing compatible rules of a rule base in a rule engine; analyzing the original sql statement to obtain an abstract syntax tree; transmitting the abstract syntax tree to an sql syntax tree classification model for information extraction; replacing rules in a rule base with the extracted information; the replaced rule is sent to an sql loading module, and a new sql statement is formed; and replacing the original sql statement with the converted sql statement through an interceptor or an active calling mode, executing a new statement downwards through a scheduling layer to reach a dream database, and realizing dynamic non-inductive compatible dream reaching of the platform. According to the method, a dynamic sql analysis adaptation engine is adopted for carrying out credential database application adaptation, sql is dynamically recognized based on the running state, sql grammar and semantic analysis is carried out, and replacement and assembly execution are dynamically carried out according to the database type needing to be adapted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field, especially to a cross-database architecture SQL semantic parsing and identification replacement method for information innovation adaptation. Background Art

[0002] The existing trusted database adaptation method is: the database is closely related to the application, and the existing application non-trusted database is adapted to the trusted database. Since the database has syntactical differences, it is necessary to find the differences and modify them one by one.

[0003] The shortcomings of the prior art are:

[0004] The scope of adaptation is large, requiring a lot of manpower, making it difficult to implement and inefficient.

[0005] The adaptation is not universal, and adapting to multiple trusted databases requires multiple investments.

[0006] The adaptation cycle is long and the adaptation process is uncontrollable.

[0007] After adaptation, developing new businesses requires taking into account multiple databases, which makes it difficult to adapt to rapid business development.

[0008] The cost of application software development and maintenance is high. Summary of the invention

[0009] The purpose of the present invention is to overcome the shortcomings of the prior art and propose a cross-database architecture SQL semantic parsing and identification and replacement method for trusted innovation adaptation. A dynamic SQL parsing adaptation engine is used to adapt trusted innovation database applications. SQL is dynamically identified based on the running state, and SQL syntax and semantic analysis is performed. Dynamic replacement is performed according to the database type that needs to be adapted, and assembly execution is performed.

[0010] The present invention solves the technical problem by adopting the following technical solutions:

[0011] The cross-database architecture SQL semantic parsing and identification replacement method for trust innovation adaptation includes the following steps:

[0012] Step 1: Get the original SQL statement;

[0013] Step 2: Identify the target database type used by the system and retrieve the existing compatible rules in the rule base in the rule engine;

[0014] Step 3: Parse the original SQL statement to obtain an abstract syntax tree;

[0015] Step 4: Pass the abstract syntax tree to the SQL syntax tree classification model for information extraction;

[0016] Step 5: Replace the rules in the rule base with the extracted information;

[0017] Step 6: Send the replaced rules to the SQL loading module to form a new SQL statement;

[0018] Step 7. Replace the original SQL statement with the converted SQL statement through an interceptor or active call, pass it downward through the scheduling layer, and execute the new statement to the Dameng database, so as to realize dynamic and seamless compatibility of the platform with Dameng.

[0019] Moreover, the specific implementation method of step 1 is: when the program needs to execute the original SQL statement, the compatible system will capture the original SQL statement through the aspect method and start the compatible conversion process.

[0020] Moreover, the specific implementation method of step 2 is: the compatible module will identify the target database type used by the current system and will search the existing compatible rules in the rule library in the rule engine. If it is obtained, it will continue to execute. If there is no match, it will not be processed and the original SQL statement will be kept.

[0021] Moreover, the specific implementation method of step 3 is: the captured original sql statement is passed to the sql parsing engine, and the engine parses the sql string into an abstract syntax tree AST.

[0022] Moreover, the specific implementation method of step 4 is: passing the existing syntax tree and rule information to the model calculator, the rule base contains database type specific syntax rules, functions and data type information; matching the nodes in the AST with the rules in the rule base, and preparing for conversion.

[0023] Moreover, the specific implementation method of step 5 is as follows: the model calculator notifies the converter of the node information and the node configuration rules in the model for the nodes searched in the previous step, and the converter performs compatible processing according to the rules.

[0024] Moreover, the specific implementation method of step 6 is: the new syntax tree converted by the model calculator, such as the above DAMO syntax tree structure, is passed to the assembler, and the nodes are traversed to assemble into a new SQL statement.

[0025] The advantages and positive effects of the present invention are:

[0026] The present invention obtains the original sql statement; identifies the target database type used by the system and retrieves the existing compatible rules of the rule base in the rule engine; parses the original sql statement to obtain an abstract syntax tree; passes the abstract syntax tree to the sql syntax tree classification model for information extraction; replaces the rules in the rule base with the extracted information; sends the replaced rules to the sql loading module to form a new sql statement; replaces the original sql statement with the converted sql statement through an interceptor or an active call, passes down through the scheduling layer, executes the new statement to reach the dream database, and realizes the dynamic and non-sensing compatibility of the platform with the dream. The present invention adopts a dynamic sql parsing adaptation engine to adapt the xinchuang database application, dynamically identifies sql based on the running state, and performs sql syntax semantic analysis, dynamically replaces according to the database type that needs to be adapted, and assembles and executes. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a flow chart of the present invention;

[0028] Figure 2 This is a schematic diagram of the Select query statement of the present invention;

[0029] Figure 3 This is a schematic diagram of SQL interception and parsing processing of the present invention;

[0030] Figure 4 This is a schematic diagram of the DAMO database SQL syntax and configuration syntax tree model of the present invention. DETAILED DESCRIPTION

[0031] The present invention is further described in detail below with reference to the accompanying drawings.

[0032] Cross-database architecture sql semantic parsing and identification replacement method for trust innovation adaptation, such as Figure 1 As shown, the following steps are included:

[0033] Step 1: Get the original SQL statement.

[0034] When the program needs to execute the original SQL statement, the compatible system will capture the original SQL through the aspect method and start the compatible conversion process.

[0035] Step 2: Identify the target database type used by the system and retrieve the existing compatible rules in the rule base within the rule engine.

[0036] In the first step of the process processing, the compatible module will identify the target database type used by the current system and retrieve the existing compatible rules in the rule library in the rule engine. If it is obtained, it will continue to execute. If there is no match, it will not be processed and the original SQL will be returned. For example, the above environment is to obtain the current environment DAMO, and the conversion rules for configuring DAMO are obtained.

[0037] like Figure 2 Shown is the MYSQL database sql syntax and configuration syntax tree model;

[0038] Collect the SQL syntax features of mainstream databases, including DDL, DML, DCL, DQL, etc. Different lexical syntax tree models will be configured according to the manufacturer version for SQL recognition. Each SQL statement will correspond to a Statement class, such as create database, create table, delete and modify table, query, update, delete, insert, etc.

[0039] like Figure 2 As shown in the figure, the syntax tree model describes the sql syntax structure, decomposes sql into n minimum units, and forms a tree structure. According to the characteristics of each database manufacturer, a complete syntax tree is configured and constructed.

[0040] Step 3: Parse the original SQL statement to get the abstract syntax tree.

[0041] The captured raw SQL statement is passed to the SQL parsing engine, which parses the SQL string into an abstract syntax tree (AST).

[0042] like Figure 3 As shown, the slicing technology is used to intercept the SQL executed by the application and the JSQLParser tool is used to parse it into a syntax tree.

[0043] SELECT UUID()AS id,S_NAME AS name,TIMESTAMP(DT_CREATE_TIME)time FROMTAB_ORG WHERE I_TYPE=3AND S_NAME LIKE'%room%'ORDER BY DT_CREATE_TIME

[0044] Step 4: Pass the abstract syntax tree to the SQL syntax tree classification model for information extraction.

[0045] Pass the existing syntax tree and rule information to the model calculator. The rule base contains database type-specific syntax rules, functions, data types, and other information. Match the nodes in the AST with the rules in the rule base and prepare for conversion. For example, the above sql will find the Function:UUID function node, Function:TIMESTAMP function node, and Orderby keyword node through the configuration rules in the model.

[0046] The construction method of the sql syntax tree classification model is:

[0047] Collect the SQL syntax features of mainstream manufacturer databases, including DDL, DML, DCL, DQL, etc. Different lexical syntax tree models will be configured according to the manufacturer version for SQL recognition. Each SQL statement will correspond to a Statement class, such as create database, create table, delete and modify table, query, update, delete, insert and other statements.

[0048] (Attached Figure 2 , 3 4 has nothing to do with the construction method of the SQL syntax tree classification model. Please clarify the relationship between them)

[0049] Step 5: Replace the rules in the rule base with the extracted information.

[0050] like Figure 4 As shown, the model calculator will notify the converter of the node information and the node rules configured in the model for the node searched in the previous step, and the converter will process it according to the rule compatibility. There will be, for example, the following rule information [{Function:UUID->Function:NEWID},{Function:TIMESTAMP->Function:TO_TIMESTAMP},{Keyword:Orderby->add:{Function:Function:ISNULL}}], traverse the incoming SQL syntax tree nodes [{Function:UUID,value:data},{Function:TIMESTAMP,value:data},{Keyword:Order by,value:data}], dynamically replace the keywords in each node or add conversion data content.

[0051] Step 6: Send the replaced rules to the SQL loading module to form a new SQL statement.

[0052] The new syntax tree converted by the model calculator, such as the above DAMO syntax tree structure, is passed to the assembler, and the nodes are traversed to assemble into a new SQL statement.

[0053] Step 7. Replace the original SQL statement with the converted SQL statement through an interceptor or active call, pass it downward through the scheduling layer, and execute the new statement to the Dameng database, so as to realize dynamic and seamless compatibility of the platform with Dameng.

[0054] The present invention obtains the original sql statement; identifies the target database type used by the system and retrieves the existing compatible rules of the rule base in the rule engine; parses the original sql statement to obtain an abstract syntax tree; passes the abstract syntax tree to the sql syntax tree classification model for information extraction; replaces the rules in the rule base with the extracted information; sends the replaced rules to the sql loading module to form a new sql statement; replaces the original sql statement with the converted sql statement through an interceptor or an active call, passes down through the scheduling layer, executes the new statement to reach the dream database, and realizes the dynamic and non-sensing compatibility of the platform with the dream. The present invention adopts a dynamic sql parsing adaptation engine to adapt the xinchuang database application, dynamically identifies sql based on the running state, and performs sql syntax semantic analysis, dynamically replaces according to the database type that needs to be adapted, and assembles and executes.

[0055] It should be emphasized that the embodiments described in the present invention are illustrative rather than restrictive. Therefore, the present invention includes but is not limited to the embodiments described in the specific implementation manner. Any other implementation manners derived by those skilled in the art based on the technical solution of the present invention also fall within the scope of protection of the present invention.

Claims

1. A cross-database architecture SQL semantic parsing and identification replacement method for trust innovation adaptation, characterized by: The following steps are involved: Step 1: Get the original SQL statement; Step 2: Identify the target database type used by the system and retrieve the existing compatible rules in the rule base in the rule engine; Step 3: Parse the original SQL statement to obtain an abstract syntax tree; Step 4: Pass the abstract syntax tree to the SQL syntax tree classification model for information extraction; Step 5: Replace the rules in the rule base with the extracted information; Step 6: Send the replaced rules to the SQL loading module to form a new SQL statement; Step 7. Replace the original SQL statement with the converted SQL statement through an interceptor or active call, pass it downward through the scheduling layer, and execute the new statement to the Dameng database, so as to realize dynamic and seamless compatibility of the platform with Dameng.

2. According to claim 1, the cross-database architecture SQL semantic parsing and identification replacement method for information innovation adaptation is characterized by: The specific implementation method of step 1 is: when the program needs to execute the original SQL statement, the compatible system will capture the original SQL statement through the aspect method and start the compatible conversion process.

3. According to claim 1, the cross-database architecture SQL semantic parsing and identification replacement method for information innovation adaptation is characterized by: The specific implementation method of step 2 is as follows: the compatible module will identify the target database type used by the current system and will search for existing compatible rules in the rule library in the rule engine. If the compatible rules are obtained, the execution will continue. If there is no match, the original SQL statement will be kept without processing.

4. According to claim 1, the cross-database architecture SQL semantic parsing and identification replacement method for information innovation adaptation is characterized by: The specific implementation method of step 3 is: the captured original SQL statement is passed to the SQL parsing engine, and the engine parses the SQL string into an abstract syntax tree AST.

5. According to claim 1, the cross-database architecture SQL semantic parsing and identification replacement method for information innovation adaptation is characterized by: The specific implementation method of step 4 is: passing the existing syntax tree and rule information to the model calculator, the rule base contains database type specific syntax rules, functions and data type information; matching the nodes in the AST with the rules in the rule base, and preparing for conversion.

6. According to claim 1, the cross-database architecture SQL semantic parsing and identification replacement method for information innovation adaptation is characterized by: The specific implementation method of step 5 is as follows: the model calculator notifies the converter of the node information and the node configuration rules in the model for the nodes searched in the previous step, and the converter processes the nodes in accordance with the rule compatibility.

7. According to claim 1, the cross-database architecture SQL semantic parsing and identification replacement method for information innovation adaptation is characterized by: The specific implementation method of step 6 is: the new syntax tree converted by the model calculator, such as the above DAMO syntax tree structure, is passed into the assembler, and the nodes are traversed to assemble into a new SQL statement.

Citation Information

Cited By

  • Method for transferring mainstream relational database SQL (Structured Query Language) sentences into domestic DM 8 database SQL sentences

    CN120407612A