Quality inspection method and device

By obtaining and applying the rules in the target inspection package to inspect the SQL text, the problem of low flexibility and low efficiency in SQL quality inspection is solved, and flexible and efficient inspection is achieved to adapt to changes in user needs.

CN118779348AActive Publication Date: 2024-10-15CHINA ELECTRONICS JINXIN DIGITAL TECH GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410962939.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-10-15
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

In the existing technology, the flexibility and scalability of SQL quality inspection are poor, and the efficiency is low. It cannot adapt to changes in user needs and needs to be re-hardcoded.

Method used

By obtaining the target inspection package, which contains the target inspection rule method and the target inspection rule, the SQL text to be inspected is inspected based on these rules, the inspection rule weight proportion and the initial quality score are calculated, the quality level of the SQL is determined, and flexibility and efficiency are achieved. test.

Benefits of technology

It improves the flexibility and efficiency of SQL quality inspection, avoids hard coding, adapts to changes in user needs, significantly distinguishes rules that affect SQL quality, and improves the accuracy and flexibility of inspection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779348A_ABST
    Figure CN118779348A_ABST
Patent Text Reader

Abstract

The invention provides a quality inspection method and device, and the method comprises the steps: obtaining a target inspection program package in an inspection program; based on the target inspection program package, inspecting the to-be-inspected structured query language text in the target database to obtain a first inspection result; determining an inspection rule weight ratio of the first inspection rule according to a ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rules; and determining the quality level of the to-be-inspected structured query language text according to the inspection rule weight proportion and the initial quality score of the to-be-inspected structured query language text, thereby not only meeting the requirements of the user, but also realizing the quality level of the to-be-inspected structured query language text under the condition that the requirements of the user are changed by defining the target inspection program package. According to the method, the target inspection rule included in the target inspection rule method is changed to adapt to new requirements of users, program hard coding is avoided, and the inspection efficiency and flexibility of the structured query language text are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a quality inspection method and device. Background Art

[0002] At present, in order to improve program quality, quality inspection is required for the Structured Query Language (SQL) written in the data development process. In the related art, based on user needs, the quality inspection of SQL is carried out by hard-coding the program. However, when user needs change, the program needs to be hard-coded again, resulting in poor flexibility and scalability of SQL quality inspection, and low efficiency of SQL quality inspection. Summary of the invention

[0003] The present disclosure provides a quality inspection method and device to solve one of the technical problems in the related art at least to a certain extent. The technical solution of the present disclosure is as follows:

[0004] According to a first aspect of an embodiment of the present disclosure, a quality inspection method is provided, comprising: obtaining a target inspection program package in an inspection program; wherein the target inspection program comprises a target inspection rule method, wherein the target inspection rule method comprises at least one target inspection rule, wherein the target inspection rule is used to indicate a structured query language text with restricted use; based on the target inspection program package, inspecting a structured query language text to be inspected in a target database to obtain a first inspection result, wherein the first inspection result is used to indicate a first inspection rule associated with an unqualified structured query language text, wherein the unqualified structured query language text is used to indicate a structured query language text that does not satisfy at least one of the target inspection rules in the structured query language text to be inspected; determining an inspection rule weight ratio of the first inspection rule according to a ratio between a weight of the first inspection rule and a sum of weights of the target inspection rules; and determining a quality grade of the structured query language text to be inspected according to the inspection rule weight ratio and an initial quality score of the structured query language text to be inspected.

[0005] According to a second aspect of an embodiment of the present disclosure, a quality inspection device is provided, comprising: a first acquisition module, configured to acquire a target inspection program package in an inspection program; wherein the target inspection program comprises a target inspection rule method, wherein the target inspection rule method comprises at least one target inspection rule, wherein the target inspection rule is used to indicate a structured query language text with restricted use; a verification module, configured to inspect a structured query language text to be inspected in a target database based on the target inspection program package, so as to obtain a first inspection result, wherein the first inspection result is used to indicate a first inspection rule associated with an unqualified structured query language text, wherein the unqualified structured query language text is used to indicate a structured query language text that does not satisfy at least one of the target inspection rules in the structured query language text to be inspected; a first determination module, configured to determine an inspection rule weight ratio of the first inspection rule according to a ratio between a weight of the first inspection rule and a sum of weights of the target inspection rule; and a second determination module, configured to determine a quality grade of the structured query language text to be inspected according to the inspection rule weight ratio and an initial quality score of the structured query language text to be inspected.

[0006] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the quality inspection method as described in the embodiment of the first aspect of the present disclosure.

[0007] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the quality inspection method as described in the embodiment of the first aspect of the present disclosure.

[0008] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising: a computer program, wherein when the computer program is executed by a processor, the quality inspection method as described in the embodiment of the first aspect of the present disclosure is implemented.

