Operation instruction processing method and device applied to database, equipment and medium

By extracting instruction elements and association relationships in database operation instructions, automatically generate audit rules and conduct automatic auditing, the problem of insufficient real-time caused by traditional manual auditing is solved, and more efficient database operation instruction audit is achieved.

CN119759731APending Publication Date: 2025-04-04SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411940253.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The existing technology has poor real-time performance during the audit of database operation instructions, and relying on manual audits cannot meet the rapidly growing database application needs.

Method used

By obtaining the target project file and the instruction language to be reviewed, extracting the instruction elements and association relationships in the target operation instructions, dynamically selecting the rule to generate templates, automatically generating target audit rules, and automatically reviewing the operation instructions according to the rules.

Benefits of technology

It improves the real-time auditing and processing of database operation instructions, reduces the dependence on manual auditing, and can process a large number of database operation instructions more quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759731A_ABST
    Figure CN119759731A_ABST
Patent Text Reader

Abstract

The invention relates to an operation instruction processing method and device applied to a database, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps of obtaining a target project file and a to-be-audited instruction language, and extracting a target operation instruction matched with the to-be-audited instruction language in the target project file; extracting instruction elements in the target operation instruction and an association relationship between different instruction elements; selecting a rule generation template according to the instruction element and the association relationship, and generating a target auditing rule according to the rule generation template; and auditing the target operation instruction according to the target auditing rule to obtain an auditing result. By adopting the method, the real-time performance of auditing processing for the database operation instruction can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database technology, and in particular to a method, device, computer equipment, storage medium and computer program product for processing operation instructions applied to a database. Background Art

[0002] At present, manual review is usually used to review the quality of operation instructions written based on business scenarios in application systems, such as SQL (Structured Query Language) statements. However, with the advancement of informatization and digital construction, the number of applications has grown rapidly, and database applications have also continued to grow. However, traditional database management and operation and maintenance rely heavily on manpower and have poor real-time performance.

[0003] The relevant technology adopts an online audit method, which deploys an audit platform for developers and managers to audit the operation instruction language. However, it is essentially dominated by manpower and cannot fully improve the real-time nature of the audit. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for processing operation instructions applied to the database, which can improve the real-time performance of the audit processing of database operation instructions in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for processing an operation instruction applied to a database, comprising:

[0006] Acquire a target engineering file and a to-be-reviewed instruction language, and extract a target operation instruction in the target engineering file that matches the to-be-reviewed instruction language;

[0007] Extracting the instruction element in the target operation instruction and the association relationship between different instruction elements;

[0008] A rule generation template is selected according to the instruction element and the association relationship, and a target audit rule is generated according to the rule generation template;

[0009] The target operation instruction is audited according to the target audit rule to obtain an audit result.

[0010] In one embodiment, extracting the target operation instruction in the target engineering file that matches the instruction language to be reviewed includes:

[0011] Identify the initial operation instruction in the target engineering file according to the instruction language to be reviewed;

[0012] Acquire the project configuration information corresponding to the target project file, and determine the target database type corresponding to the target project file according to the project configuration information;

[0013] According to the target database type, the initial operation instruction is converted into a target operation instruction.

[0014] In one embodiment, determining the target database type corresponding to the target project file according to the project configuration information includes:

[0015] Determine database characteristic data according to the engineering configuration information;

[0016] Acquire a historical feature value set, and perform a cosine distance check on the database feature data according to the historical feature value set to obtain a distance check result;

[0017] The target database type corresponding to the target engineering file is determined according to the distance verification result.

[0018] In one embodiment, determining database characteristic data according to the engineering configuration information includes:

[0019] In the case that there is no sub-instruction carrying a special function tag in the initial operation instruction, determining database characteristic data according to the engineering configuration information;

[0020] In the case where a sub-instruction carrying a special function tag exists in the initial operation instruction, the database characteristic data is determined according to the special function tag and the engineering configuration information.

[0021] In one embodiment, generating target audit rules according to the rule generation template includes:

[0022] Converting the natural language description in the rule generation template into a mathematical logic description;

[0023] Generate target audit rules based on the mathematical logic description.

[0024] In one embodiment, the rule generation template includes any one or more of an instruction element, an element behavior, an element relationship diagram, and an element context; and converting the natural language description in the rule generation template into a mathematical logic description includes:

[0025] Any one or more of the element, the element behavior, the element relationship diagram and the element context are converted into sub-logical descriptions respectively, and the sub-logical descriptions are collected to obtain a mathematical logic description.

[0026] In a second aspect, the present application further provides an operation instruction processing device applied to a database, comprising:

[0027] A data acquisition module, used to acquire a target engineering file and an instruction language to be reviewed, and extract a target operation instruction in the target engineering file that matches the instruction language to be reviewed;

[0028] An instruction extraction module, used for extracting instruction elements in the target operation instruction and association relationships between different instruction elements;

[0029] A rule generation module, used for selecting a rule generation template according to the instruction element and the association relationship, and generating a target audit rule according to the rule generation template;

[0030] The instruction review module is used to review the target operation instruction according to the target review rule to obtain the review result.

[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0032] Acquire a target engineering file and a to-be-reviewed instruction language, and extract a target operation instruction in the target engineering file that matches the to-be-reviewed instruction language;

[0033] Extracting the instruction element in the target operation instruction and the association relationship between different instruction elements;

[0034] A rule generation template is selected according to the instruction element and the association relationship, and a target audit rule is generated according to the rule generation template;

[0035] The target operation instruction is audited according to the target audit rule to obtain an audit result.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0037] Acquire a target engineering file and a to-be-reviewed instruction language, and extract a target operation instruction in the target engineering file that matches the to-be-reviewed instruction language;

[0038] Extracting the instruction element in the target operation instruction and the association relationship between different instruction elements;

[0039] A rule generation template is selected according to the instruction element and the association relationship, and a target audit rule is generated according to the rule generation template;

[0040] The target operation instruction is audited according to the target audit rule to obtain an audit result.

[0041] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0042] Acquire a target engineering file and a to-be-reviewed instruction language, and extract a target operation instruction in the target engineering file that matches the to-be-reviewed instruction language;

[0043] Extracting the instruction element in the target operation instruction and the association relationship between different instruction elements;

[0044] A rule generation template is selected according to the instruction element and the association relationship, and a target audit rule is generated according to the rule generation template;

[0045] The target operation instruction is audited according to the target audit rule to obtain an audit result.

[0046] The above-mentioned operation instruction processing method, device, computer equipment, storage medium and computer program product applied to the database obtains the target engineering file and the instruction language to be reviewed, extracts the target operation instruction that matches the instruction language to be reviewed in the target engineering file, extracts the instruction elements in the target operation instruction and the association relationship between different instruction elements, selects a rule generation template according to the instruction elements and the association relationship, generates a target audit rule according to the rule generation template, and audits the target operation instruction according to the target audit rule to obtain the audit result. The above-mentioned method dynamically selects a rule generation template for the instruction elements and the element association relationship in the target operation instruction, thereby automatically generating the target audit rule. The generation and execution of the target audit rule are automatically performed according to the target operation instruction in the target engineering file, thereby improving the real-time audit processing of the database operation instruction. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 An application environment diagram of an operation instruction processing method applied to a database in one embodiment;

[0049] Figure 2 A schematic diagram of a flow chart of an operation instruction processing method applied to a database in one embodiment;

[0050] Figure 3 This is a flow chart of step S202 of a method for processing an operation instruction applied to a database in one embodiment;

[0051] Figure 4 is a structural block diagram of an operation instruction processing device applied to a database in one embodiment;

[0052] Figure 5 is an internal structure diagram of a computer device in one embodiment;

[0053] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] The operation instruction processing method applied to a database provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network, the terminal 102 can be used to obtain the target project file, and send the obtained target project file to the server 104, and the terminal 102 can also be used to receive the audit instruction, and send the relevant information of the instruction language to be audited to the server 104 according to the audit instruction. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The data storage system can be used to store the obtained target project file, the preset rule generation template, and the mapping relationship between the instruction element, the association relationship and the rule generation template. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0056] In an exemplary embodiment, Figure 2 As shown, a method for processing operation instructions applied to a database is provided. Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S202 to S208. Among them:

[0057] Step S202, obtaining the target project file and the instruction language to be reviewed, and extracting the target operation instruction in the target project file that matches the instruction language to be reviewed.

[0058] The target project file refers to a project file written by a developer or a server for code generation. The target project file may be a source code, or other project files that are rewritten from the source code, such as a Java project file.

[0059] Furthermore, the target project file may include multiple operation instructions, and different operation instructions may correspond to different types of instruction languages ​​to be reviewed. The instruction language to be reviewed refers to the language type of the part of the project file that currently needs to be reviewed, and the instruction language to be reviewed may be SQL language, for example, the SQL part included in the Java project file.

