Program splitting method, device, equipment and computer storage medium

By performing chunking processing and attribute dependency analysis on the batch program, and automatically identifying and deleting irrelevant code, the problems of low program splitting efficiency and high error rate in the existing technology are solved, and efficient program subset generation is achieved.

CN114090014BActive Publication Date: 2025-08-22CHINA CONSTRUCTION BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111406731.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-24
Publication Date
2025-08-22
Estimated Expiration
2041-11-24

AI Technical Summary

Technical Problem

In the prior art, program splitting is inefficient and error-prone, especially when the subset program is split from the full set program, it cannot be maintained in batches, resulting in the existence of invalid code.

Method used

By chunking the batch program and using the attribute dependencies between program blocks, the target program blocks associated with the target attributes are automatically identified, unrelated program blocks and code are deleted, and subprocessors are automatically generated.

Benefits of technology

This improves program splitting efficiency and reduces the probability of errors, so that users only need to consider the scope of target attributes without caring about the specific implementation process, achieving accurate program subset acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114090014B_ABST
    Figure CN114090014B_ABST
Patent Text Reader

Abstract

The present application discloses a program splitting method, device, equipment and computer storage medium. The program splitting method includes obtaining a batch program corresponding to each data table from a program set; for the batch program corresponding to each data table, the batch program is divided into blocks according to a preset block rule to obtain a plurality of program blocks corresponding to the batch program; according to the dependency relationship between the attributes used by different program blocks, a target program block associated with a target attribute is determined; other program blocks except the target program block are deleted from the plurality of program blocks, and processing codes corresponding to other attributes unrelated to the target attribute in the target program block are deleted to obtain a program block after deletion; according to the program block after deletion, a corresponding sub-processor is generated to obtain a program subset corresponding to the target attribute in the program set. According to the embodiment of the present application, the efficiency of program splitting can be improved and the probability of error can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular relates to a program splitting method, apparatus, device and computer storage medium. Background Art

[0002] In some business scenarios, it's often necessary to extract metrics from a calculation set. For example, extracting 80 attributes from a data table's 100 attribute metrics. Accordingly, while extracting the attributes, it's also necessary to split the full set of batch programs corresponding to the 100 attributes into a subset of batch programs corresponding to the 80 attributes.

[0003] In the existing technology, non-subset codes are mainly deleted from the entire set manually, and the batch programs involved in each attribute are judged and modified one by one. This leads to inefficient program splitting and is prone to errors, and invalid and unreferenced codes may exist. Summary of the Invention

[0004] The embodiments of the present application provide a program splitting method, apparatus, device, and computer storage medium, which can improve program splitting efficiency and reduce the probability of errors.

[0005] In a first aspect, an embodiment of the present application provides a method for splitting a program, the method comprising:

[0006] Acquire multiple data tables associated with the program set to be split; wherein the program set corresponds to using multiple attributes, and the multiple attributes include at least one target attribute to be extracted;

[0007] Obtaining a batch processing program corresponding to each data table from the program collection;

[0008] For each batch processing program corresponding to each data table, the batch processing program is divided into blocks according to a preset block rule to obtain a plurality of program blocks corresponding to the batch processing program;

[0009] Determining a target program block associated with the target attribute based on dependency relationships between attributes used by different program blocks;

[0010] Deleting other program blocks except the target program block from the plurality of program blocks, and deleting processing codes corresponding to other attributes unrelated to the target attribute in the target program block, to obtain a program block after deletion processing;

[0011] generating a sub-processing program corresponding to the batch processing program according to the program blocks after the deletion process;

[0012] Based on the sub-processing programs respectively corresponding to each batch processing program, a program subset corresponding to the target attribute in the program set is obtained.

[0013] In some embodiments, after performing block processing on the batch processing program corresponding to each data table according to a preset block processing rule to obtain a plurality of program blocks corresponding to the batch processing program, the method further includes:

[0014] sequentially numbering the plurality of program blocks according to their position order in the batch processing program;

[0015] The step of generating a sub-processing program corresponding to the batch processing program according to the deleted program blocks includes:

[0016] Determine the order of program blocks according to the numbers corresponding to the deleted program blocks;

[0017] The deleted program blocks are spliced ​​together according to the program block arrangement order to generate a sub-processing program corresponding to the batch processing program.

[0018] In some embodiments, before determining the target program block associated with the target attribute based on the dependency relationship between the attributes used by different program blocks, the method further includes:

[0019] For each of the plurality of program blocks, the following steps are performed to obtain the attributes used by each program block and the dependency relationships between the attributes used by different program blocks:

[0020] Identifying a block type corresponding to the program block;

[0021] Determining, according to the block type, a parsing and processing method corresponding to the program block;

[0022] The program block is parsed according to the parsing method.

