Multi-storage medium grammar generation method and system based on syntactic analyzer

By using a multi-storage-media syntax generation method based on a parser, the problems of excessive data volume and increased computer processing time in database syntax analysis are solved, achieving faster database statement conversion and higher economic efficiency.

CN120950504APending Publication Date: 2025-11-14BEIJING SEEYON INTERNET SOFTWARE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511038112.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing technologies suffer from problems such as excessive data volume, increased computer processing time, and computer unresponsiveness during database syntax analysis, leading to reduced work efficiency and economic benefits.

Method used

A multi-storage-media syntax generation method based on a parser is adopted. By acquiring statements, filtering normal statement words, analyzing types, and analyzing keywords, statements in the target database are generated, reducing the amount of data, narrowing the search scope for the computer, and preventing the computer from becoming unresponsive.

Benefits of technology

It improved computer processing speed, reduced database statement conversion time, and increased the company's economic benefits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120950504A_ABST
    Figure CN120950504A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-storage medium grammar generation method and system based on a grammar analyzer, and relates to the technical field of grammar construction.The method comprises the steps of 1, statement obtaining, 2, normal statement word screening, 3, normal statement type analysis, 4, normal statement keyword analysis and 5, target statement generation. According to the method, the statement type of the normal statement is judged by analyzing the position and the byte number of each fixed word of the normal statement, and each key word of the normal statement is further screened into a table name word, each field word, each data type word and each constraint word, so that the reference statement for database conversion is quickly positioned, and the database conversion efficiency is improved. The syntactic analyzer can conveniently carry out statement conversion of multiple databases, the operation duration of a computer is shortened, the working efficiency is improved, and therefore economic benefits are brought to companies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of grammar construction technology, and specifically to a multi-storage-media grammar generation method and system based on a parser. Background Technology

[0002] In today's digital age, databases have become the infrastructure of information management, providing powerful and flexible data storage, query, and update functions. Therefore, databases are an indispensable part of company operations. However, different departments within a company may use different databases, resulting in inconsistent database syntax. The lack of support for conversion between databases with different syntaxes leads to inflexible use of functions for different databases. When departments need to call databases from other departments, the database syntax must be recompiled, slowing down departmental efficiency. Therefore, it is necessary to research a method for intelligent generation of multi-database syntax.

[0003] The existing technology can basically meet the current needs, but there are still some defects, which are specifically manifested in: (1) The existing technology lacks attention to the statement type of the database statement. The database statement is divided according to the function into query statement, add statement, delete statement, modify statement, etc. Since the existing technology does not divide the database according to the statement type in advance, it is easy to have a large amount of data during database syntax analysis, which increases the computer's computing time, reduces work efficiency, and thus causes economic losses to the company.

[0004] (2) Existing technologies do not pay enough attention to the functional division of keywords in database statements. In addition to fixed words, database statements also contain keywords input by the programmer. These keywords are used to describe the table names, table attributes, changed values ​​of table attributes, and constraints. When searching for database reference statements, the amount of data is often extremely large. If the search is performed one byte at a time instead of matching the combination of keywords in the database statement, the computer's processing cycle may become too long, or even cause the computer to become unresponsive. This increases the conversion time of database statements, increases working time, and reduces the company's economic benefits. Summary of the Invention

[0005] The purpose of this invention is to provide a multi-storage-media syntax generation method and system based on a syntax analyzer, which solves the problems existing in the background art.

[0006] To solve the above technical problems, the present invention adopts the following technical solution: The first aspect of the present invention provides a multi-storage medium syntax generation method and system based on a syntax analyzer, including: Step 1. Statement acquisition: acquire the current statement from the current database storage medium, extract each word of the current statement, and acquire the sorting position of each word in the current statement, distinguish the current statement into a normal statement or an abnormal statement, and if the current statement is an abnormal statement, remind the user that the abnormal statement cannot be identified.

[0007] Step 2. Normal Sentence Word Filtering: Obtain the number of bytes and the corresponding ASCII code value of each word in the normal sentence, and filter the words in the normal sentence into fixed words and keywords.

[0008] Step 3. Normal statement type analysis: Calculate the feature value of the normal statement and determine the statement type of the normal statement.