[0060] For example, developers can use Java to develop SQL, so the SQL part is expressed as Java code. In this writing mode, the SQL part is a part of the operation instructions in the target project file. When SQL statement audit is required, the server 104 can receive the audit instruction from the terminal 102, thereby obtaining the statement type label corresponding to the target project file to be audited (such as Java project file) and the instruction language to be audited (such as SQL language). Further, the server 104 can extract the target operation instruction in the target project file that matches the instruction language to be audited according to the statement type label corresponding to the instruction language to be audited.

[0061] Furthermore, during the SIT (system integration test) construction phase, the server 104 can pull the project code from the code hosting platform such as GitLab as the above-mentioned target project file. When receiving the audit instruction, the server 104 can obtain the warehouse address of the project on GitLab. The warehouse address is the URL pointing to the project code library on GitLab. After obtaining the warehouse address, the server 104 can access the code library on GitLab according to this address and clone or pull the code through the Git command.

[0062] Further, the terminal 102 can set a service interface of the SQL quality audit platform, and different permissions can be set for staff members of different roles in the SQL quality audit platform. The server 104 can periodically (for example, every day) synchronize staff information and corresponding system permissions from the cmdb system, and save the relationship between the staff and the corresponding system to the data storage system through a scheduled task. For example, the roles of the staff can include administrators, developers, project managers, etc. Among them, the administrator has the highest authority, can see all menus of the SQL quality audit platform, can assign roles to other staff members, and can configure audit rules and audit rule groups; the menus that the developer role can operate include the process and results of automatic audits, manual review, upload configuration files, and changes that do not involve code, as well as device information management content, such as adding information about the project to which it belongs and the path where the SQL configuration file is stored; the menus that the project manager role can operate include operations for automatic audit results, manual compound results of developers, and management operations on device information and management operations on user information. The server 104 can receive the audit instruction from the terminal 102 according to the above role permissions, and execute the above steps in response to the audit instruction.

[0063] Step S204: extracting the instruction element in the target operation instruction and the association relationship between different instruction elements.

[0064] Among them, instruction elements refer to the basic components that constitute an instruction in programming languages ​​and database queries, that is, the core units of instructions, which are used to define the behavior and structure of instructions during execution. For example, in an SQL query statement, instruction elements may include keywords, field names, table names, operators, and constant values. For example, in a SELECT statement, SELECT, FROM, WHERE, etc. are all SQL keywords used to define basic query operations; name and age are field names used to indicate the columns in the table to be queried; users is a table name used to indicate the data source table for the query; > is an operator used for comparison; 18 is a constant value used to filter data.

[0065] Similarly, in programming languages ​​such as Java, instruction elements also include keywords, identifiers, operators, constants, etc. For example, public, class, and void are Java keywords, which are used to define class access control, the class itself, and the return type of the method, respectively; x and y are identifiers used to name variables; + is an operator used for mathematical calculations; 5 and 10 are constant values.

[0066] Each of the above instruction elements has a specific function and meaning, and they are connected to each other through grammatical rules and logical relationships to ensure that the code is executed as expected. For example, in regular expressions, instruction elements include characters, symbols, and metacharacters. For example, a and b are specific characters, ^ and $ are the start and end positions of the matching string, and .* means matching any character. Different instruction elements jointly determine the matching rules of regular expressions, that is, there is an association relationship between the various instruction elements.

[0067] Exemplarily, the server 104 can extract instruction elements from the target operation instruction, which are basic components of the instruction. For example, in an SQL statement, the instruction elements can be keywords, field names, operators, etc. In addition to the individual instruction elements, the server 104 can also analyze the association relationship between these instruction elements, that is, their interaction and mutual dependence in the instruction.

[0068] Step S206, selecting a rule generation template according to the instruction elements and the association relationship, and generating a target audit rule according to the rule generation template.

[0069] The rule generation template can be understood as a rule framework, which is used to define how to generate specific rules according to different elements and relationships.

[0070] For example, since the rule configuration personnel are likely to be familiar with SQL specifications but do not have Java development capabilities, the server 104 can convert the natural language description in the rule generation template into a mathematical logic description, and generate the target audit rule according to the mathematical logic description. The rule generation template includes any one or more of the instruction element, element behavior, element relationship diagram, and element context. Further, the server 104 can convert any one or more of the element, element behavior, element relationship diagram, and element context into sub-logic descriptions, and collect the sub-logic descriptions to obtain a mathematical logic description.

