Processing method and device of stored procedure, electronic equipment, medium and product

CN115904386BActive Publication Date: 2026-04-14CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2022-11-11
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

[0003]然而,存储过程也存在缺点

Benefits of technology

[0023]This application provides a method, apparatus, electronic device, medium, and product for processing stored procedures. The method includes: receiving a stored procedure file and an identifier of a first database input by a user, wherein the stored procedure file supports execution in a second database; performing syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, and creating a Java task for calling the executable statements; extracting parameters from the stored procedure file, filling the parameters into a specification template corresponding to the stored procedure file to obtain Java code for the data persistence layer; and outputting a conversion result, wherein the conversion result includes the statement file, the Java task, and the Java code for the data persistence layer, and the conversion result supports execution in the first database. This solution, by batch processing stored procedures using a specification template, provides more readable results compared to manual processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115904386B_ABST
    Figure CN115904386B_ABST
Patent Text Reader

Abstract

The application provides a storage process processing method and device, electronic equipment, medium and product, and relates to the technical field of data processing. The method comprises the following steps: receiving a storage process file input by a user and an identifier of a first database, the storage process file supporting running in a second database; performing syntax conversion on the storage process file according to a syntax type of the first database to obtain executable statements, and creating a Java task for calling the executable statements; extracting parameters of the storage process file, filling the parameters into a specification template corresponding to the storage process file, and obtaining Java code of a data persistence layer; and outputting a conversion result, the conversion result comprising a statement file, the Java task and the Java code of the data persistence layer, the conversion result supporting running in the first database. According to the above scheme, the storage process is processed in batches through the specification template, and the readability of the processing result is higher compared with manual processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, electronic device, medium and product for processing stored procedures. Background Technology

[0002] In database applications, stored procedures with complex business logic offer advantages such as fast execution speed and minimal network transmission. When a stored procedure is created, the database parses and optimizes it. Once executed, the procedure remains in memory and can be directly invoked on subsequent runs. Stored procedures have their own self-contained data system, requiring only a few input parameters to start. All data access occurs within the database server, eliminating the need for data transfer with other servers.

[0003] However, stored procedures also have drawbacks. They have interface limitations; they can only interact with the Oracle database and cannot interact with other databases. Furthermore, stored procedures use Oracle's built-in functions and syntax, and cannot be run directly in other databases.

[0004] Given the above background, in practical applications, when switching from an Oracle database to another database, stored procedures need to be modified so that the modified code files can run in the other database. In practice, manually modifying these code files and improving their readability is crucial for increasing the success rate of the switched database. Summary of the Invention

[0005] This application provides a method, apparatus, electronic device, medium, and product for processing stored procedures, used to improve the readability of modified stored procedures.

[0006] In a first aspect, this application provides a method for processing stored procedures, comprising: receiving a stored procedure file and an identifier of a first database input by a user, wherein the stored procedure file supports execution in a second database; performing syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, and creating a Java task for calling the executable statements; extracting parameters from the stored procedure file, filling the parameters into a specification template corresponding to the stored procedure file to obtain Java code for a data persistence layer; and outputting a conversion result, wherein the conversion result includes the statement file, the Java task, and the Java code for the data persistence layer, and the conversion result supports execution in the first database.

[0007] In one possible implementation, the step of performing syntax conversion on the stored procedure file according to the syntax type of the first database to obtain an executable statement includes: splitting the statements in the stored procedure file into multiple statement fragments; rewriting the multiple statement fragments according to the syntax type of the first database; and arranging the rewritten statement fragments in ascending order according to the ascending order of the multiple statement fragments in the stored procedure file to obtain the executable statement.

[0008] In one possible implementation, before performing syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, the method further includes: determining a corresponding specification template according to the business attributes of the stored procedure file; wherein different business attributes correspond to different specification templates; and adjusting the data format of the stored procedure file according to the format of the specification template.

[0009] In one possible implementation, the method further includes: if there is no specification template corresponding to the business attributes of the stored procedure file, extracting the logical process corresponding to the business attributes of the stored procedure file, using the logical process as a framework to generate a corresponding specification template and storing it.