[0009] Step 4. Keyword Analysis of Normal Statements: Obtain the data types of each keyword in the normal statement from the parser, obtain the reference statements for each statement type from the MySQL database, and obtain the table name words, field names and data types of each table attribute. Filter the table name words, field names and data types of each table attribute, and constraint words in the normal statement, and analyze the target reference statement of the normal statement.

[0010] Step 5. Target Statement Generation: Obtain the mapping reference statements of each statement type in the current database storage medium from the MySQL database to the target database storage medium, and generate the target statement for the target database storage medium through the syntax analyzer.

[0011] Preferably, the method for distinguishing the current statement into a normal statement or an abnormal statement is as follows: obtain each reference word and its probability value and abnormal coefficient threshold from the MySQL database.

[0012] The words in the current sentence are compared with each reference word. If a word in the current sentence matches a reference word, the word is marked as a word to be analyzed, thereby filtering the words to be analyzed in the current sentence.

[0013] Based on the order of each word in the current sentence, extract the order of each word to be analyzed in the current sentence.

[0014] Extract the probability value of each word to be analyzed in the current sentence at each sorting position, and extract the probability value f of each word to be analyzed at the current sentence's sorting position. i Where i represents the number of each word to be analyzed, i = 1, 2, ..., j, and j is a positive integer greater than 2. The anomaly coefficient of the current statement is calculated.

[0015] The abnormality coefficient of the current statement is compared with the abnormality coefficient threshold. If the abnormality coefficient of the current statement is greater than the abnormality coefficient threshold, the current statement is marked as an abnormal statement; otherwise, the current statement is marked as a normal statement.

[0016] Preferably, the specific calculation method for calculating the feature value of a normal statement is as follows: obtain the type coefficient tuning value corresponding to each byte number tuning coefficient range and the reference value corresponding to each sorting position from the MySQL database.

[0017] Based on the byte count of each word in a normal sentence, extract the byte count of each fixed word in the normal sentence. x Where x is the number of each fixed word, x = 1, 2, ..., y, and y is a positive integer greater than 2. Based on the order position of each word in the normal sentence, the order position of each fixed word in the normal sentence is extracted, and the reference value c corresponding to the order position of each fixed word in the normal sentence is extracted. x Calculate the byte count parameter of a normal statement.

[0018] Based on the ASCII code values ​​of each character in each word of a normal sentence, extract the ASCII code value b corresponding to each character of each fixed word in the normal sentence. xn Where n is the character number of each fixed word, n = 1, 2, ..., m, and m is a positive integer greater than 2. Calculate the feature value of a normal sentence. Where e is the natural constant.

[0019] Preferably, the specific method for determining the statement type of a normal statement is to obtain the feature values ​​of each statement of each statement type from the MySQL database.

[0020] The feature value of a normal statement is compared with the feature values ​​of each statement in each statement type. If the feature value of a normal statement matches the feature value of a statement in a certain statement type, then that statement type is designated as the statement type of a normal statement.

[0021] Preferably, the specific filtering method for the table name words, field words and data type words of each table attribute, and constraint words of the normal statement is as follows: compare each keyword of the normal statement with the table name words of each data table. If a keyword of the normal statement is consistent with a table name word of a data table, then the keyword is marked as a table name word, and the data table is marked as the target data table of the normal statement. Otherwise, the keyword is marked as a word to be analyzed by the field, thereby filtering each word to be analyzed by the field of the normal statement.

[0022] Based on the field names of the attributes of each table in each data table, extract the field names of the attributes of each table in the target data table of the current statement. Compare the terms to be analyzed in each field of the current statement with the field names of the attributes of each table in the target data table. If a term to be analyzed in the current statement matches a field name of an attribute in the target data table, mark the term to be analyzed as a field term of that attribute, thus filtering the field terms of the attributes of each table in the current statement. Otherwise, mark the term to be analyzed as a data type analysis term, thus filtering the data type analysis terms of each data type in the current statement.

[0023] Based on the data types of each keyword in the normal statement, the data types of each data type analysis term in the normal statement are extracted. Based on the data types of each table attribute in the normal statement, the data types of each data type analysis term in the normal statement are compared with the data types of each table attribute. If the data type of a data type analysis term in the normal statement is consistent with the data type of a table attribute, then the data type analysis term is marked as a data type term of that table attribute, thereby filtering the data type terms of each table attribute in the current statement. Otherwise, the data type analysis term is marked as a constraint term, thereby filtering the constraint terms in the current statement.