[0023] In some embodiments, for each of the plurality of program blocks, performing the following steps to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks includes:

[0024] Based on the position order of the multiple program blocks in the batch program, each program block is traversed in reverse order to perform the following steps for each program block in the multiple program blocks to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks.

[0025] In some implementations, the block processing of the batch program according to a preset block rule to obtain a plurality of program blocks corresponding to the batch program includes:

[0026] identifying a plurality of identifiers included in the batch program;

[0027] The batch program is divided into blocks using the identifier as a dividing point to obtain a plurality of program blocks corresponding to the batch program.

[0028] In some implementations, before obtaining a plurality of data tables associated with the assembly of programs to be split, the method further includes:

[0029] receiving a user's selection input of at least one target attribute among the plurality of attributes;

[0030] In response to the selection input, a batch program set corresponding to the multiple attributes is obtained as the program set to be split, and the at least one target attribute is determined.

[0031] In some embodiments, the target program block includes a first program block that uses the target attribute, and a second program block that uses other attributes on which the target attribute depends.

[0032] In a second aspect, an embodiment of the present application provides a program splitting device, the device comprising:

[0033] A data table acquisition module is used to acquire multiple data tables associated with the program set to be split; wherein the program set corresponds to using multiple attributes, and the multiple attributes include at least one target attribute to be extracted;

[0034] A program acquisition module, configured to acquire a batch processing program corresponding to each data table from the program set;

[0035] A block processing module is used to block process the batch processing program corresponding to each data table according to a preset block processing rule to obtain multiple program blocks corresponding to the batch processing program;

[0036] A target determination module, configured to determine a target program block associated with the target attribute based on dependencies between attributes used by different program blocks;

[0037] a deletion processing module, configured to delete other program blocks except the target program block from the plurality of program blocks, and delete processing codes corresponding to other attributes in the target program block that are not related to the target attribute, to obtain a program block after deletion processing;

[0038] A program generating module, configured to generate a sub-processing program corresponding to the batch processing program according to the program blocks after the deletion process;

[0039] The sub-program determining module is configured to obtain a program subset corresponding to the target attribute in the program set based on the sub-processing programs respectively corresponding to each batch processing program.

[0040] In some embodiments, the program splitting device further includes:

[0041] a numbering processing module, configured to divide the batch processing program corresponding to each data table into blocks according to a preset block division rule, obtain a plurality of program blocks corresponding to the batch processing program, and then sequentially number the plurality of program blocks according to their position order in the batch processing program;

[0042] The program generation module includes:

[0043] The sequence determination submodule is used to determine the arrangement order of the program blocks according to the numbers corresponding to the program blocks after the deletion process;

[0044] The splicing processing submodule is used to splice the program blocks after the deletion processing according to the arrangement order of the program blocks, and generate a sub-processing program corresponding to the batch processing program.

[0045] In some embodiments, the program splitting device further includes:

[0046] The relationship determination module is configured to, before determining a target program block associated with the target attribute based on the dependency relationship between the attributes used by different program blocks, perform the following steps for each of the multiple program blocks to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks:

[0047] The above relationship determination module specifically includes:

[0048] A type identification submodule, used to identify the block type corresponding to the program block;

[0049] A method determination submodule, used to determine the parsing processing method corresponding to the program block according to the block type;

[0050] The parsing submodule is used to parse the program block according to the parsing method.

[0051] In some embodiments, the relationship determination module is specifically configured to:

[0052] Based on the position order of the multiple program blocks in the batch program, each program block is traversed in reverse order to perform the following steps for each program block in the multiple program blocks to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks.

[0053] In some embodiments, the block processing module specifically includes:

[0054] an identifier recognition submodule, configured to recognize a plurality of identifiers contained in the batch processing program;

[0055] The segmentation processing submodule is used to perform block processing on the batch program using the identifier as a segmentation point to obtain multiple program blocks corresponding to the batch program.

[0056] In some embodiments, the program splitting device further includes:

[0057] An input receiving module, configured to receive a user's selection input of at least one target attribute among the plurality of attributes before obtaining a plurality of data tables associated with the assembly of programs to be split;

[0058] The input response module is configured to obtain, in response to the selection input, a batch program set corresponding to the multiple attributes as the program set to be split, and determine the at least one target attribute.

[0059] In some embodiments, the target program block includes a first program block that uses the target attribute, and a second program block that uses other attributes on which the target attribute depends.

[0060] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;

[0061] When the processor executes the computer program instructions, the steps of the program splitting method described in any one of the embodiments of the first aspect are implemented.

[0062] In a fourth aspect, an embodiment of the present application provides a computer storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the steps of the program splitting method described in any one of the embodiments of the first aspect are implemented.