[0009] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0010] In the technical scheme, a target inspection program package in the inspection program is obtained; wherein the target inspection program includes a target inspection rule method, the target inspection rule method includes at least one target inspection rule, and the target inspection rule is used to indicate a structured query language text with restricted use; based on the target inspection program package, the structured query language text to be inspected in the target database is inspected to obtain a first inspection result, wherein the first inspection result is used to indicate a first inspection rule associated with an unqualified structured query language text, and the unqualified structured query language text is used to indicate a structured query language text that does not satisfy at least one target inspection rule in the structured query language text to be inspected; according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rule, the inspection rule weight ratio of the first inspection rule is determined; according to the inspection rule weight ratio and the initial quality score of the structured query language text to be inspected, the quality level of the structured query language text to be inspected is determined, thereby, by adopting the definition of the target inspection program package, not only the needs of users are met, but also when the needs of users change, the target inspection rules included in the target inspection rule method are modified to adapt to the new needs of users. The requirements are met, and the hard coding of the program is avoided, thereby improving the inspection efficiency and inspection flexibility of the structured query language text; wherein, when determining the inspection rule weight ratio of the first inspection rule, it is determined according to the weight of the configured target inspection rule, and different target inspection rules correspond to different weights, thereby significantly distinguishing the target inspection rules that have a greater impact on the writing quality of the structured query language text, so as to better meet the needs of users; in addition, before uploading the packaged target inspection program package to the inspection program, the initial inspection program package in the inspection program is first obtained, and the obtained initial inspection program package is debugged, and then the debugged initial inspection program package is uploaded to the inspection program as the target inspection program package, so that when the quality inspection of the structured query language text to be inspected is performed, it is only necessary to inspect the structured query language text to be inspected in the target database based on the target inspection program package, without hard coding the program, and the inspection rules that the structured query language text to be inspected does not meet can be accurately obtained from the target inspection rules, thereby accurately inspecting the quality level of the structured query language text to be inspected, and further improving the flexibility of the quality inspection of the structured query language text.

[0011] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0013] Figure 1is a flow chart of a quality inspection method shown in the first embodiment of the present disclosure;

[0014] Figure 2 is a flow chart of a quality inspection method shown in the second embodiment of the present disclosure;

[0015] Figure 3 is a flow chart of a quality inspection method shown in the third embodiment of the present disclosure;

[0016] Figure 4 is a flow chart of a quality inspection method shown in the fourth embodiment of the present disclosure;

[0017] Figure 5 is a structural schematic diagram of a quality inspection device shown in the fifth embodiment of the present disclosure;

[0018] Figure 6 It is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0021] It should be noted that in the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, and are in compliance with relevant laws and regulations and do not violate public order and good morals.

[0022] At present, in the related art, the method of checking the structured query language text by hard coding in the program has the following problems:

[0023] 1. When the user's needs change, the same program cannot meet the user's new needs. This is because the structured query language text that the user is restricted to use has changed, and the inspection rules in the same program cannot adapt to the new needs. It is necessary to re-hard code and release a new program, and the development process is rigid.

[0024] 2. Even the needs of the same user have different focuses, and there are some verification rules that are important criteria for verifying the quality of the structured query language text.

[0025] In view of the above problems, the present disclosure proposes a quality inspection method and device.

[0026] The quality inspection method and device according to the embodiments of the present disclosure will be described below with reference to the accompanying drawings.

[0027] Figure 1 A flow chart of a quality inspection method provided in an embodiment of the present disclosure.

[0028] like Figure 1 As shown, the quality inspection method includes the following steps:

[0029] Step 101, obtaining a target inspection program package in the inspection program.

[0030] The target verification program includes a target verification rule method, the target verification rule method includes at least one target verification rule, and the target verification rule is used to indicate a structured query language text with restricted use.

[0031] In order to make the target verification rules in the acquired target verification program package meet the needs of users, as a possible implementation manner, the target verification rules in the target verification program package are determined based on the user needs.

[0032] For example, the user's requirement for the structured query language text is to restrict the use of the Drop statement, the inclusion of the NOT sub-statement in the where clause, and the restriction of the use of the union statement when writing the structured query language text. Then the target verification rule is to restrict the use of the Drop statement, the inclusion of the NOT sub-statement in the where clause, and the restriction of the use of the union statement.

[0033] In addition, it should be noted that users have different requirements for structured query language texts, and the number of target verification rules and target verification rules are also different.

[0034] Step 102: Based on the target verification program package, the structured query language text to be verified in the target database is verified to obtain a first verification result.

[0035] The first inspection result is used to indicate a first inspection rule associated with the unqualified structured query language text, and the unqualified structured query language text is used to indicate a structured query language text that does not satisfy at least one target inspection rule in the structured query language text to be inspected.

[0036] As an example, the structured query language text to be checked includes multiple structured query statements, wherein at least one structured query statement among the multiple structured query statements serves as the structured query language text in the structured query language text to be checked.

[0037] In order to accurately detect the verification rules that are not satisfied by the structured query language text to be tested from the target verification rules, as a possible implementation method, the structured query language text to be tested is traversed to obtain the structured query language text that does not satisfy at least one target verification rule, that is, to obtain the unqualified structured query language text, and then, according to the first verification rule associated with the unqualified structured query language text, a first verification result is obtained.

[0038] As an example, when the structured query language text to be verified includes both structured query language text that satisfies all target verification rules (or, when there are multiple target verification rules, satisfies one of the target verification rules and is not related to other target verification rules) and structured query language text that does not satisfy at least one target verification rule, the at least one target verification rule that the structured query language text does not satisfy is used as the first verification rule.