[0024] Preferably, the target reference statement for analyzing normal statements is specifically analyzed by: extracting reference statements of each statement type for normal statements based on the reference statements of each statement type.

[0025] Based on the reference values ​​corresponding to each sorting position, and according to the sorting position of each word in the current statement, extract the reference value g corresponding to the sorting position of the table name words in the current statement, and the reference value h corresponding to the sorting position of the field words of each table attribute. r The reference value k corresponding to the sorting position of the data type terms of each table attribute. r The reference value l corresponding to the sorting position of each constraint term t , where r represents the number of each table attribute, r = 1, 2, ..., s, where s is a positive integer greater than 2, and t represents the number of each constraint term, t = 1, 2, ..., z, where z is a positive integer greater than 2.

[0026] Retrieve the sorting position of each word in each reference statement for each statement type from the MySQL database, and obtain the reference value g′ corresponding to the sorting position of the table name words in each reference statement for the normal statement type. p The reference value h′ corresponding to the sorting position of the field terms in each table attribute. pr′ The reference value k′ corresponding to the sorting position of the data type terms of each table attribute. pr′ The reference value l′ corresponding to the sorting position of each constraint term pt′, where p represents the number of each reference statement, p = 1, 2, ..., q, q is a positive integer greater than 2, r′ represents the number of each table attribute of the reference statement, r′ = 1, 2, ..., s′, s′ is a positive integer greater than 2, t′ represents the number of each constraint word, t′ = 1, 2, ..., z′, z′ is a positive integer greater than 2;

[0027] Calculate the relevance of the current statement to each reference statement.

[0028] Sort the reference statements in descending order of relevance, and mark the first reference statement in the sorted list as the target reference statement for the normal statement.

[0029] Preferably, the specific calculation method for calculating the relevance between the current statement and each reference statement is as follows: obtain the relevance feature value A and the parameter tuning values ​​of each data type from the MySQL database.

[0030] Extract the data type of each data type term in the current statement, and extract the parameter values ​​u of the data type terms of each table attribute in the current statement. r .

[0031] Similarly, extract the parameter values ​​u′ of the data type words of each table attribute in each reference statement. pr′ .

[0032] Calculate the relevance between the current statement and each reference statement.

[0033] The second aspect of the present invention provides a multi-storage-media syntax generation system that executes the multi-storage-media syntax generation method based on a parser as described in any one of the first aspects, comprising: a statement acquisition module, configured to acquire a current statement from a current database storage medium, extract each word of the current statement, acquire the sorting position of each word in the current statement, distinguish the current statement as a normal statement or an abnormal statement, and if the current statement is an abnormal statement, remind the user that the abnormal statement cannot be identified.

[0034] The normal sentence word filtering module is used to obtain the number of bytes of each word in a normal sentence and the ASCII code value of each character, and to filter the words in the normal sentence into fixed words and keywords.

[0035] The normal statement type analysis module is used to calculate the feature values ​​of normal statements and determine the statement type of normal statements.

[0036] The Normal Statement Keyword Analysis module is used to obtain the data types of each keyword in a normal statement from the parser, obtain the reference statements for each statement type from the MySQL database, and obtain the table names, field names, and data types of each table attribute. It filters the table name words, field words, data type words, and constraint words in the normal statement and analyzes the target reference statement of the normal statement.

[0037] The target statement generation module is used to obtain the mapping reference statements of each statement type in the current database storage medium from the MySQL database to the target database storage medium, and to generate the target statement for the target database storage medium through the syntax analyzer.

[0038] The beneficial effects of the present invention are as follows: (1) Step 1 of the present invention, statement acquisition, by acquiring the current statement and analyzing whether the statement is normal, facilitates subsequent analysis.

[0039] (2) Step 2 of the present invention: normal sentence word screening, which initially screens and divides the words of normal sentences to facilitate subsequent analysis.

[0040] (3) Step 3 of the present invention: Normal statement type analysis. By analyzing the fixed words of normal statements, the statement type of normal statements can be determined, thereby facilitating the screening of reference statements of the statement type of normal statements, reducing the amount of data, narrowing the search range of the computer, thereby speeding up the computer's operation and improving the company's economic benefits.