[0063] The program splitting method, apparatus, device and computer storage medium in the embodiments of the present application divide each batch program into blocks and utilize the dependency relationship between the attributes used by each program block to automatically obtain the target program block associated with the target attribute, and then automatically generate a sub-processor corresponding to each batch program by deleting other irrelevant program blocks and processing codes corresponding to other attributes in the target program block that are irrelevant to the target attribute. In this way, a program subset corresponding to the target attribute in the program set to be split can be obtained. In this way, without manual program splitting, the subset program corresponding to any target attribute can be automatically and accurately split from the program set, thereby improving the program splitting efficiency and reducing the error probability. When obtaining the subset program, the user only needs to consider the range of attributes to be extracted without considering the specific implementation process of program splitting. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0065] Figure 1 This is one of the flowcharts of the program splitting method provided in one embodiment of the present application;

[0066] Figure 2a This is one of the schematic diagrams of program block dependencies provided in one embodiment of the present application;

[0067] Figure 2b This is the second schematic diagram of the program block dependency relationship provided by an embodiment of the present application;

[0068] Figure 3a This is one of the schematic diagrams of the attribute dependency relationship between program blocks provided in one embodiment of the present application;

[0069] Figure 3b This is the second schematic diagram of the attribute dependency relationship between program blocks provided in one embodiment of the present application;

[0070] Figure 4 This is the second flowchart of the program splitting method provided in one embodiment of the present application;

[0071] Figure 5 This is one of the schematic diagrams of the process of selecting a program block processing type provided in one embodiment of the present application;

[0072] Figure 6 This is a schematic diagram of the architecture of a program splitting system provided by an embodiment of the present application;

[0073] Figure 71 is a flowchart of an exemplary program splitting method provided in one embodiment of the present application;

[0074] Figure 8 This is a schematic diagram of the structure of a program splitting device provided in one embodiment of the present application;

[0075] Figure 9 It is a structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0076] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.

[0077] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, the elements defined by the phrase "comprising..." do not exclude the presence of other identical elements in the process, method, article, or device comprising the elements.

[0078] In order to solve the problems of the prior art, the embodiments of the present application provide a program splitting method, apparatus, device and computer storage medium. The program splitting method can be applied to the scenario of program splitting a batch program set. The program splitting method provided by the embodiments of the present application is first introduced below.

[0079] Figure 1 FIG. 1 shows a flow chart of a program splitting method provided by an embodiment of the present application. Figure 1 As shown, the program splitting method may specifically include the following steps:

[0080] Step 110 , obtaining multiple data tables associated with the program set to be split; wherein the program set corresponds to using multiple attributes, and the multiple attributes include at least one target attribute to be extracted.

[0081] Step 120: Obtain a batch processing program corresponding to each data table from the program set.

[0082] Step 130 : For each batch processing program corresponding to each data table, the batch processing program is divided into blocks according to a preset block rule to obtain a plurality of program blocks corresponding to the batch processing program.

[0083] Step 140 : Determine a target program block associated with a target attribute based on the dependency relationship between attributes used by different program blocks.

[0084] Step 150: deleting other program blocks except the target program block from the plurality of program blocks, and deleting processing codes corresponding to other attributes unrelated to the target attribute in the target program block, to obtain a program block after deletion.

[0085] Step 160: Generate a sub-processing program corresponding to the batch processing program based on the program blocks that have been deleted.

[0086] Step 170 : Based on the sub-processing programs corresponding to each batch processing program, a program subset corresponding to the target attribute in the program set is obtained.

[0087] Therefore, by dividing each batch program into blocks and utilizing the dependency relationship between the attributes used by each program block, the target program block associated with the target attribute is automatically obtained, and then by deleting other irrelevant program blocks and the processing code corresponding to other attributes in the target program block that are irrelevant to the target attribute, the sub-processor corresponding to each batch program is automatically generated. In this way, a program subset corresponding to the target attribute in the program set to be split can be obtained. In this way, there is no need to manually split the program, and the subset program corresponding to any target attribute can be automatically and accurately split from the program set, which improves the program splitting efficiency and reduces the error probability. When obtaining the subset program, the user only needs to consider the range of attributes that need to be extracted, without considering the specific implementation process of program splitting.

[0088] The above steps are explained in detail below:

[0089] Regarding step 110, in an embodiment of the present application, the program set to be split may include multiple batch programs, and the program set may be associated with multiple data tables, with each data table corresponding to each batch program. The multiple data tables associated with the program set may contain data such as multiple attributes and their corresponding attribute values, wherein the multiple attributes may be attributes used by the program set.

[0090] In some implementations, before step 110, the program splitting method may further include:

[0091] receiving a user's selection input of at least one target attribute among the plurality of attributes;