[0010] In one possible implementation, receiving the stored procedure file and the identifier of the first database input by the user includes: receiving the stored procedure file uploaded by the user on the front-end visual interface and the identifier of the first database input by the user; the output conversion result includes: displaying a download option for the conversion result on the front-end visual interface.

[0011] Secondly, this application provides a method for processing stored procedures, applied to a first database, comprising: receiving a conversion result, the conversion result including an executable statement corresponding to the stored procedure file, a Java task, and Java code of a data persistence layer; wherein, the executable statement is obtained by performing a syntax conversion on the stored procedure file based on a user-input stored procedure file and an identifier of the first database, the Java task is used to call the executable statement, and the Java code of the data persistence layer is obtained by extracting parameters from the stored procedure file and filling the parameters into a specification template corresponding to the stored procedure file; if an execution instruction is received, the Java code of the data persistence layer is run to execute the Java task to call the statement file, so as to complete the processing corresponding to the stored procedure file in the first database.

[0012] In one possible implementation, after receiving the conversion result, the method further includes: adding the first database and the conversion result to the project task; if an execution instruction is received, running the Java code of the data persistence layer, including: if the execution instruction sent by the project task is received, running the Java code of the data persistence layer; wherein the execution instruction is sent by the project task in response to the user's execution instruction.

[0013] Thirdly, this application provides a stored procedure processing apparatus, comprising: a receiving module for receiving a stored procedure file and an identifier of a first database input by a user, wherein the stored procedure file supports execution in a second database; a conversion module for performing syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, and creating a Java task for calling the executable statements; and extracting parameters from the stored procedure file, filling the parameters into a specification template corresponding to the stored procedure file to obtain Java code for a data persistence layer; and an output module for outputting a conversion result, wherein the conversion result includes the statement file, the Java task, and the Java code for the data persistence layer, and the conversion result supports execution in the first database.

[0014] In one possible implementation, the conversion module is specifically used to split the statements in the stored procedure file into multiple statement fragments; the conversion module is further used to rewrite the multiple statement fragments according to the syntax type of the first database; the conversion module is further used to arrange the rewritten statement fragments in ascending order according to the ascending order of the multiple statement fragments in the stored procedure file to obtain the executable statement.

[0015] In one possible implementation, the apparatus further includes: a determining module, configured to determine a corresponding specification template based on the business attributes of the stored procedure file; wherein different business attributes correspond to different specification templates; and an adjusting module, configured to adjust the data format of the stored procedure file according to the format of the specification template.

[0016] In one possible implementation, the determining module is further configured to, if there is no specification template corresponding to the business attributes of the stored procedure file, extract the logical process corresponding to the business attributes of the stored procedure file, use the logical process as a framework to generate a corresponding specification template, and store it.

[0017] In one possible implementation, the apparatus further includes: a display module for receiving a stored process file uploaded by a user on a front-end visual interface and an identifier of the first database input; the display module is also configured to display a download option for the conversion result on the front-end visual interface.

[0018] Fourthly, this application provides a stored procedure processing apparatus, comprising: an acquisition module, configured to receive a conversion result, the conversion result including an executable statement corresponding to the stored procedure file, a Java task, and Java code of a data persistence layer; wherein the executable statement is obtained by performing a syntax conversion on the stored procedure file based on a user-input stored procedure file and an identifier of a first database; the Java task is used to call the executable statement; and the Java code of the data persistence layer is obtained by extracting parameters from the stored procedure file and filling the parameters into a specification template corresponding to the stored procedure file; and a running module, configured to, upon receiving an execution instruction, run the Java code of the data persistence layer to execute the Java task to call the statement file, thereby completing the processing corresponding to the stored procedure file in the first database.

[0019] In one possible implementation, the apparatus further includes: an addition module for adding the first database and the transformation result to a project task; and a response module for running the Java code of the data persistence layer if the project task sends an execution instruction; wherein the execution instruction is sent by the project task in response to a user's execution instruction.