[0041] (4) Step 4 of the present invention: Normal statement keyword analysis. By filtering the table name words, field words, data type words and constraint words of the normal statement, the target reference statement of the normal statement is analyzed. Each word is analyzed as a whole to prevent matching and searching for reference statements one byte at a time, reduce the computer operation cycle, prevent the computer from not responding, thereby reducing the conversion time of database statements, reducing working time, and increasing the company's economic benefits.

[0042] (5) Step 5 of the present invention: Target statement generation. Through the syntax analyzer, the mapping reference statements of each reference statement in the target database storage medium are obtained, and the corresponding target statements are generated so that the target database storage medium can use them. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0045] Figure 2 This is a schematic diagram of the system modules of the present invention. Detailed Implementation

[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] Reference Figure 1 As shown, the first aspect of the present invention provides a multi-storage-media syntax generation method and system based on a syntax analyzer, including: Step 1. Statement acquisition: acquiring the current statement from the current database storage medium, extracting each word of the current statement, and acquiring the sorting position of each word in the current statement, classifying the current statement into a normal statement or an abnormal statement, and if the current statement is an abnormal statement, reminding the user that the abnormal statement cannot be identified.

[0048] In a specific embodiment of the present invention, the method for distinguishing the current statement into a normal statement or an abnormal statement is as follows: obtaining each reference word and its probability value and abnormal coefficient threshold at each sorting position from the MySQL database.

[0049] It should be noted that the MySQL database is used to store the probability values ​​of each reference word and its appearance at each sorting position, the anomaly coefficient threshold, each reference fixed word, the type coefficient tuning values ​​corresponding to each byte number tuning coefficient range, the reference values ​​corresponding to each sorting position, the feature values ​​of each statement of each statement type, each reference statement of each statement type, the table name words of each data table, the field names and data types of each table attribute, the sorting position of each word in each reference statement of each statement type, the relevance feature value, the tuning values ​​of each data type, and the mapping reference statements of each statement type in the current database storage medium to the target database storage medium.

[0050] The words in the current sentence are compared with each reference word. If a word in the current sentence matches a reference word, the word is marked as a word to be analyzed, thereby filtering the words to be analyzed in the current sentence.

[0051] Based on the order of each word in the current sentence, extract the order of each word to be analyzed in the current sentence.

[0052] Extract the probability value of each word to be analyzed in the current sentence at each sorting position, and extract the probability value f of each word to be analyzed at the current sentence's sorting position. i Where i represents the number of each word to be analyzed, i = 1, 2, ..., j, and j is a positive integer greater than 2. The anomaly coefficient of the current statement is calculated.

[0053] The abnormality coefficient of the current statement is compared with the abnormality coefficient threshold. If the abnormality coefficient of the current statement is greater than the abnormality coefficient threshold, the current statement is marked as an abnormal statement; otherwise, the current statement is marked as a normal statement.

[0054] Step 2. Normal Sentence Word Filtering: Obtain the number of bytes and the corresponding ASCII code value of each word in the normal sentence, and filter the words in the normal sentence into fixed words and keywords.

[0055] In one specific embodiment, the method for filtering words in a normal statement into fixed words and keywords is as follows: obtain reference fixed words from a MySQL database, compare each word in the current statement with each reference fixed word, and if a word in the current statement matches a reference fixed word, mark that word as a fixed word, thereby filtering the fixed words in the current statement; otherwise, mark that word as a keyword, thereby filtering the keywords in the current statement.

[0056] Step 3. Normal statement type analysis: Calculate the feature value of the normal statement and determine the statement type of the normal statement.

[0057] In a specific embodiment of the present invention, the specific calculation method for calculating the feature value of a normal statement is as follows: obtain the type coefficient tuning value corresponding to each byte number tuning coefficient range and the reference value corresponding to each sorting position from the MySQL database.

[0058] Based on the byte count of each word in a normal sentence, extract the byte count of each fixed word in the normal sentence. x Where x is the number of each fixed word, x = 1, 2, ..., y, and y is a positive integer greater than 2. Based on the order position of each word in the normal sentence, the order position of each fixed word in the normal sentence is extracted, and the reference value c corresponding to the order position of each fixed word in the normal sentence is extracted.x Calculate the byte count parameter of a normal statement.