[0092] In response to a selection input, a batch program set corresponding to a plurality of attributes is obtained as a program set to be split, and at least one target attribute is determined.

[0093] For example, the user can select attributes to be extracted from multiple attributes in the interactive interface corresponding to the program splitting system. In a specific example, if the user needs to select 80 attributes from 100 attributes, the user can select the corresponding attribute extraction range through the interactive interface, such as selecting 80 attributes to be retained from the 100 attributes, or selecting 20 attributes to be deleted. After receiving the user input, the batch program set corresponding to the original 100 attributes can be first obtained and used as the program set to be split, and the 80 attributes extracted from them can be determined and used as the target attributes.

[0094] In this way, users do not need to worry about the program disassembly process. They only need to enter the range of attributes that need to be retained to complete the automatic splitting of the program collection.

[0095] Regarding step 120, in an embodiment of the present application, different data tables may have different identifiers for uniquely identifying the data tables, where the identifiers may be information such as table names and table numbers. For example, based on the table names corresponding to each traversed data table, the script corresponding to the batch program corresponding to each data table may be read from the program set to be split.

[0096] Regarding step 130, in an embodiment of the present application, in order to facilitate the identification of the distribution position of each attribute in the program set, the batch program script corresponding to a single data table can be treated as a processing unit, and each batch program can be traversed. In addition, in order to determine the dependency relationship between the attributes used in a single batch program, when processing each batch program, the batch program can be first divided into blocks to obtain multiple program blocks corresponding to each batch program. Among them, the preset block rule can be, for example, a rule for dividing blocks with a specific identifier as a dividing point, or a rule for dividing blocks with a landmark statement as a dividing point.

[0097] It should be noted that if the batch program contains comment information, the comment information in the program can be deleted first, and then the block processing of the program can be executed.

[0098] In some implementations, the above step 130 may specifically include:

[0099] Recognize multiple identifiers contained in batch programs;

[0100] The batch program is divided into blocks using the identifier as a dividing point to obtain a plurality of program blocks corresponding to the batch program.

[0101] Here, the identifier can be a setting symbol, an alphabetic word with a special meaning, or a combination thereof, such as ";", "begin", "end", etc.

[0102] In a specific example, a block processing operation may be performed on a single batch program with "end" as a dividing point to obtain multiple program blocks corresponding to the batch program.

[0103] Regarding step 140, in the embodiment of the present application, since different attributes included in the same data table may have dependencies, there may also be dependencies between the attributes used by different program blocks in the same batch program. For example, if the value of attribute a is the sum of two other attributes, attribute b and attribute c, then attribute a can be determined to be dependent on attribute b and attribute c.

[0104] In a specific example, Figure 2a As shown, the attribute A1 used in the program block 11 depends on the attribute B1 and attribute B2 used in the program block 12, and the attribute A2 used in the program block 11 depends on the attribute B2 used in the program block 13 and the attribute C1 used in the program block 12. Figure 2b As shown, the attribute B1 used in the program block 12 depends on the attributes D1 and D3 used in the program block 14 , and the attribute B2 used in the program block 12 depends on the attribute D2 used in the program block 14 .

[0105] In the embodiment of the present application, the block content of each program block can be matched with the attributes included in the data table corresponding to the batch program, and then the attribute dependency range that needs to be traced can be determined based on the dependency relationship between the attributes. The dependent tables and attribute fields are traced back recursively until there are no subsequent dependencies. Therefore, one or more program blocks associated with the target attribute can be determined within the dependency range corresponding to the target attribute that needs to be extracted as the target program block.

[0106] In some implementations, the target program block may specifically include a first program block that uses the target attribute, and a second program block that uses other attributes on which the target attribute depends.

[0107] In a specific example, based on Figure 3a As shown in the attribute dependency relationship between the program blocks, if the target attribute to be extracted is attribute A1 in program block 11, then the target program blocks can be determined to be program blocks 11, 12, and 14. Similarly, Figure 3bAs shown, if the target attribute to be extracted is attribute A2 in program block 11, the target program blocks can be determined to be program block 11, program block 12, program block 13 and program block 14.

[0108] In this way, the program block range corresponding to each attribute that needs to be extracted can be traced back, so as to delete the program blocks or codes that are not related to the attribute and obtain the program subset corresponding to the extracted attribute.

[0109] Regarding step 150, in an embodiment of the present application, other program blocks outside the target program block and processing codes corresponding to other attributes in the target program block that are not related to the target attribute can be deleted, and then the remaining program blocks and processing codes in the program blocks after the deletion processing can be obtained.