[0020] Fifthly, this application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method described in any one of the first aspects.

[0021] In a sixth aspect, this application provides a computer-readable storage medium storing computer-executable instructions, which are executed by a processor as described in any one of the first aspects.

[0022] In a seventh aspect, this application provides a computer program product including a computer program that is executed by a processor as described in any one of the first aspects.

[0023] This application provides a method, apparatus, electronic device, medium, and product for processing stored procedures. The method includes: receiving a stored procedure file and an identifier of a first database input by a user, wherein the stored procedure file supports execution in a second database; performing syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, and creating a Java task for calling the executable statements; extracting parameters from the stored procedure file, filling the parameters into a specification template corresponding to the stored procedure file to obtain Java code for the data persistence layer; and outputting a conversion result, wherein the conversion result includes the statement file, the Java task, and the Java code for the data persistence layer, and the conversion result supports execution in the first database. This solution, by batch processing stored procedures using a specification template, provides more readable results compared to manual processing. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0025] Figure 1 A schematic diagram illustrating an application scenario of a stored procedure processing method provided in an embodiment of this application;

[0026] Figure 2 A flowchart illustrating a method for processing a stored procedure provided in Embodiment 1 of this application;

[0027] Figure 3 Example of a specification template provided for embodiments of this application;

[0028] Figure 4 Examples of generating executable statements provided in this application embodiment;

[0029] Figure 5 Examples of visual interfaces provided for embodiments of this application;

[0030] Figure 6 A flowchart illustrating a method for processing a stored procedure provided in Embodiment 1 of this application;

[0031] Figure 7 A structural example diagram of a storage procedure processing apparatus provided in Embodiment 2 of this application;

[0032] Figure 8 A structural example diagram of a storage procedure processing apparatus provided in Embodiment 2 of this application;

[0033] Figure 9 A device block diagram of a storage procedure processing apparatus provided in Embodiment 3 of this application;

[0034] Figure 10 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of this application.

[0035] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0036] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0037] First, let's explain the terms involved:

[0038] Stored procedure: A set of structured query language statements designed to perform a specific function. It is stored in the database, compiled once, and remains valid indefinitely. Users run the stored procedure by specifying its name and providing parameters.

[0039] Figure 1 This is a schematic diagram illustrating an application scenario of a stored procedure processing method provided in an embodiment of this application. An example is given based on the illustrated scenario: the stored procedure can directly interact with the Oracle database, but cannot directly interact with other databases. The stored procedure is modified according to the syntax of other databases to obtain modified code, which can then interact with other databases.

[0040] The technical solutions of this application will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. In the description of this application, unless otherwise expressly specified and limited, the terms should be broadly understood within the art. The embodiments of this application will now be described with reference to the accompanying drawings.

[0041] Example 1

[0042] Figure 2 The following is a flowchart illustrating a method for processing a stored procedure according to Embodiment 1 of this application. The method includes the following steps:

[0043] S201. Receive a stored procedure file and an identifier of the first database input by the user, wherein the stored procedure file supports execution in the second database;

[0044] S202. Based on the syntax type of the first database, perform syntax conversion on the stored procedure file to obtain executable statements, and create a Java task for calling the executable statements; and extract the parameters of the stored procedure file, fill the parameters into the specification template corresponding to the stored procedure file, and obtain the Java code of the data persistence layer.

[0045] S203. Output the conversion result, which includes the statement file, the Java task, and the Java code of the data persistence layer. The conversion result supports running in the first database.

[0046] As an example, the execution entity of this embodiment can be a storage process processing device, which can be implemented in various ways. For example, it can be program software, or a medium storing related computer programs, such as a USB flash drive; or, the device can also be a physical device that integrates or installs related computer programs, such as a chip, a smart terminal, a computer, a server, etc.

[0047] In one example, before S201, the method further includes: determining a corresponding specification template based on the business attributes of the stored procedure file; wherein different business attributes correspond to different specification templates; and adjusting the data format of the stored procedure file according to the format of the specification template.

