Program updating method and device, electronic equipment, readable storage medium and product
By obtaining the identifier of the upstream system and migrating the comparison data, and automatically extracting and updating the identifier of the downstream system, the problem of low efficiency in program adjustment of downstream systems is solved, and higher integrity and correctness are achieved.
Patent Information
- Application Number
- CN202410905657.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-11-12
AI Technical Summary
When the upstream system program is changed in the prior art, the adjustment of downstream system programs relies on manual mapping, and there are problems of integrity, correctness and efficiency.
By obtaining the identifier migration comparison data of the upstream system, extracting the identifier data in the downstream system program, generating a candidate identifier data set, and updating the identifier based on this to realize automated batch migration replacement.
It improves the integrity, correctness and efficiency of downstream system program updates, reduces manual intervention, and fills the gap in automatic updates.
Smart Images

Figure CN118939286A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a program updating method, device, electronic device, readable storage medium and product. Background Art
[0002] The upstream system usually refers to the source of the data flow, that is, the place where the data is generated or input. In the business process, the upstream refers to the tasks or links in the front link of the business process. The downstream system is the end point of the data flow, that is, the place where the data is consumed or output. In the business process, the downstream refers to the tasks or links in the subsequent links of the business process. Influenced by factors such as innovation drive, technology upgrade or scalability, the upstream system will undergo a certain range of upgrades and improvements during the operation process. The downstream system needs the data or services provided by the upstream system to complete its tasks or functions, that is, the downstream system depends on the upstream system. Therefore, when the system program of the upstream system changes, the system program of the downstream system also needs to be changed accordingly.
[0003] At present, when the system program of the upstream system changes, the table names and field names involved in the downstream system program are generally adjusted one by one according to the mapping document or code program of the system. However, this method still has room for further improvement in terms of completeness, correctness and efficiency. Summary of the invention
[0004] In view of the above situation, the embodiments of the present disclosure provide a program updating method, device, electronic device, readable storage medium and product, aiming to solve the above problems or at least partially solve the above problems.
[0005] In a first aspect, an embodiment of the present disclosure provides a program update method, the method comprising:
[0006] Acquire upstream identifier migration comparison data for assisting the upstream system update and at least one program file of the corresponding target downstream system, wherein each of the program files contains a database operation statement;
[0007] For any target program file in the at least one program file, extract identifier data for each query statement in the target program file to generate a corresponding candidate identifier data set, wherein the identifier data includes at least one of the following: an identifier and a corresponding relationship between identifiers;
[0008] generating downstream identifier migration comparison data based on the candidate identifier data set and the upstream identifier migration comparison data;
[0009] Based on the downstream identifier migration comparison data, the identifier in the target program file is updated to obtain an updated target program file.
[0010] In a second aspect, an embodiment of the present disclosure further provides a program updating device, the device comprising:
[0011] An acquisition module, used to acquire upstream identifier migration comparison data for assisting the upstream system update and at least one program file of the corresponding target downstream system, wherein each of the program files contains a database operation statement;
[0012] an extraction module, for extracting identifier data from each query statement in any target program file in the at least one program file, and generating a corresponding candidate identifier data set, wherein the identifier data includes at least one of the following: an identifier and a corresponding relationship between identifiers;
[0013] A generating module, configured to generate downstream identifier migration control data based on the candidate identifier data set and the upstream identifier migration control data;
[0014] An update module is used to update the identifier in the target program file based on the downstream identifier migration control data to obtain an updated target program file.
[0015] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to execute the steps of the above-mentioned program updating method.
[0016] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes the steps of the above-mentioned program updating method.
[0017] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, wherein the computer program product carries a program code, and the program code includes instructions that can be used to execute the steps of the program update method as described in the first aspect.
[0018] By means of the above technical scheme, the program update method, device, electronic device, readable storage medium and product provided by the embodiment of the present disclosure, by obtaining the upstream identifier migration comparison data for assisting the upstream system update and at least one program file of the corresponding target downstream system, wherein each program file contains a database operation statement; for any target program file in at least one program file, extract the identifier data for each query statement in the target program file, and generate a corresponding candidate identifier data set, wherein the identifier data includes at least one of the following: an identifier and a correspondence between identifiers; based on the candidate identifier data set and the upstream identifier migration comparison data, generate the downstream identifier migration comparison data; based on the downstream identifier migration comparison data, update the identifier in the target program file to obtain the updated target program file. It can be seen that the embodiment of the present disclosure can automatically extract all the identifier data in the downstream system program, and use the generated downstream identifier migration comparison data to batch migrate and replace the identifiers in the target downstream system program, which is not affected by human subjective factors, can greatly improve the integrity, correctness and efficiency of updating the downstream system, save time and effort, and fill the gap in the current technical field regarding automatic updating of downstream system programs.
[0019] The above description is only an overview of the technical solution of the present disclosure. In order to more clearly understand the technical means of the present disclosure, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the specific implementation methods of the present disclosure are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure. In the drawings:
[0021] Figure 1 A schematic diagram showing a flow chart of a program updating method provided by an embodiment of the present disclosure is shown;
[0022] Figure 2 A schematic diagram showing the structure of a program updating device provided by an embodiment of the present disclosure is shown;
[0023] Figure 3 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions of the present disclosure will be clearly and completely described below in combination with the specific embodiments of the present disclosure and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.
[0025] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such usage is interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the term "including" and its variants are to be interpreted as open-ended terms meaning "including but not limited to".
[0027] As described above, in the prior art, when the system program of the upstream system changes, the table names and field names involved in the downstream system program are generally adjusted one by one manually according to the Mapping document or code program of the system. However, this method still has room for further improvement in terms of completeness, correctness and efficiency. Based on this, the present invention proposes a program update method, device, electronic device, readable storage medium and product, and the present disclosure is described in detail below through specific embodiments.
[0028] To facilitate understanding of the present embodiment, a program update method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the program update method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, etc. In some possible implementations, the program update method can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0029] Figure 1 A schematic diagram showing a flow chart of a program updating method provided by an embodiment of the present disclosure is shown. Figure 1 It can be seen that the embodiment of the present disclosure at least includes steps S101-S104:
[0030] S101: Acquire upstream identifier migration comparison data for assisting upstream system update and at least one program file of a corresponding target downstream system, wherein each of the program files contains database operation statements.
[0031] S102: For any target program file in the at least one program file, extract identifier data for each query statement in the target program file to generate a corresponding candidate identifier data set, wherein the identifier data includes at least one of the following: an identifier and a corresponding relationship between identifiers.
[0032] S103: Generate downstream identifier migration comparison data based on the candidate identifier data set and the upstream identifier migration comparison data.
[0033] S104: Based on the downstream identifier migration comparison data, the identifier in the target program file is updated to obtain an updated target program file.
[0034] from Figure 1 It can be seen from the method shown that the embodiment of the present disclosure can automatically extract all identifier data in the downstream system program, and use the generated downstream identifier migration control data to batch migrate and replace the identifiers in the target downstream system program. It is not affected by human subjective factors, and can greatly improve the integrity, correctness and efficiency of updating the downstream system, save time and effort, and fill the gap in the current technical field regarding automatic updating of downstream system programs.
[0035] The above S101-S104 are described in detail below.
[0036] Regarding S101 above:
[0037] Here, the upstream system may be, for example, a credit reporting system responsible for collecting and evaluating customer credit information, and correspondingly, the corresponding target downstream system may be an asset disposal system that handles the disposal and recovery of non-performing loans. The embodiments of the present disclosure do not limit the fields, types, etc. to which the upstream and downstream systems belong. The upstream identifier migration comparison data is data used to record the identifier mapping relationship between the old upstream system and the new upstream system. In specific implementation, the upstream identifier migration comparison data may exist in a variety of forms, such as mapping tables, configuration files, or database records, etc., which are not limited by the embodiments of the present disclosure and can be selected according to actual needs. The embodiments of the present disclosure do not limit the database type corresponding to the database operation statement, for example, the database operation statement may be a MySQL database operation statement, an Oracle database operation statement, a SQL Server database operation statement, etc. The programming language for implementing the embodiments of the present disclosure is not limited, and for example, it can be written in Python.
[0038] In specific implementation, for example, the path of the program file can be specified in a configuration file, and the configuration file can be read to obtain the file path when executing this embodiment, so as to obtain the program file. The user can also be guided to specify the program file through a file selection dialog box in a graphical interface, so as to obtain the program file. It can also be sent to a server or device executing this embodiment through a network protocol (such as HTTP, FTP, etc.). The embodiment of the present disclosure does not limit the method of obtaining the program file.
[0039] Regarding S102 above:
[0040] Here, an identifier is a name or symbol used to uniquely identify an object (such as a table, column, constraint, etc.) in a database. For the correspondence between identifiers, for example, the correspondence between table names and field names, the correspondence between index names and field names, the correspondence between stored procedure names and their parameter names, etc., the present disclosure does not limit this.
[0041] During implementation, this step can be performed first for any target program file in each program file, and then the subsequent two steps can be continued to be performed, so as to realize the update of the system program for the target downstream system. Exemplarily, if the query statement only includes one identifier data, that is, an identifier, then for a certain target query statement, the target query statement can be parsed to identify the keywords, identifiers, etc. in the statement, and then each identifier can be matched by defining a regular expression rule, so as to obtain a candidate identifier data set. It should be noted that the examples given here are only illustrative and do not limit the embodiments of the present disclosure.
[0042] In a possible implementation, the identifier data is a correspondence between a table name and / or a table alias and a field name; the identifier data is extracted for each query statement in the target program file to generate a corresponding candidate identifier data set, including: for any target query statement in the target program file, the following steps are executed: the target query statement is parsed to identify at least one keyword in the target query statement; at least one field name is extracted based on a field name keyword in the at least one keyword; wherein a clause corresponding to the field name keyword includes a field name; for any target field name in the at least one field name, it is determined whether there is a corresponding target table name and / or target table alias in the target query statement; if there is a corresponding target table name and / or target table alias in the target query statement, the candidate identifier data set is generated based on each of the target field names and the corresponding target table names and / or target table aliases.
[0043] In actual application scenarios, table names, table aliases, and field names are the main elements in each query statement, through which database management, data operations and processing, and various business needs can be achieved. In this embodiment, the identifier data is the correspondence between the table name and / or table alias, and the field name. The target query statement can be parsed first to identify one or more keywords in the target query statement. Specifically, for example, a word segmentation algorithm can be used to segment the target query statement to obtain a segmentation result; then, a pre-built word library containing query statement keywords is used to define regular expression rules to match the segmentation results to obtain one or more keywords.
[0044] Then, the field name keywords are filtered out from the matched keywords. Here, the clause corresponding to the field name keyword contains the field name, so one or more field names can be extracted according to each field name keyword. For example, there is a target query statement a "SELECT name, age FROM students", which obtains the keywords SELECT and FROM, where SELECT is the field name keyword. The non-comma split result in the clause corresponding to the SELECT keyword, that is, name and age, can be used as the two extracted field names.
[0045] Finally, for any target field name, determine whether there is a corresponding target table name and / or target table alias in the target query statement. Specifically, for example, the target table name and / or target table alias corresponding to the target field name can be found according to the following methods: 1. Analyze the grammatical structure of the target query statement to determine the position where the table name and table alias appear, such as whether the target table name and / or target table alias exists after keywords such as "FROM" and "JOIN". For example: if the target query statement is "SELECTname FROM table1 t1", it can be determined that table1 is the table name corresponding to the name field name, and t1 is the corresponding table alias. 2. Use a predefined regular expression to match content that appears in the form of "table name.field name". For example: "SELECTtable1.column1", it can be determined that the target table name corresponding to the field name column1 is table1. It should be noted that the examples given here are only illustrative and do not limit the embodiments of the present disclosure. If there is a corresponding target table name and / or target table alias in the target query statement, the target table name and / or target table corresponding to each target field name can be obtained according to the above steps, and a candidate identifier data set can be generated according to each target field name and the corresponding target table name and / or target table. Exemplarily, an element in the candidate identifier data set is: table name a-table alias a'-field name a1, field name a2, field name a3.
[0046] In actual application scenarios, the target query statement has the problem of non-standard writing. In this case, the corresponding target table name and / or target table alias may not exist in the target query statement. Based on this, in a possible implementation of the present disclosure, the method also includes: if the corresponding target table name and / or target table alias does not exist in the target query statement, the target table name and / or target table alias is obtained according to the target field name using a pre-built mapping relationship; wherein the pre-built mapping relationship is a mapping relationship between the table name and / or table alias corresponding to all tables in the target downstream system and all field names in the table; the candidate identifier data set is generated according to each of the target field names and the corresponding target table name and / or target table alias.
[0047] During implementation, for example, the pre-built mapping relationship may be in the form of a dictionary, which is not limited in the embodiments of the present disclosure. It can be seen that the present embodiment uses the pre-built mapping relationship to store and manage the mapping relationship between the table names and / or table aliases corresponding to all tables in the target downstream system and all field names in the table. By using the pre-built mapping relationship, even when the query statement is not written in a standardized manner, that is, when the corresponding target table name and / or target table alias may not exist in the target query statement, the accurate target table name and / or target table alias can be quickly given and a candidate identifier data set can be generated.
[0048] Regarding S103 above:
[0049] In a possible implementation, the downstream identifier migration comparison data is generated based on the candidate identifier data set and the upstream identifier migration comparison data, including: for any element in the candidate identifier data set, determining whether there is a corresponding identifier to be migrated in the upstream identifier migration comparison data; if the identifier to be migrated exists in the upstream identifier migration comparison data, using the identifier to be migrated as a pending identifier; and generating the downstream identifier migration comparison data according to each pending identifier and the corresponding new identifier in the upstream identifier migration comparison data.
[0050] Table 1 is a candidate identifier data set, Table 2 is upstream identifier migration comparison data, and Table 3 is downstream identifier migration comparison data. The present embodiment is exemplarily described below in conjunction with Table 1, Table 2 and Table 3.
[0051] Table 1 Candidate identifier data set
[0052] Table name Table alias Field Name Table m1 Table m1' Field name m11 Field name m12 Table m2 Table m2' Field name m21 Table m3 Table m3' Field name m31
[0053] Table 2 Upstream identifier migration comparison data
[0054] Old table name New table name Old table alias New table alias Old field name New field name Table m1 Table m1_u Table m1' none Field name m11 Field name m11' Table n none Table n' none Field name n2 Field name n2' … … … … … …
[0055] Table 3 Downstream identifier migration comparison data
[0056] Target program file name Old table name New table name Old field name New field name Program File A Table m1 Table m1_u Field name m11 Field name m11'
[0057] The candidate identifier data set corresponding to the program file A indicated in Table 1 includes 3 elements. We can first determine whether there are corresponding identifiers to be migrated in the upstream identifier migration comparison data shown in Table 2 for the elements of Table m1: Table m1-Table m1'-Field name m11, Field name m12. It can be seen that there are identifiers to be migrated "Table m1" and "Field name m11", so "Table m1" and "Field name m11" can be used as identifiers to be processed. By analogy, it can be determined that for the other two elements of the candidate identifier data set, there are no corresponding identifiers to be migrated in the upstream identifier migration comparison data. Therefore, the downstream identifier migration comparison data shown in Table 3 can be generated based on each identifier to be processed and the corresponding new identifier in Table 2. It should be noted that the examples given here are only illustrative and do not limit the embodiments of the present disclosure.
[0058] Regarding S104 above:
[0059] During implementation, for any target pending identifier in the downstream identifier migration comparison data, an identifier query can be performed in the target program file, and the queried target pending identifier can be replaced with the corresponding new identifier, and finally the updated target program file is obtained.
[0060] In actual application scenarios, the same field names may exist in different tables. In order to accurately update the field names, in a possible implementation of the present disclosure, the downstream identifier migration reference data includes migration reference data for the field names; based on the downstream identifier migration reference data, the identifiers in the target program file are updated to obtain an updated target program file, including: generating a target regular expression set according to each old field name in the downstream identifier migration reference data and the corresponding old table name or old table alias in the candidate identifier data set; using the target regular expression set, matching each old field name from the target program file and replacing them with the corresponding new field name to obtain the updated target program file.
[0061] During implementation, the target regular expression set can be generated first according to the old field names in the downstream identifier migration comparison data and the corresponding old table names or old table aliases in the candidate identifier data set. For example, the downstream identifier migration comparison data includes: the field name name from the table named table1, the field name age from the table named table2 and the table alias t2, then the target regular expression set includes 3 elements: \table1\b\.\name\b, \table2\b\.\age\b, \t2\b\.\age\b. Using each element in the target regular expression set, matching is performed in the target program file, name and age are matched, and then replaced with the corresponding new field names, and finally the updated target program file is obtained. This embodiment performs a joint match with [table name / table alias + field name] for the field name, thereby achieving accurate update of the field name and greatly improving the quality of the generated updated target program file.
[0062] In a possible implementation, before the step of extracting identifier data for each query statement in any target program file among the at least one program file to generate a corresponding candidate identifier data set, the method further includes: for any pending program file among the at least one program file, based on preset judgment conditions, determining whether the program in the pending program file has any irregular behavior; if the program in the pending program file has any irregular behavior, sending the pending program file to a terminal of a corresponding developer; receiving the adjusted program file sent by the terminal as a new pending program file; and returning to the step of determining whether the program in the pending program file has any irregular behavior based on the preset judgment conditions until the pending program file has no irregular behavior.
[0063] During specific implementation, for any program file to be processed, it can be determined based on preset judgment conditions whether the program in the program file to be processed has irregular behavior. Here, the preset judgment condition can be set according to actual needs, and the embodiment of the present disclosure does not limit this. Exemplarily, the preset judgment condition is: if the program in the program file to be processed has at least one of the following errors, it is determined that the program in the program file to be processed has irregular behavior; otherwise, it is determined that the program in the program file to be processed does not have irregular behavior: "SELECT*" appears, and column aliases are not used to distinguish columns with the same name from different tables.
[0064] If it is determined that there is non-standard behavior in the program in the pending program file, the pending program file can be sent to the terminal of the developer who wrote the pending program file, and the developer corrects and adjusts the pending program file, and sends the adjusted program file to the execution subject of this embodiment, and the execution subject of this embodiment uses the received adjusted program file as a new pending program file; and returns to the step of judging whether there is non-standard behavior in the program in the pending program file based on the preset judgment condition, until there is no non-standard behavior in the pending program file. If it is determined that there is no non-standard behavior in the program in the pending program file, it can be directly judged whether the next pending program file is standardized. This embodiment can first conduct a standardization check on each program file, adjust the non-standard program file, and then execute the aforementioned steps S102, S103, and S104 to update the downstream system program, which can greatly improve the integrity and efficiency of updating the downstream system (for example, if the error of "SELECT*" is not corrected, after the downstream system program is updated using the present disclosure, it is still necessary to manually modify it, which is time-consuming and laborious).
[0065] The present disclosure also provides a program update method, comprising the following steps:
[0066] Step S1: Acquire upstream identifier migration comparison data for assisting the upstream system update and at least one program file of the corresponding target downstream system, wherein each program file contains database operation statements.
[0067] Step S2: for any program file to be processed in at least one program file, based on a preset judgment condition, determine whether the program in the program file to be processed has irregular behavior.
[0068] Step S3: If there is any irregular behavior in the program in the program file to be processed, the program file to be processed is sent to the terminal of the corresponding developer; the adjusted program file sent by the receiving terminal is used as a new program file to be processed; and the process returns to step S2 until there is no irregular behavior in the program file to be processed.
[0069] Step S4: for any target program file in at least one program file, extract identifier data for each query statement in the target program file to generate a corresponding candidate identifier data set, and the identifier data includes at least one of the following: identifiers and correspondences between identifiers. In specific implementation, if the identifier data is a table name and / or table alias, or a correspondence between field names, then step S4 specifically includes: for any target query statement in the target program file, execute the following steps: parse the target query statement to identify at least one keyword in the target query statement; extract at least one field name based on the field name keyword in at least one keyword; wherein the clause corresponding to the field name keyword includes a field name; for any target field name in at least one field name, determine whether there is a corresponding target table name and / or target table alias in the target query statement; if there is a corresponding target table name and / or target table alias in the target query statement In the corresponding target table name and / or target table alias, a candidate identifier data set is generated according to each target field name and the corresponding target table name and / or target table alias respectively; if the corresponding target table name and / or target table alias does not exist in the target query statement, a pre-built mapping relationship is used to obtain the target table name and / or target table alias according to the target field name; wherein the pre-built mapping relationship is a mapping relationship between the table name and / or table alias corresponding to all tables in the target downstream system and all field names in the table; a candidate identifier data set is generated according to each target field name and the corresponding target table name and / or target table alias respectively.
[0070] Step S5: for any element in the candidate identifier data set, determine whether there is a corresponding identifier to be migrated in the upstream identifier migration comparison data.
[0071] Step S6: If there is an identifier to be migrated in the upstream identifier migration comparison data, the identifier to be migrated is used as an identifier to be processed.
[0072] Step S7: Generate downstream identifier migration comparison data according to each identifier to be processed and the corresponding new identifier in the upstream identifier migration comparison data.
[0073] Step S8: Based on the downstream identifier migration control data, the identifier in the target program file is updated to obtain the updated target program file. In specific implementation, if the downstream identifier migration control data includes migration control data for field names, this step specifically includes: generating a target regular expression set according to each old field name in the downstream identifier migration control data and the corresponding old table name or old table alias in the candidate identifier data set; using the target regular expression set, matching each old field name from the target program file and replacing it with the corresponding new field name to obtain the updated target program file.
[0074] Those skilled in the art will appreciate that, in the above method of the specific implementation manner, the writing order of the steps does not mean a strict execution order, but does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0075] It should be noted that, in practical applications, all possible implementations described above can be combined in any manner to form possible embodiments of the present disclosure, which will not be described one by one here.
[0076] Based on the same concept, the embodiment of the present disclosure also provides a program updating device. Figure 2 A schematic diagram showing the structure of a program updating device provided by an embodiment of the present disclosure is shown. Figure 2 As shown, the program updating device 200 provided by the embodiment of the present disclosure includes:
[0077] The acquisition module 201 is used to acquire upstream identifier migration comparison data for assisting the upstream system update and at least one program file of the corresponding target downstream system, wherein each of the program files contains a database operation statement;
[0078] An extraction module 202 is used to extract identifier data from each query statement in any target program file in the at least one program file, and generate a corresponding candidate identifier data set, wherein the identifier data includes at least one of the following: an identifier and a corresponding relationship between identifiers;
[0079] A generating module 203, configured to generate downstream identifier migration comparison data based on the candidate identifier data set and the upstream identifier migration comparison data;
[0080] The updating module 204 is used to update the identifier in the target program file based on the downstream identifier migration control data to obtain an updated target program file.
[0081] In a possible implementation, in the above-mentioned device, the identifier data is the correspondence between the table name and / or table alias and the field name; the extraction module is used to: for any target query statement in the target program file, execute the following steps: parse the target query statement to identify at least one keyword in the target query statement; extract at least one field name based on the field name keyword in the at least one keyword; wherein the clause corresponding to the field name keyword includes the field name; for any target field name in the at least one field name, determine whether there is a corresponding target table name and / or target table alias in the target query statement; if there is a corresponding target table name and / or target table alias in the target query statement, generate the candidate identifier data set based on each of the target field names and the corresponding target table names and / or target table aliases.
[0082] In a possible implementation, in the above-mentioned device, the extraction module is also used for: if there is no corresponding target table name and / or target table alias in the target query statement, obtaining the target table name and / or target table alias according to the target field name by using a pre-built mapping relationship; wherein the pre-built mapping relationship is a mapping relationship between the table names and / or table aliases corresponding to all tables in the target downstream system and all field names in the table; generating the candidate identifier data set according to each of the target field names and the corresponding target table names and / or target table aliases.
[0083] In a possible implementation, in the above-mentioned device, the generation module is used to: for any element in the candidate identifier data set, determine whether there is a corresponding identifier to be migrated in the upstream identifier migration comparison data; if the identifier to be migrated exists in the upstream identifier migration comparison data, use the identifier to be migrated as the identifier to be processed; and generate the downstream identifier migration comparison data based on each identifier to be processed and the corresponding new identifier in the upstream identifier migration comparison data.
[0084] In a possible implementation, in the above-mentioned device, the downstream identifier migration comparison data includes migration comparison data for field names; the update module is used to: generate a target regular expression set based on each old field name in the downstream identifier migration comparison data and the corresponding old table name or old table alias in the candidate identifier data set; use the target regular expression set to match each old field name from the target program file, and replace it with the corresponding new field name to obtain the updated target program file.
[0085] In one possible implementation, the device further includes an adjustment module, which is used to: for any pending program file among the at least one program file, determine whether the program in the pending program file has any non-standard behavior based on preset judgment conditions; if the program in the pending program file has any non-standard behavior, send the pending program file to a terminal of a corresponding developer; receive the adjusted program file sent by the terminal as a new pending program file; and return to the step of determining whether the program in the pending program file has any non-standard behavior based on preset judgment conditions until the pending program file has no non-standard behavior.
[0086] It should be noted that any of the above-mentioned program updating devices can implement the above-mentioned program updating method one by one, which will not be described in detail here.
[0087] Figure 3 FIG. 1 shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 3 As shown, at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage, etc. Of course, the electronic device may also include hardware required for other services.
[0088] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0089] The memory is used to store programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include internal memory and non-volatile memory, and provides instructions and data to the processor.
[0090] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a program update device at the logical level. The processor executes the program stored in the memory and is specifically used to execute the above method.
[0091] The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0092] The electronic device can execute the program updating method provided by the embodiments of the present disclosure, and realize the program updating device in Figure 2 The functions of the illustrated embodiments will not be described in detail in the embodiments of the present disclosure.
[0093] The embodiments of the present disclosure also propose a computer-readable storage medium, which stores one or more programs, and the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, can enable the electronic device to execute the program update method provided by multiple embodiments of the present disclosure.
[0094] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0095] The present disclosure is 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 disclosure. 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 processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. 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.
[0096] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate 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 A function specified in one or more boxes.
[0097] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0098] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0099] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0100] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0101] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the program updating method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0102] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0103] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity or device including the element.
[0104] It will be appreciated by those skilled in the art that the embodiments of the present disclosure may be provided as methods, systems or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0105] The above are only embodiments of the present disclosure and are not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the scope of the claims of the present disclosure.
Claims
1. A program updating method, characterized in that: The method comprises: Acquire upstream identifier migration comparison data for assisting the upstream system update and at least one program file of the corresponding target downstream system, wherein each of the program files contains a database operation statement; For any target program file in the at least one program file, extract identifier data for each query statement in the target program file to generate a corresponding candidate identifier data set, wherein the identifier data includes at least one of the following: an identifier and a corresponding relationship between identifiers; generating downstream identifier migration comparison data based on the candidate identifier data set and the upstream identifier migration comparison data; Based on the downstream identifier migration comparison data, the identifier in the target program file is updated to obtain an updated target program file.
2. The method according to claim 1, characterized in that The identifier data is a correspondence between a table name and / or a table alias and a field name; extracting identifier data from each query statement in the target program file to generate a corresponding candidate identifier data set includes: For any target query statement in the target program file, perform the following steps: Parsing the target query statement to identify at least one keyword in the target query statement; Extracting at least one field name according to a field name keyword in the at least one keyword; wherein the clause corresponding to the field name keyword includes the field name; For any target field name among the at least one field name, determining whether there is a corresponding target table name and / or target table alias in the target query statement; If there is a corresponding target table name and / or target table alias in the target query statement, the candidate identifier data set is generated according to each of the target field names and the corresponding target table name and / or target table alias.
3. The method according to claim 2, characterized in that The method further comprises: If the target query statement does not contain a corresponding target table name and / or target table alias, the target table name and / or target table alias is obtained according to the target field name by using a pre-built mapping relationship; wherein the pre-built mapping relationship is a mapping relationship between the table names and / or table aliases corresponding to all tables in the target downstream system and all field names in the table; The candidate identifier data set is generated according to each of the target field names, the corresponding target table names and / or target table aliases.
4. The method according to claim 1, characterized in that The generating downstream identifier migration comparison data based on the candidate identifier data set and the upstream identifier migration comparison data comprises: For any element in the candidate identifier data set, determining whether there is a corresponding identifier to be migrated in the upstream identifier migration comparison data; If the identifier to be migrated exists in the upstream identifier migration comparison data, the identifier to be migrated is used as the identifier to be processed; The downstream identifier migration comparison data is generated according to each of the identifiers to be processed and the corresponding new identifier in the upstream identifier migration comparison data.
5. The method according to claim 2, characterized in that: The downstream identifier migration comparison data includes migration comparison data for field names; the identifier in the target program file is updated based on the downstream identifier migration comparison data to obtain an updated target program file, including: Generate a target regular expression set according to each old field name in the downstream identifier migration comparison data and the corresponding old table name or old table alias in the candidate identifier data set; The target regular expression set is used to match each old field name from the target program file, and the old field name is replaced with the corresponding new field name to obtain the updated target program file.
6. The method according to any one of claims 1 to 5, characterized in that: Before the step of extracting identifier data from each query statement in any target program file of the at least one program file to generate a corresponding candidate identifier data set, the method further includes: For any program file to be processed in the at least one program file, judging whether a program in the program file to be processed has irregular behavior based on a preset judgment condition; If there is any irregular behavior in the program in the program file to be processed, the program file to be processed is sent to the terminal of the corresponding developer; the adjusted program file sent by the terminal is received as a new program file to be processed; and the process returns to the step of judging whether there is any irregular behavior in the program in the program file to be processed based on the preset judgment condition, until there is no irregular behavior in the program file to be processed.
7. A program updating device, characterized in that: The device comprises: An acquisition module, used to acquire upstream identifier migration comparison data for assisting the upstream system update and at least one program file of the corresponding target downstream system, wherein each of the program files contains a database operation statement; an extraction module, for extracting identifier data from each query statement in any target program file in the at least one program file, and generating a corresponding candidate identifier data set, wherein the identifier data includes at least one of the following: an identifier and a corresponding relationship between identifiers; A generating module, configured to generate downstream identifier migration control data based on the candidate identifier data set and the upstream identifier migration control data; An update module is used to update the identifier in the target program file based on the downstream identifier migration control data to obtain an updated target program file.
8. An electronic device comprising: processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing one or more programs, characterized in that: When the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device executes the steps of the method as claimed in any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product carries a program code, and the program code includes instructions that can be used to execute the steps of any one of the methods according to claims 1-6.