[0110] For example, based on the result of dependency tracing, the program blocks and / or the codes in the program blocks can be trimmed and deleted in sequence. Figure 3a As shown in the attribute dependency relationships between program blocks, if the target attribute to be extracted is attribute A1, then program block 13 will not be referenced. In this case, the code for program block 13 can be directly deleted. Furthermore, in program block 11, attributes A2 and A3 are not referenced. Therefore, the code related to A2 and A3 can also be deleted. Similarly, the code corresponding to attributes in other program blocks that have no dependency on attribute A1 can also be deleted, such as attribute B3 in program block 12.

[0111] Regarding step 160 and step 170, in the embodiment of the present application, the program blocks remaining after the deletion process and the processing codes in the program blocks are integrated and written into a file to obtain a new batch program corresponding to the original batch program, that is, a sub-processing program.

[0112] Finally, the trimmed batch programs corresponding to each data table, that is, the sub-processing programs corresponding to each batch program in the program set, are put together to form a complete program subset. This program subset is the program obtained by splitting the program set corresponding to the target attribute.

[0113] In addition, in some implementations, after step 130, the program splitting method provided in the embodiment of the present application may further include:

[0114] According to the position sequence of the multiple program blocks in the batch program, the multiple program blocks are numbered in sequence;

[0115] Accordingly, the above step 160 may specifically include:

[0116] Determine the order of program blocks according to the numbers corresponding to the deleted program blocks;

[0117] The deleted program blocks are spliced ​​together according to the program block arrangement sequence to generate a sub-processing program corresponding to the batch processing program.

[0118] Here, since the position order of each program block in the batch program may affect the execution order between the program blocks, the position order between the program blocks can be recorded when the batch program is divided into blocks, and then after the deletion processing, the program blocks can be spliced ​​according to the position order, so as to ensure that the execution order of the code in the sub-processor is not affected.

[0119] For example, the position sequence can be recorded by numbering each program block in order from top to bottom in the process of splitting the program blocks, for example, 1, 2, 3, ..., N. When the deleted program blocks are joined together, the program blocks can be arranged according to the size of the corresponding numbers of the program blocks, for example, in ascending order of numbers, and then joined together in this order to generate the corresponding sub-processing program.

[0120] Additionally, in some embodiments, Figure 4 As shown, before step 140, the program splitting method may further include: executing the following steps 1401 to 1403 for each of the multiple program blocks, respectively, to obtain the attributes used by each program block, and the dependency relationship between the attributes used by different program blocks, which is explained in detail below.

[0121] Step 1401, identifying the block type corresponding to the program block;

[0122] Step 1402, determining the parsing processing method corresponding to the program block according to the block type;

[0123] Step 1403: parse the program block according to the parsing method.

[0124] Here, program blocks can be divided into multiple block types, such as INSERT type, DELETE type, and UPDATE type. Accordingly, different block types can correspond to different parsing and processing methods, for example, INSERT type corresponds to INSERT block processing, DELETE type corresponds to DELETE block processing, UPDATE type corresponds to UPDATE block processing, etc.

[0125] For example, a selection route can be used to identify the code content in a program block, determine which block type the program block belongs to, and then determine the type of parsing process to be performed on the program block. The selection route can be a judgment program for determining the type of program block and then assigning a parsing process to perform the parsing process.

[0126] In a specific example, Figure 5 As shown, each program block can be input into the selection route 51 respectively. If the program block is identified as an INSERT type, the program block can be input into the INSERT block processing module 52 to be parsed according to the parsing processing method corresponding to the INSERT type to parse and obtain the attributes used by the program block; if the program block is identified as a DELETE type, the program block can be input into the DELETE block processing module 53 to be parsed according to the parsing processing method corresponding to the DELETE type to parse and obtain the attributes used by the program block; if the program block is identified as an UPDATE type, the program block can be input into the UPDATE block processing module 54 to be parsed according to the parsing processing method corresponding to the UPDATE type to parse and obtain the attributes used by the program block. Finally, by comparing the dependency between the attributes in the data table, the dependency between the attributes used by different program blocks can be determined.

[0127] Based on this, in some implementations, steps 1401 to 1403 are performed for each of the multiple program blocks to obtain the attributes used by each program block and the dependencies between the attributes used by different program blocks, which may specifically include:

[0128] Based on the position order of multiple program blocks in the batch program, each program block is traversed in reverse order to execute the above steps 1401 to 1403 for each program block in the multiple program blocks, so as to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks.

[0129] Here, in order to facilitate the determination of the dependency between the attributes used by different program blocks, each program block can be parsed and processed in reverse order, that is, the last executed program block is parsed first, and so on, traversing each program block.

[0130] In this way, by using different parsing methods to parse different block types of program blocks, it can help to accurately identify the content of the program block and determine the attributes it uses. Then, based on the dependency relationship between the attributes used by different program blocks, the traceability range corresponding to the target attribute can be accurately determined to facilitate accurate program splitting.