[0059] Based on the ASCII code values ​​of each character in each word of a normal sentence, extract the ASCII code value b corresponding to each character of each fixed word in the normal sentence. xn Where n is the character number of each fixed word, n = 1, 2, ..., m, and m is a positive integer greater than 2. Calculate the feature value of a normal sentence. Where e is the natural constant.

[0060] In a specific embodiment of the present invention, the method for determining the statement type of a normal statement is as follows: obtain the feature values ​​of each statement of each statement type from the MySQL database.

[0061] The feature value of a normal statement is compared with the feature values ​​of each statement in each statement type. If the feature value of a normal statement matches the feature value of a statement in a certain statement type, then that statement type is designated as the statement type of a normal statement.

[0062] It should be noted that the method for calculating the feature values ​​of each statement of each statement type is the same as the method for calculating the feature values ​​of normal statements.

[0063] Step 4. Keyword Analysis of Normal Statements: Obtain the data types of each keyword in the normal statement from the parser, obtain the reference statements for each statement type from the MySQL database, and obtain the table name words, field names and data types of each table attribute. Filter the table name words, field names and data types of each table attribute, and constraint words in the normal statement, and analyze the target reference statement of the normal statement.

[0064] In a specific embodiment of the present invention, the method for filtering table name terms, field terms and data type terms of each table attribute, and constraint terms of normal statements is as follows: each keyword of the normal statement is compared with the table name terms of each data table. If a keyword of the normal statement is consistent with a table name term of a data table, the keyword is marked as a table name term, and the data table is marked as the target data table of the normal statement. Otherwise, the keyword is marked as a term to be analyzed by the field, thereby filtering each term to be analyzed by the field of the normal statement.

[0065] Based on the field names of the attributes of each table in each data table, extract the field names of the attributes of each table in the target data table of the current statement. Compare the terms to be analyzed in each field of the current statement with the field names of the attributes of each table in the target data table. If a term to be analyzed in the current statement matches a field name of an attribute in the target data table, mark the term to be analyzed as a field term of that attribute, thus filtering the field terms of the attributes of each table in the current statement. Otherwise, mark the term to be analyzed as a data type analysis term, thus filtering the data type analysis terms of each data type in the current statement.

[0066] Based on the data types of each keyword in the normal statement, the data types of each data type analysis term in the normal statement are extracted. Based on the data types of each table attribute in the normal statement, the data types of each data type analysis term in the normal statement are compared with the data types of each table attribute. If the data type of a data type analysis term in the normal statement is consistent with the data type of a table attribute, then the data type analysis term is marked as a data type term of that table attribute, thereby filtering the data type terms of each table attribute in the current statement. Otherwise, the data type analysis term is marked as a constraint term, thereby filtering the constraint terms in the current statement.

[0067] In a specific embodiment of the present invention, the target reference statement for analyzing normal statements is specifically analyzed as follows: based on the reference statements of each statement type, the reference statements of each statement type of normal statements are extracted.

[0068] Based on the reference values ​​corresponding to each sorting position, and according to the sorting position of each word in the current statement, extract the reference value g corresponding to the sorting position of the table name words in the current statement, and the reference value h corresponding to the sorting position of the field words of each table attribute. r The reference value k corresponding to the sorting position of the data type terms of each table attribute. r The reference value l corresponding to the sorting position of each constraint term t , where r represents the number of each table attribute, r = 1, 2, ..., s, where s is a positive integer greater than 2, and t represents the number of each constraint term, t = 1, 2, ..., z, where z is a positive integer greater than 2.

[0069] Retrieve the sorting position of each word in each reference statement for each statement type from the MySQL database, and obtain the reference value g′ corresponding to the sorting position of the table name words in each reference statement for the normal statement type. p The reference value h′ corresponding to the sorting position of the field terms in each table attribute. pr′ The reference value k′ corresponding to the sorting position of the data type terms of each table attribute. pr′ The reference value l′ corresponding to the sorting position of each constraint term pt′, where p represents the number of each reference statement, p = 1, 2, ..., q, q is a positive integer greater than 2, r′ represents the number of each table attribute of the reference statement, r′ = 1, 2, ..., s′, s′ is a positive integer greater than 2, t′ represents the number of each constraint word, t′ = 1, 2, ..., z′, z′ is a positive integer greater than 2;