[0039] For example, if the structured query language text to be checked includes a structured query language text using a Drop statement, then the structured query language text using the Drop statement is an unqualified structured query language text, and the target verification rule (restricting the use of the Drop statement) associated with the unqualified structured query language text is the first verification rule.

[0040] Step 103: Determine the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rules.

[0041] In order to significantly distinguish the target verification rules that have a greater impact on the quality of the structured query language text and better meet user needs, as an example, weights are configured for the target verification rules.

[0042] For example, in the structured query language text that the user restricts when writing the structured query language text, restricting the use of the Drop statement is a target inspection rule that significantly affects the quality of the structured query language text, and including the NOT substatement in the where clause and restricting the use of the union statement are not target inspection rules that significantly affect the quality of the structured query language text. When configuring weights for restricting the use of the Drop statement, including the NOT substatement in the where clause, and restricting the use of the union statement, the weight of restricting the use of the Drop statement can be configured to be 2, and the weights of including the NOT substatement in the where clause and restricting the use of the union statement can be configured to be 1. Among them, the target inspection rule associated with the unqualified structured query language text (restricting the use of Drop statements) is the first inspection rule, and the weight of the first inspection rule is 2. The target inspection rules include restricting the use of Drop statements, containing NOT sub-statements in the where clause, and restricting the use of union statements. The sum of the weights of the target inspection rules is the sum of the weight 2 of restricting the use of Drop statements, the weight 1 of containing NOT sub-statements in the where clause, and the weight 1 of restricting the use of union statements, that is, the sum of the weights of the target inspection rules is 4. It can be determined that the inspection rule weight ratio of the first inspection rule is 1 / 2.

[0043] Step 104: Determine the quality level of the structured query language text to be checked according to the weight ratio of the check rule and the initial quality score of the structured query language text to be checked.

[0044] It should be understood that, since the target verification program package is used to verify the structured query language text to be verified in the target database, the target verification rules included in the target verification rule methods in different target verification programs are different, and different target verification rules correspond to different user needs. Therefore, when the user's needs change, by updating the target verification rules to match the user's new needs, there is no need to directly hard-code them in the verification program, which can flexibly meet the user's needs for the quality verification of the structured query language text, thereby improving the efficiency and flexibility of the quality verification of the structured query language text.

[0045] As an example, the target quality score of the structured query language text to be tested is determined according to the weight ratio of the test rules and the initial quality score of the structured query language text to be tested, and the corresponding quality grade is determined based on the target quality score, wherein the quality grades include: excellent, good, poor and unqualified, etc.; wherein the initial quality score is pre-set based on historical experience.

[0046] In order to improve the objectivity of the quality inspection of the structured query language text to be inspected, as an example, the initial quality scores of different structured query language texts to be inspected are the same.

[0047] In summary, by obtaining the target inspection program package in the inspection program; based on the target inspection program package, inspecting the structured query language text to be inspected in the target database to obtain the first inspection result; determining the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rules; determining the quality level of the structured query language text to be inspected according to the inspection rule weight ratio and the initial quality score of the structured query language text to be inspected, thereby, pre-configuring the target inspection program package in the inspection program, using the target inspection rules in the target inspection program package to inspect the structured query language text to be inspected to obtain the inspection result, reducing the score of the structured query language text to be inspected according to the weight of the inspection rule associated with the inspection result and the initial quality score of the structured query language text to be inspected to determine the quality level of the structured query language text to be inspected, and by adopting the definition of the target inspection program package, not only the needs of users are met, but also when the needs of users change, the target inspection rules included in the target inspection rule method are changed to adapt to the new needs of users, avoiding program hard coding, and improving the efficiency and flexibility of structured query language text quality inspection.

[0048] In order to clearly explain how the target verification program package is used to verify the structured query language text to be verified in the target database to obtain the first verification result in the above embodiment, the present disclosure proposes another quality verification method.

[0049] Figure 2 It is a flow chart of the quality inspection method shown in the second embodiment of the present disclosure.

[0050] like Figure 2 As shown, the quality inspection method includes the following steps:

[0051] Step 201, obtaining a target inspection program package in the inspection program.

[0052] Step 202, in response to finding the current class loader, calling the current class loader and loading the target inspection rule method in the target inspection program package.

[0053] Among them, the target inspection rule method is the method in the target inspection interface in the target inspection program.

[0054] As an example, a current class loader matching the class loading request is searched, and when the current class loader is found, the current class loader is called and the target verification rule method is loaded.

[0055] As another example, if the current class loader matching the class loading request is not found, the class loading request is delegated to the parent class loader, and the target verification rule method is loaded through the parent class loader.

[0056] Step 203: Based on the target verification interface, the type of the target database is obtained, and the structured query language text to be verified in the target database is obtained.

[0057] In order to effectively obtain the structured query language text to be checked, as a possible implementation method, the structured query language text to be checked in the target database is determined by defining a target check rule in the target check interface.

[0058] As an example, two input parameters are defined in the target verification rule method defined in the target interface, one of which is the structured query language text to be verified, and the other is the target database extension information, wherein the target database extension information includes the database type of the target database, database connection information and other information.