[0131] In order to better describe the entire solution, a specific example is given based on the above embodiments.

[0132] For example, Figure 6 The program splitting system may include an input module 61, a single table processing module 62 and an output module 63, which will be explained in detail below.

[0133] Input module 61 may include a full set model, a subset model, and a full set program, with these three parameters serving as input parameters. The full set model may include the full set of all attributes, the subset model may include the subset of attributes to be extracted from the full set of attributes, i.e., the target attributes, and the full set program may include a set of batch processing programs corresponding to the full set model. The full set model may correspond to multiple data tables, with a one-to-one correspondence between the data tables corresponding to the full set model and the batch processing programs.

[0134] The single table processing module 62 may be used to sequentially delete and trim the batch programs corresponding to the single data table until each data table corresponding to the set of programs to be split is traversed.

[0135] The output module 63 can be used to sequentially output the trimmed batch processing programs corresponding to the single tables according to the results obtained by the single table processing module, and finally form a complete program subset.

[0136] In addition, the single table processing module 62 may also include multiple steps, such as Figure 7 As shown, it may specifically include steps 701-707, as shown below, which are explained in detail below.

[0137] Step 701, read the script.

[0138] In a specific example, according to the table name of the traversed data table, the corresponding batch processing program script is read from the full set program.

[0139] Step 702: block processing.

[0140] In a specific example, after removing the comment information from the batch program script read in step 701, the code blocks are divided into blocks and numbered 1, 2, 3, ...N from top to bottom in order.

[0141] Step 703: Reverse the order of blocks.

[0142] In a specific example, the blocks are processed in reverse order according to their serial numbers, that is, the code that is executed last is sorted first.

[0143] Step 704, traversal processing.

[0144] In a specific example, each program block is traversed and the block processing unit is called for processing.

[0145] Step 705, block processing.

[0146] In a specific example, types such as INSERT block processing, DELETE block processing, and UPDATE block processing are preset. Based on the selected route, the type of processing for each program block is determined, and the attributes used by the program block and the attributes of the blocks or tables on which the attributes depend are parsed to form a dependency relationship.

[0147] Step 706 , whether it is the last program block, if so, execute step 707 ; if not, return to execute step 705 .

[0148] Step 707: Dependency tracing.

[0149] In a specific example, the content of each program block is matched with the attributes of the subset model table to determine the attribute range that needs to be traced. Then, the dependent tables and fields are traced back recursively until there are no subsequent dependencies.

[0150] Step 708: Script generation.

[0151] In a specific example, based on the results of dependency tracing, the code blocks are trimmed or deleted one by one. The removed code is written to files in ascending order of block numbers to generate a script file corresponding to the batch program.

[0152] Therefore, the program splitting method provided in the embodiment of the present application solves the problems of the previous process of splitting subset programs from the full set of programs, which cannot be maintained in batches, is inefficient, and is prone to errors. When obtaining the subset program, it is only necessary to consider the range of required attributes without considering the specific implementation process.

[0153] It should be noted that the application scenarios described in the above-mentioned embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Ordinary technicians in this field can know that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0154] Based on the same inventive concept, this application also provides a program splitting device. Figure 8 Provide detailed explanation.

[0155] Figure 8 The figure is a schematic structural diagram of a program splitting device according to an exemplary embodiment.

[0156] like Figure 8 As shown, the program splitting device 800 may include:

[0157] The data table acquisition module 801 is used to acquire multiple data tables associated with the program set to be split; wherein the program set corresponds to using multiple attributes, and the multiple attributes include at least one target attribute to be extracted;

[0158] A program acquisition module 802 is used to acquire a batch processing program corresponding to each data table from a program set;

[0159] A block processing module 803 is used to block the batch processing program corresponding to each data table according to a preset block processing rule to obtain multiple program blocks corresponding to the batch processing program;

[0160] A target determination module 804 is configured to determine a target program block associated with a target attribute based on dependencies between attributes used by different program blocks;

[0161] A deletion processing module 805 is used to delete other program blocks except the target program block from the plurality of program blocks, and delete processing codes corresponding to other attributes in the target program block that are not related to the target attribute, to obtain a program block after deletion processing;

[0162] A program generating module 806 is used to generate a sub-processing program corresponding to the batch processing program according to the program blocks after the deletion process;

[0163] The sub-program determining module 807 is configured to obtain a program subset corresponding to the target attribute in the program set based on the sub-processing programs corresponding to each batch processing program.

[0164] The program splitting device 800 is described in detail below, as follows:

[0165] In some embodiments, the program splitting apparatus 800 further includes:

[0166] a numbering processing module for dividing the batch processing program corresponding to each data table into blocks according to a preset block division rule, obtaining a plurality of program blocks corresponding to the batch processing program, and then sequentially numbering the plurality of program blocks according to the position sequence of the plurality of program blocks in the batch processing program;