[0070] Calculate the relevance of the current statement to each reference statement.

[0071] Sort the reference statements in descending order of relevance, and mark the first reference statement in the sorted list as the target reference statement for the normal statement.

[0072] In a specific embodiment of the present invention, the method for calculating the relevance between the current statement and each reference statement is as follows: obtain the relevance feature value A and the parameter tuning values ​​of each data type from the MySQL database.

[0073] Extract the data type of each data type term in the current statement, and extract the parameter values ​​u of the data type terms of each table attribute in the current statement. r .

[0074] Similarly, extract the parameter values ​​u′ of the data type words of each table attribute in each reference statement. pr′ .

[0075] Calculate the relevance between the current statement and each reference statement.

[0076] Step 5. Target Statement Generation: Obtain the mapping reference statements of each statement type in the current database storage medium from the MySQL database to the target database storage medium, and generate the target statement for the target database storage medium through the syntax analyzer.

[0077] In one specific embodiment, the method for obtaining the mapping reference statements of each statement type in the current database storage medium to the target database storage medium is as follows: using an existing parser, the mapping reference statements of each statement type in the current database storage medium to the target database storage medium can be obtained.

[0078] In one specific embodiment, the method for generating the target statement of the target database storage medium is as follows: based on the mapping reference statements of each reference statement of each statement type in the current database storage medium to the target database storage medium, extract the mapping reference statements of the target reference statements of the current statement type in the current database storage medium to the target database storage medium, and use an existing parser to generate the target statement of the target database storage medium, thereby using the target statement in the target database storage medium.

[0079] Reference Figure 2 As shown, the second aspect of the present invention provides a multi-storage-media syntax generation system for the multi-storage-media syntax generation method based on a syntax analyzer, comprising: a statement acquisition module, a normal statement word filtering module, a normal statement type analysis module, a normal statement keyword analysis module, a target statement generation module, and a MySQL database.

[0080] It should be noted that the sentence acquisition module is connected to the normal sentence word filtering module, the normal sentence type analysis module is connected to the normal sentence word filtering module, the normal sentence type analysis module is connected to the normal sentence keyword analysis module, and the target sentence generation module is connected to the normal sentence keyword analysis module. The MySQL database is connected to the sentence acquisition module, the normal sentence word filtering module, the normal sentence type analysis module, the normal sentence keyword analysis module, and the target sentence generation module.

[0081] The statement acquisition module is used to retrieve the current statement from the current database storage medium, extract each word of the current statement, obtain the sorting position of each word in the current statement, and distinguish the current statement into a normal statement or an abnormal statement. If the current statement is an abnormal statement, the user is notified that the abnormal statement cannot be identified.

[0082] The normal sentence word filtering module is used to obtain the number of bytes of each word in a normal sentence and the ASCII code value corresponding to each character, and to filter each word in the normal sentence into fixed words and keywords.

[0083] The normal statement type analysis module is used to calculate the feature value of a normal statement and determine the statement type of the normal statement.

[0084] The normal statement keyword analysis module is used to obtain the data types of each keyword in a normal statement from the parser, obtain each reference statement of each statement type from the MySQL database, and obtain the table name, field name and data type of each table attribute. It then filters the table name words, field words, data type words and constraint words of the normal statement and analyzes the target reference statement of the normal statement.

[0085] The target statement generation module is used to obtain the mapping reference statements of each statement type in the current database storage medium from the MySQL database and generate the target statement in the target database storage medium through a syntax analyzer.

[0086] The above content is merely an example and illustration of the concept of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described, or use similar methods to replace them, as long as they do not deviate from the concept of the invention or exceed the scope defined by the present invention, and all such modifications and additions should fall within the protection scope of the present invention.

Claims