[0059] Step 204, according to the type of the target database, call the corresponding structured query language parser, use the structured query language parser to perform syntax analysis on the structured query language text to be checked, so as to obtain an abstract syntax tree corresponding to the structured query language text to be checked.

[0060] In order to completely obtain the abstract syntax tree of the structured query language text to be checked, as an example, each structured query statement of the structured query language text to be checked is traversed in turn, and then, a structured query language parser is used to perform syntax parsing on each structured query statement of the structured query language text to be checked, so as to obtain the abstract syntax tree corresponding to the structured query language text to be checked. Different types of target databases call different corresponding structured query language parsers.

[0061] Step 205: Use the abstract syntax tree and the target verification rule to verify the structured query language text to be verified, so as to obtain unqualified structured query language text.

[0062] Step 206: Obtain a first inspection rule associated with the unqualified structured query language text from the target inspection rules, and use the first inspection rule as a first inspection result.

[0063] It should be understood that the focus of the structured query language text quality inspection is whether the structured query language text meets the target inspection rules, and the quality level of the structured query language text is determined according to the target inspection rules that the structured query language text does not meet.

[0064] Therefore, as an example, after using the abstract syntax tree and the target verification rule to verify the structured query language text to be verified to obtain unqualified structured query language text, the first verification rule associated with the unqualified structured query language text can be used as the first verification result, so that according to the first verification result, the quality of the structured query language text can be specifically verified.

[0065] Step 207: Determine the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rules.

[0066] Step 208: Determine the quality level of the structured query language text to be checked according to the weight ratio of the check rule and the initial quality score of the structured query language text to be checked.

[0067] It should be noted that the execution process of step 201 and steps 205 to 208 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0068] In summary, in response to finding the current class loader, the current class loader is called, and the target verification rule method is loaded, wherein the target verification rule method is a method in the target verification interface in the target verification program; based on the target verification interface, the type of the target database is obtained, and the structured query language text to be verified in the target database is obtained; according to the type of the target database, the corresponding structured query language parser is called, and the structured query language parser is used to perform syntax analysis on the structured query language text to be verified, so as to obtain the abstract syntax tree corresponding to the structured query language text to be verified; the abstract syntax tree and the target verification rule are used to perform syntax analysis on the structured query language text to be verified A test is performed to obtain an unqualified structured query language text; a first test rule associated with the unqualified structured query language text is obtained from the target test rule, and the first test rule is used as a first test result. Thus, when the first test result is obtained, the structured query language text to be tested is firstly tested using the abstract syntax tree and the target test rule to obtain the unqualified structured query language text, and the first test result is obtained by using the first test rule associated with the unqualified structured query language text, thereby focusing on whether the structured query language text meets the target test rule, thereby testing the quality of the structured query language text in a targeted manner.

[0069] In order to clearly explain how the quality level of the structured query language text to be checked is determined according to the weight ratio of the check rules and the initial quality score of the structured query language text to be checked in the above embodiment, the present disclosure proposes another quality checking method.

[0070] Figure 3 It is a flowchart of the quality inspection method shown in the third embodiment of the present disclosure.

[0071] like Figure 3 As shown, the quality inspection method includes the following steps:

[0072] Step 301, obtaining a target inspection program package in the inspection program.

[0073] Step 302: Based on the target verification program package, the structured query language text to be verified in the target database is verified to obtain a first verification result.

[0074] Step 303: Determine the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rules.

[0075] Step 304: subtract the initial quality score of the structured query language text to be checked according to the weight ratio of the checking rules to obtain a target quality score of the structured query language text to be checked.

[0076] For example, the initial quality score of the structured query language text to be checked is 100, and the check rule weight of the first check rule is 1 / 2, then the target quality score of the structured query language text to be checked is 100-100*1 / 2=50.

[0077] Step 305: Determine the quality level of the structured query language text to be checked according to the target quality score.

[0078] In order to more intuitively determine the quality of the structured query language text, as an example, according to the target quality score, the target score interval in which the target quality score is located is determined from multiple set candidate score intervals, and the quality level of the structured query language text to be tested is determined according to the quality level corresponding to the target score interval.

[0079] It should be noted that each candidate score interval has a corresponding quality level.

[0080] For example, the quality score and quality grade comparison table is shown in Table 1. Assuming that the target quality score of the structured query language text to be tested is 50, according to the quality grade comparison table, the candidate score interval where the target quality score is located is the third candidate score interval in the quality grade comparison table, then the quality grade of the structured query language text to be tested can be expressed as "poor".

[0081] Table 1 Comparison table of quality scores and quality grades

[0082] Candidate score interval Quality Grade 80 < Target quality score ≤ 100 excellent 60 < Target quality score ≤ 80 good 40 < Target quality score ≤ 60 inferior 0 < Target quality score ≤ 40 Failure