[0048] One possible implementation is to adjust the data format of the stored procedure file, including standardizing the stored procedure comments, standardizing the variables used by the stored procedure, and standardizing the body statements of the stored procedure. The stored procedure comments explain the main business logic performed by the stored procedure and any precautions; these comments should be placed after the `Create` statement. Variables used by the stored procedure should be placed after the `Is` statement. The body statements of the stored procedure contain the actual business logic of the stored procedure; these should be placed after the `Begin` statement.

[0049] It should be noted that this application does not restrict the specific format of the specification template.

[0050] In a scenario example, although stored procedures generally follow pre-defined development standards during development by technical personnel, differences can still exist between stored procedures developed by different personnel. By standardizing the format of templates and adjusting the data format of the stored procedure files, the readability of the modified stored procedures can be improved.

[0051] Based on the above implementation methods, by adjusting the data format of the stored procedure file, the differences caused by different technicians developing the stored procedure can be eliminated, thereby improving the readability of the modified stored procedure.

[0052] Furthermore, in one example, the method for processing stored procedures also includes: if there is no specification template corresponding to the business attributes of the stored procedure file, extracting the logical procedure corresponding to the business attributes of the stored procedure file, using the logical procedure as a framework to generate a corresponding specification template and storing it.

[0053] As one possible implementation method, such as Figure 3 As shown, Figure 3 This is an example of a standardized template. Based on the stored procedure's business attributes, a matching standardized template is searched in the template library. If found, the data format of the stored procedure file is adjusted to match the found standardized template. If no matching standardized template is found in the template library, a standardized template conforming to the stored procedure file is generated and added to the template library.

[0054] Based on the above implementation methods, the scheme of setting up new standard templates can improve the scalability of various types of stored procedure files.

[0055] In one example, S201 includes: splitting the statements in the stored procedure file into multiple statement fragments; rewriting the multiple statement fragments according to the syntax type of the first database; and arranging the rewritten statement fragments in ascending order according to the ascending order of the multiple statement fragments in the stored procedure file to obtain the executable statement.

[0056] As one possible implementation method, such as Figure 4 As shown, Figure 4 To generate an example of an executable statement, the stored procedure is broken down into multiple independently executable statement fragments that perform their respective functions. Each first database has a corresponding syntax type. The statement fragments are then rewritten according to the syntax type of the target first database. The statement fragments themselves have an execution order, which is reflected in the nested hierarchy within the stored procedure. In the second database, the stored procedure executes according to this execution order. The stored procedure's functions can only be realized by executing the statement fragments in the correct order. Therefore, the rewritten statement fragments are arranged in ascending order of their corresponding execution order to obtain the executable statement.

[0057] In a scenario example, a stored procedure integrates multiple statement fragments to implement complex business logic in a second database. However, the first database cannot run such complex business logic, so it needs to be split. Rewriting the split results according to the syntax of the first database can improve the readability of the split results.

[0058] Based on the above implementation methods, the executable statements obtained through syntax transformation can improve readability.

[0059] The above solutions illustrate the processing methods for stored procedures. Next, we will illustrate the front-end visual interface used for user interaction.

[0060] In one example, S201 includes: receiving a stored process file uploaded by a user on a front-end visual interface and an identifier of the first database; the output conversion result includes: displaying a download option for the conversion result on the front-end visual interface.

[0061] As one possible implementation method, such as Figure 5 As shown, Figure 5 This is an example of a visual interface. Users upload stored procedures and fill in their information, including the project team, the person making the changes, the target database, and the name of the stored procedure. Clicking "Submit" begins the stored procedure's processing flow. Users can click the "Download" option to download the completed transformation results.

[0062] As an example, users can click the reset option to reset the currently entered information and the currently uploaded stored procedure. Users can select the target database through the drop-down menu.

[0063] Based on the above implementation methods, the user's operations can be reduced through a front-end visual interface, thereby improving the processing efficiency of stored procedures.

[0064] Figure 6 The flowchart illustrates a stored procedure processing method provided in Embodiment 1 of this application, applied to a first database. The method includes the following steps:

[0065] S301. Receive the conversion result, the conversion result including the executable statement corresponding to the stored procedure file, the Java task, and the Java code of the data persistence layer; wherein, the executable statement is obtained by performing a syntax conversion on the stored procedure file based on the user-input stored procedure file and the identifier of the first database, the Java task is used to call the executable statement, and the Java code of the data persistence layer is obtained by extracting the parameters of the stored procedure file and filling the parameters into the specification template corresponding to the stored procedure file;

[0066] S302. If an execution instruction is received, the Java code of the data persistence layer is run to execute the Java task to call the statement file, so as to complete the processing corresponding to the stored procedure file in the first database.

[0067] In one example, after S301, the method further includes: adding the first database and the transformation result to the engineering task; S302 includes: if the execution instruction sent by the engineering task is received, then running the Java code of the data persistence layer; wherein the execution instruction is sent by the engineering task in response to the user's execution instruction.

[0068] One possible implementation is to incorporate a first database and its transformation results into a project task, with the project task user-controlled by the first database. The user only needs to issue an execution command to the project task, which can then respond by sending execution commands to the first database.

[0069] Based on the above implementation methods, using engineering tasks to execute the conversion results can reduce user operations and improve operational efficiency.

[0070] The stored procedure processing method provided in this embodiment receives a stored procedure file and an identifier of a first database input by the user. The stored procedure file supports execution in a second database. Based on the syntax type of the first database, the stored procedure file is syntax-converted to obtain executable statements, and a Java task for calling the executable statements is created. Parameters of the stored procedure file are extracted and filled into a corresponding specification template to obtain Java code for the data persistence layer. The conversion result is output, including the statement file, the Java task, and the Java code for the data persistence layer. The conversion result supports execution in the first database. This solution, by batch processing stored procedures using a specification template, provides more readable results compared to manual processing.

[0071] Example 2

[0072] Figure 7 This is a schematic diagram of the structure of a storage procedure processing device provided in Embodiment 2 of this application, as shown below. Figure 7 As shown, the processing apparatus for the stored procedure includes:

[0073] The receiving module 71 is used to receive a stored procedure file and an identifier of the first database input by the user, wherein the stored procedure file supports execution in the second database;

[0074] The conversion module 72 is used to perform syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, and create a Java task for calling the executable statements; and to extract the parameters of the stored procedure file, fill the parameters into the specification template corresponding to the stored procedure file, and obtain the Java code of the data persistence layer.

[0075] Output module 73 is used to output conversion results, which include the statement file, the Java task, and the Java code of the data persistence layer. The conversion results support running in the first database.

[0076] In one example, the stored procedure processing apparatus further includes: a determining module 74, configured to determine a corresponding specification template based on the business attributes of the stored procedure file; wherein different business attributes correspond to different specification templates; and an adjusting module 75, configured to adjust the data format of the stored procedure file according to the format of the specification template.

[0077] One possible implementation is to adjust the data format of the stored procedure file, including standardizing the stored procedure comments, standardizing the variables used by the stored procedure, and standardizing the body statements of the stored procedure. The stored procedure comments explain the main business logic performed by the stored procedure and any precautions; these comments should be placed after the `Create` statement. Variables used by the stored procedure should be placed after the `Is` statement. The body statements of the stored procedure contain the actual business logic of the stored procedure; these should be placed after the `Begin` statement.

[0078] It should be noted that this application does not restrict the specific format of the specification template.

[0079] In a scenario example, although stored procedures generally follow pre-defined development standards during development by technical personnel, differences can still exist between stored procedures developed by different personnel. By standardizing the format of templates and adjusting the data format of the stored procedure files, the readability of the modified stored procedures can be improved.

[0080] Based on the above implementation methods, by adjusting the data format of the stored procedure file, the differences caused by different technicians developing the stored procedure can be eliminated, thereby improving the readability of the modified stored procedure.

[0081] Furthermore, in one example, the determining module 74 is also used to extract the logical process corresponding to the business attributes of the stored procedure file if there is no specification template corresponding to the business attributes of the stored procedure file, and use the logical process as a framework to generate and store the corresponding specification template.