[0071] Exemplarily, the server 104 can select a suitable rule generation template based on the acquired instruction elements and the associations between them. The rule generation template is not just a simple grammatical template, it can also include the behavior of each element in the instruction (i.e., the role and function of the element in the instruction), the element relationship diagram (i.e., how the elements are associated with each other), and the element context (i.e., the context environment in which the element is located). The server 104 can convert the natural language description in the rule generation template into a mathematical logic description. The natural language description is a way for rule configuration personnel or developers to define audit rules. For example, the natural language description can be "if SELECT* is used in the instruction, a warning is required", etc. The server 104 can convert these descriptions into mathematical logic descriptions through the rule generation template, and the converted logic is easy for the computer to understand and execute. The server 104 can convert the instruction elements, element behaviors, element relationship diagrams, and element contexts into sub-logic descriptions respectively. Each part is independently converted into a small logic description, and then these sub-logic descriptions are collected together to form the final mathematical logic description.

[0072] Furthermore, the server 104 can analyze the core concepts and conditions in the description through natural language processing technology (NLP). In this process, the server 104 can identify keywords, operators, and conditional relationships. For example, for the natural language "if the query contains SELECT *, then warn", the server 104 can convert it into a clear condition: whether the query contains SELECT *, and when this condition is met, trigger a warning. The server 104 can convert the fuzzy description in the language into precise logical conditions, remove unnecessary grammar and emotional colors, and retain the parts that can be calculated and evaluated.

[0073] Next, the server 104 can further convert the conditions in these natural languages ​​into mathematical logic expressions. For example, in the SQL audit rule, the condition "query contains SELECT *" can be converted into a Boolean expression to determine whether the SELECT * pattern exists in the query. The conversion at this stage turns the simple description of natural language into an executable mathematical form. If there are multiple parts in the condition, the server 104 can use logical operators (such as "AND", "OR") to combine them to form a complete logical formula. For example, "if the query contains SELECT * and the query table is not users, then warn" will be converted into a combination of two conditions: SELECT * in query AND table != 'users'. This conversion method clearly expresses the relationship between the two conditions.

[0074] After completing these logical conversions, the server 104 can convert the mathematical logic into a rule framework through a rule generation template. The rule generation template can be a preset structure that can generate specific target audit rules based on the input logical conditions. For example, a rule generation template may be: "If (condition), then (action)", where the "condition" part is composed of the aforementioned mathematical logic, and the "action" is to perform an operation, such as issuing a warning or triggering an error. According to different rule contents, the server 104 can extract a suitable structure from the template and fill in specific conditions and behaviors to form the final target audit rules.

[0075] Step S208, review the target operation instruction according to the target review rules to obtain the review result.

[0076] Exemplarily, these rules can be input into the rule engine, and the server 104 can perform matching according to the actual SQL statement or code to determine whether the rules are met. When the rules are met, the server 104 can trigger corresponding operations, such as alarming or preventing non-compliant operations.

[0077] Furthermore, after the target operation instruction (such as an SQL query statement) is submitted to the audit system, assume that the target operation instruction is an SQL query: "SELECT * FROM users WHERE age > 18". At this time, the server 104 can audit this SQL statement according to the target audit rule. The target audit rule may involve multiple conditions, such as whether the query contains SELECT *, or whether the table name is correct, whether the field name complies with the naming specification, etc. The target audit rule defines the rule content of "If the query uses SELECT *, make sure that the table name is not users". Server 104 can apply the rule content in the rule engine. The audit engine can first identify the instruction elements in the query, extract SELECT * as the key part of the query, and check the table name users to determine whether the statement complies with the above rule content, and then obtain the audit result of the corresponding part.

[0078] In the above-mentioned operation instruction processing method applied to the database, by obtaining the target engineering file and the instruction language to be reviewed, the target operation instruction matching the instruction language to be reviewed in the target engineering file is extracted, the instruction elements in the target operation instruction and the association relationship between different instruction elements are extracted, a rule generation template is selected according to the instruction elements and the association relationship, and a target audit rule is generated according to the rule generation template, and the target operation instruction is audited according to the target audit rule to obtain the audit result. The above-mentioned method automatically generates the target audit rule by dynamically selecting the rule generation template for the instruction elements and the element association relationship in the target operation instruction. The generation and execution of the target audit rule are automatically performed according to the target operation instruction in the target engineering file, thereby improving the real-time audit processing of the database operation instruction.