[0083] It should be noted that the execution process of steps 301 to 303 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0084] In summary, the initial quality score of the structured query language text to be tested is subtracted according to the weight ratio of the test rules to obtain the target quality score of the structured query language text to be tested; the quality level of the structured query language text to be tested is determined according to the target quality score, thereby determining the target quality score of the structured query language text to be tested, and then determining the target score interval in which the target quality score is located from multiple set candidate score intervals, and determining the quality level of the structured query language text to be tested according to the quality level corresponding to the target score interval, pre-setting multiple quality levels, and accurately determining the quality level of the structured query language text to be tested from the pre-set multiple quality levels according to the target quality score of the structured query language text to be tested, thereby achieving more intuitive determination of the quality of the structured query language text.

[0085] In order to clearly explain how to obtain the target inspection program package before uploading the packaged target inspection program package to the inspection program in the above embodiment, the present disclosure proposes another quality inspection method.

[0086] Figure 4 It is a flowchart of the quality inspection method shown in the fourth embodiment of the present disclosure.

[0087] like Figure 4 As shown, the quality inspection method includes the following steps:

[0088] Step 401, obtaining an initial inspection program package in the inspection program.

[0089] It should be understood that in order to verify the structured query language text to be verified in the target database based on the target verification program package, so as to more accurately obtain the verification rules that are not satisfied by the structured query language text to be verified from the target verification rules, before uploading the packaged target verification program package to the verification program, an initial verification program package is obtained, the initial verification program package is debugged, and then the debugged initial verification program package is uploaded to the verification program as the target verification program package.

[0090] Therefore, in order to accurately obtain the initial inspection program package, as an example, before obtaining the initial inspection program package in the inspection program, obtain an interface creation request, and create an initial inspection interface in the initial inspection program package to be generated according to the interface creation request; determine the initial inspection rules in the initial inspection program package to be generated according to the restricted structured query language text; construct the initial inspection method in the initial inspection program package to be generated according to the initial inspection rules; and package the initial inspection interface and the initial inspection rules to obtain the initial inspection program package. It should be noted that the interface creation request includes the restricted structured query language text.

[0091] For example, the initial validation rules in the initial validation package are to restrict the use of Drop statements, where clauses contain NOT sub-statements, and to restrict the use of Union statements.

[0092] Step 402: Obtain the debugging structured query language text in the debugging database.

[0093] The debugging structured query language text includes the debugging structured query language text that does not satisfy at least one initial verification rule in the initial verification program package, and indication information of the associated verification rule associated with the debugging structured query language text that does not satisfy at least one initial verification rule.

[0094] For example, there is a structured query language text using a Drop statement in the debugging structured query language text. The structured query language text using the Drop statement is the debugging structured query language text that does not meet the initial verification rule (restriction on the use of Drop statements) in the initial verification program package. The restricted use of Drop statement associated with the debugging structured query language text that does not meet the initial verification rule (restriction on the use of Drop statements) is the associated verification rule.

[0095] Step 403: Use the initial verification program package to verify the debugged structured query language text to obtain a second verification result.

[0096] In order to effectively obtain the second inspection result, as a possible implementation method, based on the abstract syntax tree corresponding to the debugging structured query language text and the initial inspection rules in the initial inspection package, the debugging structured query language text is inspected to obtain unqualified debugging structured query language text, and then, based on the second inspection rule associated with the unqualified debugging structured query language text, the second inspection result is determined. As an example, when the current class loader is found, the current class loader is called, and the initial inspection method in the initial inspection interface in the initial inspection package is loaded; then, based on the initial inspection interface, the type of the debugging database is obtained; according to the type of the debugging database, the corresponding structured query language parser is called, and the structured query language parser is used to perform syntax analysis on the debugging structured query language text to obtain the abstract syntax tree corresponding to the debugging structured query language text; the debugging structured query language text is inspected using the abstract syntax tree and the initial inspection rule to obtain unqualified debugging structured query language text; thus, the second inspection rule associated with the unqualified debugging structured query language text is obtained from the initial inspection rule, and the second inspection rule is used as the second inspection result.

[0097] The second inspection result is used to indicate the second inspection rule associated with the unqualified debugging structured query language text, and the unqualified debugging structured query language text is used to indicate the debugging structured query language text that does not meet at least one initial inspection rule in the debugging structured query language text.

[0098] Step 404: In response to the second inspection result being consistent with the indication information, the initial inspection program package is used as the target inspection program package.

[0099] In order to accurately obtain the target inspection program package, as a possible implementation manner, the target inspection program package is determined according to the comparison result between the second inspection result and the indication information.

[0100] As an example, in response to the second inspection result being consistent with the indication information, when the initial inspection program package is uploaded to the inspection program as the target inspection program package, a configuration interface for setting the target inspection program package is displayed, and the target inspection rule metadata information is configured on the configuration page.

[0101] In addition, it should be noted that the target verification rule metadata information includes at least one of the following information: the target verification rule name; the weight of the target verification rule; the database type of the database suitable for quality inspection; and optimization suggestions; wherein the optimization suggestions are used to make adjustments to the structured query language text that does not meet the target verification rule.

[0102] As another example, in response to the second inspection result being inconsistent with the indication information, the initial inspection program package is adjusted according to the indication information; the debug structured query language text is inspected using the adjusted initial inspection program package to obtain a third inspection result; wherein the third inspection result is used to indicate a third inspection rule associated with the unqualified debug structured query language text.

