Structured query language verification method and device and program product

By automating the processing of rule files and generating structured query statements, the inefficiency of traditional manual SQL validation rule development is solved, achieving efficient and accurate SQL statement generation and validation, and reducing system maintenance costs.

CN121786056APending Publication Date: 2026-04-03SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-25
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Traditional developers face significant challenges in manually developing Structured Query Language (SQL) validation rules, especially when multiple reports involve thousands of validation rules. This results in high development and maintenance costs, making it difficult to meet regulatory requirements for high accuracy and timeliness.

Method used

By obtaining and preprocessing the rule file, converting characters using a Chinese-English mapping table, generating initial statements based on the basic structured query language template and regular expressions, calling function libraries for processing, and finally connecting to the database for verification, the system can automatically generate and test SQL statements in batches.

Benefits of technology

It improves the validation efficiency of the structured query language, reduces development and maintenance time, ensures the accuracy and efficiency of validation results, and reduces system maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786056A_ABST
    Figure CN121786056A_ABST
Patent Text Reader

Abstract

The invention relates to a structured query language verification method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps of obtaining a rule file containing a structured query language verification rule, and performing preprocessing to obtain a processed rule file; converting the preset characters into corresponding Chinese and English names based on a preset Chinese and English mapping table, and generating an intermediate format file; classifying the intermediate format file according to the type of the structured query language verification rule, and performing matching based on a preset basic structured query language template and a regular expression to generate an initial structured query statement; calling a preset function library to process the initial structured query statement to obtain a final structured query statement; and connecting a preset database, and verifying the final structured query statement to obtain a final verification result. By adopting the method, the verification efficiency of the structured query language can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for validating a structured query language. Background Technology

[0002] As regulators demand higher accuracy and timeliness in reporting from various banks, and as the scale and dimensions of reported data rapidly increase, the requirements for accuracy and timeliness also become increasingly stringent. This necessitates the ability to accurately identify abnormal data while simultaneously developing a large number of rule-based SQL (structured query statements) to verify the completeness and accuracy of the data. The pressure on traditional developers to manually develop verification rules is growing.

[0003] Developing a validation rule requires meeting business needs while also satisfying database syntax and SQL statement execution efficiency. In particular, a single report may involve the development of hundreds of validation rules. Therefore, the development, testing, and subsequent maintenance of the SQL statements corresponding to a validation rule can take a considerable amount of time. This is especially true when regulators issue multiple reports involving thousands of validation rules, but require the use of these validation rule SQL statements to validate the data soon. In such cases, developers need to spend a significant amount of time on thousands of validation rules. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for validating a structured query language that can improve the validation efficiency of the structured query language, in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a method for validating a structured query language, including:

[0006] Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file;

[0007] Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0008] The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements.

[0009] The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement;

[0010] Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0011] In one embodiment, the preprocessing of the rule file includes:

[0012] The rule file is cleaned to obtain a cleaned rule file;

[0013] Convert Chinese characters in the cleaned rule file that do not conform to the database syntax specifications into English characters.

[0014] In one embodiment, the preset Chinese-English mapping table includes a Chinese-English reporting table name mapping table and a Chinese-English field mapping table.

[0015] In one embodiment, the step of classifying the intermediate format file according to the type of Structured Query Language (SCL) validation rules, and matching it based on a preset basic SCL template and regular expressions to generate an initial structured query statement includes:

[0016] The intermediate format files are classified based on the type of the structured query language validation rules to determine the preset basic structured query language template;

[0017] Based on regular expressions, the intermediate format file is matched with a preset basic structured query language template to determine key parameters;

[0018] The key parameters are filled into a preset basic structured query language template to generate an initial structured query statement.

[0019] In one embodiment, the preset function library includes at least one processing function selected from string replacement function, fuzzy matching function, string splitting function, and field mapping function.

[0020] In one embodiment, the connection to a preset database is used to validate the final structured query statement and obtain the final validation result, including:

[0021] Connect to a preset database and perform syntax validation based on the execution result of the final structured query statement in the preset database;