[0079] In an exemplary embodiment, Figure 3 As shown, step S202 includes steps S302 to S306. Among them:

[0080] Step S302: identifying the initial operation instructions in the target project file according to the instruction language to be reviewed.

[0081] For example, the server 104 may receive the audit instruction from the terminal 102, thereby obtaining the target project file to be audited and the statement type tag corresponding to the instruction language to be audited. Further, the server 104 may extract the target operation instruction matching the instruction language to be audited from the target project file according to the statement type tag corresponding to the instruction language to be audited.

[0082] The target project file may be a Java project file; the initial operation instruction may be a part of the statements in the target operation file for executing SQL.

[0083] Step S304, obtaining the project configuration information corresponding to the target project file, and determining the target database type corresponding to the target project file according to the project configuration information.

[0084] Exemplarily, the server 104 may first obtain the target project configuration information, wherein the project configuration information is contained in the configuration file of the project, such as a POM file, i.e., a project object model file. In a Java project, the POM file is used to describe the dependencies of the project, build configuration, and the like. After obtaining the POM file, the server 104 may extract database-related configurations therefrom, such as a database driver (jar package) for connecting to a database, which is used to indicate how to interact with a specific type of database. Next, the server 104 may determine the target database type based on the types of these driver packages. For example, if the POM file loads a MySQL JAR package, the server 104 may infer that the target database is MySQL; if the Oracle database driver package is loaded, the target database is Oracle, which ensures the consistency and accuracy of the project configuration while simplifying the complexity of manual configuration and identification.

[0085] Furthermore, the server 104 can determine the database feature data according to the project configuration information; obtain a set of historical feature values, and perform a cosine distance check on the database feature data according to the set of historical feature values ​​to obtain a distance check result; and determine the target database type corresponding to the target project file according to the distance check result.

[0086] Among them, the cosine distance check (Cosine Similarity) can be used to measure the similarity between two vectors. By calculating the angle between the two vectors, their cosine similarity is inferred, so as to compare the feature data of the currently recorded database and the target database, and then determine the most matching database type. The calculation principle of cosine similarity is: suppose there are two vectors, A and B, which represent the feature data of two different database types respectively. The degree of matching is determined by calculating the cosine similarity between the two vectors.

[0087] Exemplarily, the process of cosine distance verification is as follows: the server 104 can extract the SQL features in the statements corresponding to the target operation instructions, and extract the feature data of the database by scanning the POM file in the current project code of the target engineering file and the SQL part in the code. The POM file contains the loaded database driver information, and the server 104 can preliminarily determine the type of database that may be used based on the type of these driver packages.

[0088] Furthermore, the server 104 may analyze the SQL-related parts of the code, especially the SQL functions, keywords and other special syntax used. The server 104 may determine the database feature data according to the engineering configuration information when there is no sub-instruction carrying a special function tag in the initial operation instruction; when there is a sub-instruction carrying a special function tag in the initial operation instruction, the database feature data may be determined according to the special function tag and the engineering configuration information. For example, MySQL may use the CONCAT() function, while Oracle may use || for string concatenation. The server 104 may use the special function tag to record these features to form a "feature vector".

[0089] Next, the server 104 can compare these feature data in the current project code with the feature data of multiple known database types. Each database type (such as MySQL, Oracle, PostgreSQL, etc.) has a set of defined feature vectors correspondingly, and these feature vectors represent the functions, keywords and other characteristics of the database. The server 104 can calculate the cosine similarity between the current project code feature vector and each database feature vector. Through the calculation of cosine similarity, the system can derive a value indicating the similarity between the current code and each database type. Exemplarily, the value range of cosine similarity is from -1 to 1, wherein the closer the value is to 1, the higher the similarity between the two, and the closer the value is to 0, the lower the similarity.

[0090] Finally, the server 104 may select the database type with the highest similarity to the target project file as the target database type according to the calculated cosine similarity result.

[0091] Step S306: convert the initial operation instruction into a target operation instruction according to the target database type.