1. A multi-storage-media syntax generation method based on a parser, characterized in that, include: Step 1. Statement Acquisition: Retrieve the current statement from the current database storage medium, extract each word of the current statement, and obtain the sorting position of each word in the current statement. Distinguish the current statement into a normal statement or an abnormal statement. If the current statement is an abnormal statement, notify the user that the abnormal statement cannot be identified. Step 2. Normal sentence word filtering: Obtain the number of bytes of each word in the normal sentence and the ASCII code value of each character, and filter the words in the normal sentence into fixed words and keywords; Step 3. Normal Statement Type Analysis: Calculate the feature values ​​of normal statements to determine their statement type; Step 4. Keyword Analysis of Normal Statements: Obtain the data types of each keyword in the normal statement from the parser, obtain the reference statements for each statement type from the MySQL database, and obtain the table name words, field names and data types of each table attribute. Filter the table name words, field words and data type words of each table attribute, and constraint words in the normal statement, and analyze the target reference statement of the normal statement. Step 5. Target Statement Generation: Obtain the mapping reference statements of each statement type in the current database storage medium from the MySQL database to the target database storage medium, and generate the target statement for the target database storage medium using a syntax analyzer.

2. The multi-storage-media syntax generation method based on a parser according to claim 1, characterized in that, The specific method for distinguishing the current statement into a normal statement or an abnormal statement is as follows: Retrieve each reference word and its probability value and anomaly coefficient threshold at each sorting position from the MySQL database; The words in the current sentence are compared with each reference word. If a word in the current sentence matches a reference word, the word is marked as a word to be analyzed, thereby filtering the words to be analyzed in the current sentence. Based on the order position of each word in the current sentence, extract the order position of each word to be analyzed in the current sentence; Extract the probability value of each word to be analyzed in the current sentence at each sorting position, and extract the probability value f of each word to be analyzed at the current sentence's sorting position. i Where i represents the number of each word to be analyzed, i = 1, 2, ..., j, and j is a positive integer greater than 2. The anomaly coefficient of the current statement is calculated. The abnormality coefficient of the current statement is compared with the abnormality coefficient threshold. If the abnormality coefficient of the current statement is greater than the abnormality coefficient threshold, the current statement is marked as an abnormal statement; otherwise, the current statement is marked as a normal statement.

3. The multi-storage-media syntax generation method based on a parser according to claim 1, characterized in that, The specific calculation method for the feature value of a normal statement is as follows: Retrieve the type coefficient tuning values ​​corresponding to each byte number tuning range and the reference values ​​corresponding to each sorting position from the MySQL database; Based on the byte count of each word in a normal sentence, extract the byte count of each fixed word in the normal sentence. x Where x is the number of each fixed word, x = 1, 2, ..., y, and y is a positive integer greater than 2. Based on the order position of each word in the normal sentence, the order position of each fixed word in the normal sentence is extracted, and the reference value c corresponding to the order position of each fixed word in the normal sentence is extracted. x Calculate the byte count parameter of a normal statement. Based on the ASCII code values ​​of each character in each word of a normal sentence, extract the ASCII code value b corresponding to each character of each fixed word in the normal sentence. xn Where n is the character number of each fixed word, n = 1, 2, ..., m, and m is a positive integer greater than 2. Calculate the feature value of a normal sentence. Where e is the natural constant.

4. The multi-storage-media syntax generation method based on a parser according to claim 1, characterized in that, The specific method for determining the statement type of a normal statement is as follows: Retrieve the feature values ​​of each statement type from the MySQL database; The feature value of a normal statement is compared with the feature values ​​of each statement in each statement type. If the feature value of a normal statement matches the feature value of a statement in a certain statement type, then that statement type is designated as the statement type of a normal statement.

5. The multi-storage-media syntax generation method based on a parser according to claim 1, characterized in that, The specific filtering method for the table name terms, field terms and data type terms of each table attribute, and constraint terms in the filtering of normal statements is as follows: The keywords in the normal statement are compared with the table names of the data tables. If a keyword in the normal statement matches a table name, the keyword is marked as a table name and the data table is marked as the target data table of the normal statement. Otherwise, the keyword is marked as a field to be analyzed, thereby filtering the field to be analyzed in the normal statement. Based on the field names of the attributes of each table in each data table, extract the field names of the attributes of each table in the target data table of the current statement. Compare the terms to be analyzed in each field of the current statement with the field names of the attributes of each table in the target data table. If a term to be analyzed in the current statement matches a field name of an attribute of a table in the target data table, mark the term to be analyzed as a field term of that table attribute, thereby filtering the field terms of the attributes of each table in the current statement. Otherwise, mark the term to be analyzed as a data type analysis term, thereby filtering the data type analysis terms of each data type in the current statement. Based on the data types of each keyword in the normal statement, the data types of each data type analysis term in the normal statement are extracted. Based on the data types of each table attribute in the normal statement, the data types of each data type analysis term in the normal statement are compared with the data types of each table attribute. If the data type of a data type analysis term in the normal statement is consistent with the data type of a table attribute, then the data type analysis term is marked as a data type term of that table attribute, thereby filtering the data type terms of each table attribute in the current statement. Otherwise, the data type analysis term is marked as a constraint term, thereby filtering the constraint terms in the current statement.