[0022] Record the runtime of the final structured query statement in the preset database to verify runtime efficiency.

[0023] Secondly, this application also provides a validation device for a structured query language, comprising:

[0024] The acquisition module is used to acquire a rule file containing structured query language validation rules, preprocess the rule file, and obtain a processed rule file.

[0025] The generation module is used to convert preset characters in the processed rule file into corresponding Chinese and English names based on a preset Chinese-English mapping table, and generate an intermediate format file.

[0026] The generation module is also used to classify the intermediate format file according to the type of the structured query language validation rules, and to match it based on the preset basic structured query language template and regular expression to generate an initial structured query statement.

[0027] The calling module is used to call a preset function library to process the initial structured query statement and obtain the final structured query statement;

[0028] The verification module is used to connect to a preset database, verify the final structured query statement, and obtain the final verification result.

[0029] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0030] Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file;

[0031] Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0032] The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements.

[0033] The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement;

[0034] Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0035] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0036] Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file;

[0037] Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0038] The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements.

[0039] The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement;

[0040] Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0041] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0042] Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file;

[0043] Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0044] The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements.

[0045] The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement;

[0046] Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0047] The aforementioned method, apparatus, computer device, computer-readable storage medium, and computer program product for validating Structured Query Language (SCL) first obtain a rule file containing SCL validation rules, preprocess the rule file to obtain a processed rule file, convert preset characters in the processed rule file into corresponding Chinese and English names based on a preset Chinese-English mapping table, and generate an intermediate format file, classify the intermediate format file according to the type of SCL validation rules, and perform matching based on a preset basic SCL template and regular expressions to generate an initial structured query statement, call a preset function library to process the initial structured query statement to obtain a final structured query statement, connect to a preset database, validate the final structured query statement, and obtain the final validation result. In this way, by continuously batch reading rules to generate batches of SQL statements, and immediately connecting to the database after statement generation for syntax testing and time-consuming data retrieval, and displaying the final validation rule results and time spent, the efficiency of SCL validation is improved. Attached Figure Description

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

[0049] Figure 1 This is a diagram illustrating the application environment of a structured query language validation method in one embodiment.

[0050] Figure 2 This is a flowchart illustrating a structured query language validation method in one embodiment;

[0051] Figure 3 This is a structural block diagram of a structured query language validation device in one embodiment;

[0052] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0053] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0054] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0055] The structured query language validation method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0056] In one exemplary embodiment, such as Figure 2 As shown, a validation method for a structured query language is provided, which is then applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps 202 to 210. Wherein:

[0057] Step 202: Obtain the rule file containing the structured query language validation rules, preprocess the rule file to obtain the processed rule file.

[0058] For example, a rule file containing structured query language validation rules is obtained, and the rule file is preprocessed to obtain a processed rule file.

[0059] The rule file can be an EXCEL file or a file of other formats; this application embodiment does not limit this.

[0060] Step 204: Based on the preset Chinese-English mapping table, convert the preset characters in the processed rule file into corresponding Chinese and English names, and generate an intermediate format file.

[0061] Optionally, based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0062] In one embodiment, the preset Chinese-English mapping table is established based on business requirements. The EXCEL file containing the validation rules is combined with the English names of the reports and the Chinese names of the fields obtained by mapping through the preset Chinese-English mapping table, and then converted into CSV format.

[0063] In one embodiment, Python can be used to start reading intermediate format files, and the corresponding functions of Python's built-in CSV module can be used for batch data processing, processing each validation rule.

[0064] In another embodiment, a standard field library is established based on business characteristics, that is, the correspondence between the Chinese and English names of the fields in each report, which is used for mapping and replacement when the corresponding fields appear in subsequent rules.

[0065] Step 206: Classify the intermediate format files according to the type of Structured Query Language (SCL) validation rules, and perform matching based on the preset basic SCL template and regular expressions to generate the initial structured query statement.

[0066] For example, the intermediate format file is classified according to the rule type field in the intermediate format file, and the initial structured query statement is generated by matching based on the preset basic structured query language template and regular expression.