[0103] Step 405: Based on the target verification program package, the structured query language text to be verified in the target database is verified to obtain a first verification result.

[0104] Step 406: Determine the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rules.

[0105] Step 407: Determine the quality level of the structured query language text to be checked according to the weight ratio of the check rule and the initial quality score of the structured query language text to be checked.

[0106] It should be noted that the execution process of steps 405 to 407 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0107] In summary, an initial inspection program package in the inspection program is obtained; a debugging structured query language text in a debugging database is obtained; the initial inspection program package is used to inspect the debugging structured query language text to obtain a second inspection result; in response to the second inspection result being consistent with the indication information, the initial inspection program package is used as a target inspection program package, thereby, before uploading the packaged target inspection program package to the inspection program, the obtained initial inspection program package can be debugged, and the debugged initial inspection program package is uploaded to the inspection program as a target inspection program package, thereby, when performing a quality inspection on the structured query language text to be inspected, it is only necessary to inspect the structured query language text to be inspected in the target database based on the target inspection program package, without hard coding the program, and the inspection rules that are not satisfied by the structured query language text to be inspected can be accurately obtained from the target inspection rules, thereby obtaining the quality level of the structured query language text to be inspected, and at the same time further improving the flexibility of the quality inspection of the structured query language text.

[0108] Corresponding to the quality inspection method provided in the above-mentioned embodiment, the present disclosure also provides a quality inspection device. Since the quality inspection device provided in the embodiment of the present disclosure corresponds to the quality inspection method provided in the above-mentioned embodiment, the implementation method of the quality inspection method is also applicable to the quality inspection device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.

[0109] Figure 5 It is a schematic structural diagram of a quality inspection device shown in the fifth embodiment of the present disclosure.

[0110] like Figure 5 As shown, the quality inspection device 500 includes: a first acquisition module 501 , an inspection module 502 , a first determination module 503 and a second determination module 504 .

[0111] The first acquisition module 501 is used to acquire a target inspection program package in the inspection program; wherein the target inspection program includes a target inspection rule method, the target inspection rule method includes at least one target inspection rule, and the target inspection rule is used to indicate a structured query language text with restricted use; the inspection module 502 is used to inspect the structured query language text to be inspected in the target database based on the target inspection program package to obtain a first inspection result, wherein the first inspection result is used to indicate the first inspection rule associated with the unqualified structured query language text, and the unqualified structured query language text is used to indicate the structured query language text that does not meet at least one target inspection rule in the structured query language text to be inspected; the first determination module 503 is used to determine the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rules; the second determination module 504 is used to determine the quality level of the structured query language text to be inspected according to the inspection rule weight ratio and the initial quality score of the structured query language text to be inspected.

[0112] As a possible implementation method of the embodiment of the present disclosure, the inspection module 502 is used to call the current class loader in response to finding the current class loader, and load the target inspection rule method in the target inspection program package; and is used to inspect the structured query language text to be inspected in the target database based on the class object created by the target inspection rule method to obtain the first inspection result returned by the target inspection rule method.

[0113] As a possible implementation of the embodiment of the present disclosure, the target verification rule method is a method in the target verification interface in the target verification program, and the verification module 502 is used to obtain the type of the target database and the structured query language text to be verified in the target database based on the target verification interface; according to the type of the target database, call the corresponding structured query language parser, use the structured query language parser to perform syntax analysis on the structured query language text to be verified, so as to obtain an abstract syntax tree corresponding to the structured query language text to be verified; use the abstract syntax tree and the target verification rule to verify the structured query language text to be verified, so as to obtain unqualified structured query language text; from the target verification rule, obtain the first verification rule associated with the unqualified structured query language text, and use the first verification rule as the first verification result.

[0114] As a possible implementation method of the embodiment of the present disclosure, the second determination module 504 is used to reduce the initial quality score of the structured query language text to be verified according to the weight ratio of the verification rules to obtain a target quality score of the structured query language text to be verified; and determine the quality level of the structured query language text to be verified according to the target quality score.

[0115] As a possible implementation method of the embodiment of the present disclosure, the second determination module 504 is used to determine a target score interval in which a target quality score is located from a plurality of set candidate score intervals; wherein each candidate score interval has a corresponding quality level; and determine the quality level of the structured query language text to be verified according to the quality level corresponding to the target score interval.

[0116] As a possible implementation of the embodiment of the present disclosure, the quality inspection device 500 further includes: an initial inspection program package module, an adjustment module and a configuration interface module.

[0117] The initial inspection program package module is used to obtain an initial inspection program package in the inspection program; obtain a debugging structured query language text in a debugging database; wherein the debugging structured query language text includes debugging structured query language text that does not satisfy at least one initial inspection rule in the initial inspection program package, and indication information of an associated inspection rule associated with the debugging structured query language text that does not satisfy at least one initial inspection rule; use the initial inspection program package to inspect the debugging structured query language text to obtain a second inspection result; wherein the second inspection result is used to indicate the second inspection rule associated with the unqualified debugging structured query language text, and the unqualified debugging structured query language text is used to indicate the debugging structured query language text in the debugging structured query language text that does not satisfy at least one initial inspection rule; in response to the second inspection result being consistent with the indication information, the initial inspection program package is used as a target inspection program package.