[0082] As one possible implementation method, such as Figure 3 As shown, Figure 3 This is an example of a standardized template. Based on the stored procedure's business attributes, a matching standardized template is searched in the template library. If found, the data format of the stored procedure file is adjusted to match the found standardized template. If no matching standardized template is found in the template library, a standardized template conforming to the stored procedure file is generated and added to the template library.

[0083] Based on the above implementation methods, the scheme of setting up new standard templates can improve the scalability of various types of stored procedure files.

[0084] In one example, the conversion module 72 is specifically used to split the statements of the stored procedure file into multiple statement fragments; the conversion module 72 is also specifically used to rewrite the multiple statement fragments according to the syntax type of the first database; the conversion module 72 is also specifically used to arrange the rewritten statement fragments in ascending order according to the ascending order of the multiple statement fragments in the stored procedure file to obtain the executable statement.

[0085] As one possible implementation method, such as Figure 4 As shown, Figure 4 To generate an example of an executable statement, the stored procedure is broken down into multiple independently executable statement fragments that perform their respective functions. Each first database has a corresponding syntax type. The statement fragments are then rewritten according to the syntax type of the target first database. The statement fragments themselves have an execution order, which is reflected in the nested hierarchy within the stored procedure. In the second database, the stored procedure executes according to this execution order. The stored procedure's functions can only be realized by executing the statement fragments in the correct order. Therefore, the rewritten statement fragments are arranged in ascending order of their corresponding execution order to obtain the executable statement.

[0086] In a scenario example, a stored procedure integrates multiple statement fragments to implement complex business logic in a second database. However, the first database cannot run such complex business logic, so it needs to be split. Rewriting the split results according to the syntax of the first database can improve the readability of the split results.

[0087] Based on the above implementation methods, the executable statements obtained through syntax transformation can improve readability.

[0088] The above solutions illustrate the processing methods for stored procedures. Next, we will illustrate the front-end visual interface used for user interaction.

[0089] In one example, the stored procedure processing apparatus further includes: a display module 76, configured to receive the stored procedure file uploaded by the user on a front-end visual interface and the identifier of the first database input; the display module 76 is also configured to display a download option for the conversion result on the front-end visual interface.

[0090] As one possible implementation method, such as Figure 5 As shown, Figure 5This is an example of a visual interface. Users upload stored procedures and fill in their information, including the project team, the person making the changes, the target database, and the name of the stored procedure. Clicking "Submit" begins the stored procedure's processing flow. Users can click the "Download" option to download the completed transformation results.

[0091] As an example, users can click the reset option to reset the currently entered information and the currently uploaded stored procedure. Users can select the target database through the drop-down menu.

[0092] Based on the above implementation methods, the user's operations can be reduced through a front-end visual interface, thereby improving the processing efficiency of stored procedures.

[0093] Figure 8 This is a schematic diagram of the structure of a storage procedure processing device provided in Embodiment 1 of this application, as shown below. Figure 8 As shown, the processing apparatus for the stored procedure includes:

[0094] The acquisition module 81 is used to receive the conversion result, which includes the executable statement corresponding to the stored procedure file, the Java task, and the Java code of the data persistence layer; wherein, the executable statement is obtained by performing a syntax conversion on the stored procedure file based on the user-input stored procedure file and the identifier of the first database; the Java task is used to call the executable statement; and the Java code of the data persistence layer is obtained by extracting the parameters of the stored procedure file and filling the parameters into the specification template corresponding to the stored procedure file.

[0095] The execution module 82 is configured to, upon receiving an execution instruction, run the Java code of the data persistence layer to execute the Java task to call the statement file, so as to complete the processing corresponding to the stored procedure file in the first database.

[0096] In one example, the stored procedure processing apparatus further includes: an addition module 83, configured to add the first database and the transformation result to a project task; and a response module 84, configured to run the Java code of the data persistence layer if the project task sends the execution instruction; wherein the execution instruction is sent by the project task in response to a user's execution instruction.

