Script optimization method and computing equipment
Through automated detection and optimization scripts, error information of the script to be tested is obtained and optimization reports are generated, which solves the problem of low manual optimization efficiency, improves script optimization efficiency and system upgrade success rate, and ensures the stability of the system.
Patent Information
- Application Number
- CN202510505912.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-15
AI Technical Summary
In the prior art, manual optimization of scripts is inefficient, making it difficult to quickly identify and resolve errors in scripts, resulting in system upgrade failure and low stability.
Provides a script optimization method, which automatically detects and optimizes scripts by obtaining error information of scripts to be tested and generates optimization reports, including solutions to text errors and execution error information, automates detection and optimizes scripts, and reduces manual intervention.
It improves script optimization efficiency, reduces labor costs, reduces human errors, ensures the success rate and stability of system upgrades, simplifies operation and maintenance operations, and saves time and labor costs.
Smart Images

Figure CN120492326A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of script processing technology, and in particular to a script optimization method and computing device. Background Art
[0002] In multi-party collaborative development scenarios, developers can use scripts to automatically upgrade the system. For example, users can pre-write incremental scripts to perform incremental upgrades on the database.
[0003] When upgrading the system automatically through scripts, error messages may appear. In related technologies, developers usually need to manually check the scripts one by one based on these error messages to find the cause of the error and optimize the script based on the error cause.
[0004] However, manual optimization is inefficient in optimizing scripts. Summary of the Invention
[0005] The embodiments of the present application provide a script optimization method and computing device, which are conducive to improving the optimization efficiency of scripts.
[0006] In a first aspect, an embodiment of the present application provides a script optimization method, the method comprising:
[0007] Get the system's script detection request, which is used to request detection of the script to be tested;
[0008] In response to the script detection request, obtaining error information of the script to be tested, where the error information is used to indicate error information existing in the script to be tested and / or error information occurring during the execution of the script to be tested;
[0009] An optimization report of the script to be tested is generated according to the error information of the script to be tested, and the optimization report at least includes solution measures corresponding to the error information of the script to be tested.
[0010] In the above technical solution, there is no need to rely on manual detection and processing of the script to be tested, which is conducive to reducing the requirements for the technical capabilities of developers, thereby helping to reduce labor costs, and can also reduce problems such as errors in the detection of the script to be tested due to human errors in the manual detection process, thereby improving the efficiency of script optimization; and, the method combines the error information of the script to be tested and / or the error information that appears during the execution of the script to be tested, and comprehensively detects the upgrade process of the system based on the script to be tested and generates an optimization report, so that the user can identify and quickly solve the potential problems of the script to be tested in advance through the optimization report, which is conducive to improving the user's optimization efficiency of the script to be tested, and can also avoid system upgrade failures caused by errors in the script to be tested, which is conducive to improving the success rate of the system upgrade and ensuring the stability and reliability of the system upgrade.
[0011] In a possible implementation, the error information includes a text error message; obtaining the error information of the script to be tested includes:
[0012] Perform text detection on the script to be tested to obtain text error information of the script to be tested, where the text error information at least includes syntax errors or character errors.
[0013] In the above technical solution, by performing text detection processing on the script to be tested, it is possible to promptly discover whether there is text error information in the script to be tested, and if there is text error information, the corresponding solution measures for the text error information can be determined, so that subsequent users can quickly optimize the script to be tested according to the corresponding solution measures for the text error information, which is conducive to improving the script optimization efficiency of the script to be tested.
[0014] In one possible implementation, the text error message includes a grammatical error; and the corresponding solution to the error message includes at least:
[0015] Determine whether there are any grammatical problems with the query statements in the script to be tested, and if so, correct the grammatical problems with the query statements; and / or,
[0016] Determine whether there are writing errors in the elements of the query statement in the script to be tested, and correct the writing errors in the elements if there are writing errors in the elements. The elements include at least one of the following: identifiers, keywords, expressions, operators, and punctuation marks of database objects. The writing errors include at least: wrong characters in the elements, and / or missing characters in the elements.
[0017] In the above technical solution, when the text error information includes grammatical errors, multiple optional solutions can be provided for the grammatical errors, so that users can quickly resolve the grammatical errors in the script to be tested based on multiple optional solutions, which is conducive to improving the user's optimization efficiency of the script to be tested.
[0018] In a possible implementation, the error information includes execution error information; obtaining the error information of the script to be tested includes:
[0019] Send the script to be tested to the execution system, which is used to execute the script to be tested;
[0020] Get the execution error information, which is the error information that occurs when the execution system executes the script to be tested.
[0021] In the above technical solution, by obtaining the execution error information that occurs during the execution of the script to be tested, the upgrade process of the system based on the script to be tested can be comprehensively detected, and in the case of the existence of execution error information, the solution corresponding to the execution error information can be determined, so that subsequent users can quickly optimize the script to be tested according to the solution corresponding to the execution error information, which is conducive to improving the script optimization efficiency of the script to be tested.
[0022] In one possible implementation, the execution error information includes an object does not exist error; and the corresponding solution to the error information includes at least:
[0023] Determining whether a first identifier of a database object in the script to be tested is consistent with a second identifier of the database object stored in the source data, and updating the first identifier or the second identifier if the first identifier is inconsistent with the second identifier; and / or,
[0024] Determine whether the database object in the script to be tested is a newly added object, and if the database object is a newly added object, generate an identifier of the database object, and add the identifier of the database object to the source data where the database object is located.
[0025] In the above technical solution, when the execution error information includes an object does not exist error, a variety of optional solutions can be provided for the object does not exist error, so that the user can quickly resolve the object does not exist error in the script to be tested based on a variety of optional solutions, which is conducive to improving the user's optimization efficiency of the script to be tested.
[0026] In one possible implementation, the execution error information includes an operation restriction error, which includes at least one of the following: an update restriction error, an insert restriction error, or a delete restriction error. The corresponding solution to the error information includes at least:
[0027] If there is an update restriction error on a database object in a field in the script to be tested, update the field and its value using an update statement; and / or,
[0028] When an insert restriction error and / or a delete restriction error exists in the script to be tested for the first database object, a second database object is created, and an insert operation is performed on the second database object, and / or a delete operation is performed on the second database object, and the data of the second database object is the same as the data of the first database object.
[0029] In the above technical solution, when the execution error information includes an update restriction error, a variety of optional solutions can be provided for the update restriction error, so that the user can quickly resolve the update restriction error in the script to be tested based on a variety of optional solutions, which is conducive to improving the user's optimization efficiency of the script to be tested.
[0030] In one possible implementation, the execution error information includes a connection failure error; and the corresponding solution to the error information includes at least:
[0031] Determining a network status of the execution system and generating a first error message if the network status is abnormal, the first error message being used to indicate that the execution system network is abnormal; and, if the network status is normal, reconnecting the execution system; and / or,
[0032] Determine the service status of the database used by the script to be tested, and generate second error information if the service status is abnormal, the second error information is used to indicate that the database service is abnormal, and reconnect to the database if the service status is normal.
[0033] In the above technical solution, when the execution error information includes a connection failure error, a variety of optional solutions can be provided for the connection failure error, so that the user can quickly resolve the connection failure error in the script to be tested based on a variety of optional solutions, which is conducive to improving the user's optimization efficiency of the script to be tested.
[0034] In one possible implementation, the script to be tested is an incremental script used for system upgrade, and the script detection request includes an interface path called during the execution of the incremental script; during the execution of the script to be tested, the execution system calls the corresponding upgrade interface based on the interface path to upgrade the execution system, and the execution error information is the error information that occurs during the upgrade of the execution system.
[0035] In the above technical solution, the script optimization method can be applied to the incremental upgrade processing of the execution system. The computing device realizes the automatic incremental upgrade processing of the execution system according to the interface path called in the execution of the incremental script in the script detection request, simplifies the incremental upgrade steps of the execution system, and makes it easier for operation and maintenance personnel to perform incremental upgrades on the execution system. It avoids repeated communication between operation and maintenance personnel and developers during the system upgrade process due to the operation and maintenance personnel not being clear about the details of the script to be tested, which is conducive to saving manpower and time costs and improving system upgrade efficiency.
[0036] In one possible implementation, the method further includes:
[0037] The script to be tested is optimized based on the solution to obtain the optimized script.
[0038] In the above technical solution, an optimized script can be generated and can also be added to the optimization report, so that users can quickly obtain the optimized script through the optimization report, which is conducive to reducing manual intervention in the script optimization process, lowering the technical requirements for users in the script optimization process, and improving the efficiency of script optimization.
[0039] In a second aspect, an embodiment of the present application provides a script optimization device, the device comprising:
[0040] An acquisition module is used to obtain a script detection request from the system, where the script detection request is used to request detection of the script to be tested;
[0041] The acquisition module is further used to obtain error information of the script to be tested in response to the script detection request, where the error information is used to indicate error information existing in the script to be tested and / or error information occurring during the execution of the script to be tested;
[0042] The processing module is used to generate an optimization report of the script to be tested according to the error information of the script to be tested, and the optimization report at least includes a solution corresponding to the error information of the script to be tested.
[0043] The script optimization device provided in the embodiment of the present application can execute the technical solutions described in any one of the first aspects, and its beneficial effects are similar, which will not be repeated here.
[0044] In a possible implementation, the error information includes text error information; and the acquisition module is specifically configured to:
[0045] Perform text detection on the script to be tested to obtain text error information of the script to be tested, where the text error information at least includes syntax errors or character errors.
[0046] In one possible implementation, the text error message includes a grammatical error; and the corresponding solution to the error message includes at least:
[0047] Determine whether there are any grammatical problems with the query statements in the script to be tested, and if so, correct the grammatical problems with the query statements; and / or,
[0048] Determine whether there are writing errors in the elements of the query statement in the script to be tested, and correct the writing errors in the elements if there are writing errors in the elements. The elements include at least one of the following: identifiers, keywords, expressions, operators, and punctuation marks of database objects. The writing errors include at least: wrong characters in the elements, and / or missing characters in the elements.
[0049] In a possible implementation, the error information includes execution error information; and the acquisition module is further configured to:
[0050] Send the script to be tested to the execution system, which is used to execute the script to be tested;
[0051] Get the execution error information, which is the error information that occurs when the execution system executes the script to be tested.
[0052] In one possible implementation, the execution error information includes an object does not exist error; and the corresponding solution to the error information includes at least:
[0053] Determining whether a first identifier of a database object in the script to be tested is consistent with a second identifier of the database object stored in the source data, and updating the first identifier or the second identifier if the first identifier is inconsistent with the second identifier; and / or,
[0054] Determine whether the database object in the script to be tested is a newly added object, and if the database object is a newly added object, generate an identifier of the database object, and add the identifier of the database object to the source data where the database object is located.
[0055] In one possible implementation, the execution error information includes an operation restriction error, which includes at least one of the following: an update restriction error, an insert restriction error, or a delete restriction error. The corresponding solution to the error information includes at least:
[0056] If there is an update restriction error on a database object in a field in the script to be tested, update the field and its value using an update statement; and / or,
[0057] When an insert restriction error and / or a delete restriction error exists in the script to be tested for the first database object, a second database object is created, and an insert operation is performed on the second database object, and / or a delete operation is performed on the second database object, and the data of the second database object is the same as the data of the first database object.
[0058] In one possible implementation, the execution error information includes a connection failure error; and the corresponding solution to the error information includes at least:
[0059] Determining a network status of the execution system and generating a first error message if the network status is abnormal, the first error message being used to indicate that the execution system network is abnormal; and, if the network status is normal, reconnecting the execution system; and / or,
[0060] Determine the service status of the database used by the script to be tested, and generate second error information if the service status is abnormal, the second error information is used to indicate that the database service is abnormal, and reconnect to the database if the service status is normal.
[0061] In one possible implementation, the script to be tested is an incremental script used for system upgrade, and the script detection request includes an interface path called during the execution of the incremental script; during the execution of the script to be tested, the execution system calls the corresponding upgrade interface based on the interface path to upgrade the execution system, and the execution error information is the error information that occurs during the upgrade of the execution system.
[0062] In a possible implementation manner, the processing module is further configured to:
[0063] The script to be tested is optimized based on the solution to obtain the optimized script.
[0064] In a third aspect, an embodiment of the present application provides a computing device, comprising: a processor and a memory; the processor and the memory are coupled;
[0065] The memory is used to store program instructions;
[0066] The processor is configured to execute program instructions to perform the method as described in any one of the first aspects.
[0067] The computing device provided in the embodiment of the present application can execute the technical solutions described in any one of the first aspects, and its beneficial effects are similar, which will not be repeated here.
[0068] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a computer, a method as described in any one of the first aspects is implemented.
[0069] The computer-readable storage medium provided in the embodiment of the present application can execute the technical solutions described in any one of the first aspects, and its beneficial effects are similar, which will not be repeated here.
[0070] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method described in any one of the first aspects.
[0071] The computer program product provided in the embodiments of the present application can execute the technical solutions described in any one of the first aspects, and its beneficial effects are similar, which will not be repeated here.
[0072] The script optimization method and computing device provided in the embodiments of the present application can obtain the script to be tested from the system's script detection request, and obtain error information of the script to be tested in response to the script detection request. The error information may include error information existing in the script to be tested and / or error information that occurs during the execution of the script to be tested; the method can also generate an optimization report for the script to be tested based on the error information of the script to be tested, so that the user can identify and quickly resolve potential problems of the script to be tested in advance through the optimization report, which is conducive to improving the user's optimization efficiency of the script to be tested. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0074] Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application;
[0075] Figure 2 One of the flowcharts of the script optimization method provided in the embodiment of the present application;
[0076] Figure 3 A schematic diagram of a service interface provided in an embodiment of the present application;
[0077] Figure 4 A schematic diagram of an optimization report interface provided in an embodiment of the present application;
[0078] Figure 5 The second flowchart of the script optimization method provided in the embodiment of the present application;
[0079] Figure 6 The third flowchart of the script optimization method provided in the embodiment of the present application;
[0080] Figure 7 A flowchart of a system upgrade method provided in an embodiment of the present application;
[0081] Figure 8 A schematic diagram of the structure of a script optimization device provided in an embodiment of the present application;
[0082] Figure 9 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0083] Exemplary embodiments are described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numbers in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible implementations consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of the present invention, as detailed in the appended claims.
[0084] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned. They should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0085] 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 one or more embodiments of this specification 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 laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0086] It should be noted that, in the embodiments of the present application, the term "at least one" refers to one or more, and "more than one" refers to two or more.
[0087] In order to facilitate understanding of the script optimization method provided in the embodiment of the present application, first, the application scenarios involved in the embodiment of the present application are introduced.
[0088] Figure 1 This is a schematic diagram of an application scenario provided by the embodiment of this application. Figure 1 The computing device may receive a script detection request from a client. The script detection request may include a script to be tested, which may be used to upgrade the execution system. The computing device may detect the script to be tested, generate an optimization report for the script to be tested, and send the optimization report to the client.
[0089] It should be noted that the execution system may be installed in a computing device used for detecting the script to be tested, or may be installed in a computing device other than the computing device used for detecting the script to be tested.
[0090] It should be noted that the computing device in the embodiments of the present application can be an independent physical server, or the computing device can also be a server cluster composed of multiple physical servers. From an architectural perspective, the server can be a rack server, a high-density server, a tower server, or a whole cabinet server; from a functional perspective, the server can be a general-purpose server or an artificial intelligence (AI) server, etc.
[0091] An embodiment of the present application provides a script optimization method, wherein a computing device can obtain a script detection request from a system, wherein the script detection request is used to request detection of the script to be tested; in response to the script detection request, the computing device can obtain error information of the script to be tested, wherein the error information is used to indicate error information existing in the script to be tested and / or error information occurring during the execution of the script to be tested; the computing device can also generate an optimization report for the script to be tested based on the error information of the script to be tested, wherein the optimization report includes at least solution measures corresponding to the error information of the script to be tested. In the above process, there is no need to rely on manual detection and processing of the script to be tested, which is conducive to reducing the requirements for the technical capabilities of developers, thereby helping to reduce labor costs, and can also reduce problems such as errors in the detection of the script to be tested due to human errors in the manual detection process, thereby improving the efficiency of script optimization; and, the method combines the error information of the script to be tested and / or the error information that appears during the execution of the script to be tested, and comprehensively detects the upgrade process of the system based on the script to be tested and generates an optimization report, so that the user can identify and quickly solve the potential problems of the script to be tested in advance through the optimization report, which is conducive to improving the user's optimization efficiency of the script to be tested, and can also avoid system upgrade failures caused by errors in the script to be tested, which is conducive to improving the success rate of the system upgrade and ensuring the stability and reliability of the system upgrade.
[0092] It should be noted that the script optimization method provided in the embodiment of the present application can be applied to the technical field of script processing, as well as to technical fields such as database management. The embodiment of the present application does not limit the technical field of the script optimization method.
[0093] It should be noted that the script optimization method provided in the embodiments of the present application can be applied to various types of operating systems and database platforms, for example, cloud database platforms or real-time database systems used in the field of industrial control.
[0094] The technical solution of the present application is described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0095] Figure 2This is one of the flow charts of the script optimization method provided in the embodiment of this application. Figure 2 , the method may specifically include the following steps:
[0096] S201: Obtain a script detection request from the system, where the script detection request is used to request detection of the script to be tested.
[0097] The script detection request may include the script to be tested, and may also include login information and an interface path.
[0098] The script to be tested may include a query statement. For example, the query statement may be a Structured Query Language (SQL) statement.
[0099] The login information can be used to log in to the execution system and may include a login account, login password, and Internet Protocol (IP) address. The computing device can access the execution system via the IP address and log in to the execution system based on the login account and login password. For example, the execution system may be a database management system. The computing device can automatically access the database management system's login interface based on the IP address and automatically enter the login account and login password in the corresponding locations on the login interface to log in to the database management system.
[0100] The number of interface paths may be one or more, and the interface paths may be used to call corresponding upgrade interfaces during the process of upgrading the execution system based on the script to be tested.
[0101] In some embodiments, the computing device may obtain the script detection request in the following manner: obtaining input data from the user on the service interface; and generating a script detection request based on the input data.
[0102] The service interface may include multiple indication information and a fill-in area corresponding to each indication information. The input data may include the fill-in data in the fill-in area corresponding to each indication information. The multiple indication information may include login information, script to be tested and interface path, wherein the login information may include login account, login password and IP address.
[0103] Figure 3 For a schematic diagram of a service interface provided in this application embodiment, please see Figure 3 The service interface may include multiple indication information and a fill-in area corresponding to each indication information. The multiple indication information may include: login account, login password, IP address, uploaded script to be tested, interface path, and each indication information may correspond to one or more fill-in areas. For example, the login account may correspond to 1 fill-in area, and the interface path may correspond to 3 fill-in areas.
[0104] In this method, the computing device may provide a service interface so that the user can conveniently and quickly input a script detection request to the computing device through the target client based on the service interface.
[0105] S202: In response to the script detection request, obtain error information of the script to be tested.
[0106] The error information may include: text error information, and / or execution error information, wherein the text error information may be error information that occurs when the computing device performs text detection on the script to be tested, and the execution error information may be error information that occurs when the execution system executes the script to be tested.
[0107] The text error information may include at least a grammatical error or a character error.
[0108] In some embodiments, a syntax error may be used to indicate that a query statement in the script to be tested has a syntax error, so that the database system cannot correctly parse and execute the query statement.
[0109] The number of grammatical errors may be one or more. For example, the grammatical errors may include subject-verb agreement errors, tense errors, part-of-speech collocation errors, and word order errors.
[0110] Character errors can be used to indicate a single character in the text that is incorrect in form or missing. For example, character errors may include: spelling errors, for example, "book" is misspelled as "baok"; typos, for example, "program" is mistakenly entered as "chengxu".
[0111] The execution error information may include, but is not limited to, at least one of the following: an object does not exist error, an operation restriction error, and a connection failure error.
[0112] The object does not exist error may indicate that the database object referenced in the script under test does not exist. The database object can be a data table or a view. Alternatively, the database object can also be a row or column in a data table.
[0113] An operation restriction means that the computing device cannot perform at least one of the following operations on the data table specified in the test script: add, delete, modify, or query. Operation restriction errors may include, but are not limited to, at least one of the following: update restriction error, insert restriction error, or delete restriction error.
[0114] The connection failure error may include at least: an error caused by a connection failure between the computing device and the execution system; and / or an error caused by a connection failure between the computing device and the database.
[0115] It should be noted that the process of obtaining text error information will be Figure 5The process of obtaining the execution error information will be described in detail in the embodiment. Figure 6 The details are described in the examples.
[0116] S203: Generate an optimization report of the script to be tested according to the error information of the script to be tested, where the optimization report at least includes solution measures corresponding to the error information of the script to be tested.
[0117] Error messages can be in English and / or Chinese.
[0118] The text error message may include a description of the syntax error. The description of the syntax error may indicate at least one of the following: the location of the query statement containing the syntax error in the script under test; the type of syntax error; and the corresponding solution for the syntax error. Syntax error types may include, but are not limited to, at least one of the following: spelling errors, missing symbols, mismatched symbols, syntax errors, or incorrect comment formatting.
[0119] For example, the description of the syntax error may be: "1064-You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near".
[0120] The execution error information may include, but is not limited to, at least one of the following: description information of an object not existing error, description information of an operation restriction error, and description information of a connection failure error.
[0121] For example, the description information of the object does not exist error may be: 1054-Column A does not exist in the field list, or 1054-Unknown column 'A' in 'field list'.
[0122] For example, the description information of the operation restriction error can be: "1442-Can't update table 'A' in stored function / trigger because it is already used by statement which invoked this stored function / trigger", or "1442-Can't update table 'A' in stored function / trigger because it is already used by statement which invoked this stored function / trigger".
[0123] For example, the description information of the connection failure error may be “unable to connect to MySQL server”.
[0124] In some embodiments, the execution error message may also include a description of a data type mismatch error. A data type mismatch error occurs when the data type inserted by the script under test does not match the data type supported by the execution system. For example, the description of the data type mismatch error may be "The data type of column A is integer, but the value inserted is text."
[0125] In this script optimization method, multiple error types can be divided according to the characteristics of the error information, so that the computing device can classify and analyze errors with common characteristics based on each error type, making the computing device more accurate and flexible in identifying error information of the script to be tested.
[0126] It is understandable that different error messages have different corresponding solutions. It should be noted that the solutions for each error message will be Figure 5 and Figure 6 The details are described in the examples.
[0127] In some embodiments, the computing device may optimize the script to be tested based on the solution to obtain an optimized script.
[0128] In this script optimization method, an optimized script can also be generated and added to the optimization report, so that users (for example, developers, managers or operation and maintenance personnel) can quickly obtain the optimized script through the optimization report, which is conducive to reducing manual intervention in the script optimization process, lowering the technical requirements for users in the script optimization process, and improving the efficiency of script optimization.
[0129] Figure 4 This is a schematic diagram of an optimization report interface provided in an embodiment of this application. Figure 4The optimization report may include multiple error messages, as well as the program code, description, and solution for each error message. Each error message may have one or more solutions. For example, these multiple error messages may include, but are not limited to, syntax errors, object nonexistence errors, operation restriction errors, connection failure errors, and data type mismatch errors.
[0130] Optionally, in some embodiments, the description information of each error message may include the cause of the error message.
[0131] In some embodiments, the computing device can obtain multiple error messages, as well as the program code, description information and solution measures of each error message, and can also obtain a generation template for an optimization report; multiple error messages, as well as the program code, description information and solution measures of each error message can be filled into the generation template accordingly to obtain the optimization report.
[0132] In the script optimization method, the computing device can generate a standardized optimization report based on the generated template, so that the user can quickly and conveniently access the optimization report.
[0133] In some embodiments, the script detection request also includes client information; the script optimization method provided in the embodiment of the present application may also include the following steps: determining the target client based on the client information; and sending an optimization report to the target client.
[0134] For example, the client information may include an identifier of the client, and the computing device may determine a target client based on the identifier of the client and send the optimization report to the target client. The target client may include, but is not limited to, a smartphone, a smartwatch, a tablet computer, a laptop computer, a desktop computer, a portable computer, and the like.
[0135] For example, the client information in the script detection request can be the user's mobile phone number. Based on this mobile phone number, the computing device can send a text message to the corresponding mobile phone. The text message can include a URL for viewing the optimization report. Alternatively, the client information in the script detection request can be the user's email address. Based on this email address, the computing device can also send the optimization report to the corresponding email address.
[0136] After generating the optimization report, the script optimization method can also send the optimization report to the target client, so that users (for example, developers, managers or operation and maintenance personnel) can quickly determine one or more error messages and corresponding solutions to the script to be tested based on the optimization report, and based on the corresponding solutions to the error messages, carry out manual optimization processing to the script to be tested. When the optimized script is included in the optimization report, the user can also manually review the optimized script in the optimization report, and upgrade the system based on the optimized script after the review is passed. The method is conducive to reducing manual intervention in script detection and script optimization processing, reduces technical requirements for users in the script optimization processing, reduces problems such as errors in the script to be tested detection caused by human errors in the manual detection process, and improves script optimization efficiency. For example, for a system that needs to undergo incremental upgrades multiple times within a month, if manual testing and optimization of the script to be tested is used during each upgrade to ensure the success of the incremental upgrade, five technicians will be required, and the average time required for rework due to manual errors during each incremental upgrade is two days; if the script optimization method provided in the embodiment of the present application is used to test and optimize the script to be tested to ensure the success of the incremental upgrade, the number of technicians can be reduced to two, and the average time required for rework due to manual errors during each incremental upgrade will be shortened to half a day.
[0137] In some system incremental upgrade scenarios, on-site operation and maintenance personnel may encounter errors when upgrading the system based on the script to be tested. If the on-site operation and maintenance personnel are not clear about the details of the script to be tested, it may cause the on-site operation and maintenance personnel to communicate repeatedly with the developer who provided the script to be tested to optimize the script to be tested, resulting in low optimization efficiency of the script to be tested, and thus low upgrade efficiency of the system.
[0138] In an embodiment of the present application, an on-site operation and maintenance personnel can fill in the login information and interface path on the service interface provided by the computing device, and upload the script to be tested in the service interface. The computing device can automatically log in to the system to be upgraded based on the login information, and based on the script to be tested and the interface path, realize the automated incremental upgrade of the system. The computing device can generate an optimization report corresponding to the script to be tested based on the error information in the script to be tested and / or the error information that appears during the execution of the script to be tested. In this process, the manual operation of the operation and maintenance personnel during the system upgrade process is simplified. When an error occurs, the on-site operation and maintenance personnel can quickly and accurately optimize the script to be tested based on the optimization report provided by the computing device, thereby reducing or avoiding repeated communication between the operation and maintenance personnel and the developer due to the operation and maintenance personnel not being clear about the details of the script to be tested during the system upgrade process, which is conducive to saving manpower and time costs, improving the optimization efficiency of the script to be tested, and thus improving the efficiency of the system upgrade.
[0139] For example, in a scenario involving the collaborative update of multiple regional databases, if a manual upgrade method is used and an error occurs, the operation and maintenance personnel will need to spend hours repeatedly communicating with the developer to confirm the script details. However, in the embodiment of the present application, the operation and maintenance personnel only need to send the login information, interface path and the script to be tested to the computing device through the target client. The computing device can automatically log in to the system to be upgraded based on the login information and realize the automated upgrade process of the system based on the script to be tested and the interface path, completing the script upload and script analysis quickly (for example, half an hour), which is conducive to improving the efficiency of script analysis and thus improving the efficiency of system upgrade.
[0140] The script optimization method provided in the embodiment of the present application also involves a process of obtaining error information of the script to be tested in response to a script detection request. Figure 5 Describe in detail the process of obtaining text error information and determining the corresponding solution measures for text error information; Figure 6 , which details the process of obtaining execution error information and determining the corresponding solutions to the execution error information.
[0141] Figure 5 This is the second flow chart of the script optimization method provided in the embodiment of this application. Figure 5 , the method may specifically include the following steps:
[0142] S501: Perform text detection on the script to be tested to obtain text error information of the script to be tested.
[0143] The text error information may include at least a grammatical error or a character error.
[0144] It should be noted that the specific content of the "syntax error" and "character error" in step S501 can refer to the specific content of the "syntax error" and "character error" in step S202, and will not be repeated here.
[0145] In some embodiments, the computing device may invoke a text detection tool to perform text detection on the script to be tested. The present embodiment does not limit the type of text detection tool. The text detection tool may be obtained by training a deep learning model based on historical script optimization data. The deep learning model may be used to identify grammatical errors and / or character errors in the script to be tested.
[0146] The result of the text detection can be a pass or a fail. It is understood that if the result of the text detection is a pass, it means that there is no text error information in the script to be tested; if the result of the text detection is a fail, it means that there is a text error information in the script to be tested.
[0147] Optionally, when the result of the text detection is that the detection fails, the computing device may send a prompt message to the target client, where the prompt message may be used to indicate that text error information exists in the script to be tested.
[0148] In this script optimization method, the computing device informs the target client through a prompt message that there is text error information in the script to be tested, so that the user can modify the script to be tested in time through the target client and freely choose whether to continue executing the script to be tested, thereby avoiding the script to be tested from reporting errors during subsequent execution due to text error information, etc., which is conducive to improving the execution efficiency of the script to be tested.
[0149] In some embodiments, during the text detection process of the script to be tested, grammatical information to be optimized of the script to be tested can also be obtained. The grammatical information to be optimized can include inefficient query statements in the script to be tested. Although these query statements do not have grammatical errors, they may cause the system to repeat certain operation steps or perform some redundant operation steps, resulting in a waste of system resources. The script optimization method provided in the embodiment of the present application can identify these inefficient query statements during the text detection process and generate corresponding grammatical information to be optimized, so that the computing device can perform intelligent optimization of the script to be tested based on the grammatical information to be optimized, so as to improve the upgrade efficiency of the system when the script to be tested is upgraded, thereby ensuring the performance of the system.
[0150] In some embodiments, after determining the text error information, the script optimization method may further include step S502.
[0151] S502: Determine the solution corresponding to the text error message.
[0152] In some embodiments, the computing device may determine a solution corresponding to the text error message based on the configuration information.
[0153] The configuration information may include, but is not limited to, multiple error message types, program codes corresponding to each type of error message, reference description information, and reference solutions.
[0154] The computing device may store the configuration information in a standard format, and the embodiment of the present application does not limit the storage format of the configuration information. Alternatively, the computing device may store the configuration information in the form of a data table, and the data table may be as shown in Table 1.
[0155] Table 1
[0156]
[0157]
[0158] It should be noted that the embodiment of the present application is explained by taking the configuration information including the type of error information, program code, description information and solution measures in Table 1 as an example. In some other embodiments, the type of error information in the configuration information may also include other types in addition to the types shown in Table 1, and the program code, description information and solution measures corresponding to each type of error information may also include more or less content than shown in Table 1. The embodiment of the present application does not limit the type of error information in the configuration information, program code, description information and solution measures.
[0159] Optionally, the computing device can obtain multiple historical script optimization data, and generate the configuration information based on the multiple historical script optimization data, and store the configuration information so that the configuration information can be quickly called during subsequent use to determine the solutions corresponding to each error message in each script to be tested.
[0160] The historical script optimization data may include, but is not limited to: multiple historical scripts, one or more historical error messages corresponding to each historical script, and the program code, description information, error type, and solution corresponding to each historical error message.
[0161] Optionally, the computing device may use a deep learning model to learn multiple historical script optimization data to generate the configuration information.
[0162] In some embodiments, when the text error information includes a grammatical error, the solution corresponding to the error information includes at least: determining whether there is a grammatical problem in the query statement in the script to be tested, and correcting the grammatical problem in the query statement if there is a grammatical problem in the query statement; and / or determining whether there is a writing error in the element of the query statement in the script to be tested, and correcting the writing error in the element if there is a writing error in the element.
[0163] Optionally, a grammar detection tool may be used to perform grammar detection on the query statement in the script to be tested to determine whether the query statement has grammar problems.
[0164] An element may include at least one of the following: an identifier of a database object, a keyword, an expression, an operator, or a punctuation mark.
[0165] The identifier of the database object may include, but is not limited to, at least one of the following: a table name or a column name of a data table, a view name, and an index.
[0166] The keyword may be, but is not limited to, a reserved word in the query statement. For example, the keyword may be "order" which is a reserved word in MySQL.
[0167] Expressions may include but are not limited to: arithmetic expressions, string expressions, logical expressions, function call expressions, array expressions, etc.
[0168] Operators may include but are not limited to: arithmetic operators, such as plus (+), minus (-), multiplication (* or ×) and division (÷ or / ); comparison operators, such as greater than (>), less than (<) and equal to (=); logical operators, such as AND (AND or &&), OR (OR or ||), etc.
[0169] Punctuation marks may include, but are not limited to, semicolons, commas, colons, brackets, periods, or quotation marks, where quotation marks may include single quotation marks, double quotation marks, and backquotes.
[0170] Writing errors may include at least: incorrect characters in the element, and / or missing characters in the element.
[0171] In some embodiments, the presence of incorrect characters in an element may include, but is not limited to, at least one of the following:
[0172] Incorrect placement of characters, for example, misspelling "true" as "ture" where the "u" and "r" are in the wrong place;
[0173] The character does not exist. For example, "Table 2" is written as "Table 1", which results in "Table 1" not being found.
[0174] The character data type is incorrectly matched. For example, double quotes or single quotes may be added to the table name or field name, but back quotes should be added to the table name or field name.
[0175] It is understandable that some elements in the script under test can exist in pairs. In actual applications, only some of these elements may exist, not in pairs, resulting in missing characters in these elements. For example, in punctuation marks, double quotes may only exist as left quotes or right quotes.
[0176] In some embodiments, the computing device may determine the cause of the grammatical error and determine a corresponding solution based on the cause of the error. For example, the process of determining the solution to the grammatical error may be as shown in Table 2.
[0177] Table 2
[0178]
[0179] For example, if the table name includes a MySQL reserved word such as "order", the query statement in the script to be tested may be: SELECT * FROM 'order'. After optimization, the query statement in the optimized script may be: SELECT * FROM `order`.
[0180] In this script optimization method, when a grammatical error is included in the text error information, a variety of optional solutions can be provided for the grammatical error, so that the user can quickly resolve the grammatical error in the script to be tested based on the multiple optional solutions, which is beneficial to improving the user's optimization efficiency of the script to be tested.
[0181] The script optimization method provided in the embodiment of the present application can perform text detection processing on the script to be tested, and promptly discover whether there is text error information in the script to be tested, and in the case of text error information, determine the solution corresponding to the text error information, so that subsequent users can quickly optimize the script to be tested according to the solution corresponding to the text error information, which is conducive to improving the script optimization efficiency of the script to be tested.
[0182] Figure 6 This is the third flow chart of the script optimization method provided in the embodiment of this application. Figure 6 , the method may specifically include the following steps:
[0183] S601: Send the script to be tested to an execution system, which is used to execute the script to be tested.
[0184] Optionally, the execution system may be a system that performs upgrade processing through the script to be tested in actual applications, or the execution system may be a simulation system that can be used to simulate a system that performs upgrade processing through the script to be tested in actual applications.
[0185] In some embodiments, the script to be tested may be an incremental script for system upgrade, and the script detection request may include an interface path called during the execution of the incremental script; during the execution of the script to be tested, the execution system calls the corresponding upgrade interface based on the interface path to upgrade the execution system.
[0186] Incremental scripts can be used to automate incremental upgrades of the execution system. Incremental upgrades are updates to existing functionality without redeploying the entire execution system.
[0187] In some embodiments, the script detection request may further include login information, and the computing device may log into the execution system according to the login information.
[0188] The script to be tested may include multiple operation steps and the execution order of the multiple operation steps. The computing device can execute the multiple operation steps in sequence according to the execution order to implement the system upgrade process. In the case of multiple interface paths, the computing device can call the upgrade interface based on the interface path corresponding to the upgrade interface according to the upgrade interface required by the operation step during the execution of the script to be tested.
[0189] This script optimization method can be applied to the incremental upgrade processing of the execution system. The computing device can automatically log in to the execution system according to the login information in the script detection request, and realize automatic incremental upgrade processing of the execution system according to the interface path called in the incremental script execution process in the script detection request, which simplifies the incremental upgrade steps of the execution system, makes it simpler for operation and maintenance personnel to perform incremental upgrades on the execution system, avoids repeated communication between operation and maintenance personnel and developers during the system upgrade process due to the operation and maintenance personnel not being clear about the details of the script to be tested, which is conducive to saving manpower and time costs and improving system upgrade efficiency.
[0190] In some embodiments, in the event of a system login failure, the computing device may also send a login prompt message to the target client. The login prompt message is used to indicate that the system login has failed, so that the target client can promptly detect whether the login information has been filled in unsuccessfully, and promptly send the correct login information to the computing device, so that the computing device can re-login to the system based on the correct login information.
[0191] S602: Obtain execution error information, where the execution error information is error information that occurs when the execution system executes the script to be tested.
[0192] In some embodiments, the computing device can obtain in real time the execution error information generated by the execution system during the execution of the script to be tested; or, the computing device can obtain the execution result sent by the execution system after the execution of the script to be tested is completed, and the execution result may include the execution error information.
[0193] The execution error information may include, but is not limited to, at least one of the following: an object does not exist error, an operation restriction error, and a connection failure error.
[0194] It should be noted that the specific contents of the "object does not exist error", "operation restriction error" and "connection failure error" in step S602 can refer to the specific contents of the "object does not exist error", "operation restriction error" and "connection failure error" in step S202, and will not be repeated here.
[0195] S603: Determine and execute a solution corresponding to the error message.
[0196] In some embodiments, the computing device may determine, based on the configuration information, a solution corresponding to the execution error message.
[0197] It should be noted that the content of the configuration information in step S603 can refer to the content of the configuration information in step S502, and will not be repeated here.
[0198] In this script optimization method, the computing device can quickly and accurately determine the solution corresponding to the execution error information based on the configuration information, without the need for manual intervention, which is conducive to reducing the technical requirements for users in the script optimization process, reducing problems such as errors in the detection of the script to be tested due to human errors in the manual detection process, and is conducive to reducing labor costs and improving script optimization efficiency. For example, in some emergency incremental upgrade task scenarios, if an error occurs in the script to be tested, it will take experienced operation and maintenance personnel one day to manually optimize the script to locate and solve the problem, while inexperienced operation and maintenance personnel may need to spend longer time to deal with the problem, or because inexperienced operation and maintenance personnel cannot solve the problem, they need to call experienced operation and maintenance personnel to deal with it again, resulting in a waste of personnel costs and time costs. In this scenario, if the script optimization method provided by this application is adopted, manual intervention in the script optimization process can be reduced, so that inexperienced operation and maintenance personnel can also quickly locate and solve the problem of the script to be tested, which is conducive to reducing labor costs and improving script optimization efficiency.
[0199] In some embodiments, when the execution error information includes an object does not exist error, the solution corresponding to the error information includes at least: determining whether the first identifier of the database object in the script to be tested is consistent with the second identifier of the database object stored in the source data, and updating the first identifier or the second identifier if the first identifier is inconsistent with the second identifier; and / or determining whether the database object in the script to be tested is a newly added object, and if the database object is a newly added object, generating an identifier of the database object, and adding the identifier of the database object in the source data where the database object is located.
[0200] Optionally, if the first identifier and the second identifier are inconsistent, the first identifier can be updated to the second identifier. For example, if the first identifier of a data table in the script to be tested is "Table A" and the second identifier of the data table stored in the database is "Table B", in this case, "Table A" in the script to be tested can be updated to "Table B".
[0201] Optionally, if the first identifier and the second identifier are inconsistent, the second identifier can be updated to make it consistent with the first identifier. For example, the second identifier of the data table stored in the database is "Table-B", and the first identifier of the data table in the script to be tested is "Table B". Compared to the first identifier, the second identifier has an additional "-". In this case, the "-" can be deleted from the second identifier in the source data.
[0202] In some cases, the query statement in the script under test may reference a column that was added later to Table A. While a query selecting all columns in Table A may work correctly, referencing that column individually will result in an error. In this scenario, you can rename the column in Table A (ensuring that the new name complies with naming standards) and then save the column name in the source data where Table A resides, allowing the execution system to correctly identify the column.
[0203] In some embodiments, the computing device may determine the cause of the object not existing error and determine a corresponding solution based on the cause of the error. For example, the process of determining the solution to the object not existing error may be as shown in Table 3.
[0204] Table 3
[0205]
[0206]
[0207] For example, the column name referenced by the query statement in the script to be tested is "user_name", and the column name in Table A is "username". The column name referenced by the query statement in the script to be tested can be modified to "username".
[0208] In some embodiments, when the execution error information includes an operation restriction error, the solution corresponding to the error information may at least include: when there is an update restriction error of a database object in a field in the script to be tested, updating the field and the field value of the field through an update statement; and / or, when there is an insert restriction error and / or delete restriction error of a first database object in the script to be tested, establishing a second database object and performing an insert operation on the second database object, and / or, performing a delete operation on the second database object, the data of the second database object being the same as the data of the first database object.
[0209] Exemplarily, the update statement may be a “set” statement.
[0210] In some embodiments, the computing device may determine the cause of the operation restriction error and determine a corresponding solution based on the cause of the error. For example, the process of determining the solution to the operation restriction error may be as shown in Table 4.
[0211] Table 4
[0212]
[0213] In some embodiments, when the execution error information includes a connection failure error, the solution corresponding to the error information includes at least: determining the network status of the execution system, and generating a first error message when the network status is abnormal, the first error message is used to indicate that the execution system network is abnormal, and, when the network status is normal, reconnecting the execution system; and / or, determining the service status of the database used by the script to be tested, and generating a second error message when the service status is abnormal, the second error message is used to indicate that the database service is abnormal, and, when the service status is normal, reconnecting the database.
[0214] In this script optimization method, the computing device can generate a first error message when the network status is abnormal, allowing the user to quickly repair the execution system's network based on the first error message, thereby improving the execution system's network repair speed and, in turn, the efficiency of executing the script under test. The computing device can also generate a second error message when the database service status is abnormal, allowing the user to quickly repair the database service based on the second error message, thereby improving the efficiency of executing the script under test.
[0215] In an embodiment of the present application, a computing device can be combined with the error information of the script to be tested and / or the error information that occurs in the script to be tested during execution, and comprehensively detect the upgrade process of the system based on the script to be tested and generate an optimization report, so that the user can identify and quickly solve the potential problems of the script to be tested in advance through the optimization report, which is conducive to improving the user's optimization efficiency for the script to be tested, avoiding the failure of the system upgrade caused by the error of the script to be tested, and is conducive to improving the success rate of the system upgrade, and ensuring the stability and reliability of the system upgrade. For example, in some scenarios with high requirements for the stability of the system upgrade, before the system is upgraded, the operation and maintenance personnel can first upload the script to be tested to the computing device, and the computing device can adopt the script optimization method provided by the embodiment of the present application to perform grammar detection and execution on the script to be tested, so as to obtain grammar detection data and error information during execution, and optimize the script to be tested based on the grammar detection data and report information to obtain the optimized script. The operation and maintenance personnel can adopt the optimized script to upgrade the system, so as to avoid the failure of the system upgrade caused by the error of the script to be tested, thereby causing the interruption of system business, and is conducive to improving the success rate of the system upgrade, and ensuring the stability and reliability of the system upgrade.
[0216] The embodiment of the present application can also provide a system upgrade method, as follows, Figure 7 , which explains in detail how to upgrade the system.
[0217] Figure 7 This is a flowchart of a system upgrade method provided in an embodiment of the present application. Figure 7 , the method may include the following steps:
[0218] S701: The target client sends a system script detection request to the computing device.
[0219] The script detection request can be used to request detection of the script to be tested. The script detection request may include the script to be tested, login information, and interface path.
[0220] In some embodiments, a user may access a website for script optimization processing through a browser of a target client, and the website may provide a service interface (e.g., Figure 3 As shown in the figure, the user can use the target client to fill in the login account, login password, IP address, upload incremental script, and interface path in the fill-in areas corresponding to the multiple indication information. The target client can generate a script detection request based on the data filled in the fill-in areas corresponding to the various indication information on the service interface by the designer, and send the script detection request to the computing device.
[0221] S702: In response to the script detection request, the computing device performs text detection on the script to be tested and obtains text error information of the script to be tested.
[0222] It should be noted that the specific execution process of step S702 can refer to the specific execution process of step S501, and will not be repeated here.
[0223] S703: In response to the script detection request, the computing device sends the script to be tested to the execution system and obtains execution error information.
[0224] The execution system may be used to execute the script to be tested, and the execution error information may be error information generated by the execution system during the execution of the script to be tested.
[0225] It should be noted that the specific execution process of step S703 can refer to the specific execution process of step S601, and will not be repeated here.
[0226] In some embodiments, step S702 and step S703 are optional, and step S702 or step S703 may be omitted or replaced in different embodiments. If step S702 and step S703 exist at the same time, step S702 and step S703 may be swapped in order or performed simultaneously.
[0227] S704: The computing device generates an optimization report for the script to be tested based on the text error information and / or execution error information of the script to be tested.
[0228] The optimization report can be used to optimize the script under test.
[0229] In some embodiments, the computing device can determine the solution corresponding to the text error information based on the text error information of the script to be tested; determine the solution corresponding to the execution error information based on the execution error information of the script to be tested; and generate the optimization report based on the solution corresponding to the text error information and the solution corresponding to the execution error information.
[0230] It should be noted that the specific execution process of determining the solution corresponding to the text error message in step S704 can refer to the specific execution process of determining the solution corresponding to the text error message in step S502; the specific execution process of determining the solution corresponding to the execution error message in step S704 can refer to the specific execution process of determining the solution corresponding to the execution error message in step S603, and will not be repeated here.
[0231] S705: The computing device sends an optimization report to the target client.
[0232] The optimization report may include, but is not limited to, at least one of the following: a solution corresponding to a text error message, a solution corresponding to an execution error message, and an optimized script.
[0233] S706: The target client determines a system upgrade script according to the optimization report, and upgrades the system based on the system upgrade script.
[0234] The system upgrade script can be the optimized script in the optimization report, or the system upgrade script can also be the script obtained by the user after manually optimizing the script to be tested based on the solution corresponding to the text error message and / or the solution corresponding to the execution error message.
[0235] It is understood that the target client can display the optimization report so that the user can further manually verify the optimized script in the optimization report. If the verification passes, the user can input a first control signal to the target client, which can be used to instruct the target client to determine the optimized script in the optimization report as the system upgrade script; if the verification fails, the user can update the optimized script to obtain an updated script and input a second control signal to the target client, which can include the updated script and can be used to instruct the target client to determine the updated script as the system upgrade script.
[0236] The system upgrade method provided in the embodiment of the present application can, during the system upgrade process, comprehensively detect the system upgrade process based on the script to be tested and generate an optimization report in combination with the error information existing in the script to be tested and / or the error information occurring during the execution of the script to be tested. The optimization report can enable the user to identify and quickly resolve potential problems of the script to be tested in advance, which is beneficial to improving the user's optimization efficiency for the script to be tested, and can also avoid system upgrade failures caused by errors in the script to be tested, which is beneficial to improving the success rate of the system upgrade and ensuring the stability and reliability of the system upgrade; moreover, the process does not need to rely on manual detection and processing of the script to be tested, which is beneficial to reducing the requirements for the technical capabilities of developers, thereby helping to reduce labor costs, and can also reduce problems such as errors in the detection of the script to be tested due to human errors in the manual detection process, thereby improving the script optimization efficiency.
[0237] In some embodiments, in the DevOps pipeline, a combination of Development and Operations, a process, method, and system, the script optimization method provided in the embodiment of the present application can be used to achieve a fully automated process from code submission, testing to launch. For example, a developer can upload the script to be tested after the code change to a computing device through a target client. The computing device can detect and optimize the script to be tested to obtain an optimized script, and automatically trigger the system upgrade process based on the optimized script to complete a series of operations from script generation, uploading, execution to result feedback without manual intervention, which is conducive to achieving continuous integration and continuous delivery.
[0238] In some embodiments, the script optimization method provided by the embodiment of the present application can also obtain upgrade process data during the process of upgrading the system through the script to be tested. The upgrade process data can include detailed information on the progress of the system upgrade, script syntax detection, script execution, script optimization, and other stages during the system upgrade process. For example, in the script syntax detection stage, the detailed information can include syntax detection data; in the script execution stage, the detailed information can include script execution results and execution error information during the script execution process; in the script optimization stage, the detailed information can include an optimization report. The computing device can send the upgrade process data to the target client, and the target client can generate a visual interface based on the upgrade process data so that the user (developer or operation and maintenance personnel) can clearly and intuitively see the progress of the system upgrade and the detailed information of each stage of the system upgrade process through the visual interface. The visual interface can also provide multiple controls, which can be combined to complete complex upgrade tasks. Users can complete complex upgrade tasks by simply clicking and dragging the controls in the visual interface, further reducing the operational difficulty of the system upgrade and improving work efficiency.
[0239] In some embodiments, in the process of upgrading the system based on the script to be tested (for example, incremental upgrade), the computing device can also provide personalized system upgrade reports for each user according to the roles and processing requirements of different users. For example, the operation and maintenance personnel may be more concerned about the detailed steps and problem-solving methods of the script to be tested during actual operation. The computing device can refine the detailed steps of the execution of the script to be tested, as well as the problem location and problem-solving methods of the error information in the script to be tested in the system upgrade report. Managers may be more concerned about the overall upgrade status of the system, cost-benefit analysis, and the impact of the system upgrade process on the business. The computing device can refine the overall upgrade status of the system, the manpower and time costs reduced during the system upgrade process, and whether the business is interrupted during the system upgrade process in the system upgrade report. By customizing the system upgrade report for different users, the information acquisition needs of different users during the system upgrade process can be met, and the user satisfaction and user experience of the system upgrade can be improved.
[0240] In some embodiments, the script optimization method provided in the embodiments of the present application can be applied to a shared platform. During the process of upgrading the system based on the script to be tested (for example, incremental upgrade), developers, operation and maintenance personnel, and other relevant personnel can communicate and collaborate in real time based on the shared platform to improve information communication efficiency and avoid system upgrade delays.
[0241] In some embodiments, enterprise employees can encapsulate the script optimization method provided in the embodiments of the present application into independent, multi-version software products based on the user's business scale and business needs, so as to provide users with customized script optimization services and / or system upgrade services, so that the script optimization method can meet diverse market needs.
[0242] In some embodiments, enterprise employees can develop a series of value-added services based on the script optimization methods provided in the embodiments of this application. For example, these value-added services may include regular system health checks, performance optimization consultations, emergency response support, etc. By providing these value-added services, users can more conveniently manage their systems, which helps improve the user experience.
[0243] In some embodiments, for some industries that have special needs or high requirements for incremental system upgrades, such as finance, medical care, telecommunications, etc., enterprises can combine the script optimization method provided in the embodiments of this application, as well as the standard specifications, business characteristics and technical structure of these industries to provide customers in these industries with more professional, efficient and secure script optimization services and / or system upgrade services to enhance the competitiveness of enterprises in these specific industries.
[0244] In some embodiments, when uploading the script to be tested, the computing device can introduce encryption technology to encrypt the transmission and storage of the script, and perform regular security checks and vulnerability scans during the system execution of the script to be tested to prevent the script to be tested from being attacked or the data in the script to be tested from being leaked, thereby ensuring the security and stability of the script optimization process.
[0245] In some embodiments, the script optimization method provided in the embodiments of the present application can automatically back up the system's current data based on a preset data backup mechanism before upgrading the system based on the script to be tested, thereby obtaining backup data. During the system upgrade based on the script to be tested, the integrity and recoverability of the backup data are ensured to avoid data loss or corruption due to unexpected circumstances during the system upgrade. If an upgrade failure results in data loss, the computing device can quickly restore the system data based on the backup data using a pre-established data recovery process and plan, thereby reducing the impact on the system's operations.
[0246] In some embodiments, the versions of database systems and applications are constantly iterating and updating. Enterprises can establish a version compatibility database, which can be used to record the differences and compatibility issues between different versions of each database system, as well as the differences and compatibility issues between different versions of each application. Based on the content recorded in the database, the text detection tools and configuration information used in the script optimization method provided in the embodiment of the present application are updated in a timely manner, so that the script optimization method can be adapted to the upgrade processing of multiple versions of database systems or multiple versions of applications, avoiding problems such as system upgrade failure and system failure caused by version incompatibility when the optimized script obtained based on the script optimization method is upgraded.
[0247] Figure 8 This is a schematic diagram of the structure of a script optimization device provided in an embodiment of the present application. Figure 8 , the script optimization device 10 may include:
[0248] An acquisition module 11 is used to acquire a script detection request from the system, where the script detection request is used to request detection of the script to be tested;
[0249] The acquisition module 11 is further configured to obtain error information of the script to be tested in response to the script detection request, where the error information is used to indicate error information existing in the script to be tested and / or error information occurring during the execution of the script to be tested;
[0250] The processing module 12 is configured to generate an optimization report of the script to be tested according to the error information of the script to be tested, wherein the optimization report at least includes a solution corresponding to the error information of the script to be tested.
[0251] The script optimization device provided in the embodiment of the present application can execute the technical solution in the above-mentioned script execution method, and its beneficial effects are similar, which will not be repeated here.
[0252] In a possible implementation, the error information includes text error information; the acquisition module 11 is specifically configured to:
[0253] Perform text detection on the script to be tested to obtain text error information of the script to be tested, where the text error information at least includes syntax errors or character errors.
[0254] In one possible implementation, the text error message includes a grammatical error; and the corresponding solution to the error message includes at least:
[0255] Determine whether there are any grammatical problems with the query statements in the script to be tested, and if so, correct the grammatical problems with the query statements; and / or,
[0256] Determine whether there are writing errors in the elements of the query statement in the script to be tested, and correct the writing errors in the elements if there are writing errors in the elements. The elements include at least one of the following: identifiers, keywords, expressions, operators, and punctuation marks of database objects. The writing errors include at least: wrong characters in the elements, and / or missing characters in the elements.
[0257] In a possible implementation, the error information includes execution error information; the acquisition module 11 is further configured to:
[0258] Send the script to be tested to the execution system, which is used to execute the script to be tested;
[0259] Get the execution error information, which is the error information that occurs when the execution system executes the script to be tested.
[0260] In one possible implementation, the execution error information includes an object does not exist error; and the corresponding solution to the error information includes at least:
[0261] Determining whether a first identifier of a database object in the script to be tested is consistent with a second identifier of the database object stored in the source data, and updating the first identifier or the second identifier if the first identifier is inconsistent with the second identifier; and / or,
[0262] Determine whether the database object in the script to be tested is a newly added object, and if the database object is a newly added object, generate an identifier of the database object, and add the identifier of the database object to the source data where the database object is located.
[0263] In one possible implementation, the execution error information includes an operation restriction error, which includes at least one of the following: an update restriction error, an insert restriction error, or a delete restriction error. The corresponding solution to the error information includes at least:
[0264] If there is an update restriction error on a database object in a field in the script to be tested, update the field and its value using an update statement; and / or,
[0265] When an insert restriction error and / or a delete restriction error exists in the script to be tested for the first database object, a second database object is created, and an insert operation is performed on the second database object, and / or a delete operation is performed on the second database object, and the data of the second database object is the same as the data of the first database object.
[0266] In one possible implementation, the execution error information includes a connection failure error; and the corresponding solution to the error information includes at least:
[0267] Determining a network status of the execution system and generating a first error message if the network status is abnormal, the first error message being used to indicate that the execution system network is abnormal; and, if the network status is normal, reconnecting the execution system; and / or,
[0268] Determine the service status of the database used by the script to be tested, and generate second error information if the service status is abnormal, the second error information is used to indicate that the database service is abnormal, and reconnect to the database if the service status is normal.
[0269] In one possible implementation, the script to be tested is an incremental script used for system upgrade, and the script detection request includes an interface path called during the execution of the incremental script; during the execution of the script to be tested, the execution system calls the corresponding upgrade interface based on the interface path to upgrade the execution system, and the execution error information is the error information that occurs during the upgrade of the execution system.
[0270] In a possible implementation, the processing module 12 is further configured to:
[0271] The script to be tested is optimized based on the solution to obtain the optimized script.
[0272] Figure 9 This is a hardware structure diagram of a computing device provided in an embodiment of the present application. Figure 9The computing device 20 may be the computing device in the above method embodiment, and may include a processor 21 and a memory 22, wherein the processor 21 and the memory 22 are coupled. The processor 21 and the memory 22 may communicate with each other; illustratively, the processor 21 and the memory 22 communicate with each other via a communication bus 23.
[0273] The memory 22 is used to store program instructions;
[0274] The processor 21 is used to execute program instructions to implement the technical solution shown in the above method embodiment.
[0275] Optionally, the computing device 20 may further include a communication interface, which may include a transmitter and / or a receiver.
[0276] Optionally, the processor may be a CPU, or other general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), etc. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
[0277] An embodiment of the present application provides a computer-readable storage medium having computer-executable instructions stored thereon; when the computer-executable instructions are executed by a processor, they are used to implement the script optimization method described in the above embodiment.
[0278] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer executes the script optimization method described in the above embodiment.
[0279] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-mentioned method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disc, and any combination thereof.
[0280] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0281] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0282] These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0283] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present application, rather than to limit them. Although the embodiments of the present application have been described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A script optimization method, characterized in that: The method comprises: Obtaining a script detection request from the system, wherein the script detection request is used to request detection of the script to be tested; In response to the script detection request, obtaining error information of the script to be tested, where the error information is used to indicate error information existing in the script to be tested and / or error information occurring during the execution of the script to be tested; An optimization report of the script to be tested is generated according to the error information of the script to be tested, wherein the optimization report at least includes solution measures corresponding to the error information of the script to be tested.
2. The method according to claim 1, characterized in that The error information includes text error information; and obtaining the error information of the script to be tested includes: Performing text detection on the script to be tested to obtain text error information of the script to be tested, wherein the text error information at least includes syntax errors or character errors.
3. The method according to claim 2, characterized in that The text error information includes the grammatical error; The corresponding solutions to the error message include at least: Determine whether there is a grammatical problem in the query statement in the script to be tested, and if there is a grammatical problem in the query statement, correct the grammatical problem in the query statement; and / or, Determine whether there are writing errors in the elements of the query statement in the script to be tested, and if there are writing errors in the elements, correct the writing errors in the elements, the elements include at least one of the following: identifiers, keywords, expressions, operators, and punctuation marks of database objects, and the writing errors include at least: wrong characters in the elements, and / or missing characters in the elements.
4. The method according to any one of claims 1 to 3, characterized in that The error information includes execution error information; the step of obtaining the error information of the script to be tested includes: Sending the script to be tested to an execution system, wherein the execution system is used to execute the script to be tested; The execution error information is obtained, where the execution error information is error information that occurs when the execution system executes the script to be tested.
5. The method according to claim 4, characterized in that The execution error information includes an object does not exist error; the corresponding solution measures for the error information include at least: Determining whether a first identifier of a database object in the script to be tested is consistent with a second identifier of the database object stored in the source data, and updating the first identifier or the second identifier if the first identifier is inconsistent with the second identifier; and / or, Determine whether the database object in the script to be tested is a newly added object, and if the database object is a newly added object, generate an identifier of the database object, and add the identifier of the database object to the source data where the database object is located.
6. The method according to claim 4 or 5, characterized in that The execution error information includes an operation restriction error, which includes at least one of the following: an update restriction error, an insert restriction error, or a delete restriction error; and the corresponding solution to the error information includes at least: If there is an update restriction error of a database object in a field in the script to be tested, updating the field and the field value of the field through an update statement; and / or, When there is an insert restriction error and / or a delete restriction error for a first database object in the script to be tested, a second database object is created, and an insert operation is performed on the second database object, and / or a delete operation is performed on the second database object, where the data of the second database object is the same as the data of the first database object.
7. The method according to any one of claims 4 to 6, characterized in that The execution error information includes a connection failure error; The corresponding solutions to the error message include at least: determining a network status of the execution system and, if the network status is abnormal, generating first error information, the first error information being used to indicate that the execution system network is abnormal; and, if the network status is normal, reconnecting the execution system; and / or, Determine the service status of the database used by the script to be tested, and generate second error information when the service status is abnormal, wherein the second error information is used to indicate that the database service is abnormal, and reconnect to the database when the service status is normal.
8. The method according to any one of claims 1 to 7, characterized in that The script to be tested is an incremental script used for system upgrade, and the script detection request includes an interface path called during the execution of the incremental script; during the execution of the script to be tested, the execution system calls the corresponding upgrade interface based on the interface path to upgrade the execution system, and the execution error information is the error information that occurs during the upgrade process of the execution system.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: The script to be tested is optimized based on the solution to obtain an optimized script.
10. A computing device, characterized in that include: processor and memory; The processor is coupled to the memory; The memory is used to store program instructions; The processor is configured to execute the program instructions to implement the method according to any one of claims 1 to 9.