[0118] As a possible implementation method of the embodiment of the present disclosure, the adjustment module is used to, in response to the second inspection result being inconsistent with the indication information, adjust the initial inspection program package according to the indication information; use the adjusted initial inspection program package to inspect the debugging structured query language text to obtain a third inspection result; wherein the third inspection result is used to indicate a third inspection rule associated with the unqualified debugging structured query language text; in response to the third inspection result being consistent with the indication information, use the adjusted initial inspection program package as the target inspection program package.

[0119] As a possible implementation method of the embodiment of the present disclosure, the initial inspection program package module is also used to obtain an interface creation request, and create an initial inspection interface in the initial inspection program package to be generated according to the interface creation request; wherein the interface creation request includes a structured query language text with restricted use; based on the structured query language text with restricted use, the initial inspection rules in the initial inspection program package to be generated are determined; based on the initial inspection rules, the initial inspection method in the initial inspection program package to be generated is constructed; and the initial inspection interface and the initial inspection rules are packaged to obtain the initial inspection program package.

[0120] As a possible implementation method of the embodiment of the present disclosure, in response to the second inspection result being consistent with the indication information, after the initial inspection package is used as the target inspection package, the configuration interface module 507 is used to display the configuration interface for setting the target inspection package, and configure the target inspection rule metadata information on the configuration page.

[0121] The quality inspection device of the embodiment of the present disclosure obtains a target inspection program package in the inspection program; based on the target inspection program package, inspects the structured query language text to be inspected in the target database to obtain a first inspection result; determines the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rule; determines the quality level of the structured query language text to be inspected according to the inspection rule weight ratio and the initial quality score of the structured query language text to be inspected, thereby, before the structured query language text to be inspected is inspected, the target inspection program package has been configured in the inspection program, the target inspection rule includes a target inspection rule method, and the target inspection rule method includes a result that satisfies user restrictions on use. The target verification rule of the structured query language text is constructed, and then the target verification rule is adopted to verify the structured query language text to be verified to obtain the verification result. According to the weight of the verification rule associated with the verification result and the initial quality score of the structured query language text to be verified, the score of the structured query language text to be verified is reduced to determine the quality level of the structured query language text to be verified. By adopting the definition of the target verification program package, not only the needs of users are met, but also when the needs of users change, the target verification rules included in the target verification rule method are changed to adapt to the new needs of users, avoiding program hard coding, flexibly verifying the structured query language text, and improving the efficiency and flexibility of structured query language text quality verification.

[0122] In an exemplary embodiment, an electronic device is also provided.

[0123] Among them, electronic equipment includes:

[0124] processor;

[0125] a memory for storing processor-executable instructions;

[0126] The processor is configured to execute instructions to implement the quality inspection method proposed in any of the aforementioned embodiments.

[0127] As an example, Figure 6 is a schematic diagram of the structure of an electronic device 600 shown in an exemplary embodiment of the present disclosure, such as Figure 6 As shown, the electronic device 600 may further include:

[0128] The memory 610 and the processor 620, a bus 630 connecting different components (including the memory 610 and the processor 620), the memory 610 stores a computer program, and when the processor 620 executes the program, the quality inspection method described in the embodiment of the present disclosure is implemented.

[0129] Bus 630 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0130] The electronic device 600 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 600, including volatile and non-volatile media, removable and non-removable media.

[0131] The memory 610 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 640 and / or cache memory 650. The server 600 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 660 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, often referred to as a "hard drive packager"). Although Figure 6Not shown in the figure, a disk driver package for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk driver package for reading and writing a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each driver package can be connected to the bus 630 via one or more data medium interfaces. The memory 610 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.

[0132] A program / utility 680 having a set (at least one) of program modules 670 may be stored, for example, in the memory 610, such program modules 670 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 670 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0133] The electronic device 600 may also communicate with one or more external devices 660 (e.g., keyboard, pointing device, display 691, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input / output (I / O) interface 692. In addition, the electronic device 600 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) via a network adapter 693. As shown, the network adapter 693 communicates with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device driver package, redundant processing unit, external disk driver package array, RAID system, tape driver package, and data backup storage system, etc.

[0134] The processor 620 executes various functional applications and data processing by running the programs stored in the memory 610 .

[0135] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the quality inspection method of the embodiment of the present disclosure, and will not be repeated here.

[0136] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to complete the quality inspection method proposed in any of the above embodiments. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0137] In an exemplary embodiment, a computer program product is also provided, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the quality inspection method proposed in any of the above embodiments is implemented.

[0138] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0139] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A quality inspection method, characterized in that: The following steps are involved: Obtaining a target inspection program package in the inspection program; wherein the target inspection program includes a target inspection rule method, the target inspection rule method includes at least one target inspection rule, and the target inspection rule is used to indicate a structured query language text that is restricted in use; Based on the target verification program package, the structured query language text to be verified in the target database is verified to obtain a first verification result, wherein the first verification result is used to indicate a first verification rule associated with an unqualified structured query language text, and the unqualified structured query language text is used to indicate a structured query language text that does not satisfy at least one of the target verification rules in the structured query language text to be verified; Determining the inspection rule weight ratio of the first inspection rule according to the ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rule; The quality level of the structured query language text to be checked is determined according to the weight ratio of the check rule and the initial quality score of the structured query language text to be checked.