[0097] One possible implementation is to incorporate a first database and its transformation results into a project task, with the project task user-controlled by the first database. The user only needs to issue an execution command to the project task, which can then respond by sending execution commands to the first database.

[0098] Based on the above implementation methods, using engineering tasks to execute the conversion results can reduce user operations and improve operational efficiency.

[0099] The stored procedure processing apparatus provided in this embodiment includes a receiving module for receiving a stored procedure file and an identifier of a first database input by a user, wherein the stored procedure file supports execution in a second database; a conversion module for performing syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, and creating a Java task for calling the executable statements; and extracting parameters from the stored procedure file, filling the parameters into a corresponding specification template of the stored procedure file to obtain Java code for the data persistence layer; and an output module for outputting the conversion result, which includes the statement file, the Java task, and the Java code for the data persistence layer, and the conversion result supports execution in the first database. This solution, by batch processing stored procedures using a specification template, provides more readable results compared to manual processing.

[0100] Example 3

[0101] Figure 9 This is a block diagram of a storage process processing apparatus according to an exemplary embodiment. The apparatus may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0102] The device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output interface 812, a sensor component 814, and a communication component 816.

[0103] Processing component 802 typically controls the overall operation of device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.

[0104] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0105] Power supply component 806 provides power to various components of device 800. Power supply component 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to device 800.

[0106] Multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen may be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0107] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.

[0108] Input / output interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0109] Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of device 800, changes in the position of device 800 or a component of device 800, the presence or absence of user contact with device 800, the orientation or acceleration / deceleration of device 800, and temperature changes of device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include an optical sensor, such as a complementary metal-oxide-semiconductor (CMOS) image sensor or a charge-coupled device (CCD), for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.

[0110] Communication component 816 is configured to facilitate wired or wireless communication between device 800 and other devices. Device 800 can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G, or 5G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, NFC modules can be implemented based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra-Wide Band (UWB), Bluetooth, and other technologies.

[0111] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0112] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of the device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0113] Example 4

[0114] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 10 As shown, the electronic device includes:

[0115] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, memory 292, and communication interface 293 can communicate with each other via the bus 294. The communication interface 293 can be used for information transmission. The processor 291 can invoke logical instructions stored in the memory 292 to execute the methods of the above embodiments.

[0116] Furthermore, the logic instructions in the aforementioned memory 292 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0117] The memory 292, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, thereby implementing the methods in the above-described method embodiments.

[0118] The memory 292 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 292 may include high-speed random access memory and may also include non-volatile memory.

[0119] This application provides a non-transitory computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods described in the foregoing embodiments.

[0120] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the foregoing embodiments.

[0121] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0122] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for processing a stored procedure, characterized in that, include: The system receives a stored procedure file and an identifier of a first database from the user, wherein the stored procedure file supports execution in a second database. Based on the syntax type of the first database, the stored procedure file is syntactically converted to obtain executable statements, and a Java task for calling the executable statements is created. Additionally, the parameters of the stored procedure file are extracted, and the parameters are filled into the specification template corresponding to the stored procedure file to obtain the Java code of the data persistence layer; The process of performing syntax transformation on the stored procedure file to obtain executable statements includes: splitting the statements in the stored procedure file into multiple statement fragments; rewriting the multiple statement fragments according to the syntax type of the first database; and arranging the rewritten statement fragments in ascending order according to their order in the stored procedure file to obtain the executable statements. Before performing syntax conversion on the stored procedure file to obtain executable statements, the method further includes: determining a corresponding specification template based on the business attributes of the stored procedure file; wherein different business attributes correspond to different specification templates; and adjusting the data format of the stored procedure file according to the format of the specification template. The output transformation result includes the executable statement, the Java task, and the Java code of the data persistence layer. The transformation result supports running in the first database.

2. The method according to claim 1, characterized in that, The method further includes: If there is no standard template corresponding to the business attributes of the stored procedure file, then extract the logical process corresponding to the business attributes of the stored procedure file, use the logical process as a framework to generate the corresponding standard template, and store it.