6. The multi-storage-media syntax generation method based on a parser according to claim 3, characterized in that, The specific analysis method for the target reference statement used in the analysis of normal statements is as follows: Based on the reference statements for each statement type, extract the reference statements for each statement type of normal statement; Based on the reference values ​​corresponding to each sorting position, and according to the sorting position of each word in the current statement, extract the reference value g corresponding to the sorting position of the table name words in the current statement, and the reference value h corresponding to the sorting position of the field words of each table attribute. r The reference value k corresponding to the sorting position of the data type terms of each table attribute. r The reference value l corresponding to the sorting position of each constraint term t , where r represents the number of each table attribute, r = 1, 2, ..., s, where s is a positive integer greater than 2, and t represents the number of each constraint term, t = 1, 2, ..., z, where z is a positive integer greater than 2; Retrieve the sorting position of each word in each reference statement for each statement type from the MySQL database, and obtain the reference value g′ corresponding to the sorting position of the table name words in each reference statement for the normal statement type. p The reference value h′ corresponding to the sorting position of the field terms in each table attribute. pr′ The reference value k′ corresponding to the sorting position of the data type terms of each table attribute. pr′ The reference value l′ corresponding to the sorting position of each constraint term pt′ , where p represents the number of each reference statement, p = 1, 2, ..., q, q is a positive integer greater than 2, r′ represents the number of each table attribute of the reference statement, r′ = 1, 2, ..., s′, s′ is a positive integer greater than 2, t′ represents the number of each constraint word, t′ = 1, 2, ..., z′, z′ is a positive integer greater than 2; Calculate the relevance of the current statement to each reference statement; Sort the reference statements in descending order of relevance, and mark the first reference statement in the sorted list as the target reference statement for the normal statement.

7. The multi-storage-media syntax generation method based on a parser according to claim 6, characterized in that, The specific calculation method for the relevance between the current statement and each reference statement is as follows: Retrieve the relevance feature value A and the parameter tuning values ​​for each data type from the MySQL database; Extract the data type of each data type term in the current statement, and extract the parameter values ​​u of the data type terms of each table attribute in the current statement. r ; Similarly, obtain the parameter values ​​u′ of the data type words of each table attribute in each reference statement. pr′ ; Calculate the relevance between the current statement and each reference statement.

8. A multi-storage-media syntax generation system for implementing the multi-storage-media syntax generation method based on a parser according to any one of claims 1-7, characterized in that, include: The statement acquisition module is used to retrieve the current statement from the current database storage medium, extract each word of the current statement, obtain the sorting position of each word in the current statement, and distinguish the current statement as a normal statement or an abnormal statement. If the current statement is an abnormal statement, the user will be notified that the abnormal statement cannot be identified. The normal sentence word filtering module is used to obtain the number of bytes of each word in a normal sentence and the ASCII code value of each character, and to filter each word in the normal sentence into fixed words and keywords; The normal statement type analysis module is used to calculate the feature values ​​of normal statements and determine the statement type of normal statements; The normal statement keyword analysis module is used to obtain the data types of each keyword in a normal statement from the parser, obtain each reference statement of each statement type from the MySQL database, and obtain the table name, field name and data type of each table attribute. It filters the table name words, field words, data type words and constraint words of the normal statement and analyzes the target reference statement of the normal statement. The target statement generation module is used to obtain the mapping reference statements of each statement type in the current database storage medium from the MySQL database to the target database storage medium, and to generate the target statement for the target database storage medium through the syntax analyzer.