2. The method according to claim 1, characterized in that The step of testing the structured query language text to be tested in the target database based on the target testing program package to obtain a first testing result includes: In response to finding the current class loader, calling the current class loader and loading the target inspection rule method in the target inspection program package; Based on the class object created by the target verification rule method, the structured query language text to be verified in the target database is verified to obtain the first verification result returned by the target verification rule method.

3. The method according to claim 2, characterized in that The target inspection rule method is a method in the target inspection interface in the target inspection program; The class object created based on the target verification rule method verifies the structured query language text to be verified in the target database to obtain the first verification result returned by the target verification rule method, including: Based on the target verification interface, obtaining the type of the target database and obtaining the to-be-verified structured query language text in the target database; According to the type of the target database, a corresponding structured query language parser is called, and the structured query language parser is used to perform syntax analysis on the structured query language text to be checked, so as to obtain an abstract syntax tree corresponding to the structured query language text to be checked; Using the abstract syntax tree and the target verification rule, the structured query language text to be verified is verified to obtain the unqualified structured query language text; The first verification rule associated with the unqualified structured query language text is acquired from the target verification rule, and the first verification rule is used as the first verification result.

4. The method according to claim 1, characterized in that: Determining the quality level of the structured query language text to be checked according to the weight proportion of the check rule and the initial quality of the structured query language text to be checked includes: According to the weight proportion of the inspection rule, the initial quality score of the structured query language text to be inspected is reduced to obtain a target quality score of the structured query language text to be inspected; The quality level of the to-be-verified structured query language text is determined according to the target quality score.

5. The method according to claim 4, characterized in that Determining the quality level of the to-be-verified structured query language text according to the target quality score includes: Determining a target score interval in which the target quality score is located from a plurality of set candidate score intervals; wherein each of the candidate score intervals has a corresponding quality level; The quality level of the structured query language text to be checked is determined according to the quality level corresponding to the target score interval.

6. The method according to claim 1, characterized in that The step of obtaining a target inspection program package in the inspection program includes: obtaining an initial inspection program package in the inspection program; Acquire debugging structured query language text in the debugging database; wherein the debugging structured query language text includes debugging structured query language text that does not satisfy at least one initial verification rule in the initial verification program package, and indication information of associated verification rules associated with the debugging structured query language text that does not satisfy at least one initial verification rule; Using the initial verification program package, the debugging structured query language text is verified to obtain a second verification result; wherein the second verification result is used to indicate a second verification rule associated with an unqualified debugging structured query language text, and the unqualified debugging structured query language text is used to indicate a debugging structured query language text in the debugging structured query language text that does not satisfy at least one of the initial verification rules; In response to the second inspection result being consistent with the indication information, the initial inspection program package is used as the target inspection program package.

7. The method according to claim 6, characterized in that The method further comprises: In response to the second inspection result being inconsistent with the indication information, adjusting the initial inspection program package according to the indication information; Using the adjusted initial inspection program package to inspect the debugging structured query language text to obtain a third inspection result; wherein the third inspection result is used to indicate a third inspection rule associated with the unqualified debugging structured query language text; In response to the third inspection result being consistent with the indication information, the adjusted initial inspection program package is used as the target inspection program package.

8. The method according to claim 6, characterized in that The obtaining of the initial inspection program package in the inspection program includes: Obtaining an interface creation request, and creating an initial inspection interface in an initial inspection program package to be generated according to the interface creation request; wherein the interface creation request includes a restricted structured query language text; Determining initial inspection rules in an initial inspection program package to be generated according to the restricted structured query language text; According to the initial inspection rule, construct an initial inspection method in the initial inspection program package to be generated; The initial inspection interface and the initial inspection rule are packaged to obtain the initial inspection program package.

9. The method according to claim 6, characterized in that After the initial inspection program package is used as the target inspection program package in response to the second inspection result being consistent with the indication information, the method further includes: A configuration interface for setting the target verification program package is displayed, and target verification rule metadata information is configured on the configuration page.

10. A quality inspection device, characterized in that: The following steps are involved: A first acquisition module is used to acquire a target inspection program package in the inspection program; wherein the target inspection program includes a target inspection rule method, the target inspection rule method includes at least one target inspection rule, and the target inspection rule is used to indicate a structured query language text with restricted use; A verification module, configured to verify the structured query language text to be verified in the target database based on the target verification program package to obtain a first verification result, wherein the first verification result is used to indicate a first verification rule associated with an unqualified structured query language text, and the unqualified structured query language text is used to indicate a structured query language text that does not satisfy at least one of the target verification rules in the structured query language text to be verified; A first determination module, configured to determine a weight ratio of the first inspection rule according to a ratio between the weight of the first inspection rule and the sum of the weights of the target inspection rule; The second determination module is used to determine the quality level of the structured query language text to be checked according to the weight ratio of the verification rule and the initial quality score of the structured query language text to be checked.