[0167] The program generation module 806 includes:

[0168] The sequence determination submodule is used to determine the arrangement order of the program blocks according to the numbers corresponding to the program blocks after the deletion process;

[0169] The splicing processing submodule is used to splice the program blocks after the deletion processing according to the arrangement order of the program blocks, and generate a sub-processing program corresponding to the batch processing program.

[0170] In some embodiments, the program splitting apparatus 800 further includes:

[0171] a relationship determination module, configured to, before determining a target program block associated with a target attribute based on the dependency relationship between the attributes used by different program blocks, execute the following steps for each of the plurality of program blocks to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks;

[0172] The above relationship determination module specifically includes:

[0173] A type identification submodule is used to identify the block type corresponding to the program block;

[0174] The method determination submodule is used to determine the parsing processing method corresponding to the program block according to the block type;

[0175] The parsing submodule is used to parse the program blocks according to the parsing method.

[0176] In some embodiments, the relationship determination module is specifically configured to:

[0177] Based on the position order of multiple program blocks in the batch program, each program block is traversed in reverse order to perform the following steps for each program block in the multiple program blocks to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks.

[0178] In some embodiments, the block processing module 803 specifically includes:

[0179] An identifier recognition submodule, used for recognizing multiple identifiers contained in a batch program;

[0180] The segmentation processing submodule is used to perform block processing on the batch program using the identifier as a segmentation point to obtain multiple program blocks corresponding to the batch program.

[0181] In some embodiments, the program splitting apparatus 800 further includes:

[0182] An input receiving module, configured to receive a user's selection input of at least one target attribute among a plurality of attributes before acquiring a plurality of data tables associated with the assembly of programs to be split;

[0183] The input response module is used to obtain a batch program set corresponding to multiple attributes as a program set to be split in response to a selection input, and determine at least one target attribute.

[0184] In some embodiments, the target program block includes a first program block that uses the target attribute, and a second program block that uses other attributes that the target attribute depends on.

[0185] Therefore, by dividing each batch program into blocks and utilizing the dependency relationship between the attributes used by each program block, the target program block associated with the target attribute is automatically obtained, and then by deleting other irrelevant program blocks and the processing code corresponding to other attributes in the target program block that are irrelevant to the target attribute, the sub-processor corresponding to each batch program is automatically generated. In this way, a program subset corresponding to the target attribute in the program set to be split can be obtained. In this way, there is no need to manually split the program, and the subset program corresponding to any target attribute can be automatically and accurately split from the program set, which improves the program splitting efficiency and reduces the error probability. When obtaining the subset program, the user only needs to consider the range of attributes that need to be extracted, without considering the specific implementation process of program splitting.

[0186] Figure 9 A schematic diagram of the electronic hardware structure provided by an embodiment of the present application is shown.

[0187] The electronic device may include a processor 901 and a memory 902 storing computer program instructions.

[0188] Specifically, the processor 901 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0189] The memory 902 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 902 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 902 may include removable or non-removable (or fixed) media. Where appropriate, the memory 902 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 902 is a non-volatile solid-state memory.

[0190] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present application.

[0191] The processor 901 implements any one of the program splitting methods in the above embodiments by reading and executing computer program instructions stored in the memory 902 .

[0192] In some examples, the electronic device may further include a communication interface 903 and a bus 910. Figure 9 As shown, the processor 901 , the memory 902 , and the communication interface 903 are connected via a bus 910 and communicate with each other.

[0193] The communication interface 903 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0194] Bus 910 includes hardware, software or both, and the components of online data flow metering equipment are coupled to each other. For example, but not limitation, bus can include accelerated graphics port (AGP) or other graphics bus, enhanced industry standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 910 can include one or more buses. Although the present application embodiment describes and shows specific bus, the application considers any suitable bus or interconnection.

[0195] The electronic device can execute the program splitting method in the embodiment of the present application, thereby realizing the combination Figure 1 and Figure 7 The program splitting method and device described.

[0196] In addition, in combination with the program splitting method in the above embodiments, the present application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the program splitting methods in the above embodiments is implemented.

[0197] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.

[0198] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0199] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0200] Aspects of the present application have been described above 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 box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed via the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. This processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It is also understood that each box in the block diagram and / or the flowchart and the combination of the boxes in the block diagram and / or the flowchart can also be implemented by the dedicated hardware that performs the specified function or action, or can be implemented by the combination of dedicated hardware and computer instructions.

[0201] The above description is only a specific embodiment of the present application. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application.

Claims