[0067] Step 208: Call the preset function library to process the initial structured query statement to obtain the final structured query statement.

[0068] Optionally, a preset function library can be called to process the initial structured query statement to obtain the final structured query statement.

[0069] Step 210: Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0070] For example, a preset database is connected, and the final structured query statement is subjected to syntax and runtime efficiency checks, and the final check results are output.

[0071] The above-described structured query language (SCL) validation method involves: acquiring a rule file containing SCL validation rules; preprocessing the rule file to obtain a processed rule file; converting preset characters in the processed rule file into corresponding Chinese and English names based on a preset Chinese-English mapping table, and generating an intermediate format file; classifying the intermediate format file according to the type of SCL validation rules, and matching it based on a preset basic SCL template and regular expressions to generate an initial structured query statement; calling a preset function library to process the initial structured query statement to obtain the final structured query statement; connecting to a preset database to validate the final structured query statement, and obtaining the final validation result. In this way, by continuously batch reading rules to generate batches of SQL statements, and immediately connecting to the database after statement generation for syntax testing and time-consuming data retrieval, and displaying the final validation rule results and time spent, the efficiency of SCL validation is improved.

[0072] In an exemplary embodiment, the rule file is preprocessed, including: cleaning the rule file to obtain a cleaned rule file; and converting Chinese characters in the cleaned rule file that do not conform to the database syntax specifications into English characters.

[0073] In practice, the rule file is cleaned to obtain a cleaned rule file; Chinese characters in the cleaned rule file that do not conform to the database syntax specifications are converted into English characters.

[0074] For example, change special symbols in the Chinese descriptions of an Excel file, such as Chinese symbols or Chinese parentheses, to English.

[0075] In the above embodiments, by converting the rule file into a unified character format (all English symbols), it is ensured that the regular expression pattern can accurately match the expected keywords or structures, avoiding mapping failures or matching errors caused by inconsistent symbols.

[0076] In one exemplary embodiment, the preset Chinese-English mapping table includes a Chinese-English reporting form name mapping table and a Chinese-English field mapping table.

[0077] In practice, the preset Chinese-English mapping table includes a Chinese-English reporting form name mapping table and a Chinese-English field mapping table. It may also include other Chinese-English mapping tables, which can be set according to the actual situation. This application embodiment does not limit this.

[0078] In the above embodiments, only the correspondence in the mapping table needs to be updated once. All validation rules referencing this table name or field name will automatically use the new, correct name the next time they are generated. This greatly reduces the cost and risk of system maintenance.

[0079] In an exemplary embodiment, intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and an initial structured query statement is generated by matching them with a preset basic SCL template and regular expressions. This includes: classifying intermediate format files according to the type of SCL validation rules to determine a preset basic SCL template; matching the intermediate format files with the preset basic SCL template using regular expressions to determine key parameters; and filling the key parameters into the preset basic SCL template to generate the initial structured query statement.

[0080] In practice, intermediate format files are classified based on the type of structured query language validation rules to determine the preset basic structured query language template; based on regular expressions, intermediate format files are matched with the preset basic structured query language template to determine key parameters; the key parameters are filled into the preset basic structured query language template to generate the initial structured query statement.

[0081] In one embodiment, the validation rules are classified according to the rule type field in the validation rules. Different classifications have different judgment logic and processing logic. Regular expressions are used to perform fuzzy matching and precise matching of text. The built-in RE module in Python is used to pre-configure basic SQL for the same type of validation rules. Then, based on the specificity of each data rule, adjustments are made to the basic SQL in combination with field mapping and matching process.

[0082] In the above embodiments, by reusing pre-designed and optimized basic templates, SQL generation is instantaneous. This ensures that the SQL for all similar rules is structurally consistent and standardized, eliminating problems caused by differences in coding styles among different developers.

[0083] In one exemplary embodiment, the preset function library includes at least one processing function selected from string replacement function, fuzzy matching function, string splitting function, and field mapping function.

[0084] In practice, the pre-defined function library includes at least one of the following processing functions: string replacement function, fuzzy matching function, string splitting function, and field mapping function.