[0092] Exemplarily, after determining the target database type, the server 104 can start the SQL extraction thread and start scanning the entire project code. In this embodiment, the server 104 can identify and extract all project files with the suffix .java. Next, the server 104 can convert all Java classes in these Java files into Java structure classes through a source code parsing tool. This process converts the original source code into structured data that is easy to analyze and process, that is, the process of converting the initial operation instruction into the target operation instruction.

[0093] To ensure the accuracy of processing, the server 104 can use the filter class to filter the parsed Java classes and select the classes related to SQL. After the screening, the server 104 can specially process the SQL business logic written in the annotation mode according to the target database type obtained by the previous analysis, wherein the annotation is used to mark the SQL statement or database operation, and the server 104 can escape the SQL statement in the annotation into a format that conforms to the standard SQL to ensure that it can be correctly identified and processed by the subsequent audit system.

[0094] Exemplarily, for the Java code written using the MyBatis QueryWrapper mode, server 104 can further extract nested SQL statements by identifying relevant entity classes, the dependency of entity classes, the type of QueryWrapper function and information such as its parameter characteristics. According to these characteristics, server 104 can adopt SQL generation engine to generate standard SQL statements that meet the database characteristics according to the target database type. In this process, server 104 can generate corresponding SQL statements according to the characteristics of different database types, for example, according to the differences between databases such as MySQL, Oracle, PostgreSQL, ensure that the SQL statements generated meet the grammar and the operation requirements of the target database.

[0095] In another exemplary embodiment, the server 104 obtains the target project file and the instruction language to be reviewed, identifies the initial operation instruction in the target project file according to the instruction language to be reviewed, and then obtains the engineering configuration information corresponding to the target project file. In the case where there is no sub-instruction carrying a special function mark in the initial operation instruction, the server 104 determines the database characteristic data according to the engineering configuration information; and in the case where there is a sub-instruction carrying a special function mark in the initial operation instruction, the server 104 determines the database characteristic data according to the special function mark and the engineering configuration information, thereby determining the database characteristic data.

[0096] Next, server 104 obtains a set of historical feature values, and performs a cosine distance check on the database feature data based on the set of historical feature values ​​to obtain a distance check result, determines the target database type corresponding to the target project file based on the distance check result, and then converts the initial operation instruction into a target operation instruction based on the target database type.

[0097] Subsequently, server 104 extracts the instruction elements in the target operation instruction and the association relationship between different instruction elements, and selects a rule generation template based on the instruction elements and the association relationship, and converts any one or more of the elements, element behaviors, element relationship diagrams and element contexts in the rule generation template into sub-logical descriptions, and aggregates the sub-logical descriptions to obtain a mathematical logical description, and finally generates a target audit rule based on the mathematical logical description, so as to audit the target operation instruction according to the target audit rule and obtain an audit result.

[0098] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0099] Based on the same inventive concept, the embodiment of the present application also provides an operation instruction processing device applied to a database for implementing the operation instruction processing method applied to a database involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more operation instruction processing devices applied to a database provided below can refer to the limitations of the operation instruction processing method applied to a database above, and will not be repeated here.

[0100] In an exemplary embodiment, Figure 4 As shown, an operation instruction processing device applied to a database is provided, comprising: a data acquisition module 402, an instruction extraction module 404, a rule generation module 406 and an instruction review module 408, wherein:

[0101] The data acquisition module 402 is used to acquire the target engineering file and the instruction language to be reviewed, and extract the target operation instruction in the target engineering file that matches the instruction language to be reviewed;

[0102] An instruction extraction module 404, used to extract instruction elements in a target operation instruction and association relationships between different instruction elements;

[0103] A rule generation module 406, for selecting a rule generation template according to the instruction elements and the association relationship, and generating a target audit rule according to the rule generation template;

[0104] The instruction review module 408 is used to review the target operation instruction according to the target review rules to obtain the review result.

[0105] In one embodiment, the data acquisition module 402 includes:

[0106] An instruction recognition unit, used for recognizing the initial operation instruction in the target engineering file according to the instruction language to be reviewed;

[0107] An information acquisition unit, used to acquire the project configuration information corresponding to the target project file, and determine the target database type corresponding to the target project file according to the project configuration information;

[0108] The instruction conversion unit is used to convert the initial operation instruction into the target operation instruction according to the target database type.

[0109] In one of the embodiments, the information acquisition unit is specifically used to: determine database feature data based on project configuration information; obtain a set of historical feature values, and perform a cosine distance check on the database feature data based on the set of historical feature values ​​to obtain a distance check result; and determine a target database type corresponding to a target project file based on the distance check result.

