Program statement checking method and device, processor and electronic equipment
By automatically identifying and checking program statements through file type parsing rules and keyword string inspection rules during the database version upgrade process, the problem of inefficient inspection in database version upgrade is solved, and efficient and accurate program statement inspection is achieved.
Patent Information
- Application Number
- CN202411832148.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-07-29
AI Technical Summary
During the database version upgrade process, the inspection efficiency of program statements in the prior art is low, and it takes a lot of time and manpower to manually compare and modify.
During the development of the target version database, select the target folder in the data directory, use file parsing rules that match the file types to parse the program statement collection, and use keyword strings to execute the check rules to automatically identify and check statements that do not comply with the higher version database specifications.
It improves the efficiency of program statement inspection, reduces manual identification and inspection time, ensures the accuracy and comprehensiveness of inspection, and reduces the possibility of manual intervention and misjudgment.
Smart Images

Figure CN120386789A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of fintech, and in particular, to a method and apparatus for checking program statements, a processor, and an electronic device. Background Art
[0002] With the rapid development of fintech in recent years, MySQL has become one of the mainstream database directions. To improve the performance of the database, it is usually necessary to continuously update and improve the program statements in the database. For example, a database currently using MySQL version 5.7 needs to be upgraded to MySQL version 8.0.
[0003] The differences between different versions of MySQL are very large. The system department also provides a list of all check items required for version upgrade work, including keywords, functions, drivers, permissions, system parameters, etc. Version upgrade requires very strict and meticulous verification and testing by developers and testers before the database system used by business applications can be switched.
[0004] However, in the related art, it mainly relies on the written descriptions of each check item by developers, and manually compares the differences between SQL (Structured Query Language, abbreviated as SQL) statements of different versions of the MySQL database, and then modifies or performs other processing on the SQL statements with differences. In this process, it takes a lot of time and manpower to identify the statements that do not meet the requirements of the high-version database specification in the program statements, increasing the inspection time and resulting in the technical problem of low efficiency in the inspection process of program statements.
[0005] In view of the problem of low efficiency in checking program statements during the database version upgrade process in the above related art, no effective solution has been proposed yet. Summary of the Invention
[0006] The main purpose of this application is to provide a method and apparatus for checking program statements, a processor, and an electronic device to solve the problem of low efficiency in checking program statements during the database version upgrade process in the related art.
[0007] To achieve the above object, according to one aspect of the present application, a method for checking program statements is provided. The method includes: during the development of the target version database, selecting a target folder under the data directory, where the target folder includes a set of files, and each file in the set of files includes different types of program statements; in response to a trigger operation on the target plug-in, parsing the set of files by using file parsing rules matching the file type of each file in the set of files to obtain a set of program statements to be checked, where the file parsing rules are used to define the rules for screening out the program statements to be checked from a set of files of different file types, and the set of program statements is composed of some program statements in the set of files; using a set of key strings to sequentially execute each check rule in a set of check rules on each program statement in the set of program statements to obtain a target check result, where the set of check rules defines a set of standard check logics including the set of key strings.
[0008] To achieve the above object, according to another aspect of the present application, a device for checking program statements is provided. The device includes: a first processing unit for selecting a target folder under the data directory during the development of the target version database, where the target folder includes a set of files, and each file in the set of files includes different types of program statements; a parsing unit for parsing the set of files by using file parsing rules matching the file type of each file in the set of files in response to a trigger operation on the target plug-in to obtain a set of program statements to be checked, where the file parsing rules are used to define the rules for screening out the program statements to be checked from a set of files of different file types, and the set of program statements is composed of some program statements in the set of files; a second processing unit for using a set of key strings to sequentially execute each check rule in a set of check rules on each program statement in the set of program statements to obtain a target check result, where the set of check rules defines a set of standard check logics including the set of key strings.
[0009] Optionally, in the program statement checking device provided in the embodiments of the present application, the above parsing unit includes: a first obtaining module, configured to sequentially obtain each file from a set of files as the current file; a first searching module, configured to, when the file type of the current file is the first type, search for a first part identifier and a second part identifier in a first tag pair in the current file, where the first tag pair includes the first part identifier and the second part identifier; a first processing module, configured to determine a first start position of the current set of program statements based on the first part identifier; a second processing module, configured to determine a first end position of the current set of program statements based on the second part identifier; a third processing module, configured to determine a program statement composed of the string between the first start position and the first end position as the first program statement in the current set of program statements, where the program statement set includes the first program statement.
[0010] Optionally, in the program statement checking device provided in the embodiments of the present application, the above device further includes: a second obtaining module, configured to obtain a combined string composed of a first tag pair, a target string, and an end symbol when it is parsed that the current file contains both a tag pair and a target string; a fourth processing module, configured to determine a first start position of the current set of program statements based on the first part identifier; a second searching module, configured to search for a combined string closest to the first part identifier from the current file; a fifth processing module, configured to determine a second end position of the current set of program statements based on the combined string; a sixth processing module, configured to determine a program statement composed of the string between the first start position and the second end position as the second program statement in the current set of program statements.
[0011] Optionally, in the program statement checking device provided in the embodiments of the present application, the above parsing unit includes: a third obtaining module, configured to sequentially obtain each file from a set of files as the current file; a third searching module, configured to, when the file type of the current file is the second type, search for a third part identifier and a fourth part identifier in a second tag pair in the current file, where the second tag pair includes the third part identifier and the fourth part identifier; a seventh processing module, configured to determine a second start position of the current set of program statements based on the third part identifier; an eighth processing module, configured to determine a third end position of the current set of program statements based on the fourth part identifier; a ninth processing module, configured to determine a program statement composed of the string between the second start position and the third end position as the third program statement in the current set of program statements, where the program statement set includes the third program statement.
[0012] Optionally, in the program statement checking device provided by the embodiments of the present application, the above parsing unit includes: a fourth obtaining module, configured to sequentially obtain each file from a set of files as the current file; a matching module, configured to, when the file type of the current file is the third type, use a regular expression to match a string in the current file that is the same as the target key string in a set of key strings; a tenth processing module, configured to use the position where the target string is located as the third starting position and the position where the end symbol is located as the fourth ending position; an eleventh processing module, configured to determine the program statement formed by the string between the third starting position and the fourth ending position as the fourth program statement in the current set of program statements, where the program statement set includes the fourth program statement.
[0013] Optionally, in the program statement checking device provided by the embodiments of the present application, the above second processing unit includes: a twelfth processing module, configured to, when a set of checking rules includes N checking rules, perform the following processing on a program statement in the program statement set, where N is a positive integer greater than or equal to 1: sequentially determine whether a program statement contains at least one key string in a set of key strings; when a program statement contains at least one key string in a set of key strings, determine that at least one of the N checking rules is hit, where there is a one-to-one correspondence between the N checking rules and a set of key strings; based on at least one checking rule, perform at least one specification check on a program statement to obtain a target check result.
[0014] Optionally, in the program statement checking device provided by the embodiments of the present application, the above device further includes: a third processing unit, configured to, after performing at least one specification check on a program statement based on at least one checking rule to obtain a target check result, generate a list of exception prompt messages according to the target check result, where the list of exception prompt messages includes a set of specification exception details information obtained after performing at least one specification check; a display unit, configured to output a set of specification exception details information to a target client and display the information content of the set of specification exception details information on the target client, where the target development tool runs on the target client and the target plug-in is built in the target development tool.
[0015] Through the above embodiments provided by the present application, during the development of the target version database, first, according to the file type, the program statements to be checked are accurately identified from the files, and then, using a set of key strings, the check items that hit the key strings are subjected to specification checks on the program statements according to the corresponding checking rules. This not only saves the time for manual identification of the statements to be checked, but also avoids performing each checking rule on each program statement, reducing the manual checking time and achieving the technical effect of improving the checking efficiency of program statements. Brief Description of the Drawings
[0016] The drawings forming a part of this application are used to provide a further understanding of this application. The schematic embodiments and descriptions thereof of this application are used to explain this application and do not constitute an improper limitation of this application. In the drawings:
[0017] Figure 1 is a flowchart of a method for checking program statements provided according to an embodiment of this application;
[0018] Figure 2 is an overall flowchart of an alternative method for checking program statements provided according to an embodiment of this application;
[0019] Figure 3 is a schematic diagram showing different scanning rules corresponding to different scanning objects provided according to an embodiment of this application;
[0020] Figure 4 is a design drawing of a target plug-in provided according to an embodiment of this application;
[0021] Figure 5 is a specific example of an exception prompt message provided according to an embodiment of this application;
[0022] Figure 6 is an overall flowchart of another alternative method for checking program statements provided according to an embodiment of this application;
[0023] Figure 7 is a schematic diagram of a device for checking program statements provided according to an embodiment of this application;
[0024] Figure 8 is a structural block diagram of an electronic device provided according to an embodiment of this application. Detailed Description of the Embodiments
[0025] It should be noted that, without conflict, the embodiments in this application and the features in the embodiments may be combined with each other. The following will describe this application in detail with reference to the drawings and in combination with the embodiments.
[0026] In order to enable those skilled in the art to better understand the solution of this application, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
[0027] It should be noted that the terms "first", "second", etc. in the description, claims and the above-mentioned drawings of the present application are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so as to implement the embodiments of the present application described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0028] It should be noted that the relevant information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in the present disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between the present system and relevant users or institutions to provide corresponding operation entrances for users to choose to agree or reject the results of automated decision-making; if the user chooses to reject, the expert decision-making process will be entered.
[0029] Embodiment 1
[0030] According to an embodiment of the present application, an embodiment of a method for checking program statements is further provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0031] The present invention will be described below in conjunction with the preferred implementation steps. Figure 1 is a flowchart of a method for checking program statements provided according to an embodiment of the present application, as Figure 1 shown, the method includes the following steps:
[0032] Step S102, during the development of the target version database, select the target folder under the data directory, where the target folder includes a set of files, and each file in the set of files includes different types of program statements;
[0033] Step S104, in response to a trigger operation on the target plugin, parse the set of files by using file parsing rules matching the file type of each file in the set of files to obtain a set of program statements to be checked, where the file parsing rules are used to define the rules for screening out the program statements to be checked from a set of files of different file types, and the set of program statements is composed of some program statements in the set of files;
[0034] Step S106: Use a set of key strings to sequentially execute each inspection rule in a set of inspection rules on each program statement in the set of program statements, and obtain the target inspection result. Among them, a set of inspection rules defines a set of standard inspection logics including a set of key strings.
[0035] For ease of understanding, first, in combination with Figure 2 the overall flowchart shown below, the inspection method of the above program statements will be explained.
[0036] S202: Set the rule inspection items;
[0037] Among them, the rule inspection items can but are not limited to being pre-configured by the rule configurator in the background. Among them, it includes inspection types, scanning objects, keywords, inspection prompts, etc. The following will explain it in detail in combination with specific embodiments.
[0038] S204: Set the inspection scope;
[0039] In the embodiments of the present application, the target version database can but is not limited to referring to the database environment upgraded from the MySQL 5.7 version to the MySQL 8.0 version. Since during the version upgrade process, usually the program statements in the previous version database are migrated to the development tool of the current version database. Among them, in the development tool of the current version database, there are multiple folders under the data directory.
[0040] The developer selects a target folder from multiple folders, and takes all the files in the target folder as the files to be inspected within the current scan range.
[0041] That is to say, the target folder can but is not limited to being a folder selected from the MySQL 8.0 version database directory after migrating the program statements of the MySQL 5.7 version to the MySQL 8.0 version database.
[0042] For example, assume that the developer selects target folder 1, and there are 10 files in target folder 1, and each file contains 10 program statements. Then the 100 program statements in these 10 files are the objects to be scanned in the current scan.
[0043] S206: Inspect all files within the target range;
[0044] After selecting the target folder, the developer manually triggers an operation on the target control that controls the specification inspection tool, thereby starting the scan process and performing specification inspection on each file within the target range.
[0045] For example, when a developer clicks the pre-set "Start Scanning" button, the specification checking tool built into the database development tool can be launched. Among them, the specification checking tool can be, but is not limited to, built into the database development tool in the form of a plugin.
[0046] It should be noted that in the migrated code project directory, there are various types of files, such as files of types.xml,.java,.SQL, etc. The selected target folder may also contain various types of files.
[0047] In the embodiment of the present application, some of the pre-configured checking rules are shown in Table 1 below. Among them, as Figure 3 shown, DCL (Data Control Language) is used to grant or revoke certain privileges to access the database and control the time and effect of database operation transactions, and can monitor the database. The DCL type of check is mainly used to prompt change statements;
[0048] DDL (Data Definition Language) is used to define, delete, modify relational schemas, and create various objects in the database, such as tables, indexes, views, functions, triggers, etc. As Figure 3 shown, the DDL type of check is mainly used to prompt the DDL statement file and the starting line number that need to modify the field type;
[0049] DQL (Data Query Language) is used to perform data query operations in the database. For example, the select statement. As Figure 3 shown, the DQL type of check can be, but is not limited to, used to prompt the file and the starting line number of the DQL statement that needs to modify the program code;
[0050] DML (Data Manipulation Language) is used to perform operations such as inserting tuples, and is mainly composed of insert, update, and delete syntax. As Figure 3 shown, the DML type of check can be, but is not limited to, prompting the DML statement file and the starting line number that need to modify the operator.
[0051] Table 1
[0052]
[0053]
[0054]
[0055]
[0056] S208, match and check the prompt according to the rules.
[0057] During the inspection process, according to the file type and a set of key strings, a list of statements composed of keywords (which can also be understood as key strings) and functions that are incompatible with or need to be modified in the MySQL 8.0 version is identified from all the migrated files. This list is also known as the list of differences in capabilities between different versions.
[0058] Then, each program statement in the set of program statements to be inspected is compared one by one to check if it hits each of the multiple inspection rules. Then, only for the inspection rules that are hit, a compliance check is performed on the program statement, and the corresponding inspection results are output.
[0059] For example, assume that File 1 in the target folder contains 3 program statements (which can also be understood as SQL statements), and 2 of the SQL statements contain the key string "grant". Then, when matching the first inspection rule shown in Table 1, these 2 SQL statements hit the first inspection rule, and the remaining 1 SQL statement does not hit the first inspection rule. Then, only the 2 SQL statements containing "grant" need to perform the first item of inspection, and the inspection results are output.
[0060] That is to say, when the user triggers the target plugin, the plugin will scan each file in the target folder and extract the SQL statements or code that need to be inspected to form a set of program statements to be inspected.
[0061] Using a set of preset key strings, a corresponding set of inspection rules is executed for each program statement in the set of program statements to be inspected. Among them, a set of inspection rules includes whether deprecated functions are used, whether keywords comply with the new version specifications, etc., so as to determine whether each SQL statement complies with the specification requirements of MySQL 8.0.
[0062] Through the above embodiments provided by the present application, during the development of the target version database, first, according to the file type, the program statements that need to be inspected are accurately identified from the files, and then, using a set of key strings, a compliance check is performed on the inspection items that hit the key strings on the program statements according to the corresponding inspection rules. This not only saves the time for manual identification of the statements to be inspected, but also avoids performing each inspection rule on each program statement, reducing the manual inspection time, and achieving the technical effect of improving the inspection efficiency of program statements.
[0063] As an optional example, parsing a set of files using file parsing rules that match the file type of each file in the set of files to obtain a set of program statements to be checked includes: sequentially obtaining each file in the set of files as the current file; when the file type of the current file is the first type, searching for the first part identifier and the second part identifier in the first tag pair within the current file, where the first tag pair includes the first part identifier and the second part identifier; determining the first starting position of the current set of program statements based on the first part identifier; determining the first ending position of the current set of program statements based on the second part identifier; and determining the program statement composed of the string between the first starting position and the first ending position as the first program statement in the current set of program statements, where the set of program statements includes the first program statement.
[0064] Combined with the description in the above embodiments, the inspection types in Table 1 are used for the classification of inspection rules and the statistics of abnormal situations. The inspection tool actually uses the scanned object and keywords for specification inspection. For different scanned objects, the designed rice seedling rules are also inconsistent. Specifically, reference can be made to Figure 3 .
[0065] After the user manually selects the directory of the generation project to be scanned, the file suffix to be scanned is selected. For example, the suffix can be configured as common file formats such as xml, java, properties, SQL, etc. If the file suffix is not configured, all files in the target folder are scanned by default.
[0066] After the configuration is completed, the user can manually click the "Start Scanning" button as shown in Figure 4 . At the same time, the background of the development tool will also regularly start the inspection rules (which can also be understood as scanning rules) for scanning. The prototype design of the target plugin is as shown in Figure 4 .
[0067] After executing the scanning rules using the tool program in the inspection tool, different types of files will be parsed or processed according to the file suffix after scanning, so as to accurately identify the complete SQL statements to be checked from the file.
[0068] If the program logic branch runs to scan a file with the suffix xml, the program in the inspection tool uses the xml parsing component DOM built in the Java development toolkit to find all paired tags "<>" in the xml file, pair the tags one by one, and generate an xml object tree. The return result set is the name of the root node tag, and each tag is a leaf node. Loop through each leaf node of the xml object tree, match the inspection keywords preset in the tool background in Table 1, and find the starting position of the target SQL statement in the xml.
[0069] That is to say, if the suffix of the file is xml, then use the first tag pair "<" to search for the first part identifier "<" from all program statements in a group of files, and at the same time search for the second part identifier ">", and determine the string between the first part identifier and the second part identifier as the complete SQL statement, that is, extract the first type of SQL statement to be checked from a group of files.
[0070] After the user starts the plugin in the development tool IDE and selects the target folder, the plugin will traverse all files in the folder. For XML files (the first type), the plugin will perform the following steps:
[0071] S11, File acquisition and type judgment;
[0072] The plugin sequentially reads each file from the target folder. When the file type is XML, the plugin will execute the XML-specific parsing rules.
[0073] S12, Tag location and statement extraction;
[0074] Use the DOM parser to parse the XML file and build an XML object tree. Traverse the object tree to find the paired first tag pairs, that is, <insert>, <select>When starting tags such as < / select> Match with end tags such as <insert>are encountered, it will be taken as the starting position of the first SQL statement, and then the nearest < / insert> as the first end position. After determining the start and end positions, the plug-in extracts the string between the start and end positions and regards it as an independent SQL statement (the first program statement).
[0075] S13, Construction of program statement set.
[0076] The plug-in adds all the SQL statements extracted from the XML file to the current set of program statements (i.e., the set of program statements to be checked), preparing for subsequent specification checks.
[0077] Through the recognition and pairing of tag pairs, the target plug-in can accurately locate SQL statements in the xml file, avoiding blind scanning of the entire file, improving the efficiency and accuracy of the check. At the same time, the target plug-in can automatically extract and process SQL statements, reducing manual intervention, avoiding human errors, and ensuring that each line of code can be checked for compliance.
[0078] As another alternative example, the above method further includes: when it is parsed that the current file contains both tag pairs and target strings at the same time, obtaining a combined string composed of the first tag pair, the target string, and the end symbol; determining the first start position of the current set of program statements based on the first part identifier; finding the nearest combined string to the first part identifier in the current file; determining the second end position of the current set of program statements based on the combined string; and determining the program statement composed of the string between the first start position and the second end position as the second program statement in the current set of program statements.
[0079] The SQL statements scanned according to the scanning method of the above steps S11 to S13 may be multiple lines. It is necessary to identify the line number where the end position tag is located according to the paired rule of tags, and take all the characters between the start position and the end position as the output result, so as to obtain the complete content of the SQL statement.
[0080] For example, when scanning the combination of the tag "<>" and the keyword "insert" <insert>is searched for. In the case of < / insert> ” combination, the content between the two tags and the keyword combination is the complete SQL statement. Among them, " / " is the end symbol in the xml file.
[0081] This embodiment further refines the extraction process of SQL statements in the xml file, especially in the case where the statement contains complex keywords or functions, how to accurately define the start and end positions of the SQL statement.
[0082] When the plugin processes an xml file, if it finds that the file contains both paired tags, such as <insert>and < / insert> , and also contains the target strings (such as keywords to be concerned about in MySQL 8.0 like grant, asc, etc.), the plugin will perform the following steps:
[0083] S21, combined string generation: The plugin first based on <insert>Combine the start tags and the target string, along with the semicolon at the end of the SQL statement, to form a combined string, which serves as the identifier for the statement range;
[0084] S22, Start position localization: By identifying <insert>With the start tags, the plug-in can determine the starting position of the SQL statement;
[0085] S23, combined string search and adjustment: The plug-in further searches for the combined string closest to the start tag, and this process may require the standard end tag< / insert> Make adjustments to adapt to the SQL statement range containing complex keywords or functions;
[0086] S24, End position determination: Based on the adjusted combined string, the plugin re-determines the second end position of the SQL statement;
[0087] S25, SQL statement extraction and set construction: Finally, the plugin identifies the string between the first start position and the second end position as an independent SQL statement (the second program statement) and adds it to the current set of program statements, preparing for the subsequent check of a set of key strings.
[0088] Adopting the technical solution in this embodiment ensures that the plugin can still accurately locate and extract SQL statements when dealing with complex situations, improving the accuracy and comprehensiveness of the check. By generating and utilizing the combined string, the plugin can handle various changes in SQL statement structures, ensuring the flexibility and adaptability of the specification check.
[0089] And through the above method, the combined string can be dynamically adjusted and identified, further improving the plugin's processing ability for SQL statements in XML files, especially in the case of complex statement structures and containing multiple keywords or functions. This strategy not only ensures the accuracy of the check but also enhances the flexibility and practicality of the tool, providing more comprehensive and in-depth specification check support for developers and helping to improve code quality and system stability.
[0090] As an optional example, parsing a set of files using file parsing rules that match the file type of each file in the set to obtain a set of program statements to be checked includes: sequentially obtaining each file in the set as the current file; when the file type of the current file is the second type, searching for the third part identifier and the fourth part identifier in the second tag pair within the current file, where the second tag pair includes the third part identifier and the fourth part identifier; determining the second start position of the current set of program statements based on the third part identifier; determining the third end position of the current set of program statements based on the fourth part identifier; and determining the program statement composed of the string between the second start position and the third end position as the third program statement in the current set of program statements, where the set of program statements includes the third program statement.
[0091] When performing specification checks during the processing of Java source files (the second type) using the target plugin, when traversing a group of files in a folder, it is determined whether the group of files contains Java source files. If it does, the program logic branch runs to scan files with the suffix ".java", and the program will automatically execute the "maven instal" command to compile the Java project. In a Java program, there may be various ways to generate SQL statements automatically through the Mybatis framework or use SQL statements with parameterized settings using Spring Boot annotations. Therefore, directly in the compiled file, use regular expressions to match the check keywords preset in the tool background in step 2 and the paired tags "()", and find the starting position of the target SQL statement or Spring Boot annotation in the program code.
[0092] Among them, Mybatis is a persistence layer framework that supports custom SQL, stored procedures, and advanced mapping, eliminating almost all the work of setting parameters and obtaining results in JDBC code. It can configure and map primitive types and interfaces to records in the database through simple XML or annotations. Spring Boot is a large Java open-source development framework composed of Spring, etc.
[0093] In this embodiment, for Java files, the paired second tag pair "()" is used to sequentially identify the third part identifier "(", and the position where "(" is located is used as the second starting position; then the fourth part identifier ")" is identified, and the position where ")" is located is used as the third ending position, and the program statement composed of the string between the second starting position and the third ending position is determined as the complete third program statement.
[0094] Through the above method, the target plugin can accurately and efficiently process SQL statements or code in Java source files, providing a clear data basis for subsequent key string matching and specification checks. Through automatic recognition and extraction, the plugin not only improves the inspection efficiency but also reduces the possibility of manual misjudgment, thus enhancing the code quality and the accuracy of specification governance.
[0095] As an alternative implementation, parsing a set of files using file parsing rules that match the file type of each file in the set of files to obtain a set of program statements to be checked includes: sequentially obtaining each file in the set of files as the current file; when the file type of the current file is the third type, using a regular expression to match a string in the current file that is the same as the target key string in a set of key strings; using the position where the target string is located as the third start position and the position where the end delimiter is located as the fourth end position; determining the program statement composed of the string between the third start position and the fourth end position as the fourth program statement in the current set of program statements, where the set of program statements includes the fourth program statement.
[0096] Among them, the third type includes, but is not limited to, other types of files except xml and Java files, such as SQL text files.
[0097] When the program logic branch of the inspection tool runs to scan text files with suffixes such as SQL, the program will use a regular expression to match the keywords preset in the tool background in Table 1 to find the start position and end position of the SQL statements in the text file.
[0098] A regular expression is a powerful tool for matching and manipulating text. It is a pattern composed of a series of characters and special characters used to describe the text pattern to be matched. Regular expressions can search, replace, extract, and validate specific characters and patterns in text.
[0099] In this embodiment, it further describes how to process other types of files (third type files) except xml and Java files, such as SQL script files, using the target plug-in to ensure that all potential problem SQL statements can be identified and inspected.
[0100] When the target plug-in traverses a set of files, it determines whether it is an SQL text or other unstructured file according to the file type. If it is such a file, the following steps are executed:
[0101] S31, key string matching: The target plug-in uses a regular expression to search for strings in the current file that are the same as a set of key strings, and these strings represent SQL statement keywords that may not conform to the MySQL8.0 specification;
[0102] S32, determining the start position and end position: If the target key string is found, the target plug-in will record its position as the third start position, and then continue to search until the end delimiter of the SQL statement (for example, a semicolon) is found, and determine its position as the fourth end position.
[0103] S33, SQL statement extraction: The string between the third starting position of the target key string and the fourth ending position of the terminator is regarded as an independent SQL statement (the fourth program statement) and is added to the current set of program statements, waiting for subsequent key string matching and specification checking.
[0104] Through the above method, the target plug-in can efficiently process direct SQL text files and other types of files. By matching keywords with regular expressions, it can find and extract potentially problematic SQL statements, providing a comprehensive data basis for subsequent specification checking. By accurately positioning the starting and ending positions, the plug-in improves the accuracy of the check, reduces false positives, and thus enhances the efficiency and reliability of the entire specification checking process.
[0105] In addition, by introducing the matching process of regular expressions, it can identify and check potential problematic SQL statements in SQL text files, ensuring the comprehensiveness of the specification checking.
[0106] As an optional example, using a set of key strings to sequentially execute each check rule in a set of check rules for each program statement in the set of program statements to obtain the target check result, including: when a set of check rules includes N check rules, for a program statement in the set of program statements, the following processing is performed, where N is a positive integer greater than or equal to 1: sequentially determine whether a program statement contains at least one key string in a set of key strings; when a program statement contains at least one key string in a set of key strings, determine that at least one check rule in the N check rules is hit, where there is a one-to-one correspondence between the N check rules and a set of key strings; based on at least one check rule, perform at least one specification check on a program statement to obtain the target check result.
[0107] After identifying the set of program statements to be checked according to the method in the above embodiment, according to the multiple check rules shown in Table 1, for each program statement in the set of program statements to be checked, perform matching processing one by one. For example, for a program statement, first determine whether the program statement contains the key string "grant". If it contains, execute the first check rule and output the check result; then determine whether the program statement contains the key strings "asc" and "desc". If it contains, execute the second check rule. And so on until the last check rule is compared.
[0108] Among them, when the program statement contains the key string "grant", the first check rule is hit; when the program statement contains the key strings "asc" and "desc", the second check rule is hit. In this way, it is avoided that all check rules are executed for each statement to be checked, reducing the specification check time.
[0109] Since there is a one-to-one correspondence between the check rules and the key strings, it can be ensured that the correct check logic is applied to each potential problem.
[0110] Based on the matched check rule, the target plug-in performs a specification check on the current statement. The specification check includes but is not limited to syntax verification, function testing, or compatibility analysis. The check result will clearly indicate whether the statement complies with the upgrade specification of MySQL 8.0, and if not, what modifications and adjustments are required, etc.
[0111] In the process of comparing the complete SQL statement with the configured check rules one by one, if it conforms to the current check rule (that is, the current check rule is not hit), the check process of the current check rule is ended; search for the next matching rule.
[0112] It should be noted that if an unpredictable SQL statement triggers a check rule during the program execution, it will be automatically recorded in the program execution exception list, and it is up to the human to judge whether this rule needs to be corrected. After manual processing and correction, the program will automatically learn the modified rule and continuously optimize the check and verification logic.
[0113] By adopting the above method, it is ensured that the plug-in can comprehensively check each program statement, not only can identify potential specification problems, but also can provide specific modification guidance, greatly improving the efficiency and accuracy of the specification check. Through automated checks and detailed feedback, developers can quickly locate and fix non-compliant SQL statements, reducing the burden of manual checks and at the same time reducing potential database compatibility problems that may occur after the system goes live.
[0114] As an optional implementation method, after performing at least one specification check on a program statement based on at least one check rule to obtain a target check result, the above method further includes: generating a list of exception prompt messages according to the target check result, where the list of exception prompt messages includes a set of specification exception details obtained after performing at least one specification check; outputting the set of specification exception details to the target client, and displaying the information content of the set of specification exception details in the target client, where the target development tool is running on the target client, and the target plug-in is built into the target development tool.
[0115] After completing the specification check on the set of program statements to be inspected in the manner of the above embodiments, if the program statements do not meet the specification requirements, the inspection result of the current program statement is recorded in the exception list, and after the scanning is all completed, the exception information is output to the developer for viewing through the front-end page.
[0116] For example, after scanning and processing files of the first type, second type, and third type, if the keyword "grant" is matched in the obtained complete SQL statement, the prompt content "grant does not support creating users, that is, it does not support setting passwords in the grant statement, such as: grant all privileges on *.* to 'username'@'host' identified by 'password'; " is output. Specifically, it can be referred to as Figure 5 shown.
[0117] After hitting the keyword "grant", the target plug-in can perform SQL statement inspection according to the preset rules, accurately identify incompatible syntax, and generate clear exception prompt information (which can also be understood as specification exception details information), and directly display it to the developer through the target client (such as an IDE). This process not only improves the efficiency and accuracy of database upgrade, but also promotes the developer's understanding and mastery of the new version of database functions, providing strong technical support for the IT application innovation transformation.
[0118] The exception prompt information will then be output by the plug-in to the target client (the developer's IDE) and displayed in a prominent manner in the IDE. It may be to display an exception list on the right side of the editor window or output detailed information in the console. The developer can directly view this information in the IDE without additional operations.
[0119] Through the display of the above specification exception details information, the developer can immediately see the file, line number, and specific SQL statement where the problem lies, as well as the violated rules, which avoids repeated testing and error finding during the development process.
[0120] At the same time, the automated inspection by the target plug-in avoids the situation of possible omission or misjudgment during manual inspection, ensuring that all SQL statements involving "grant" are correctly evaluated.
[0121] To more clearly understand the above technical solution, the following combines Figure 6 the overall flowchart shown to further explain the above method for inspecting program statements.
[0122] S602, configure the file suffix;
[0123] For example, configure the first type of file with the suffix xml, the second type of file with the suffix java, and the third type of file (i.e., text file) other than the first and second types.
[0124] S604, in the case of scanning an xml file, identify the program statements to be checked in the file;
[0125] Using the xml parsing component DOM in the Java Development Kit, find all pairs of tags "<>" in the xml file, pair the tags one by one to obtain the program statements to be checked. Specifically, reference can be made to the description in the above embodiments, which will not be elaborated here.
[0126] S606, in the case of scanning a java file, identify the program statements to be checked in the file;
[0127] The inspection program will automatically execute the maven instal instruction to compile the java project, and determine the program statements to be checked in the java file by searching for the second pair of tags "()".
[0128] S608, in the case of scanning a text file other than the first and second types, use regular expressions to match the preset keywords in Table 1 to find the starting position of the SQL statements in the text file;
[0129] S610, after identifying the SQL statements from the above three types of files, compare the identified program statements with the configured inspection rules one by one, and output the exception prompt information that does not meet the specification requirements;
[0130] During the comparison process, if it is checked that the specification does not meet the requirements of the current inspection rule, it is recorded in the exception list; otherwise, the specification inspection of the current inspection rule is ended, and the next inspection rule is executed until all inspection rules are executed, and the prompt information in the exception list is output to the front end for display to the developer, as in step S612.
[0131] S612, output the prompt information in the exception list to the front end for display to the developer.
[0132] The developer modifies and improves the program statements that do not meet the upgrade version specification requirements in sequence according to the prompt information, thereby completing the specification inspection of the database program statements.
[0133] The embodiments of the present application provide a tool for quickly verifying whether the generated SQL in the program meets the MySQL8.0 upgrade specification. By adopting the above embodiments provided by the present application, there are at least the following beneficial effects:
[0134] (1) High inspection efficiency: The system replaces the traditional manual comparison and verification process with an automated verification method, reducing the waiting time for manual inspection and verification. The average time-consuming for checking the project engineering code of a single item is about 1-2 minutes;
[0135] (2) Less human input: Make full use of tools to automatically check various specifications and rules, reducing human input, improving the accuracy and precision of SQL inspection and comparison, accurately positioning the location of abnormal SQL, more accurately identifying abnormal situations, and avoiding problems such as repeated inspection and repeated modification;
[0136] (3) Solve the problem of low efficiency and easy error in manual inspection, thus improving the efficiency of MySQL upgrade specification management.
[0137] Embodiment 2
[0138] The embodiment of the present application also provides an inspection device for program statements. It should be noted that the inspection device for program statements in the embodiment of the present application can be used to execute the inspection method for program statements provided in the embodiment of the present application. The following introduces the inspection device for program statements provided in the embodiment of the present application.
[0139] Figure 7 is a schematic diagram of the inspection device for program statements according to the embodiment of the present application. As Figure 7 shown, the device includes:
[0140] A first processing unit 702, configured to select a target folder in the data directory during the development of the target version database, where the target folder includes a set of files, and each file in the set of files includes different types of program statements; a parsing unit 704, configured to, in response to a trigger operation on the target plugin, parse the set of files by using a file parsing rule matching the file type of each file in the set of files to obtain a set of program statements to be inspected, where the file parsing rule is used to define a rule for screening out the program statements to be inspected from a set of files of different file types, and the set of program statements is composed of some program statements in the set of files; a second processing unit 706, configured to sequentially execute each inspection rule in a set of inspection rules on each program statement in the set of program statements by using a set of key strings to obtain a target inspection result, where the set of inspection rules defines a set of specification inspection logics including the set of key strings.
[0141] Optionally, in the program statement checking device provided in the embodiments of the present application, the parsing unit 704 includes: a first obtaining module, configured to sequentially obtain each file from a group of files as the current file; a first searching module, configured to search for a first part identifier and a second part identifier in a first tag pair in the current file when the file type of the current file is the first type, where the first tag pair includes the first part identifier and the second part identifier; a first processing module, configured to determine a first start position of the current group of program statements based on the first part identifier; a second processing module, configured to determine a first end position of the current group of program statements based on the second part identifier; a third processing module, configured to determine the program statement formed by the string between the first start position and the first end position as the first program statement in the current group of program statements, where the program statement set includes the first program statement.
[0142] Optionally, in the program statement checking device provided in the embodiments of the present application, the above device further includes: a second obtaining module, configured to obtain a combined string composed of the first tag pair, the target string, and the end symbol when it is parsed that the current file contains both the tag pair and the target string; a fourth processing module, configured to determine a first start position of the current group of program statements based on the first part identifier; a second searching module, configured to search for a combined string closest to the first part identifier from the current file; a fifth processing module, configured to determine a second end position of the current group of program statements based on the combined string; a sixth processing module, configured to determine the program statement formed by the string between the first start position and the second end position as the second program statement in the current group of program statements.
[0143] Optionally, in the program statement checking device provided in the embodiments of the present application, the parsing unit 704 includes: a third obtaining module, configured to sequentially obtain each file from a group of files as the current file; a third searching module, configured to search for a third part identifier and a fourth part identifier in a second tag pair in the current file when the file type of the current file is the second type, where the second tag pair includes the third part identifier and the fourth part identifier; a seventh processing module, configured to determine a second start position of the current group of program statements based on the third part identifier; an eighth processing module, configured to determine a third end position of the current group of program statements based on the fourth part identifier; a ninth processing module, configured to determine the program statement formed by the string between the second start position and the third end position as the third program statement in the current group of program statements, where the program statement set includes the third program statement.
[0144] Optionally, in the program statement checking device provided in the embodiments of the present application, the parsing unit 704 includes: a fourth obtaining module, configured to sequentially obtain each file from a set of files as the current file; a matching module, configured to, when the file type of the current file is the third type, use a regular expression to match a string in the current file that is the same as a target key string in a set of key strings; a tenth processing module, configured to use the position where the target string is located as the third starting position and the position where the end symbol is located as the fourth ending position; an eleventh processing module, configured to determine the program statement composed of the string between the third starting position and the fourth ending position as the fourth program statement in the current set of program statements, where the program statement set includes the fourth program statement.
[0145] Optionally, in the program statement checking device provided in the embodiments of the present application, the second processing unit 706 includes: a twelfth processing module, configured to, when a set of check rules includes N check rules, perform the following processing on a program statement in the program statement set, where N is a positive integer greater than or equal to 1: sequentially determine whether a program statement contains at least one key string in a set of key strings; when a program statement contains at least one key string in a set of key strings, determine that at least one of the N check rules is hit, where there is a one-to-one correspondence between the N check rules and a set of key strings; based on at least one check rule, perform at least one specification check on a program statement to obtain a target check result.
[0146] Optionally, in the program statement checking device provided in the embodiments of the present application, the above device further includes: a third processing unit, configured to, after performing at least one specification check on a program statement based on at least one check rule to obtain a target check result, generate a list of exception prompt messages according to the target check result, where the list of exception prompt messages includes a set of specification exception detail messages obtained after performing at least one specification check; a display unit, configured to output a set of specification exception detail messages to a target client and display the information content of the set of specification exception detail messages in the target client, where the target development tool is running on the target client and the target plug-in is built in the target development tool.
[0147] Embodiment 3
[0148] Embodiments of the present application may provide an electronic device. Figure 8 It is a structural block diagram of an electronic device according to an embodiment of the present application. As Figure 8 shown, the electronic device may include: one or more processors 802, a memory 804, a storage controller, and a peripheral interface, where the peripheral interface is connected to a radio frequency module, an audio module, and a display.
[0149] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and devices in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, the above-mentioned method is implemented. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory may further include a memory remotely set relative to the processor, and these remote memories can be connected to the terminal through a network. Examples of the above network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and combinations thereof.
[0150] The processor can call the information and application programs stored in the memory through the transmission device to execute the following steps:
[0151] During the development of the target version database, select the target folder in the data directory, where the target folder includes a set of files, and each file in the set of files includes different types of program statements;
[0152] In response to a trigger operation on the target plug-in, use the file parsing rules matching the file type of each file in the set of files to parse the set of files to obtain a set of program statements to be checked, where the file parsing rules are used to define the rules for screening out the program statements to be checked from a set of files of different file types, and the set of program statements is composed of some program statements in the set of files;
[0153] Use a set of key strings to sequentially execute each check rule in the set of check rules on each program statement in the set of program statements to obtain a target check result, where the set of check rules defines a set of standard check logics including the set of key strings.
[0154] Adopting the embodiments of the present application, a method for checking program statements is provided. During the development of the target version database, according to the file type, accurately identify the program statements to be checked from the files, and then use a set of key strings to perform standard checks on the check items that hit the key strings according to the corresponding check rules on the program statements. It reduces the time for manually identifying the program statements to be checked, and avoids executing each check rule for each program statement, reducing the manual inspection time, and achieving the technical effect of improving the inspection efficiency of program statements. Furthermore, it solves the technical problem of low inspection efficiency caused by the method of manually searching for program statements that do not meet the specification requirements in the related art.
[0155] Those of ordinary skill in the art can understand, Figure 8 The structure shown is only schematic, and the electronic device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a personal digital assistant, and terminal devices such as Mobile Internet Devices (MID) and PAD. Figure 8 It does not limit the structure of the above-mentioned electronic device. For example, the electronic device may further include more or fewer components (such as a network interface, a display device, etc.) than those shown Figure 8 in the figure, or have a different configuration from that shown Figure 8 in the figure.
[0156] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by a program instructing the hardware related to the terminal device, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disc, etc.
[0157] Embodiment 4
[0158] An embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the above storage medium can be used to store the program code executed by the program statement checking method provided in the first embodiment above.
[0159] Optionally, in this embodiment, the above storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
[0160] The present application also provides a computer program product, which is adapted to execute the program steps of the program statement checking method when executed on a data processing device.
[0161] The serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.
[0162] In the above embodiments of the present application, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0163] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of units or modules can be in electrical or other forms.
[0164] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0165] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0166] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks or optical discs that can store program codes.
[0167] The above is only the preferred embodiment of the present application. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.< / insert> < / insert>
Claims
1. A method for checking program statements, characterized in that, Including: During the development of the target version database, select the target folder under the data directory, where the target folder includes a set of files, and each file in the set of files includes different types of program statements; In response to a trigger operation on the target plugin, parse the set of files using a file parsing rule that matches the file type of each file in the set of files to obtain a set of program statements to be checked, where the file parsing rule is used to define a rule for screening out the program statements to be checked from the set of files of different file types, and the set of program statements is composed of some program statements in the set of files; Use a set of key strings to sequentially execute each check rule in a set of check rules on each program statement in the set of program statements to obtain a target check result, where the set of check rules defines a set of standard check logics including the set of key strings.
2. The method according to claim 1, wherein The step of parsing the set of files using a file parsing rule that matches the file type of each file in the set of files to obtain a set of program statements to be checked includes: Sequentially obtain each file from the set of files as the current file; When the file type of the current file is the first type, find the first part identifier and the second part identifier in the first tag pair in the current file, where the first tag pair includes the first part identifier and the second part identifier; Based on the first part identifier, determine the first start position of the current set of program statements; Based on the second part identifier, determine the first end position of the current set of program statements; Determine the program statement composed of the string between the first start position and the first end position as the first program statement in the current set of program statements, where the set of program statements includes the first program statement.
3. The method according to claim 2, wherein The method further includes: When it is parsed that the current file contains both the tag pair and the target string, obtain a combined string composed of the first tag pair, the target string, and the end symbol; Based on the first part identifier, determine the first start position of the current set of program statements; Find the nearest combined string to the first part identifier from the current file; Based on the combined string, determine the second end position of the current set of program statements; Determine the program statement composed of the string between the first start position and the second end position as the second program statement in the current set of program statements.
4. The method according to claim 1, characterized in that, The step of parsing the set of files using a file parsing rule that matches the file type of each file in the set of files to obtain a set of program statements to be checked includes: Sequentially obtain each file from the set of files as the current file; When the file type of the current file is the second type, find the third part identifier and the fourth part identifier in the second tag pair in the current file; Determine the second starting position of the current set of program statements based on the third part identifier; Determine the third ending position of the current set of program statements based on the fourth part identifier; Determine the program statement composed of the string between the second starting position and the third ending position as the third program statement in the current set of program statements, where the program statement set includes the third program statement.
5. The method according to claim 1, wherein Parsing the set of files by using file parsing rules matching the file type of each file in the set of files to obtain a set of program statements to be checked, including: Sequentially obtain each file in the set of files as the current file; When the file type of the current file is the third type, use a regular expression to match a string in the current file that is the same as the target key string in the set of key strings; Take the position where the target string is located as the third starting position and the position where the end symbol is located as the fourth ending position; Determine the program statement composed of the string between the third starting position and the fourth ending position as the fourth program statement in the current set of program statements, where the program statement set includes the fourth program statement.
6. The method according to claim 1, wherein Using a set of key strings to sequentially execute each inspection rule in a set of inspection rules on each program statement in the program statement set to obtain a target inspection result, including: When the set of inspection rules includes N inspection rules, perform the following processing on a program statement in the program statement set, where N is a positive integer greater than or equal to 1: Sequentially determine whether the one program statement contains at least one key string in the set of key strings; When a program statement contains at least one key string in the set of key strings, determine that at least one inspection rule in the N inspection rules is hit, where there is a one-to-one correspondence between the N inspection rules and the set of key strings; Based on the at least one inspection rule, perform at least one specification inspection on the one program statement to obtain the target inspection result.
7. The method according to claim 6, characterized in that, After performing at least one specification inspection on the one program statement based on the at least one inspection rule to obtain the target inspection result, the method further includes: Generate a list of exception prompt messages according to the target inspection result, where the list of exception prompt messages includes a set of specification exception details obtained after performing the at least one specification inspection; Output the set of specification exception details to the target client and display the information content of the set of specification exception details in the target client, where the target development tool is running on the target client and the target plug-in is built in the target development tool.
8. An inspection device for program statements, characterized in that, Including: A first processing unit for selecting a target folder under the data directory during the development of the target version database, where the target folder includes a set of files, and each file in the set of files includes program statements of different types; A parsing unit, configured to, in response to a triggering operation on a target plugin, parse a set of files by using file parsing rules matching the file type of each file in the set of files, to obtain a set of program statements to be inspected, where the file parsing rules are used to define rules for screening out the program statements to be inspected from the set of files of different file types, and the set of program statements is composed of some program statements in the set of files; A second processing unit, configured to sequentially execute each inspection rule in a set of inspection rules on each program statement in the set of program statements by using a set of key strings, to obtain a target inspection result, where the set of inspection rules defines a set of standard inspection logics including the set of key strings.
9. A processor, characterized in that, The processor is configured to run a program, where when the program runs, it executes the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that, Comprising one or more processors and a memory, the memory is configured to store one or more programs, where when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to any one of claims 1 to 7.