[0085] In one embodiment, for frequently processed general logic, custom functions are developed for processing and calling. Then, based on the specificity of each validation rule, different judgment logic needs to be written for parsing, matching, and conversion. Each part of the processing needs to be written as a function for logic parsing and matching. This will form a dedicated function library with different processing methods for different validation rules. The processing includes string replacement, fuzzy matching of characters, character segmentation, character mapping, etc.

[0086] In another embodiment, during the process of concatenating the SQL validation rules, the processed results of each part are processed in a certain way (including some format processing, etc.) and then concatenated to form a single SQL statement.

[0087] In the above embodiments, the function library will facilitate reconstruction and calling in the later stages, which can improve development efficiency and make it easier to handle new rules that need to be developed in the future.

[0088] In an exemplary embodiment, connecting to a preset database and validating the final structured query statement to obtain the final validation result includes: connecting to the preset database and performing syntax validation based on the execution result of the final structured query statement in the preset database; recording the execution time of the final structured query statement in the preset database and performing execution efficiency validation.

[0089] In practice, the system connects to a preset database and performs syntax validation based on the execution result of the final structured query statement in the preset database; it also records the execution time of the final structured query statement in the preset database to perform efficiency validation.

[0090] In one embodiment, when a certain type of verification rule needs to be verified according to new business requirements or new regulatory requirements, such as adding a new code value to the verification rule, this type of verification can be modified in batches. When new requirements arise, the new requirements can be added to the processing logic by modifying the configuration table or calling the function of the maintenance module.

[0091] In the above embodiments, all tests are executed automatically, and the results are integrated into a structured table. Developers no longer need to manually execute and record each test line; they can quickly identify all SQL statements with syntax errors and those that timed out by simply viewing the final results file, thus improving troubleshooting efficiency.

[0092] To illustrate the structured query language validation method in this application in detail, an embodiment is described below. For example, this application describes a structured query language validation method in a specific scenario.

[0093] First, obtain the rule file containing the structured query language validation rules, preprocess the rule file, and obtain the processed rule file.

[0094] Based on the preset Chinese-English mapping table, the preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0095] Based on the rule type field in the intermediate format file, the intermediate format file is classified, and matching is performed based on the preset basic structured query language template and regular expressions to generate the initial structured query statement.

[0096] The system calls a pre-defined function library to process the initial structured query statement, resulting in the final structured query statement. It then connects to a pre-defined database, performs syntax and performance checks on the final structured query statement, and outputs the final validation results.

[0097] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0098] Based on the same inventive concept, this application also provides a structured query language verification device for implementing the structured query language verification method described above. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations in one or more structured query language verification device embodiments provided below can be found in the limitations of the structured query language verification method described above, and will not be repeated here.

[0099] In one exemplary embodiment, such as Figure 3 As shown, a validation device for a structured query language is provided, comprising: an acquisition module 301, a generation module 302, a calling module 303, and a validation module 304, wherein:

[0100] The acquisition module is used to acquire a rule file containing structured query language validation rules, preprocess the rule file, and obtain a processed rule file.

[0101] The generation module is used to convert preset characters in the processed rule file into corresponding Chinese and English names based on a preset Chinese-English mapping table, and generate an intermediate format file.

[0102] The generation module is also used to classify the intermediate format file according to the type of the structured query language validation rules, and to generate an initial structured query statement based on a preset basic structured query language template and regular expressions.

[0103] The calling module is used to call a preset function library to process the initial structured query statement and obtain the final structured query statement.

[0104] The verification module is used to connect to a preset database, verify the final structured query statement, and obtain the final verification result.

[0105] In one exemplary embodiment, the above-described apparatus further includes a processing module for:

[0106] The rule file is cleaned to obtain the cleaned rule file;

[0107] Convert Chinese characters in the cleaned rule file that do not conform to the database syntax to English characters.

[0108] In one exemplary embodiment, the preset Chinese-English mapping table includes a Chinese-English reporting form name mapping table and a Chinese-English field mapping table.