3. The method according to claim 1, characterized in that, The identifiers of the stored procedure file and the first database input by the user include: Receive the stored procedure file uploaded by the user in the front-end visual interface and the identifier of the first database entered by the user; The output conversion result includes: The front-end visual interface displays the download option for the conversion results.

4. A method for processing a stored procedure, characterized in that, Applied to the first database, including: The conversion result is received, which includes the executable statement corresponding to the stored procedure file, the Java task, and the Java code of the data persistence layer; wherein, the executable statement is obtained by performing a syntax conversion on the stored procedure file based on the user-input stored procedure file and the identifier of the first database; the Java task is used to call the executable statement; and the Java code of the data persistence layer is obtained by extracting the parameters of the stored procedure file and filling the parameters into the specification template corresponding to the stored procedure file. After receiving the conversion result, the process further includes: adding the first database and the conversion result to the project task; If an execution instruction is received, the Java code of the data persistence layer is run to execute the Java task to call the executable statement in order to complete the processing corresponding to the stored procedure file in the first database; Specifically, if an execution instruction is received, the Java code of the data persistence layer is executed, including: if the execution instruction sent by the project task is received, the Java code of the data persistence layer is executed; wherein the execution instruction is sent by the project task in response to the user's execution instruction.

5. A storage procedure processing apparatus, characterized in that, include: A receiving module is used to receive a stored procedure file and an identifier of a first database input by the user, wherein the stored procedure file supports execution in a second database; The conversion module is used to perform syntax conversion on the stored procedure file according to the syntax type of the first database to obtain executable statements, and to create a Java task for calling the executable statements; Additionally, the parameters of the stored procedure file are extracted, and the parameters are filled into the specification template corresponding to the stored procedure file to obtain the Java code of the data persistence layer; The conversion module is specifically used to split the statements in the stored procedure file into multiple statement fragments; the conversion module is also specifically used to rewrite the multiple statement fragments according to the syntax type of the first database; the conversion module is also specifically used to arrange the rewritten statement fragments in ascending order according to the ascending order of the multiple statement fragments in the stored procedure file to obtain the executable statement. The determining module is used to determine the corresponding specification template based on the business attributes of the stored procedure file; wherein different business attributes correspond to different specification templates; the adjusting module is used to adjust the data format of the stored procedure file according to the format of the specification template. An output module is used to output the transformation result, which includes the executable statement, the Java task, and the Java code of the data persistence layer. The transformation result supports running in the first database.

6. The apparatus according to claim 5, characterized in that, The determining module is further configured to, if there is no standard template corresponding to the business attributes of the stored procedure file, extract the logical process corresponding to the business attributes of the stored procedure file, use the logical process as a framework to generate a corresponding standard template and store it.

7. The apparatus according to claim 5, characterized in that, The device further includes: The display module is used to receive the stored procedure file uploaded by the user on the front-end visual interface and the identifier of the first database input by the user. The display module is also used to display the download option of the conversion result on the front-end visualization interface.

8. A storage procedure processing apparatus, characterized in that, include: The acquisition module is used to receive the conversion results, which include the executable statements corresponding to the stored procedure file, the Java task, and the Java code of the data persistence layer; wherein, the executable statements are obtained by performing syntax conversion on the stored procedure file based on the user-input stored procedure file and the identifier of the first database; the Java task is used to call the executable statements; and the Java code of the data persistence layer is obtained by extracting the parameters of the stored procedure file and filling the parameters into the specification template corresponding to the stored procedure file. The module is used to add the first database and the transformation result to the project task; The execution module is used to run the Java code of the data persistence layer if an execution instruction is received, so as to execute the Java task to call the executable statement, so as to complete the processing corresponding to the stored procedure file in the first database; A response module is configured to run the Java code of the data persistence layer if it receives the execution instruction sent by the project task; wherein the execution instruction is sent by the project task in response to the user's execution instruction.

9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-4.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-4.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Database language type switching method and device, computer equipment and storage medium

    CN113127124A

  • SQL (Structured Query Language) statement processing method and device, electronic equipment and storage medium

    CN115269632A