1. A program splitting method, characterized in that: include: Acquire multiple data tables associated with the program set to be split; wherein the program set corresponds to using multiple attributes, and the multiple attributes include at least one target attribute to be extracted; Obtaining a batch processing program corresponding to each data table from the program collection; For each batch processing program corresponding to each data table, the batch processing program is divided into blocks according to a preset block rule to obtain a plurality of program blocks corresponding to the batch processing program; Determining a target program block associated with the target attribute based on dependency relationships between attributes used by different program blocks; Deleting other program blocks except the target program block from the plurality of program blocks, and deleting processing codes corresponding to other attributes unrelated to the target attribute in the target program block, to obtain a program block after deletion processing; generating a sub-processing program corresponding to the batch processing program according to the program blocks after the deletion process; Based on the sub-processing programs respectively corresponding to each batch processing program, a program subset corresponding to the target attribute in the program set is obtained; After the batch processing program corresponding to each data table is divided into blocks according to a preset block rule to obtain a plurality of program blocks corresponding to the batch processing program, the method further includes: sequentially numbering the plurality of program blocks according to their position order in the batch processing program; The step of generating a sub-processing program corresponding to the batch processing program according to the deleted program blocks includes: Determine the order of program blocks according to the numbers corresponding to the deleted program blocks; The deleted program blocks are spliced ​​together according to the program block arrangement order to generate a sub-processing program corresponding to the batch processing program.

2. The method according to claim 1, characterized in that Before determining the target program block associated with the target attribute based on the dependency relationship between the attributes used by different program blocks, the method further includes: For each of the plurality of program blocks, the following steps are performed to obtain the attributes used by each program block and the dependency relationships between the attributes used by different program blocks: Identifying a block type corresponding to the program block; Determining, according to the block type, a parsing and processing method corresponding to the program block; The program block is parsed according to the parsing method.

3. The method according to claim 2, characterized in that For each of the plurality of program blocks, the following steps are performed to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks, including: Based on the position order of the multiple program blocks in the batch program, each program block is traversed in reverse order to perform the following steps for each program block in the multiple program blocks to obtain the attributes used by each program block and the dependency relationship between the attributes used by different program blocks.

4. The method according to claim 1, wherein The batch processing program is divided into blocks according to a preset block rule to obtain a plurality of program blocks corresponding to the batch processing program, including: identifying a plurality of identifiers included in the batch program; The batch program is divided into blocks using the identifier as a dividing point to obtain a plurality of program blocks corresponding to the batch program.

5. The method according to claim 1, wherein Before obtaining a plurality of data tables associated with the assembly of programs to be split, the method further includes: receiving a user's selection input of at least one target attribute among the plurality of attributes; In response to the selection input, a batch program set corresponding to the multiple attributes is obtained as the program set to be split, and the at least one target attribute is determined.

6. The method according to any one of claims 1 to 5, characterized in that The target program block includes a first program block that uses the target attribute, and a second program block that uses other attributes on which the target attribute depends.

7. A program splitting device, characterized in that: The device comprises: A data table acquisition module is used to acquire multiple data tables associated with the program set to be split; wherein the program set corresponds to using multiple attributes, and the multiple attributes include at least one target attribute to be extracted; A program acquisition module, configured to acquire a batch processing program corresponding to each data table from the program set; A block processing module is used to block process the batch processing program corresponding to each data table according to a preset block processing rule to obtain multiple program blocks corresponding to the batch processing program; A target determination module, configured to determine a target program block associated with the target attribute based on dependencies between attributes used by different program blocks; a deletion processing module, configured to delete other program blocks except the target program block from the plurality of program blocks, and delete processing codes corresponding to other attributes in the target program block that are not related to the target attribute, to obtain a program block after deletion processing; A program generating module, configured to generate a sub-processing program corresponding to the batch processing program according to the program blocks after the deletion process; a subprogram determining module, configured to obtain a subset of programs corresponding to the target attribute in the program set based on the subprograms corresponding to each batch program; The program splitting device also includes: a numbering processing module, configured to divide the batch processing program corresponding to each data table into blocks according to a preset block division rule, obtain a plurality of program blocks corresponding to the batch processing program, and then sequentially number the plurality of program blocks according to their position order in the batch processing program; The program generation module includes: The sequence determination submodule is used to determine the arrangement order of the program blocks according to the numbers corresponding to the program blocks after the deletion process; The splicing processing submodule is used to splice the program blocks after the deletion processing according to the arrangement order of the program blocks, and generate a sub-processing program corresponding to the batch processing program.

8. An electronic device, characterized in that: The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the steps of the program splitting method according to any one of claims 1 to 6 are implemented.

9. A computer storage medium, characterized in that The computer storage medium stores computer program instructions, which, when executed by a processor, implement the steps of the program splitting method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Program reverse analysis method and device and electronic equipment

    CN112540787A

  • Dependence analysis and program compiling method and device and storage medium

    CN113296777A