[0109] In one exemplary embodiment, the above-described generation module is further configured to:

[0110] The intermediate format files are classified based on the type of the structured query language validation rules to determine the preset basic structured query language template;

[0111] Based on regular expressions, the intermediate format file is matched with the preset basic structured query language template to determine key parameters;

[0112] Fill in the key parameters into the preset basic structured query language template to generate the initial structured query statement.

[0113] In one exemplary embodiment, the preset function library includes at least one processing function selected from string replacement function, fuzzy matching function, string splitting function, and field mapping function.

[0114] In one exemplary embodiment, the verification module is further configured to:

[0115] Connect to the preset database and perform syntax validation based on the results of the final structured query statement in the preset database;

[0116] Record the runtime of the final structured query statement in the preset database to verify runtime efficiency.

[0117] Each module in the aforementioned structured query language validation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0118] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a structured query language verification method.

[0119] The display unit of this computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of this computer device can be a touch layer covering the display screen, or buttons, a trackball, or a touchpad set on the casing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0120] Those skilled in the art will understand that Figure 4The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0121] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0122] Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file;

[0123] Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0124] The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements.

[0125] The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement;

[0126] Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0127] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0128] Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file;

[0129] Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0130] The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements.

[0131] The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement;

[0132] Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0133] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0134] Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file;

[0135] Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated.

[0136] The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements.

[0137] The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement;

[0138] Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

[0139] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0140] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0141] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0142] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A validation method for a structured query language, characterized in that, The method includes: Obtain a rule file containing structured query language validation rules, preprocess the rule file to obtain a processed rule file; Based on a preset Chinese-English mapping table, preset characters in the processed rule file are converted into corresponding Chinese and English names, and an intermediate format file is generated. The intermediate format files are classified according to the type of Structured Query Language (SCL) validation rules, and matched based on preset basic SCL templates and regular expressions to generate initial structured query statements. The initial structured query statement is processed by calling a preset function library to obtain the final structured query statement; Connect to the preset database, validate the final structured query statement, and obtain the final validation result.

2. The method according to claim 1, characterized in that, The preprocessing of the rule file includes: The rule file is cleaned to obtain a cleaned rule file; Convert Chinese characters in the cleaned rule file that do not conform to the database syntax specifications into English characters.

3. The method according to claim 1, characterized in that, The preset Chinese-English mapping table includes a Chinese-English reporting form name mapping table and a Chinese-English field mapping table.

4. The method according to claim 1, characterized in that, The step of classifying the intermediate format files according to the type of Structured Query Language (SCL) validation rules, and matching them based on a preset basic SCL template and regular expressions to generate an initial structured query statement includes: The intermediate format files are classified based on the type of the structured query language validation rules to determine the preset basic structured query language template; Based on regular expressions, the intermediate format file is matched with a preset basic structured query language template to determine key parameters; The key parameters are filled into a preset basic structured query language template to generate an initial structured query statement.

5. The method according to claim 1, characterized in that, The preset function library includes at least one of the following processing functions: string replacement function, fuzzy matching function, string splitting function, and field mapping function.

6. The method according to claim 1, characterized in that, The connection to the preset database validates the final structured query statement, obtaining the final validation result, including: Connect to a preset database and perform syntax validation based on the execution result of the final structured query statement in the preset database; Record the runtime of the final structured query statement in the preset database to verify runtime efficiency.

7. A validation device for a structured query language, characterized in that, The device includes: The acquisition module is used to acquire a rule file containing structured query language validation rules, preprocess the rule file, and obtain a processed rule file. The generation module is used to convert preset characters in the processed rule file into corresponding Chinese and English names based on a preset Chinese-English mapping table, and generate an intermediate format file. The generation module is also used to classify the intermediate format file according to the type of the structured query language validation rules, and to match it based on the preset basic structured query language template and regular expression to generate an initial structured query statement. The calling module is used to call a preset function library to process the initial structured query statement and obtain the final structured query statement; The verification module is used to connect to a preset database, verify the final structured query statement, and obtain the final verification result.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.