[0110] In one of the embodiments, the information acquisition unit is also used to: when there is no sub-instruction carrying a special function tag in the initial operation instruction, determine the database characteristic data based on the engineering configuration information; when there is a sub-instruction carrying a special function tag in the initial operation instruction, determine the database characteristic data based on the special function tag and the engineering configuration information.

[0111] In one of the embodiments, the rule generation module 406 is specifically used to: convert the natural language description in the rule generation template into a mathematical logic description; and generate a target audit rule according to the mathematical logic description.

[0112] In one embodiment, the rule generation template includes any one or more of instruction elements, element behaviors, element relationship diagrams, and element contexts; the rule generation module 406 is also used to: convert any one or more of the elements, element behaviors, element relationship diagrams, and element contexts into sub-logical descriptions, respectively, and aggregate the sub-logical descriptions to obtain a mathematical logic description.

[0113] Each module in the above-mentioned operation instruction processing device applied to the database can be implemented in whole or in part by software, hardware or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0114] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the acquired target engineering files, preset rule generation templates, and data such as the mapping relationship between instruction elements, association relationships and rule generation templates. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for processing operation instructions applied to a database is implemented.

[0115] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, an operation instruction processing method applied to a database is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0116] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0117] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining a target project file and an instruction language to be reviewed, and extracting a target operation instruction in the target project file that matches the instruction language to be reviewed; extracting instruction elements in the target operation instruction and the association relationship between different instruction elements; selecting a rule generation template based on the instruction elements and the association relationship, and generating a target review rule based on the rule generation template; and reviewing the target operation instruction according to the target review rule to obtain a review result.

[0118] In one embodiment, when the processor executes the computer program, the following steps are also implemented: identifying the initial operation instructions in the target project file according to the instruction language to be reviewed; obtaining the project configuration information corresponding to the target project file, and determining the target database type corresponding to the target project file according to the project configuration information; and converting the initial operation instructions into target operation instructions according to the target database type.

[0119] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining database feature data based on project configuration information; obtaining a set of historical feature values, and performing a cosine distance check on the database feature data based on the set of historical feature values ​​to obtain a distance check result; and determining a target database type corresponding to the target project file based on the distance check result.

[0120] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when there is no sub-instruction carrying a special function tag in the initial operation instruction, the database characteristic data is determined according to the engineering configuration information; when there is a sub-instruction carrying a special function tag in the initial operation instruction, the database characteristic data is determined according to the special function tag and the engineering configuration information.

[0121] In one embodiment, when the processor executes the computer program, the following steps are also implemented: converting the natural language description in the rule generation template into a mathematical logic description; and generating a target audit rule according to the mathematical logic description.

[0122] In one embodiment, when the processor executes the computer program, the following steps are also implemented: any one or more of the elements, element behaviors, element relationship diagrams, and element contexts are converted into sub-logical descriptions, and the sub-logical descriptions are collected to obtain a mathematical logic description.

