Cross-database sql statement unified analysis processing method
Through the unified parsing processing method of cross-database SQL statements, and the conversion of SQL statements through segmentation and feature matching processors, the problems of low conversion efficiency and insufficient accuracy of SQL statements in the existing technology are solved, and efficient and accurate SQL statement conversion and cross-section Database compatibility simplifies the development process and improves system stability.
Patent Information
- Application Number
- CN202411041195.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-12-10
AI Technical Summary
Existing SQL statement conversion methods are inefficient when processing complex SQL statements, and inaccurate parsing may cause the generated SQL statements to be inconsistent with the original meaning, affecting the correctness of the data.
The unified parsing processing method of cross-database SQL statements is adopted, and the SQL statements are divided into segmentation units through the preset statement segmentation strategy, feature information is extracted and the processor is matched for conversion, and SQL statements that can be executed by the target database are generated, and the efficiency is improved by using the cache mechanism. And improve accuracy and stability through real-time error identification and recording execution logs.
Improves the efficiency and accuracy of SQL statement conversion, simplifies the development and maintenance process, achieves cross-database compatibility, and improves the stability and availability of the system through caching and error recognition mechanisms.
Smart Images

Figure CN119106047A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of statement parsing, and in particular to a method for uniformly parsing and processing cross-database SQL statements. Background Art
[0002] In the field of information technology, as enterprise needs change and technology develops, the demand for database migration and cross-database operations is increasing. These operations usually involve transferring data from one database system to another or executing queries across multiple database systems. However, due to differences in SQL syntax and features between different database systems, directly executing SQL statements often leads to errors. Therefore, developing an effective conversion mechanism becomes the key to solving this challenge.
[0003] Existing SQL statement conversion methods usually use the abstract syntax tree (AST) parsing method to parse SQL statements. Although this method solves the SQL statement conversion problem to a certain extent, it still has some obvious limitations:
[0004] 1. For complex SQL statements, the AST construction and conversion process may be very time-consuming, resulting in inefficient overall conversion process.
[0005] 2. During the conversion process, if the AST is not parsed or reconstructed accurately, the generated SQL statement may not be consistent with the original intention, thus affecting the correctness of the data and making it impossible to ensure accuracy.
[0006] Therefore, there is an urgent need for a unified cross-database SQL statement parsing and processing method that can improve the efficiency and accuracy of SQL statement conversion. Summary of the invention
[0007] One of the purposes of the present invention is to provide a unified parsing and processing method for cross-database SQL statements, which can improve the efficiency and accuracy of SQL statement conversion.
[0008] In order to achieve the above object, a cross-database SQL statement unified parsing and processing method is provided, comprising the following steps:
[0009] S1. Receive the current SQL statement submitted by the user;
[0010] S2. Based on a preset statement segmentation strategy, the received current SQL statement is segmented to form various segmentation units, where the segmentation units are complete SQL statement fragments;
[0011] S3, extracting the feature information corresponding to each segmentation unit according to the formed segmentation units, and matching the processor corresponding to each feature information based on the pre-configured feature processor association table;
[0012] S4, based on the processor corresponding to each feature information, performing statement conversion on each corresponding segmentation unit to generate corresponding conversion result data, wherein the conversion result data is a target SQL statement executable by the target database;
[0013] S5. Send the generated target SQL statement to the target database for execution, and generate the corresponding execution result.
[0014] Technical principles and effects of this solution: In this solution, the current SQL statement submitted by the user is first received, and then the received current SQL statement is segmented through a preset statement segmentation strategy to form various segmentation units, each of which is a complete SQL statement fragment. Through this reasonable segmentation, the current SQL statement can be segmented into multiple units, which not only realizes the segmentation of the statement but also simplifies the difficulty of statement reading.
[0015] Then, according to each segmentation unit, the feature information corresponding to the segmentation unit is extracted, and then the processor corresponding to each extracted feature information is matched according to the pre-configured feature processor association table. Based on the matching processor corresponding to each feature information, the corresponding segmentation unit is converted to generate a target SQL statement executable by the target database, and the generated target SQL statement is sent to the target database for execution, and the corresponding execution result is generated. The complexity and inefficiency of the traditional parsing method are avoided by the feature matching and the processor matching method, and the efficient conversion of SQL statements is realized. At the same time, the features corresponding to the SQL statements are directly compared and the corresponding processors are matched for conversion, which reduces the errors that may be introduced by parsing complex SQL statements and improves the accuracy of SQL statement conversion. Of course, the configuration of the features and corresponding processors corresponding to the SQL statements of various databases is realized through the setting of the feature processor association table, thereby realizing compatibility with multiple databases, and then realizing cross-database compatibility. In the whole conversion and parsing process, developers do not need to have a deep understanding of the grammatical differences between the SQLs of various databases. They only need to pay attention to the correlation between the corresponding features and the processors, and then realize the configuration between the feature information and the processors, so as to realize the conversion of SQL statements, simplifying the development and maintenance process.
[0016] Furthermore, the preset sentence segmentation strategy is:
[0017] According to the received current SQL statement, each delimiter corresponding to the current SQL statement is identified, and the current SQL statement is preliminarily segmented based on the delimiters to form a plurality of SQL statement sub-segments;
[0018] According to the formed several SQL statement sub-fragments, several initial populations are randomly generated, and the individuals of the initial population are the fragment sets corresponding to the multiple SQL statement fragments formed based on the combination of the several SQL statement sub-fragments; based on the restriction conditions, the individuals of the initial population are preliminarily screened and judged, if the restriction conditions are met, the corresponding individuals of the initial population are feasible solutions, otherwise, they are infeasible solutions and are deleted;
[0019] Performing fitness calculation on the selected population, wherein the fitness calculation includes a first fitness calculation and a second fitness calculation;
[0020] The first fitness is calculated as follows:
[0021]
[0022] In the formula, F1 is the first fitness, G i is the statement completeness corresponding to the i-th SQL statement fragment in the population, X i is the reliability of the keyword sequence corresponding to the i-th SQL statement fragment in the population, K is the preset SQL statement keyword set, k i is the keyword corresponding to the i-th SQL statement fragment in the population, M is the number of keywords corresponding to the i-th SQL statement fragment in the population in the preset SQL statement keyword set, is the actual position of the jth keyword in the SQL statement fragment corresponding to the i-th SQL statement fragment in the population, P j y is the expected position of the jth keyword in the SQL statement fragment corresponding to the i-th SQL statement fragment in the population; w1, w2, ∝ are the corresponding weighting coefficients; m is the total number of SQL statement fragments corresponding to the population; E is a randomly generated random number, and bmax is the preset random threshold;
[0023] The second fitness is calculated as follows:
[0024]
[0025] In the formula, F2 is the second fitness, W is the semantic evaluation value corresponding to the population, r z is the semantic completeness score corresponding to the zth SQL statement fragment in the population, h z is the weighted coefficient corresponding to the semantic completeness score corresponding to the zth SQL statement fragment in the population;
[0026] Within the first preset number of iterations, according to the first fitness corresponding to the population, select the population whose first fitness is greater than or equal to the first fitness threshold, and among the populations eliminated at this time, select the first three populations with the smallest second fitness, and save them in the standby library;
[0027] When the first preset number of iterations is exceeded, the current population is combined with the population in the standby library to form a new population, and a population whose second fitness corresponding to the current population is less than or equal to the preset second fitness is selected;
[0028] Based on the preset hybridization and mutation strategy, the selected population is hybridized and mutated to obtain the corresponding offspring population;
[0029] After obtaining the offspring population, continue to calculate the fitness until the preset number of iterations is met;
[0030] The output offspring population is used as the optimal solution set for multi-objective optimization.
[0031] Beneficial effects: In this solution, first, according to the received current SQL statement, the corresponding separators in the current SQL statement are identified, and the current SQL statement is preliminarily divided based on the separators to form a number of SQL statement sub-fragments; according to the formed several SQL statement sub-fragments, a number of initial populations are randomly generated, and the individuals of the initial population are fragment sets corresponding to multiple SQL statement fragments formed based on the combination of several SQL statement sub-fragments. In this way, the simplification of complex SQL statements is achieved, and then the initial population is screened by restriction conditions, thereby improving the convergence speed.
[0032] The subsequent fitness calculation of the population is used to achieve secondary screening of the population. Specifically, in the first fitness calculation, X is performed by setting a random number. i The determination of the calculation method greatly improves the randomness of the algorithm. Within the first preset number of iterations, the first fitness of the population is mainly examined, that is, the first fitness is greater than or equal to the preset first fitness threshold, so that the population with relatively small differences in sentence completeness and keyword sequence can be matched.
[0033] Of course, in this process, the eliminated populations will also be selected, and the top three populations with the smallest second fitness will be selected for storage in the reserve library. After completing the first preset number of iterations, the corresponding focus will be placed on semantic evaluation. At this time, the population stored in the reserve library will be concentrated with the population at this time to form a new population. The population at this time includes the population selected according to the first fitness and the top three populations with the smallest second fitness in each eliminated population. The offspring population obtained in this way will be better and can better retain genes with better semantic evaluation, making the subsequent offspring population better.
[0034] Furthermore, between S2 and S3, the following is also included:
[0035] S230, identifying parameters corresponding to each segmentation unit according to the formed segmentation units, and generating hash cache identifiers corresponding to each segmentation unit based on the identified parameters;
[0036] S231. According to the generated hash cache identifiers corresponding to the various segmentation units, query the cache database to see whether there is an identical hash cache identifier. If so, directly retrieve the conversion result data corresponding to the hash cache identifier from the cache database and execute S4; if not, execute S3; the cache database is used to store the hash cache identifiers corresponding to the historical segmentation units and the corresponding conversion result data.
[0037] Beneficial effect: In this solution, the identified hash cache identifier and the corresponding conversion result data are saved through the cache database. In this way, before the current SQL statement conversion is performed, the cache database can be queried first to determine whether there is the same hash cache identifier in the cache database. If so, the corresponding conversion result data can be directly used. If not, subsequent conversion can be performed. The introduction of this caching mechanism greatly improves the conversion efficiency of repeated SQL statements.
[0038] Further, the method further includes S6: during the execution of the target SQL statement in the target database, real-time identification and capture of error information of the execution process, and generation of error prompt information based on the captured error information;
[0039] S7. Record the key operations and conversion result data of the execution process to form a corresponding execution log.
[0040] Beneficial effect: In this solution, by real-time identification and capture of error information during execution, the present invention can immediately provide error prompt information to the user, facilitating rapid problem location and repair, thereby reducing debugging time and improving system stability and availability.
[0041] By recording key operations and conversion result data during the execution process, a detailed execution log is formed, which helps with subsequent audit tracking, performance analysis and troubleshooting, and also provides a basis for continuous improvement of the system.
[0042] Furthermore, the preset hybridization mutation strategy is:
[0043] When hybridization is performed, the selected populations are paired in pairs, two hybridization fragments are randomly selected, and a random number H1 and H2 between 0 and 1 are assigned to the two hybridization fragments. If both random numbers H1 and H2 are greater than or equal to the preset threshold H y , then the hybridization probability of the two hybridization fragments is A. If only one of the random numbers H1 or H2 is greater than or equal to the preset threshold H y , then the hybridization probability of the two hybridization fragments is B. If the two random numbers H1 and H2 are both less than the preset threshold H y , then the hybridization probability of the two hybridization fragments is C;
[0044] in;
[0045]
[0046] After the corresponding hybridization probability is determined, a random number H3 between 0 and 1 is regenerated. If the random number H3 is greater than or equal to the hybridization probability, the corresponding two hybridization fragments are hybridized, otherwise no hybridization operation is performed;
[0047] When performing mutation, according to the corresponding number of iterations and the fitness corresponding to the number of iterations, a mutation probability value is configured for each SQL statement fragment in the population, wherein the greater the first fitness, the greater the mutation probability value, and the smaller the second fitness, the greater the mutation probability value; the mutation probability value of each SQL statement sub-fragment in the SQL statement fragment is the same as the mutation probability value of the SQL statement fragment;
[0048] Use the roulette wheel to select the corresponding mutated SQL statement fragment, and perform the mutation operation on the selected SQL statement fragment.
[0049] Beneficial effect: Different combinations of the sizes of the two random numbers are associated with the hybridization probability, and A+B+C=1 and A>B>C, so that when both random numbers are high, the probability of hybridization is the highest; if only one is high, the probability is second; when both are low, the probability is the lowest. This hybridization strategy helps maintain the diversity of the population and encourages the spread of high-quality features.
[0050] The mutation probability is determined based on the number of iterations and the fitness of the individual. As the number of iterations increases, individuals with better fitness have a higher probability of mutation. A roulette wheel selection mechanism is used to select which individuals to mutate, and the mutation operation is performed on the selected SQL statement fragments. This mutation strategy can promote the exploration ability between different individuals in the population and help the algorithm escape from the local optimal solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 This is a logic block diagram of a unified cross-database SQL statement parsing and processing method in Embodiment 1 of the present invention. DETAILED DESCRIPTION
[0052] The following is further described in detail through specific implementation methods:
[0053] Embodiment 1
[0054] A unified parsing and processing method for cross-database SQL statements, basically as follows Figure 1 As shown, the following steps are included:
[0055] S1. Receive the current SQL statement submitted by the user: In this embodiment, the SQL statement submitted by the user is received through an API, a Web interface or other means. Perform necessary preprocessing on the received SQL statement, such as removing comments, formatting, etc.
[0056] S2. Based on a preset statement segmentation strategy, the received current SQL statement is segmented to form various segmentation units, where the segmentation units are complete SQL statement fragments;
[0057] The preset sentence segmentation strategy is:
[0058] According to the received current SQL statement, the corresponding delimiters in the current SQL statement are identified, and the current SQL statement is preliminarily segmented based on the delimiters to form a number of SQL statement sub-fragments; in this embodiment, the delimiters mainly include semicolons, line breaks, etc.
[0059] According to the formed several SQL statement sub-fragments, several initial populations are randomly generated, and the individuals of the initial population are the fragment sets corresponding to the multiple SQL statement fragments formed based on the combination of the several SQL statement sub-fragments; based on the restriction conditions, the individuals of the initial population are preliminarily screened and judged, if the restriction conditions are met, the corresponding individuals of the initial population are feasible solutions, otherwise, they are infeasible solutions and are deleted;
[0060] Performing fitness calculation on the selected population, wherein the fitness calculation includes a first fitness calculation and a second fitness calculation;
[0061] The first fitness is calculated as follows:
[0062]
[0063] In the formula, F1 is the first fitness, G i is the statement completeness corresponding to the i-th SQL statement fragment in the population, X i is the reliability of the keyword sequence corresponding to the i-th SQL statement fragment in the population, K is the preset SQL statement keyword set, k i is the keyword corresponding to the i-th SQL statement fragment in the population, M is the number of keywords corresponding to the i-th SQL statement fragment in the population in the preset SQL statement keyword set, is the actual position of the jth keyword in the SQL statement fragment corresponding to the i-th SQL statement fragment in the population, P j y is the expected position of the jth keyword in the SQL statement fragment corresponding to the i-th SQL statement fragment in the population; w1, w2, ∝ are the corresponding weighting coefficients; m is the total number of SQL statement fragments corresponding to the population; E is a randomly generated random number, and bmax is the preset random threshold;
[0064] The second fitness is calculated as follows:
[0065]
[0066] In the formula, F2 is the second fitness, W is the semantic evaluation value corresponding to the population, r z is the semantic completeness score corresponding to the zth SQL statement fragment in the population, h z is the weighted coefficient corresponding to the semantic completeness score corresponding to the zth SQL statement fragment in the population;
[0067] Within the first preset number of iterations, according to the first fitness corresponding to the population, select the population whose first fitness is greater than or equal to the first fitness threshold, and among the populations eliminated at this time, select the first three populations with the smallest second fitness, and save them in the standby library;
[0068] When the first preset number of iterations is exceeded, the current population is combined with the population in the standby library to form a new population, and a population whose second fitness corresponding to the current population is less than or equal to the preset second fitness is selected;
[0069] Based on the preset hybridization and mutation strategy, the selected population is hybridized and mutated to obtain the corresponding offspring population;
[0070] The preset hybridization mutation strategy is:
[0071] When hybridization is performed, the selected populations are paired in pairs, two hybridization fragments are randomly selected, and a random number H1 and H2 between 0 and 1 are assigned to the two hybridization fragments. If both random numbers H1 and H2 are greater than or equal to the preset threshold H y , then the hybridization probability of the two hybridization fragments is A. If only one of the random numbers H1 or H2 is greater than or equal to the preset threshold H y , then the hybridization probability of the two hybridization fragments is B. If the two random numbers H1 and H2 are both less than the preset threshold H y , then the hybridization probability of the two hybridization fragments is C;
[0072] in;
[0073]
[0074] After the corresponding hybridization probability is determined, a random number H3 between 0 and 1 is regenerated. If the random number H3 is greater than or equal to the hybridization probability, the corresponding two hybridization fragments are hybridized, otherwise no hybridization operation is performed;
[0075] When performing mutation, according to the corresponding number of iterations and the fitness corresponding to the number of iterations, a mutation probability value is configured for each SQL statement fragment in the population, wherein the greater the first fitness, the greater the mutation probability value, and the smaller the second fitness, the greater the mutation probability value; the mutation probability value of each SQL statement sub-fragment in the SQL statement fragment is the same as the mutation probability value of the SQL statement fragment;
[0076] Use the roulette wheel to select the corresponding mutated SQL statement fragment, and perform the mutation operation on the selected SQL statement fragment.
[0077] After obtaining the offspring population, continue to calculate the fitness until the preset number of iterations is met;
[0078] The output offspring population is used as the optimal solution set for multi-objective optimization.
[0079] The S2 and S3 also include:
[0080] S230. According to the formed segmentation units, the parameters corresponding to the segmentation units are identified, and based on the identified parameters, a hash cache identifier corresponding to the segmentation units is generated; in this embodiment, corresponding specific information such as an SQL template may also be identified.
[0081] S231. According to the generated hash cache identifiers corresponding to the various segmentation units, query the cache database to see whether there is an identical hash cache identifier. If so, directly retrieve the conversion result data corresponding to the hash cache identifier from the cache database and execute S4; if not, execute S3; the cache database is used to store the hash cache identifiers corresponding to the historical segmentation units and the corresponding conversion result data.
[0082] S3. According to the formed segmentation units, the feature information corresponding to each segmentation unit is extracted, and based on the pre-configured feature processor association table, the processor corresponding to each feature information is matched; in this embodiment, the corresponding feature information includes table name, field name, operator, etc.
[0083] S4. Based on the processor corresponding to each feature information, the corresponding segmentation unit is converted to generate corresponding conversion result data, and the conversion result data is a target SQL statement executable by the target database; in this embodiment, the processor converts the original SQL statement into an SQL statement executable by the target database according to a preset conversion protocol.
[0084] S5. Send the generated target SQL statement to the target database for execution, and generate the corresponding execution result.
[0085] The method further includes S6: during the execution of the target SQL statement in the target database, real-time identification and capture of error information of the execution process, and generation of error prompt information based on the captured error information;
[0086] S7. Record the key operations and conversion result data of the execution process to form a corresponding execution log. In this embodiment, a log query function is provided to facilitate subsequent auditing and problem tracking.
[0087] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is described too much here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field of the invention before the application date or priority date, can know all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The protection scope required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.
Claims
1. A cross-database SQL statement unified parsing and processing method, characterized by: The following steps are involved: S1. Receive the current SQL statement submitted by the user; S2. Based on a preset statement segmentation strategy, the received current SQL statement is segmented to form various segmentation units, where the segmentation units are complete SQL statement fragments; S3, extracting the feature information corresponding to each segmentation unit according to the formed segmentation units, and matching the processor corresponding to each feature information based on the pre-configured feature processor association table; S4, based on the processor corresponding to each feature information, performing statement conversion on each corresponding segmentation unit to generate corresponding conversion result data, wherein the conversion result data is a target SQL statement executable by the target database; S5. Send the generated target SQL statement to the target database for execution, and generate the corresponding execution result.
2. According to claim 1, a cross-database SQL statement unified parsing and processing method is characterized by: The preset sentence segmentation strategy is: According to the received current SQL statement, each delimiter corresponding to the current SQL statement is identified, and the current SQL statement is preliminarily segmented based on the delimiters to form a plurality of SQL statement sub-segments; According to the formed several SQL statement sub-fragments, several initial populations are randomly generated, and the individuals of the initial population are the fragment sets corresponding to the multiple SQL statement fragments formed based on the combination of the several SQL statement sub-fragments; based on the restriction conditions, the individuals of the initial population are preliminarily screened and judged, if the restriction conditions are met, the corresponding individuals of the initial population are feasible solutions, otherwise, they are infeasible solutions and are deleted; Performing fitness calculation on the selected population, wherein the fitness calculation includes a first fitness calculation and a second fitness calculation; The first fitness is calculated as follows: In the formula, F1 is the first fitness, G i is the statement completeness corresponding to the i-th SQL statement fragment in the population, X i is the reliability of the keyword sequence corresponding to the i-th SQL statement fragment in the population, K is the preset SQL statement keyword set, k i is the keyword corresponding to the i-th SQL statement fragment in the population, M is the number of keywords corresponding to the i-th SQL statement fragment in the population in the preset SQL statement keyword set, is the actual position of the jth keyword in the SQL statement fragment corresponding to the i-th SQL statement fragment in the population, P j y is the expected position of the jth keyword in the SQL statement fragment corresponding to the i-th SQL statement fragment in the population; w1, w2, ∝ are the corresponding weighting coefficients; m is the total number of SQL statement fragments corresponding to the population; E is a randomly generated random number, and bmax is the preset random threshold; The second fitness is calculated as follows: In the formula, F2 is the second fitness, W is the semantic evaluation value corresponding to the population, r z is the semantic completeness score corresponding to the zth SQL statement fragment in the population, h z is the weighted coefficient corresponding to the semantic completeness score corresponding to the zth SQL statement fragment in the population; Within the first preset number of iterations, according to the first fitness corresponding to the population, select the population whose first fitness is greater than or equal to the first fitness threshold, and among the populations eliminated at this time, select the first three populations with the smallest second fitness, and save them in the standby library; When the first preset number of iterations is exceeded, the current population is combined with the population in the standby library to form a new population, and a population whose second fitness corresponding to the current population is less than or equal to the preset second fitness is selected; Based on the preset hybridization and mutation strategy, the selected population is hybridized and mutated to obtain the corresponding offspring population; After obtaining the offspring population, continue to calculate the fitness until the preset number of iterations is met; The output offspring population is used as the optimal solution set for multi-objective optimization.
3. A cross-database SQL statement unified parsing and processing method according to claim 2, characterized in that: The S2 and S3 also include: S230, identifying parameters corresponding to each segmentation unit according to the formed segmentation units, and generating hash cache identifiers corresponding to each segmentation unit based on the identified parameters; S231. According to the generated hash cache identifiers corresponding to the various segmentation units, query the cache database to see whether there is an identical hash cache identifier. If so, directly retrieve the conversion result data corresponding to the hash cache identifier from the cache database and execute S4; if not, execute S3; the cache database is used to store the hash cache identifiers corresponding to the historical segmentation units and the corresponding conversion result data.
4. A cross-database SQL statement unified parsing and processing method according to claim 3, characterized in that: The method further includes S6: during the execution of the target SQL statement in the target database, real-time identification and capture of error information of the execution process, and generation of error prompt information based on the captured error information; S7. Record the key operations and conversion result data of the execution process to form a corresponding execution log.
5. A cross-database SQL statement unified parsing and processing method according to claim 4, characterized in that: The preset hybridization mutation strategy is: When hybridization is performed, the selected populations are paired in pairs, two hybridization fragments are randomly selected, and a random number H1 and H2 between 0 and 1 are assigned to the two hybridization fragments. If both random numbers H1 and H2 are greater than or equal to the preset threshold H y , then the hybridization probability of the two hybridization fragments is A. If only one of the random numbers H1 or H2 is greater than or equal to the preset threshold H y , then the hybridization probability of the two hybridization fragments is B. If the two random numbers H1 and H2 are both less than the preset threshold H y , then the hybridization probability of the two hybridization fragments is C; in; After the corresponding hybridization probability is determined, a random number H3 between 0 and 1 is regenerated. If the random number H3 is greater than or equal to the hybridization probability, the corresponding two hybridization fragments are hybridized, otherwise no hybridization operation is performed; When performing mutation, according to the corresponding number of iterations and the fitness corresponding to the number of iterations, a mutation probability value is configured for each SQL statement fragment in the population, wherein the greater the first fitness, the greater the mutation probability value, and the smaller the second fitness, the greater the mutation probability value; the mutation probability value of each SQL statement sub-fragment in the SQL statement fragment is the same as the mutation probability value of the SQL statement fragment; Use the roulette wheel to select the corresponding mutated SQL statement fragment, and perform the mutation operation on the selected SQL statement fragment.
Citation Information
Patent Citations
Feature derivation method and device, nonvolatile storage medium and electronic equipment
CN114661750A
Method for generating SQL (Structured Query Language) statement from Chinese natural language and cross
CN115576984A
Database adaptation method and device, equipment and storage medium
CN117648363A
Fuzzy test-oriented statement sequence variation method
CN117762773A
Method for storing multi-model data by utilizing relational database management system
CN118035365A
