Code processing method, business processing method, device, electronic equipment and medium
By updating the stored procedure code of the source database to the call functions supported by the target database during the database migration process, the problem of code not running normally after migration was solved, the migration efficiency and transformation efficiency were improved, and human error was reduced.
Patent Information
- Application Number
- CN202310800617.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-06-30
AI Technical Summary
Because the source database before migration and the target database after migration are different, some data types of code cannot run normally in the target database, resulting in complex migration operations and low migration efficiency.
By obtaining the original stored procedure code from the source database, detecting the data type, updating each original calling function to the target calling function, generating the target stored procedure code, and completing the database migration process while ensuring that the relationships between and within the stored procedures remain unchanged.
The transformation workload was reduced, the transformation time was shortened, the transformation efficiency was improved, and coding errors caused by manual intervention were reduced, thus ensuring the normal operation of the target database and the provision of business functions.
Smart Images

Figure CN116775618B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of big data technology, and more specifically to a code processing method, business processing method, apparatus, electronic device, and medium. Background Technology
[0002] In the field of big data technology, enterprises can migrate various types of data, such as business data, from Oracle databases to other databases to perform data storage, management, and computation operations on the migrated database. For example, Gaussian Database can be used as the target database to manage and compute the migrated data and provide services to users based on it.
[0003] In the process of realizing the above-mentioned inventive concept, the inventors discovered that because the source database before migration and the target database after migration are different, the code of some data types cannot run normally in the target database, which causes the migration operation to be complicated and the migration efficiency to be low. Summary of the Invention
[0004] In view of the above problems, this disclosure provides a code processing method, a business processing method, an apparatus, an electronic device, and a medium.
[0005] According to a first aspect of this disclosure, a code processing method is provided, comprising:
[0006] Obtain the code of the original stored procedure from the source database. The original stored procedure includes M original calling functions, which are used to jointly implement the business functions of the original stored procedure. M is greater than or equal to 1.
[0007] In response to detecting that the data type of the original stored procedure is the target data type, each original calling function is updated to the target calling function, thus obtaining the code of the target stored procedure; and
[0008] Store the code of the target stored procedure.
[0009] According to embodiments of this disclosure, in response to detecting that the data type of the original stored procedure is the target data type, each original calling function is updated to the target calling function to obtain the code of the target stored procedure, including: for each original calling function,
[0010] Modify the call path code of the original calling function to the call path code of the target calling function.
[0011] According to embodiments of this disclosure, the call path code includes a function name and function prefix information; the function name of the target call function is the same as the function name of the original call function, and modifying the call path code of the original call function to the call path code of the target call function includes:
[0012] Replace the function prefix information of the original called function with the target string, where the target string represents the function package to which the target called function belongs; and
[0013] Concatenate the target string with the function name to form the call path of the target function.
[0014] According to embodiments of this disclosure, the target data type includes an Extensible Markup Language (EXPLAIN) format processing type.
[0015] A second aspect of this disclosure provides a business processing method, comprising: in response to receiving a business request from a user, executing the code of a target stored procedure that matches the business request, obtaining an execution result, wherein the code of the target stored procedure is determined according to the above-described code processing method; and outputting the execution result.
[0016] According to embodiments of this disclosure, in response to receiving a business request from a user, executing code of a target stored procedure matching the business request to obtain an execution result includes:
[0017] Parse the business request to obtain parsed data, which includes business type, data type, and execution data;
[0018] Based on the business type and data type, determine the code of the target stored procedure, where the target stored procedure includes M target call functions, where M is greater than or equal to 1; and
[0019] Call at least one target function to process the execution data and obtain the execution result.
[0020] According to embodiments of this disclosure, the target calling function includes an insertion function, and the execution data includes a first execution node and an insertion string;
[0021] Calling at least one target function to process the execution data yields the following execution results:
[0022] Calling the insert function inserts a string before or after the first execution node, and obtains the execution result. At the same time as inserting the string, the data type of the target stored procedure is converted to a string type.
[0023] According to embodiments of this disclosure, the target calling function includes an update function, and the execution data includes a second execution node and an update value;
[0024] Calling at least one function to process the execution data yields the following results:
[0025] The update function is called to update the parameter value of the second execution node to the updated value. At the same time as updating the parameter value of the second execution node, the data type of the target stored procedure is converted to string type.
[0026] According to embodiments of this disclosure, the target calling function includes a deletion function, and the execution data includes a third execution node;
[0027] Calling at least one target function to process the execution data yields the following execution results:
[0028] The delete function is called to delete the third execution node. At the same time as deleting the third execution node, the data type of the target stored procedure is converted to string type.
[0029] According to embodiments of this disclosure, the target calling function includes a query function, and the execution data includes a fourth execution node;
[0030] Calling at least one target function to process the execution data yields the following execution results:
[0031] The query function is called to read the node path of the fourth execution node. While reading the node path, the data type of the target stored procedure is converted to a string type.
[0032] A third aspect of this disclosure provides a code processing apparatus, comprising:
[0033] The acquisition module is used to acquire the code of the original stored procedure in the source database. The original stored procedure includes M original calling functions, which are used to jointly implement the business functions of the original stored procedure. M is greater than or equal to 1.
[0034] The update module, in response to detecting that the data type of the original stored procedure is the target data type, updates each original calling function to the target calling function, thereby obtaining the code of the target stored procedure; and
[0035] The storage module is used to store the code of the target stored procedure.
[0036] A fourth aspect of this disclosure provides a business processing apparatus, comprising:
[0037] The execution module is used to respond to a business request received from a user, execute the code of the target stored procedure that matches the business request, and obtain the execution result. The target stored procedure is determined according to the code processing method described above. The output module is used to output the execution result.
[0038] A fifth aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to perform the code processing method and the business processing method described above.
[0039] A sixth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the above-described code processing method and business processing method.
[0040] The seventh aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described code processing method and business processing method.
[0041] This disclosure obtains the code of the original stored procedure from the source database, wherein the original stored procedure includes M original calling functions; in response to detecting that the data type of the original stored procedure is the target data type, each original calling function is updated to the target calling function to obtain the code of the target stored procedure; and stores the code of the target stored procedure. While ensuring the nesting and calling relationships between and within stored procedures, this method can complete the transformation of stored procedures during database migration. Since the code processing does not require manual sorting of calling relationships or code transformation for each stored procedure, it achieves the technical effects of reducing the workload, reducing the time spent on transformation, improving transformation efficiency, and reducing coding errors caused by manual intervention. Attached Figure Description
[0042] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0043] Figure 1 This illustration schematically depicts an application scenario of the code processing method and business processing method according to embodiments of the present disclosure;
[0044] Figure 2 A flowchart illustrating a code processing method according to an embodiment of the present disclosure is shown schematically.
[0045] Figure 3 A flowchart illustrating the modification of the call path of the target function according to an embodiment of the present disclosure is shown schematically;
[0046] Figure 4 A flowchart illustrating a service processing method according to an embodiment of the present disclosure is shown schematically.
[0047] Figure 5 A flowchart illustrating the determination of execution results according to embodiments of the present disclosure is shown schematically.
[0048] Figure 6 A schematic block diagram of a code processing apparatus according to an embodiment of the present disclosure is shown.
[0049] Figure 7 A schematic block diagram of a service processing apparatus according to an embodiment of the present disclosure is shown; and
[0050] Figure 8 A block diagram schematically illustrates an electronic device suitable for code processing methods and business processing methods according to embodiments of the present disclosure. Detailed Implementation
[0051] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0052] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0053] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0054] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).
[0055] It should be noted that the processing methods, business processing methods, and devices disclosed herein can be used in the application of big data in the financial field, and can also be used in any field other than the financial field. The application fields of the processing methods, business processing methods, and devices disclosed herein are not limited.
[0056] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of data (including but not limited to user personal information) comply with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals.
[0057] In the field of big data technology, enterprises can migrate various types of data, such as business data, from Oracle databases to other databases to perform data storage, management, and computation operations based on the migrated database. For example, Gaussian Database can be used as the target database to perform business operations using the migrated data.
[0058] In practical applications, the source database before data migration and the target database after data migration are different. For example, as a source database, Oracle supports the xmltype data type and supports the storage and computation of XML message type data objects. While Gaussian Database, as a target database, can retain stored procedures written in Procedural Language / SQL (PL / SQL), it cannot execute stored procedures of the xmltype data type.
[0059] To address the above situation, relevant technologies typically involve rewriting or modifying the stored procedure according to the business logic, transforming the entire stored procedure into a Java program so that the target database can simultaneously support the xmltype data type and other data types. However, transforming a stored procedure into a Java program is a massive undertaking, which is why large-scale existing application systems choose GaussDatabase to retain stored procedures.
[0060] Furthermore, stored procedures are interconnected and nested, making it technically challenging to modify only stored procedures containing the xmltype data type. Modifying only these procedures would involve complex restructuring and extensive modifications. If only stored procedures containing xmltype data types are modified, the processing of the xmltype data fields would need to be extracted as pre- or post-processing Java code, thus introducing the risk of altering the transaction flow.
[0061] During the data migration and transformation process, the inventors discovered that, due to the differences between the source and target databases, existing technologies suffer from complex migration operations and low migration efficiency in order to ensure that the migrated data and code run normally in the target database.
[0062] Embodiments of this disclosure provide a code processing method, including: obtaining the code of an original stored procedure from a source database, wherein the original stored procedure includes M original calling functions, the M original calling functions are used to jointly implement the business functions of the original stored procedure, and M is greater than or equal to 1; in response to detecting that the data type of the original stored procedure is a target data type, updating each original calling function to the target calling function to obtain the code of the target stored procedure; and storing the code of the target stored procedure.
[0063] Figure 1 The illustrations depict application scenarios of the code processing method and business processing method according to embodiments of the present disclosure.
[0064] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0065] Users can interact with server 105 via network 104 using at least one of the first terminal device 101, second terminal device 102, and third terminal device 103 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, second terminal device 102, and third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0066] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0067] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0068] For example, server 105 can obtain the code of the original stored procedure in the source database, wherein the original stored procedure includes M original calling functions, the M original calling functions are used to jointly implement the business function of the original stored procedure, and M is greater than or equal to 1; in response to detecting that the data type of the original stored procedure is the target data type, each original calling function is updated to the target calling function to obtain the code of the target stored procedure; and the code of the target stored procedure is stored.
[0069] Alternatively, a source database or a target database can be deployed on server 105. After determining the code of the target stored procedure based on the code of the original stored procedure, the target database responds to the business request received from the user by executing the code of the target stored procedure that matches the business request, obtaining the execution result, and outputting the execution result.
[0070] It should be noted that the code processing method and business processing method provided in the embodiments of this disclosure can generally be executed by server 105. Correspondingly, the code processing device and business processing device provided in the embodiments of this disclosure can generally be located in server 105. The code processing method and business processing method provided in the embodiments of this disclosure can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the code processing device and business processing device provided in the embodiments of this disclosure can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0071] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0072] The following will be based on Figure 1 The described scene, through Figures 2-3 The code processing method of the disclosed embodiments will be described in detail.
[0073] Figure 2 A flowchart illustrating a code processing method according to an embodiment of the present disclosure is shown schematically.
[0074] like Figure 2 As shown, the method 200 includes operations S210 to S230.
[0075] According to embodiments of this disclosure, a stored procedure is a database object, which can be viewed as a function or subroutine within a database, belonging to a specific combination of code within the database. A stored procedure can be understood as the process of storing complex programs in a database for external programs to call.
[0076] In operation S210, the code of the original stored procedure in the source database is obtained. The original stored procedure includes M original calling functions, which are used to jointly implement the business functions of the original stored procedure. M is greater than or equal to 1.
[0077] According to embodiments of this disclosure, the original stored procedure can be understood as the code executed by the source database to implement business functions, and the target stored procedure can be understood as the code executed by the target database to implement the same business functions. Embodiments of this disclosure transform the original stored procedure in the source database, which belongs to the target data type, into the target stored procedure so that the target database can execute the target stored procedure normally and provide services to users.
[0078] According to embodiments of this disclosure, the original stored procedure includes multiple original calling functions, which are used to perform multiple operations, such as original calling functions for performing query operations and original calling functions for performing calculation operations. The original stored procedure can implement the corresponding business functions through M original calling functions.
[0079] For example, for the original stored procedure used to implement the transfer operation, according to the business execution logic, the original stored procedure includes original call functions for querying the transfer user, executing the transfer operation, and querying the balance after the transfer.
[0080] In operation S220, in response to detecting that the data type of the original stored procedure is the target data type, each original calling function is updated to the target calling function, and the code of the target stored procedure is obtained.
[0081] According to embodiments of this disclosure, the data type of the original stored procedure can be understood as a data type that matches the type of the object being processed by the original stored procedure.
[0082] According to embodiments of this disclosure, the target data type represents the data types supported by the source database. The target database may or may not support the target data type described above.
[0083] Specifically, if the target database does not support the target data type mentioned above, by updating each original calling function to the target calling function, obtaining and storing the code of the target stored procedure, it can be ensured that the target database can execute the code of the target stored procedure normally.
[0084] If the target database supports the target data types mentioned above, by updating each original calling function to the target calling function, the code of the target stored procedure can be obtained and stored. This allows the original calling functions to be flexibly switched to the data types supported by the target database, so that other processing can be performed on the target stored procedure later, such as statistical information, anomaly location, etc.
[0085] According to embodiments of this disclosure, the code of an original stored procedure can be obtained from a source database based on the business type. Then, the data type of the original stored procedure can be analyzed, updated, and stored. Alternatively, the code of multiple original stored procedures can be obtained from the source database in batches, and the data type of each original stored procedure can be analyzed, updated, and stored.
[0086] According to embodiments of this disclosure, the source database includes at least one database that supports the target data type, such as an Oracle database.
[0087] According to embodiments of this disclosure, the target calling function differs from the original calling function in its data processing type and / or data processing logic, but the final result is the same or similar. For example, the original calling function is used to perform a query operation, and the execution logic of the target calling function is different from that of the original calling function, but the operation performed by calling the target calling function is still a query operation.
[0088] In operation S230, the code of the target stored procedure is stored.
[0089] According to embodiments of this disclosure, after updating the original calling function to the target calling function and obtaining the code of the target stored function, the code of the target stored procedure can be stored in a preset location of the target database so that the target database can provide corresponding business functions or services to users based on the target stored procedure.
[0090] This disclosure obtains the code of the original stored procedure from the source database, wherein the original stored procedure includes M original calling functions; in response to detecting that the data type of the original stored procedure is the target data type, each original calling function is updated to the target calling function to obtain the code of the target stored procedure; and stores the code of the target stored procedure. While ensuring the nesting and calling relationships between and within stored procedures, this method can complete the transformation of stored procedures during database migration. Since the code processing does not require manual sorting of calling relationships or code transformation for each stored procedure, it achieves the technical effects of reducing the workload, reducing the time spent on transformation, improving transformation efficiency, and reducing coding errors caused by manual intervention.
[0091] According to an embodiment of this disclosure, in response to detecting that the data type of the original stored procedure is the target data type, each original calling function is updated to the target calling function to obtain the code of the target stored procedure, including: for each original calling function, modifying the call path code of the original calling function to the call path code of the target calling function.
[0092] According to embodiments of this disclosure, when the target database does not support the target data type, the target database cannot call the original calling function or obtain the result of the original calling function, thus making the target database not support the original calling function.
[0093] According to embodiments of this disclosure, the original stored procedure can invoke the function by determining the call path of the original calling function. Therefore, when updating the original calling function to the target calling function, function replacement can be achieved by modifying the call path code.
[0094] In the embodiments of this disclosure, since there are mutual calls and nesting relationships between stored procedures, and between multiple functions within a stored procedure, the function replacement operation can be completed simply and quickly by modifying the call path code, thereby improving the efficiency of the modification.
[0095] According to embodiments of this disclosure, the target data type includes an Extensible Markup Language Type (XMLType). The processing object of the original stored procedure whose data type is the target data type is an XML object.
[0096] For example, for Oracle databases, the system functions used to handle XMLType types mainly include: (1) the sys.xmltype.createXML function to create data objects; (2) the InsertXMLBefore, InsertXMLAfter, and InsertChildXML functions to insert new nodes; (3) the updateXML function to update node values; (4) the deleteXML function to delete nodes; and (5) node value query functions such as extract, extractValue, and existsNode. When the target database is not an Oracle database, these system functions cannot be called, causing the original stored procedures to fail to run properly in the target database.
[0097] According to embodiments of this disclosure, the target database can generate a target stored procedure by adding system functions for the XMLType type, replacing the source database's system functions with the target database's system functions, and enabling the target database to run the business functions corresponding to the original stored procedure normally.
[0098] According to embodiments of this disclosure, during data processing using system functions, the data type of the target stored procedure is converted to a data type supported by the target database. Therefore, after processing using system functions, the target database can continue processing the converted target stored procedure without altering its nesting relationships.
[0099] According to embodiments of this disclosure, the data type of the converted target stored procedure can be a string type, such as VARCHAR2.
[0100] Figure 3 A flowchart illustrating the modified call path of the target function according to an embodiment of the present disclosure is shown.
[0101] like Figure 3 As shown, the flowchart 300 of the modified target function call path in this embodiment includes operations S321 to S322, which can be used as a specific embodiment of operation S220.
[0102] In operation S321, the function prefix information of the original called function is replaced with the target string, where the target string represents the function package to which the target called function belongs.
[0103] In operation S322, the target string is concatenated with the function name to form the call path of the target function.
[0104] According to embodiments of this disclosure, the call path code includes a function name and function prefix information; the function name of the target call function is the same as the function name of the original call function.
[0105] According to embodiments of this disclosure, the original calling function is generally a system function of the source database, and the target calling function can also be a system function of the target database.
[0106] For example, the original function call in the original stored procedure could be "dmsml.insert()", where "dmsml." represents the function prefix information of the original function call, and "insert()" represents the function name. The target function call in the target stored procedure could be "zdy.insert()", where "zdy." represents the function prefix information of the target function call, and "insert()" represents the function name. The function name of the target function call is the same as the function name of the original function call.
[0107] According to embodiments of this disclosure, the target string represents the function package to which the target called function belongs, wherein the function package may encapsulate multiple system functions. Therefore, for each original called function, the target called function can be obtained from the same call path, and a replacement function with the same name can be completed.
[0108] According to embodiments of this disclosure, the target string can be a custom function package name.
[0109] The embodiments of this disclosure, by using functions with the same name for replacement, can not only reduce the number and types of function names, but also improve the reusability of target calling functions in the function package.
[0110] The embodiments disclosed herein are based on string data types and their string parsing and assembly operations, offering high versatility and ensuring that the target stored procedure can be directly called and used within a Gaussian database stored procedure. Because the embodiments of this disclosure ensure that the stored procedure transaction flow and nested call relationships remain unchanged through name-matching function replacement, while maintaining the consistency of input and output parameters, they also achieve name-matching reusability, improving the efficiency of transformational R&D.
[0111] The second aspect of this disclosure provides a business processing method.
[0112] Figure 4 A flowchart illustrating a service processing method according to an embodiment of the present disclosure is shown schematically.
[0113] like Figure 4 As shown, the service processing method 400 of this embodiment includes operations S410 to S420.
[0114] When operating S410, upon receiving a business request from a user, the code of the target stored procedure that matches the business request is executed, and the execution result is obtained.
[0115] When operating S420, the execution result is output.
[0116] According to embodiments of this disclosure, the code of the target stored procedure is determined based on a code processing method. Specifically, the process of determining the target stored procedure includes: obtaining the code of the original stored procedure from the source database, wherein the original stored procedure includes M original calling functions; in response to detecting that the data type of the original stored procedure is the target data type, updating each original calling function to the target calling function, thereby obtaining and storing the target stored procedure.
[0117] According to embodiments of this disclosure, original stored procedures can be retrieved in batches from a source database, transformed into target stored procedures, and then the code of the target stored procedures can be stored in the target database. After the data migration is completed, the operations providing business services are also implemented by the target database accordingly. For example, the target database receives business requests and returns execution results.
[0118] According to an embodiment of this disclosure, in response to receiving a business request from a user, the target database can determine the code of a matching target stored procedure based on the business request, and execute the code of the target stored procedure to obtain an execution result.
[0119] In the embodiments of this disclosure, since the code of the target stored procedure is obtained by updating the original calling function, the nesting relationship and calling relationship between target stored procedures, as well as the nesting relationship and calling relationship between target calling functions within the target stored procedure, remain unchanged. By executing the modified code of the target stored procedure and outputting the execution result, no other operations are required to ensure that the target stored procedure supports the target data type of the stored procedure.
[0120] Figure 5 A flowchart illustrating the determination of execution results according to an embodiment of the present disclosure is shown schematically.
[0121] like Figure 5 As shown, the flowchart 500 for determining the execution result in this embodiment includes operations S511 to S513, which can be used as a specific embodiment of operation S220.
[0122] When operating S511, the business request is parsed to obtain parsed data, which includes business type, data type, and execution data.
[0123] In S512, the code of the target stored procedure is determined based on the business type and data type. The target stored procedure includes M target call functions, where M is greater than or equal to 1.
[0124] In operation S513, at least one target function is called to process the execution data and obtain the execution result.
[0125] According to embodiments of this disclosure, a business type is used to characterize a business function. For example, a business type can be a transfer function, an investment function, a query function, a wealth management function, etc. Data types include various types such as string type, XMLType type, and numeric type.
[0126] According to embodiments of this disclosure, determining the code of a target stored procedure based on the business type and data type includes identifying a target stored procedure that matches the business type and data type, and obtaining the code of the target stored procedure from a target database.
[0127] According to embodiments of this disclosure, the target stored procedure includes at least one target calling function, thereby enabling the execution of the code of the target stored procedure to call at least one target calling function within the target stored procedure.
[0128] According to embodiments of this disclosure, the target calling function includes an insertion function, and the execution data includes a first execution node and an insertion character.
[0129] According to embodiments of this disclosure, calling at least one target call function to process execution data and obtain execution results includes: calling an insert function to insert an insert string before or after the first execution node and obtaining execution results, wherein, while inserting the insert string, the data type of the target stored procedure is converted to a string type.
[0130] According to embodiments of this disclosure, an insertion function is used to perform an insertion operation in a target stored function. The insertion functions include a first insertion function, a second insertion function, and a third insertion function, and the specific insertion position can be determined based on the insertion functions.
[0131] According to embodiments of this disclosure, a first insertion function is used to insert an insertion character before the first execution node. A second insertion function is used to insert an insertion character after the first execution node. A third insertion function is used to insert a child node before the first execution node. For the third insertion function, the insertion character can be a string of code text used for data processing operations; in this case, the insertion character can be understood as a child node under the first execution node.
[0132] According to embodiments of this disclosure, the insertion function includes three input variables and one return variable. The three input variables are the message object, the first execution node, and the inserted character, respectively, and the return variable can be understood as the updated message object.
[0133] According to embodiments of this disclosure, for the first insertion function InsertXMLBefore(), the message object can be an XML message object.
[0134] For example, for the original stored procedure " <prod>…<xml_tenor> 1< / xml_tenor> The first execution node is " / prod / xml_tenor", and the inserted character is "<xml_enddate> 20140101< / xml_enddate> "At that time, the execution logic of the first insertion function is as follows: starting from the first position of the XML message object, search for the node's starting string." <prod>"; in finding" <prod>"Use this as the starting point and search for the next node starting string to the right from that position."<xml_tenor> This is used as the new starting point, and the starting point position is updated iteratively until the innermost node in the path is reached. Then, the aforementioned inserted character is inserted before the first execution node at the innermost level, resulting in the updated target stored procedure being "". <prod>…<xml_enddate> 20140101< / xml_enddate><xml_tenor> 1< / xml_tenor> ".
[0135] According to embodiments of this disclosure, the first insertion function uses the starting position of the innermost node's starting string as the boundary, i.e., the innermost first execution node, to split the XML message object into two segments, concatenating the third input variable (the insertion character) in between, thus obtaining the updated XML message object. It should be noted that the updated XML message object is actually a string-type data object, and the data type of the entire stored procedure is also converted to a string type, such as VARCHAR2.
[0136] According to embodiments of this disclosure, the inserted character can be determined according to the actual situation, for example, it can be "1" or the date "201401XX".
[0137] According to embodiments of this disclosure, the second insertion function InsertXMLAfter() has the same execution logic as the first insertion function, except that it is inserted after the first execution node. The insertion position of the second insertion function is after the termination position of the innermost node's ending string in the specified node path.
[0138] For example, if the first execution node is " / prod / xml_tenor", the inserted character is "<xml_grate> 0.7< / xml_grate> In the case of "", the updated target stored procedure is " <prod>…<xml_tenor> 1< / xml_tenor><xml_grate> 0.7< / xml_grate> ".
[0139] According to embodiments of this disclosure, the third insertion function can be insertChildXML(). (For stored procedures) <prod> … <prod>The first execution node is " / prod", and the inserted character is "<xml_newchildnode> newValue< / xml_newchildnode> In the case of "", the updated target stored procedure is " <prod>…<xml_newchildnode>newValue< / xml_newchildnode> <prod>".
[0140] In the embodiments of this disclosure, based on the modified insert function, the data type is converted while performing the insert operation, realizing the practical application of the xmltype class storage process.
[0141] According to embodiments of this disclosure, the target calling function includes an update function, and the execution data includes a second execution node and an update value; calling at least one calling function to process the execution data and obtain an execution result includes: calling the update function to update the parameter value of the second execution node to the update value, wherein, while updating the parameter value of the second execution node, the data type of the target stored procedure is converted to a string type.
[0142] According to embodiments of this disclosure, the update function can be the updateXML() function. The input variables of the updateXML() function are similar to those of InsertXMLBefore, including a message object, a second execution node, and an update value. The variable "update value" is used to update the parameter value of the second execution node to the value specified by the third parameter, i.e., the specific update value.
[0143] According to embodiments of this disclosure, the target calling function includes a deletion function, and the execution data includes a third execution node; calling at least one target calling function to process the execution data and obtain the execution result includes: calling the deletion function to delete the third execution node, wherein, while deleting the third execution node, the data type of the target stored procedure is converted to a string type.
[0144] According to embodiments of this disclosure, the deletion function can be `deleteXML()`. The `deleteXML()` function takes two input variables: the message object and the third execution node to be deleted. The `deleteXML()` function is used to delete the third execution node, i.e., the node specified by the second input variable. The implementation logic is as follows: find the starting position of the node's start string and the ending position of the node's end string of the innermost node, concatenate the strings on both sides, and return the result.
[0145] According to embodiments of this disclosure, the target calling function includes a query function, and the execution data includes a fourth execution node; calling at least one target calling function to process the execution data and obtain the execution result includes: calling the query function to read the node path of the fourth execution node, wherein, while reading the node path, the data type of the target stored procedure is converted to a string type.
[0146] According to embodiments of this disclosure, the query function includes a first query function and a second query function. The first query function may be the extract() function, which is the same as the extractValue() function in Oracle databases. It has two input variables, namely the message object and the fourth execution node; the extract() function has one return variable, namely the return value.
[0147] For example, when the target storage object is " <prod>…<xml_enddate> 20140101< / xml_enddate> The fourth execution node is " / prod / xml_enddate". When the message object is an XML message object, the first query function can search for the node's starting string from the first position of the XML message object. <prod>Using this as the starting point, search to the right for the next node's starting string.<xml_enddate> Using this as a new starting point, the starting point position is updated iteratively until the innermost node in the path is reached. Then, from that position, the node ending string is searched for to the right.< / xml_enddate> This allows us to obtain the innermost XML node message. The node value is then extracted from the innermost XML node message and returned, resulting in the return value being "20140101".
[0148] According to embodiments of this disclosure, the second query function can be the existsNode() function, which includes two input variables: the message object and the fourth execution node. The second query function is used to query whether the message object of the fourth execution node exists.
[0149] According to embodiments of this disclosure, the data type of the return variable of the insert function, update function, delete function, and first query function can all be VARCHAR2, and the data type of the return variable of the second query function can be either VARCHAR2 or NUMBER.
[0150] According to embodiments of this disclosure, since the VARCHAR2 data type in Gaussian Database can support a maximum length of 10MB, it is fully compatible with storing xmltype type fields in Oracle Database. Therefore, in Gaussian Database, functions with the same name can replace the original calling functions, maintaining the nested calling relationship between stored procedures and ensuring that the transaction process remains largely unchanged. Furthermore, due to the high versatility of the VARCHAR2 data type, stored procedures can be directly called and used in Gaussian Database without modification, ensuring that the stored procedure transaction process and nested calling relationship remain unchanged, while maintaining the consistency of input and output parameters. This achieves reusability through name replacement, greatly improving the efficiency of transformation and development.
[0151] Figure 6 A schematic block diagram of a code processing apparatus according to an embodiment of the present disclosure is shown.
[0152] like Figure 6 As shown, the code processing device 600 of this embodiment includes an acquisition module 610, an update module 620, and a storage module 630.
[0153] The acquisition module 610 is used to acquire the code of the original stored procedure in the source database. The original stored procedure includes M original calling functions, which together implement the business functionality of the original stored procedure, where M is greater than or equal to 1. In one embodiment, the acquisition module 610 can be used to execute the operation S210 described above, which will not be repeated here.
[0154] The update module 620 is used to update each original calling function to the target calling function in response to detecting that the data type of the original stored procedure is the target data type, thereby obtaining the code of the target stored procedure. In one embodiment, the update module 620 can be used to perform the operation S220 described above, which will not be repeated here.
[0155] Storage module 630 is used to store the code of the target stored procedure. In one embodiment, storage module 630 can be used to execute the operation S230 described above, which will not be repeated here.
[0156] According to an embodiment of this disclosure, the update module 620 includes an update unit for modifying the call path code of the original calling function to the call path code of the target calling function.
[0157] According to embodiments of this disclosure, the updating unit includes a replacement sub-unit and a splicing sub-unit. The call path code includes a function name and function prefix information; the function name of the target called function is the same as the function name of the original called function.
[0158] The replacement subunit is used to replace the function prefix information of the original calling function with the target string, where the target string represents the function package to which the target calling function belongs.
[0159] The concatenation subunit is used to concatenate the target string with the function name to form the call path of the target function.
[0160] According to embodiments of this disclosure, the target data type includes Extensible Markup Language (EXPLAIN) format processing types.
[0161] According to embodiments of this disclosure, any plurality of modules among the acquisition module 610, update module 620, and storage module 630 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least some of the functionality of one or more of these modules may be combined with at least some of the functionality of other modules and implemented in one module.
[0162] According to embodiments of this disclosure, at least one of the acquisition module 610, update module 620, and storage module 630 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three methods. Alternatively, at least one of the acquisition module 610, update module 620, and storage module 630 can be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.
[0163] Figure 7 A schematic block diagram of a service processing apparatus according to an embodiment of the present disclosure is shown.
[0164] like Figure 7 As shown, the service processing device 700 of this embodiment includes an execution module 710 and an output module 720.
[0165] The execution module 710 is used to respond to a received business request from a user, execute the code of a target stored procedure that matches the business request, and obtain an execution result. The code of the target stored procedure is determined according to the code determination method described above. In one embodiment, the execution module 710 can be used to execute the operation S410 described above, which will not be repeated here.
[0166] The output module 720 is used to output the execution result. In one embodiment, the output module 720 can be used to execute the operation S420 described above, which will not be repeated here.
[0167] According to embodiments of this disclosure, the execution module 710 includes a parsing unit, a determining unit, and a calling unit.
[0168] The parsing unit is used to parse the business request and obtain parsed data, wherein the parsed data includes business type, data type, and execution data. In one embodiment, the parsing unit can be used to perform the operation S511 described above, which will not be repeated here.
[0169] The determining unit is used to determine the code of the target stored procedure based on the business type and data type, wherein the target stored procedure includes M target call functions, where M is greater than or equal to 1. In one embodiment, the determining unit can be used to execute the operation S512 described above, which will not be repeated here.
[0170] The calling unit is used to call at least one target calling function to process the execution data and obtain the execution result. In one embodiment, the calling unit can be used to execute the operation S513 described above, which will not be repeated here.
[0171] According to embodiments of this disclosure, the target calling function includes an insertion function, and the execution data includes a first execution node and an insertion string. The calling unit includes a first calling subunit, used to call the insertion function to insert the insertion string before or after the first execution node to obtain an execution result. Simultaneously with inserting the insertion string, the data type of the target stored procedure is converted to a string type.
[0172] According to embodiments of this disclosure, the target calling function includes an update function, and the execution data includes a second execution node and an update value.
[0173] The calling unit includes a second calling subunit, which is used to call the update function to update the parameter value of the second execution node to the updated value. While updating the parameter value of the second execution node, the data type of the target stored procedure is converted to a string type.
[0174] According to embodiments of this disclosure, the target calling function includes a deletion function, and the execution data includes a third execution node.
[0175] The calling unit includes a second calling subunit, which is used to call the deletion function to delete the third execution node. While deleting the third execution node, the data type of the target stored procedure is converted to a string type.
[0176] According to embodiments of this disclosure, the target calling function includes a query function, and the execution data includes a fourth execution node.
[0177] The calling unit includes a second calling subunit, which is used to call the query function to read the node path of the fourth execution node. While reading the node path, the data type of the target stored procedure is converted to a string type.
[0178] According to embodiments of this disclosure, any plurality of modules in execution module 710 and output module 720 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least some of the functionality of one or more of these modules may be combined with at least some of the functionality of other modules and implemented in one module.
[0179] According to embodiments of this disclosure, at least one of the execution module 710 and the output module 720 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three methods. Alternatively, at least one of the execution module 710 and the output module 720 can be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.
[0180] Figure 8 A block diagram schematically illustrates an electronic device suitable for code processing methods and business processing methods according to embodiments of the present disclosure.
[0181] like Figure 8 As shown, an electronic device 800 according to an embodiment of this disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage portion 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.
[0182] RAM 803 stores various programs and data required for the operation of electronic device 800. Processor 801, ROM 802, and RAM 803 are interconnected via bus 804. Processor 801 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 802 and / or RAM 803. It should be noted that the programs may also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0183] According to embodiments of this disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to a bus 804. The electronic device 800 may also include one or more of the following components connected to the input / output I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.
[0184] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0185] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 802 and / or RAM 803 and / or one or more memories other than ROM 802 and RAM 803 described above.
[0186] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this disclosure.
[0187] When the computer program is executed by the processor 801, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0188] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 809, and / or installed from a removable medium 811. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0189] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by processor 801, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0190] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0191] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0192] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0193] The specific embodiments described above further illustrate the purpose, technical solutions, and beneficial effects of this disclosure. It should be understood that the above descriptions are merely specific embodiments of this disclosure and are not intended to limit this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the protection scope of this disclosure.< / prod> < / prod> < / prod> < / prod> < / prod> < / prod> < / prod> < / prod> < / prod> < / prod> < / prod>
Claims
1. A code processing method, comprising: obtaining a code of an original stored procedure of a source database, wherein the original stored procedure comprises M original calling functions, the M original calling functions are used to jointly implement a business function of the original stored procedure, and M is greater than or equal to 1; in response to detecting that a data type of the original stored procedure is a target data type, updating each of the original calling functions into a target calling function to obtain a code of a target stored procedure; and storing the code of the target stored procedure.
2. The method of claim 1, wherein, The updating each of the original calling functions into a target calling function to obtain a code of a target stored procedure in response to detecting that a data type of the original stored procedure is a target data type comprises, for each original calling function, modifying a calling path code of the original calling function into a calling path code of the target calling function.
3. The method of claim 2, wherein, The calling path code comprises a function name and function prefix information, the function name of the target calling function is the same as the function name of the original calling function, and the modifying a calling path code of the original calling function into a calling path code of the target calling function comprises: replacing the function prefix information of the original calling function with a target string, wherein the target string represents a function package to which the target calling function belongs; and concatenating the target string and the function name into a calling path of the target calling function.
4. The method of claim 1, wherein, The target data type comprises an extensible markup language format processing type. 5.A business processing method, comprising: in response to receiving a business request from a user, executing a code of a target stored procedure matched with the business request to obtain an execution result, wherein the code of the target stored procedure is determined according to the method of any one of claims 1 to 4; and outputting the execution result.
6. The method of claim 5, wherein, The executing a code of a target stored procedure matched with the business request to obtain an execution result in response to receiving a business request from a user comprises: parsing the business request to obtain parsed data, wherein the parsed data comprises a business type, a data type, and execution data; determining a code of a target stored procedure according to the business type and the data type, wherein the target stored procedure comprises M target calling functions, and M is greater than or equal to 1; and calling at least one of the target calling functions to process the execution data to obtain an execution result.
7. The method of claim 6, wherein, The target calling function comprises an insertion function, and the execution data comprises a first execution node and an insertion string. The calling at least one of the target calling functions to process the execution data to obtain an execution result comprises: calling the insertion function to insert the insertion string before or after the first execution node to obtain an execution result, wherein the data type of the target stored procedure is converted into a string type while the insertion string is inserted.
8. The method of claim 6, wherein, The target calling function comprises an update function, and the execution data comprises a second execution node and an update value. The calling at least one of the calling functions to process the execution data to obtain an execution result comprises: The updating function is called to update the parameter value of the second execution node to the updated value, wherein the data type of the target stored procedure is converted to a string type while updating the parameter value of the second execution node.
9. The method of claim 6, wherein, The target calling function includes a deletion function, and the execution data includes a third execution node. The calling at least one target calling function to process the execution data to obtain an execution result includes: The deletion function is called to delete the third execution node, wherein the data type of the target stored procedure is converted to a string type while deleting the third execution node.
10. The method of claim 6, wherein, The target calling function includes a query function, and the execution data includes a fourth execution node. The calling at least one target calling function to process the execution data to obtain an execution result includes: The query function is called to read the node path of the fourth execution node, wherein the data type of the target stored procedure is converted to a string type while reading the node path.
11. A code processing apparatus, comprising: an obtaining module configured to obtain a code of an original stored procedure of a source database, wherein the original stored procedure includes M original calling functions, the M original calling functions are used to collectively implement a business function of the original stored procedure, and M is greater than or equal to 1; an updating module configured to, in response to detecting that a data type of the original stored procedure is a target data type, update each of the original calling functions to a target calling function to obtain a code of a target stored procedure; and a storage module configured to store the code of the target stored procedure.
12. A business processing apparatus, comprising: an execution module configured to, in response to receiving a business request from a user, execute a code of a target stored procedure matched with the business request to obtain an execution result, wherein the target stored procedure is determined according to the method of any one of claims 1-4; and an output module configured to output the execution result.
13. An electronic device, comprising: one or more processors; a storage device configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method according to any one of claims 1-10.
14. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1-10.
15. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-10.
Citation Information
Patent Citations
Processing method and device for program code, computing equipment and medium
CN113688359A
Sensitive data coding method, device, equipment and storage medium
CN113722757A