[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining a target project file and an instruction language to be reviewed, and extracting target operation instructions in the target project file that match the instruction language to be reviewed; extracting instruction elements in the target operation instructions and associations between different instruction elements; selecting a rule generation template based on the instruction elements and the associations, and generating a target review rule based on the rule generation template; and reviewing the target operation instructions according to the target review rules to obtain a review result.

[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: identifying the initial operation instructions in the target project file according to the instruction language to be reviewed; obtaining the project configuration information corresponding to the target project file, and determining the target database type corresponding to the target project file according to the project configuration information; and converting the initial operation instructions into target operation instructions according to the target database type.

[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining database feature data based on project configuration information; obtaining a set of historical feature values, and performing a cosine distance check on the database feature data based on the set of historical feature values ​​to obtain a distance check result; and determining a target database type corresponding to the target project file based on the distance check result.

[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when there are no sub-instructions carrying special function tags in the initial operation instructions, the database characteristic data is determined according to the engineering configuration information; when there are sub-instructions carrying special function tags in the initial operation instructions, the database characteristic data is determined according to the special function tags and the engineering configuration information.

[0127] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: converting the natural language description in the rule generation template into a mathematical logic description; and generating a target audit rule based on the mathematical logic description.

[0128] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: any one or more of the elements, element behaviors, element relationship diagrams, and element contexts are converted into sub-logical descriptions, and the sub-logical descriptions are collected to obtain a mathematical logic description.

[0129] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: obtaining a target engineering file and an instruction language to be reviewed, and extracting target operation instructions in the target engineering file that match the instruction language to be reviewed; extracting instruction elements in the target operation instructions and associations between different instruction elements; selecting a rule generation template based on the instruction elements and the associations, and generating a target review rule based on the rule generation template; and reviewing the target operation instructions according to the target review rules to obtain a review result.

[0130] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: identifying the initial operation instructions in the target project file according to the instruction language to be reviewed; obtaining the project configuration information corresponding to the target project file, and determining the target database type corresponding to the target project file according to the project configuration information; and converting the initial operation instructions into target operation instructions according to the target database type.

[0131] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining database feature data based on project configuration information; obtaining a set of historical feature values, and performing a cosine distance check on the database feature data based on the set of historical feature values ​​to obtain a distance check result; and determining a target database type corresponding to the target project file based on the distance check result.

[0132] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when there are no sub-instructions carrying special function tags in the initial operation instructions, the database characteristic data is determined according to the engineering configuration information; when there are sub-instructions carrying special function tags in the initial operation instructions, the database characteristic data is determined according to the special function tags and the engineering configuration information.

[0133] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: converting the natural language description in the rule generation template into a mathematical logic description; and generating a target audit rule based on the mathematical logic description.

[0134] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: any one or more of the elements, element behaviors, element relationship diagrams, and element contexts are converted into sub-logical descriptions, and the sub-logical descriptions are collected to obtain a mathematical logic description.

[0135] 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, stored data, displayed data, 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 relevant data must comply with relevant regulations.

[0136] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile 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), magnetoresistive 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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 specification.

[0138] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for processing operation instructions applied to a database, characterized in that: The method comprises: Acquire a target engineering file and a to-be-reviewed instruction language, and extract a target operation instruction in the target engineering file that matches the to-be-reviewed instruction language; Extracting the instruction element in the target operation instruction and the association relationship between different instruction elements; A rule generation template is selected according to the instruction element and the association relationship, and a target audit rule is generated according to the rule generation template; The target operation instruction is audited according to the target audit rule to obtain an audit result.

2. The method according to claim 1, characterized in that The step of extracting the target operation instruction in the target engineering file that matches the instruction language to be reviewed includes: Identify the initial operation instruction in the target engineering file according to the instruction language to be reviewed; Acquire the project configuration information corresponding to the target project file, and determine the target database type corresponding to the target project file according to the project configuration information; According to the target database type, the initial operation instruction is converted into a target operation instruction.

3. The method according to claim 2, characterized in that The step of determining the target database type corresponding to the target project file according to the project configuration information includes: Determine database characteristic data according to the engineering configuration information; Acquire a historical feature value set, and perform a cosine distance check on the database feature data according to the historical feature value set to obtain a distance check result; The target database type corresponding to the target engineering file is determined according to the distance verification result.

4. The method according to claim 3, characterized in that The determining of database characteristic data according to the engineering configuration information comprises: In the case that there is no sub-instruction carrying a special function tag in the initial operation instruction, determining database characteristic data according to the engineering configuration information; In the case where a sub-instruction carrying a special function tag exists in the initial operation instruction, the database characteristic data is determined according to the special function tag and the engineering configuration information.

5. The method according to any one of claims 1 to 4, characterized in that: Generating target audit rules according to the rule generation template includes: Converting the natural language description in the rule generation template into a mathematical logic description; Generate target audit rules based on the mathematical logic description.

6. The method according to claim 5, characterized in that The rule generation template includes any one or more of an instruction element, an element behavior, an element relationship diagram, and an element context; the converting the natural language description in the rule generation template into a mathematical logic description includes: Any one or more of the element, the element behavior, the element relationship diagram and the element context are converted into sub-logical descriptions respectively, and the sub-logical descriptions are collected to obtain a mathematical logic description.

7. An operation instruction processing device applied to a database, characterized in that: The device comprises: A data acquisition module, used to acquire a target engineering file and an instruction language to be reviewed, and extract a target operation instruction in the target engineering file that matches the instruction language to be reviewed; An instruction extraction module, used for extracting instruction elements in the target operation instruction and association relationships between different instruction elements; A rule generation module, used for selecting a rule generation template according to the instruction element and the association relationship, and generating a target audit rule according to the rule generation template; The instruction review module is used to review the target operation instruction according to the target review rule to obtain the review result.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

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

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