Stored procedure calling method, device, equipment, and media based on the MyBatis framework

By generating target variables and stored procedures in the database object table of the MyBatis framework and replacing custom variables and index information, the problem that the MyBatis framework cannot recognize custom variables in external stored procedures is solved, and the accuracy and correctness of data calls are achieved.

CN114741406BActive Publication Date: 2025-09-16CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210440464.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-25
Publication Date
2025-09-16
Estimated Expiration
2042-04-25

AI Technical Summary

Technical Problem

The MyBatis framework cannot effectively identify custom variables in external stored procedures, resulting in logical errors in data calls.

Method used

By generating target variables and stored procedures in the database object table of the MyBatis framework and replacing custom variables and index information, we ensure that the MyBatis framework can correctly identify and call the target stored procedures.

Benefits of technology

The accuracy of data calling is achieved, errors caused by the inability to recognize custom variables are avoided, and the correctness of the data calling process is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741406B_ABST
    Figure CN114741406B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of artificial intelligence and provides a stored procedure calling method, device, equipment, and medium based on the MyBatis framework. The method includes: determining a custom stored procedure including at least one custom variable from a stored procedure precompiled in the MyBatis framework; generating a target variable corresponding to the custom variable and a target stored procedure identical to the custom stored procedure in a database object table of the MyBatis framework, and replacing the custom variable with the target variable; replacing the index information of the custom stored procedure with the target index information of the target stored procedure in a calling index table; and responding to a stored procedure calling instruction according to the updated MyBatis framework. According to the technical solution of this embodiment, the MyBatis framework is able to convert a call to a custom stored procedure into a call to a target stored procedure, thereby ensuring the accuracy of data calling and effectively avoiding data calling errors caused by the inability to recognize custom variables.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of databases, and in particular relates to a stored procedure calling method, apparatus, device, and medium based on a MyBatis framework. Background Art

[0002] A stored procedure is a set of SQL statements that performs a specific function, typically written in Procedural Structured Query Language (PLSQL). To implement specific business logic using stored procedures, multiple stored procedures can be combined into a stored procedure package. As database traffic increases, business logic implementation is shifting from stored procedure packages to Java, requiring conversion between PLSQL and Java.

[0003] For stored procedure packages provided by third parties, they cannot be converted into Java due to database security requirements or business needs. Java needs to call the stored procedures in the stored procedure packages through the MyBatis framework. However, the MyBatis framework cannot well identify the custom variables of external stored procedures, which can easily lead to logical errors in data calls. Summary of the Invention

[0004] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.

[0005] The embodiment of the present invention provides a stored procedure calling method, apparatus, device, and medium based on the MyBatis framework, which can generate identifiable target variables and target stored procedures in the database object table of the MyBatis framework, so that the Mybatis framework can call data through the internal target stored procedures to ensure the accuracy of the data call.

[0006] In a first aspect, an embodiment of the present invention provides a stored procedure calling method based on the MyBatis framework, comprising:

[0007] Determine a custom stored procedure from a stored procedure precompiled in a MyBatis framework, wherein the custom stored procedure includes at least one custom variable;

[0008] Obtain the database object table and call index table of the MyBatis framework, wherein the database object table is used to record the variables and stored procedures defined in the target database, and the call index table records the index information of each stored procedure in the MyBatis framework;

[0009] Generating a target variable corresponding to the custom variable in the database object table, and determining the parameter value of the custom variable as the parameter value of the target variable;

[0010] Generate a target stored procedure identical to the custom stored procedure in the database object table, and replace the custom variables in the target stored procedure with the target variables;

[0011] Obtain target index information of the target stored procedure, and replace the index information of the custom stored procedure with the target index information in the call index table;

[0012] When a stored procedure call instruction is obtained, the stored procedure is called according to the stored procedure call instruction and the MyBatis framework.

[0013] In some embodiments, determining a custom stored procedure from stored procedures precompiled in the MyBatis framework includes:

[0014] Obtain a stored procedure package precompiled in the MyBatis framework, wherein the stored procedure package includes at least two initial stored procedures and at least one custom variable;

[0015] At least one of the initial stored procedures to which the custom variables are applied is determined as the custom stored procedure.

[0016] In some embodiments, determining at least one of the initial stored procedures to which the custom variables are applied as the custom stored procedure comprises:

[0017] determining the custom variable not recorded in the database object table as a target custom variable;

[0018] At least one of the initial stored procedures to which the target custom variable is applied is determined as the custom stored procedure.

[0019] In some embodiments, calling a stored procedure according to the stored procedure call instruction and the MyBatis framework includes:

[0020] When the stored procedure corresponding to the stored procedure call instruction is the target stored procedure, determining a target parser corresponding to the target stored procedure from a plurality of preset optional parsers;

[0021] Acquire intermediate data from the target database through the target stored procedure;

[0022] The intermediate data is parsed according to the target parser to obtain target data.

[0023] In some embodiments, each of the optional parsers is used to parse data in different data arrangements, and determining the target parser corresponding to the target stored procedure from the preset multiple optional parsers includes:

[0024] Determine a target data structure predefined in the target storage process, wherein the target data structure represents a data arrangement of the target data;

[0025] The target parser is determined from a plurality of the selectable parsers according to the target data structure.

[0026] In some embodiments, parsing the intermediate data according to the target parser to obtain target data includes:

[0027] When the target data is data input to the target stored procedure, determining a preset keyword corresponding to the target data structure, and extracting the target data from the intermediate data according to the preset keyword by the target parser;

[0028] or,

[0029] When the target data is data output by the target stored procedure, the intermediate data is converted into a target array by the target parser, and the target array is determined as the target data.

[0030] In some embodiments, after replacing the custom variable in the target stored procedure with the target variable, the method further includes:

[0031] When the target stored procedure includes an output operation statement, determining the target variable corresponding to the output operation statement as the target output variable;

[0032] Determine the data type of the custom variable corresponding to the target output variable in the custom storage process as the target output data type;

[0033] The target output data type is determined as the data type of the target output variable.

[0034] In a second aspect, an embodiment of the present invention provides a stored procedure calling device based on the MyBatis framework, comprising:

[0035] A first acquisition unit is configured to determine a custom stored procedure from stored procedures precompiled in a MyBatis framework, wherein the custom stored procedure includes at least one custom variable;

[0036] A second acquisition unit is used to obtain a database object table and a call index table of the MyBatis framework, wherein the database object table is used to record variables and stored procedures defined in the target database, and the call index table records index information of each stored procedure in the MyBatis framework;

[0037] a variable generating unit, configured to generate a target variable corresponding to the custom variable in the database object table, and determine the parameter value of the custom variable as the parameter value of the target variable;

[0038] A stored procedure generating unit, configured to generate a target stored procedure identical to the user-defined stored procedure in the database object table, and replace the user-defined variables in the target stored procedure with the target variables;

[0039] An index information replacement unit, configured to obtain target index information of the target stored procedure, and replace the index information of the custom stored procedure with the target index information in the call index table;

[0040] The stored procedure calling unit is used to call the stored procedure according to the stored procedure calling instruction and the MyBatis framework when a stored procedure calling instruction is obtained.

[0041] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the computer program, the stored procedure calling method based on the MyBatis framework as described in the first aspect is implemented.

[0042] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program is used to execute the stored procedure calling method based on the MyBatis framework as described in the first aspect.

[0043] An embodiment of the present invention includes: determining a custom stored procedure from a stored procedure precompiled in a MyBatis framework, wherein the custom stored procedure includes at least one custom variable; obtaining a database object table and a call index table of the MyBatis framework, wherein the database object table is used to record variables and stored procedures defined in a target database, and the call index table records index information of each stored procedure in the MyBatis framework; generating a target variable corresponding to the custom variable in the database object table, and determining a parameter value of the custom variable as the parameter value of the target variable; generating a target stored procedure identical to the custom stored procedure in the database object table, and replacing the custom variable in the target stored procedure with the target variable; obtaining target index information of the target stored procedure, and replacing the index information of the custom stored procedure with the target index information in the call index table; and when a stored procedure call instruction is obtained, calling the stored procedure according to the stored procedure call instruction and the MyBatis framework. According to the technical solution of this embodiment, since the target variables and target stored procedures are defined in the database object table of the MyBatis framework, and the index information of the custom stored procedure is replaced with the index information of the target stored procedure by updating the call index table, the MyBatis framework can convert the call to the custom stored procedure into a call to the target stored procedure. The MyBatis framework can correctly identify the variables in the database object table, thereby ensuring the accuracy of data calls and effectively avoiding data call errors caused by the inability to identify custom variables.

[0044] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation to the technical solution of the present invention.

[0046] Figure 1 This is a flowchart of a stored procedure calling method based on the MyBatis framework provided by one embodiment of the present invention;

[0047] Figure 2 is a flowchart of determining a custom stored procedure provided by another embodiment of the present invention;

[0048] Figure 3is a flowchart of determining a custom stored procedure based on a database object table provided by another embodiment of the present invention;

[0049] Figure 4 is a flowchart of parsing and obtaining target data provided by another embodiment of the present invention;

[0050] Figure 5 is a flowchart of determining a target parser provided by another embodiment of the present invention;

[0051] Figure 6 is a flowchart of obtaining target data provided by another embodiment of the present invention;

[0052] Figure 7 is a flowchart of outputting target data provided by another embodiment of the present invention;

[0053] Figure 8 This is a structural diagram of a stored procedure calling device based on the MyBatis framework provided by another embodiment of the present invention;

[0054] Figure 9 is a device diagram of an electronic device provided in another embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0056] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "objective," and the like in the specification, claims, or accompanying drawings are used to distinguish similar objects and are not necessarily intended to describe a specific sequence or precedence.

[0057] The present invention provides a stored procedure calling method, device, equipment and medium based on the MyBatis framework. The method comprises: determining a custom stored procedure from a stored procedure precompiled in the MyBatis framework, wherein the custom stored procedure includes at least one custom variable; obtaining a database object table and a call index table of the MyBatis framework, wherein the database object table is used to record variables and stored procedures defined in a target database, and the call index table records index information of each stored procedure in the MyBatis framework; generating a target variable corresponding to the custom variable in the database object table, and determining a parameter value of the custom variable as the parameter value of the target variable; generating a target stored procedure identical to the custom stored procedure in the database object table, and replacing the custom variable in the target stored procedure with the target variable; obtaining target index information of the target stored procedure, and replacing the index information of the custom stored procedure with the target index information in the call index table; and when a stored procedure calling instruction is obtained, calling the stored procedure according to the stored procedure calling instruction and the MyBatis framework. According to the technical solution of this embodiment, since the target variables and target stored procedures are defined in the database object table of the MyBatis framework, and the index information of the custom stored procedure is replaced with the index information of the target stored procedure by updating the call index table, the MyBatis framework can convert the call to the custom stored procedure into a call to the target stored procedure. The MyBatis framework can correctly identify the variables in the database object table, thereby ensuring the accuracy of data calls and effectively avoiding data call errors caused by the inability to identify custom variables.

[0058] The embodiments of the present application can compile, acquire, and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) refers to the theories, methods, technologies, and application devices that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.

[0059] The database in the embodiment of the present application refers to an organized and sharable data set stored in a computer. The data in the database refers to a certain data model organization.

[0060] Database operation statements are programming languages ​​used to operate on data in a database. For example, database operation statements can be, but are not limited to, programming languages ​​used to add, delete, modify, and query data in a database. Database operation statements can also be, but are not limited to, SQL statements in a MySQL database or an Oracle database. An online data processing request is a user request for a corresponding service in a specific business scenario. The online data processing request can determine the request type of the database operation statement based on the content of the online data processing request. The request types of database operation statements include, but are not limited to, add, delete, modify, and query. Specifically, determining the database operation statement based on the online data processing request can be based on the content of the online data processing request. For example, an online data processing request can be a data processing request requesting to add data to a database, a data processing request requesting to query data in a database, or a data processing request requesting to delete or modify data in a database.

[0061] It should be noted that the data of the embodiments of the present invention can be stored in a server. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0062] like Figure 1 As shown, Figure 1 The following is a flowchart of a stored procedure calling method based on the MyBatis framework provided by one embodiment of the present invention. The stored procedure calling method based on the MyBatis framework includes but is not limited to the following steps:

[0063] Step S110, determining a custom stored procedure from the stored procedures precompiled in the MyBatis framework, where the custom stored procedure includes at least one custom variable;

[0064] Step S120, obtaining the database object table and call index table of the MyBatis framework, where the database object table is used to record the variables and stored procedures defined in the target database, and the call index table records the index information of each stored procedure in the MyBatis framework;

[0065] Step S130: generating a target variable corresponding to the custom variable in the database object table, and determining the parameter value of the custom variable as the parameter value of the target variable;

[0066] Step S140, generating a target stored procedure identical to the custom stored procedure in the database object table, and replacing the custom variables in the target stored procedure with the target variables;

[0067] Step S150, obtaining target index information of the target stored procedure, and replacing the index information of the custom stored procedure with the target index information in the calling index table;

[0068] Step S160: When a stored procedure call instruction is obtained, the stored procedure is called according to the stored procedure call instruction and the MyBatis framework.

[0069] It should be noted that in Java, the call of the stored procedure needs to be completed through the Mybatis framework. Therefore, the stored procedure can be precompiled into the Mybatis framework so that the Mybatis framework can directly call the stored procedure after obtaining the stored procedure call instruction. The precompilation can be performed for an independent stored procedure or for a stored procedure package composed of multiple stored procedures. This embodiment does not impose any restrictions on this.

[0070] It should be noted that the custom variable can be a variable of any custom type. This embodiment does not impose too many restrictions on the specific type of the variable. It can be customized in a stored procedure or stored procedure package and cannot be converted into Java.

[0071] It should be noted that the database object table can be the schema of the MyBatis framework, which records all objects in the target database including variables and stored procedures. Therefore, the variables and stored procedures defined in the schema table can be recognized by the Mybatis framework. Based on this, after determining the custom stored procedure with custom variables, since it cannot be converted into Java, in order to ensure that the custom variables can be accurately identified during the call process, the target variables and target stored procedures can be defined in the database object table. The specific definition method is a technology well known to those skilled in the art and will not be elaborated here.

[0072] It is worth noting that after the corresponding target variable is generated in the database object table, the value of the custom variable needs to be passed to the target variable. The specific form can be direct assignment of a string, or an SQL statement that represents the assignment operation. This embodiment does not impose many restrictions on this, and it is sufficient to ensure that the target variable and the corresponding custom variable have the same value.

[0073] It is worth noting that in order to ensure that the external stored procedure can accurately call the target stored procedure, when defining the target stored procedure, you can use the same name as the corresponding custom stored procedure, and ensure that the logical call and data structure are the same, and replace the custom variables in the custom stored procedure with the target variables defined in the schema, so that the Mybatis framework can correctly call the target stored procedure and implement the same data call operation as the custom stored procedure.

[0074] It should be noted that the calling index table can be the mapper file of the Mybatis framework. The mapper file records the index information of each object in the Mybatis framework. After generating the target stored procedure that is the same as the custom stored procedure, since the custom stored procedure and the target stored procedure have the same name, the index information of the custom stored procedure can be replaced with the target index information in the mapper file. The original call to the custom stored procedure can be redirected to the target stored procedure through the mapper file, thereby realizing the call to the target stored procedure and ensuring that the Mybatis framework obtains the correct target data.

[0075] It should be noted that after generating the target stored procedure and target variable in the schema and modifying the index information in the mapper, the Mybatis framework will redirect the call of the custom stored procedure to the target stored procedure after obtaining the stored procedure call instruction, thereby accurately implementing the data call. The specific data call process is a technology well known to those skilled in the art and will not be repeated here.

[0076] In addition, in one embodiment, referring to Figure 2 , Figure 1 Step S110 of the illustrated embodiment further includes but is not limited to the following steps:

[0077] Step S210: Obtain a stored procedure package precompiled in the MyBatis framework, where the stored procedure package includes at least two initial stored procedures and at least one custom variable;

[0078] Step S220: Determine at least one initial stored procedure that applies the custom variable as a custom stored procedure.

[0079] It should be noted that the stored procedure package is a common package. Multiple initial stored procedures can be defined in the package. Custom variables can be defined in the declaration part of the package, so that the custom variables can be applied to any initial stored procedure in the package. Of course, custom variables can also be defined in the declaration part of the initial stored procedure. This embodiment does not impose any restrictions on this.

[0080] It should be noted that there can be multiple initial stored procedures in a stored procedure package, and only the initial stored procedure that applies custom variables cannot be correctly recognized by the Mybatis framework. If the initial stored procedure does not have custom variables, it can be recognized by the Mybatis framework. In this case, the conversion of the initial stored procedure without custom variables can be omitted to avoid the data structure being too complicated. Therefore, the initial stored procedure that applies custom variables can be determined as a custom stored procedure.

[0081] In addition, in one embodiment, referring to Figure 3 , Figure 2 Step S220 of the illustrated embodiment further includes but is not limited to the following steps:

[0082] Step S310, determining a custom variable that is not recorded in the database object table as a target custom variable;

[0083] Step S320: Determine at least one initial stored procedure of the application target custom variable as a custom stored procedure.

[0084] It should be noted that the database object table records all the variables in the target database. Therefore, when the custom variables have been recorded in the database objects, even if they are custom variables, they can be recognized by the Mybatis framework. Therefore, after determining the custom variables, you can further match them from the database object table, determine the unrecorded custom variables as target custom variables, and then determine the custom stored procedure based on them, and generate the corresponding target variables.

[0085] In addition, in one embodiment, referring to Figure 4 , Figure 1 Step S160 of the illustrated embodiment further includes but is not limited to the following steps:

[0086] Step S410: When the stored procedure corresponding to the stored procedure call instruction is a target stored procedure, a target parser corresponding to the target stored procedure is determined from a plurality of preset optional parsers;

[0087] Step S420, obtaining intermediate data from the target database through the target stored procedure;

[0088] Step S430: parse the intermediate data according to the target parser to obtain target data.

[0089] It should be noted that after obtaining the stored procedure call instruction for the target stored procedure, the intermediate data is obtained from the target database through the target stored procedure. The intermediate data can be in the form of an array. The intermediate data is parsed by the target parser to obtain the target data.

[0090] It should be noted that since there can be many ways to arrange data in the target database, such as the common records, arrays, and tables, after obtaining the intermediate data, different data arrangements need to output data in different forms. Therefore, after obtaining the intermediate data, the intermediate data can be parsed by the target parser to obtain the target data that conforms to the data arrangement.

[0091] It should be noted that the obtained target data may be data used internally by the target storage process, or data output externally. This embodiment does not limit the specific use of the target data.

[0092] In addition, in one embodiment, each optional parser is used to parse data in different data arrangements, referring to Figure 5 , Figure 4 Step S430 of the illustrated embodiment further includes but is not limited to the following steps:

[0093] Step S510, determining a target data structure predefined in a target storage process, where the target data structure represents a data arrangement of the target data;

[0094] Step S520: determining a target parser from a plurality of optional parsers according to the target data structure.

[0095] It should be noted that, according to the above embodiments, the data arrangement methods can be Record, Array and Table, where Array is a data array composed of numerical values, and Table and Record include specific data arrangement formats in addition to data. For example, Table is arranged into a table, and Record is in the form of multiple records. Therefore, after obtaining the intermediate data, it is necessary to select a suitable target parser according to the target data structure of the target stored procedure. For example, if the target data structure of the target stored procedure is Record, it is necessary to select a target parser suitable for Record from the optional parsers. The specific parsing process of the parser is not described in detail in this embodiment, and it is sufficient to ensure that the correct target data is parsed.

[0096] In addition, in one embodiment, referring to Figure 6 , Figure 4 Step S430 of the illustrated embodiment further includes but is not limited to the following steps:

[0097] Step S610, when the target data is data input to the target stored procedure, a preset keyword corresponding to the target data structure is determined, and the target data is extracted from the intermediate data according to the preset keyword by the target parser;

[0098] or,

[0099] Step S620: When the target data is the output data of the target stored procedure, the intermediate data is converted into a target array through the target parser, and the target array is determined as the target data.

[0100] It should be noted that, based on the description of the above embodiments, since different target storage processes may have different data arrangement structures and there are multiple structures in the storage process, the target data may be for a specific structure. Therefore, after obtaining the intermediate data, the target parser can convert the structure of the target data that needs to be obtained in the target storage process into an intermediate array, set a preset keyword in the intermediate array, fill the intermediate data into the intermediate array, and obtain a structure filled with data, thereby completing the data input of the target storage process.

[0101] It is worth noting that when the target data is output data, the target parser can convert the intermediate data into a target array and output the entire target array to an external storage process to ensure the accuracy of data transmission.

[0102] In order to better illustrate the technical solution of this embodiment, three specific examples are provided below. In the following three specific examples, the preset keyword takes jdbcTypeName as an example.

[0103] Example 1: The target data structure is Record type

[0104] For target data that is input to the target stored procedure: Before calling the target stored procedure, convert the structure object that the target stored procedure needs to pass into an intermediate array. The properties of the structure object are the elements of the array. At the same time, insert the value of jdbcTypeName at the head of the intermediate array so that the target parser can identify the specific structure object based on jdbcTypeName. When obtaining data from the target database, you can obtain jdbcTypeName from the intermediate array and delete it from the intermediate array. The jdbcTypeName can be used to obtain the description information and corresponding values ​​of the Record type from the database. Then, in the target parser, the description information and the array values ​​in the intermediate array are used to construct the structure object to obtain the final target data.

[0105] For the target data, which is the data output to the target storage process: after obtaining the intermediate data, the intermediate data is extracted through the target parser and stored in the target array, and the target array is returned as the return value to the external storage structure to complete the data output.

[0106] Example 2: The target data structure is an Array type

[0107] For target data input to the target stored procedure: Before calling the target stored procedure, insert the jdbcTypeName value into the header of the intermediate array. This allows the target parser to identify the specific Array description based on the jdbcTypeName and construct multiple Array objects. When retrieving data from the target database, populate the data into the corresponding objects and apply the populated Array objects to the target stored procedure.

[0108] If the target data is output to the target stored procedure: For Array type structures, the returned data cannot be directly converted to the target array. In this case, you need to convert the returned intermediate data into a ResultSet object, iterate over the object, store the obtained data in the target array, and return it as the return value.

[0109] Example 3: The target data structure is a Table type

[0110] For the target data that is input into the target stored procedure: before calling the target stored procedure, define an intermediate array of table type, and the elements of the intermediate array are structure types. The process of obtaining intermediate data from the target database can refer to the embodiment of Example 2. The difference is that the intermediate data obtained in this example includes array type and structure type, which can be separated by delimiters. The array type and structure type are filled into the structure object of Table type through the target parser to complete the data filling and obtain the target data.

[0111] For the target data that is output to the target stored procedure: After the target parser obtains the intermediate data, it converts it into a ResultSet object, iterates the object one by one to obtain multiple structure type data, and converts the structure type data into multiple arrays, that is, one structure type object is an array, each array is stored in the target array, and finally the target array is returned.

[0112] In addition, in one embodiment, referring to Figure 7 After executing Figure 1 After step S140 in the illustrated embodiment, the following steps are also included but not limited to:

[0113] Step S710: When the target stored procedure includes an output operation statement, the target variable corresponding to the output operation statement is determined as the target output variable;

[0114] Step S720, determining the data type of the custom variable corresponding to the target output variable in the custom storage process as the target output data type;

[0115] Step S730: Determine the target output data type as the data type of the target output variable.

[0116] It should be noted that the output operation statement of the target stored procedure can be a return value operation statement or an out type parameter, that is, the parameter value needs to be passed back to the parameter of the external stored procedure. Since the target variable and the target stored procedure are defined in the database object table, the target output data type needs to be determined according to the data type of the custom variable specified in the custom type to ensure that the parameter type output to the external stored procedure remains consistent.

[0117] In addition, refer to Figure 8 The embodiment of the present invention provides a stored procedure calling device based on the MyBatis framework. The stored procedure calling device 800 based on the MyBatis framework includes but is not limited to the following units:

[0118] A first acquisition unit 810 is configured to determine a custom stored procedure from stored procedures precompiled in the MyBatis framework, where the custom stored procedure includes at least one custom variable;

[0119] The second acquisition unit 820 is used to obtain the database object table and call index table of the MyBatis framework. The database object table is used to record the variables and stored procedures defined in the target database. The call index table records the index information of each stored procedure in the MyBatis framework.

[0120] The variable generation unit 830 is used to generate a target variable corresponding to the custom variable in the database object table, and determine the parameter value of the custom variable as the parameter value of the target variable;

[0121] The stored procedure generating unit 840 is used to generate a target stored procedure identical to the custom stored procedure in the database object table, and replace the custom variables in the target stored procedure with the target variables;

[0122] The index information replacement unit 850 is used to obtain the target index information of the target stored procedure and replace the index information of the custom stored procedure with the target index information in the calling index table;

[0123] The stored procedure calling unit 860 is used to call the stored procedure according to the stored procedure calling instruction and the MyBatis framework when a stored procedure calling instruction is obtained.

[0124] In addition, refer to Figure 9 An embodiment of the present invention further provides an electronic device. The electronic device 900 includes a memory 910, a processor 920, and a computer program stored in the memory 910 and executable on the processor 920.

[0125] The processor 920 and the memory 910 may be connected via a bus or other means.

[0126] The non-transient software program and instructions required to implement the stored procedure calling method based on the MyBatis framework of the above embodiment are stored in the memory 910. When executed by the processor 920, the stored procedure calling method based on the MyBatis framework in the above embodiment is executed, for example, the above-described Figure 1 Steps S110 to S150 of the method, Figure 3 Steps S310 to S330 of the method, Figure 4 Steps S410 to S440 of the method, Figure 5 Steps S510 to S530 of the method, Figure 6 Steps S610 to S630 of the method, Figure 7 Steps S710 to S720 of the method, Figure 8 Method steps S810 to S830.

[0127] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0128] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, which is executed by a processor or controller, for example, by a processor in the above electronic device embodiment, so that the above processor can execute the stored procedure call method based on the MyBatis framework in the above embodiment, for example, to execute the above described Figure 1 Steps S110 to S150 of the method, Figure 3 Steps S310 to S330 of the method, Figure 4 Steps S410 to S440 of the method, Figure 5 Steps S510 to S530 of the method, Figure 6 Steps S610 to S630 of the method, Figure 7 Steps S710 to S720 of the method, Figure 8Method steps S810 to S830 in the method. It will be appreciated by those skilled in the art that all or some of the steps and devices in the method disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable storage medium, which can include computer storage media (or non-transitory storage media) and communication storage media (or temporary storage media). As known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable storage media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other storage medium that can be used to store desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication storage media generally contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery storage media.

[0129] The present embodiment can be used in many general or special computer device environments or configurations. For example: personal computers, server computers, handheld electronic devices or portable electronic devices, tablet electronic devices, multi-processor devices, microprocessor-based devices, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above devices or electronic devices, etc. The present application can be described in the general context of computer programs executed by computers, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing electronic devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage electronic devices.

[0130] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.

[0131] It should be noted that, although several modules or units of the electronic device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0132] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing electronic device (which can be a personal computer, a server, a touch terminal, or a network electronic device, etc.) to execute the method according to the embodiments of the present application.

[0133] The electronic device of this embodiment may include components such as a radio frequency (RF) circuit, a memory, an input unit, a display unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a processor, and a power supply. The RF circuit can be used to receive and send signals during information transmission or calls. In particular, it receives downlink information from the base station and sends it to the processor for processing; in addition, it sends uplink data to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit can also communicate with the network and other devices via wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc. The memory can be used to store software programs and modules, and the processor executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the electronic device (such as audio data, a phone book, etc.). In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The input unit can be used to receive input digital or character information, and to generate key signal input related to the settings and function control of the electronic device. Specifically, the input unit may include a touch panel and other input devices. The touch panel, also known as a touch screen, can collect touch operations on or near it (such as operations using any suitable object or accessory such as a finger, a stylus, etc. on or near the touch panel) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel may include two parts: a touch detection device and a touch controller.Among them, the touch detection device detects the touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor, and can receive and execute commands sent by the processor. In addition, the touch panel can be implemented using various types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch panel, the input unit can also include other input devices. Specifically, other input devices can include but are not limited to one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), a trackball, a mouse, a joystick, etc. The display unit can be used to display input information or provided information and various menus of the electronic device. The display unit may include a display panel, and optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Furthermore, the touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor to determine the type of touch event, and the processor then provides corresponding visual output on the display panel based on the type of touch event. The touch panel and the display panel are two independent components to realize the input and output functions of the electronic device, but in some embodiments, the touch panel and the display panel can be integrated to realize the input and output functions of the electronic device. The electronic device may also include at least one sensor, such as a light sensor, a motion sensor and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor can turn off the display panel and / or backlight when the electronic device is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors that can be configured in electronic devices, they will not be repeated here. The audio circuit, speaker, and microphone can provide an audio interface. The audio circuit can convert the received audio data into an electrical signal and transmit it to the speaker, which converts it into a sound signal for output. On the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit and converted into audio data. The audio data is then output to the processor for processing and then sent to another electronic device through the RF circuit, or the audio data is output to the memory for further processing.

[0134] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.

[0135] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0136] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above implementation. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A stored procedure calling method based on the MyBatis framework, characterized in that: include: Determine a custom stored procedure from a stored procedure precompiled in a MyBatis framework, wherein the custom stored procedure includes at least one custom variable; Obtain the database object table and call index table of the MyBatis framework, wherein the database object table is used to record the variables and stored procedures defined in the target database, and the call index table records the index information of each stored procedure in the MyBatis framework; Generating a target variable corresponding to the custom variable in the database object table, and determining the parameter value of the custom variable as the parameter value of the target variable; Generate a target stored procedure identical to the custom stored procedure in the database object table, and replace the custom variables in the target stored procedure with the target variables; Obtain target index information of the target stored procedure, and replace the index information of the custom stored procedure with the target index information in the call index table; When a stored procedure call instruction is obtained and the stored procedure corresponding to the stored procedure call instruction is the target stored procedure, a target parser corresponding to the target stored procedure is determined from a plurality of preset optional parsers; wherein each of the optional parsers is used to parse data in different data arrangements; Acquire intermediate data from the target database through the target stored procedure; The intermediate data is parsed according to the target parser to obtain target data.

2. A stored procedure calling method based on the MyBatis framework according to claim 1, characterized in that, Determining a custom stored procedure from a stored procedure precompiled in the MyBatis framework includes: Obtain a stored procedure package precompiled in the MyBatis framework, wherein the stored procedure package includes at least two initial stored procedures and at least one custom variable; At least one of the initial stored procedures to which the custom variables are applied is determined as the custom stored procedure.

3. A stored procedure calling method based on the MyBatis framework according to claim 2, characterized in that, The step of determining at least one of the initial stored procedures applying the custom variables as the custom stored procedure comprises: determining the custom variable not recorded in the database object table as a target custom variable; At least one of the initial stored procedures to which the target custom variable is applied is determined as the custom stored procedure.

4. A stored procedure calling method based on the MyBatis framework according to claim 1, characterized in that, The determining of a target parser corresponding to the target stored procedure from a plurality of preset optional parsers includes: Determine a target data structure predefined in the target storage process, wherein the target data structure represents a data arrangement of the target data; The target parser is determined from a plurality of the selectable parsers according to the target data structure.

5. A stored procedure calling method based on the MyBatis framework according to claim 4, characterized in that, The step of parsing the intermediate data according to the target parser to obtain target data includes: When the target data is data input to the target stored procedure, determining a preset keyword corresponding to the target data structure, and extracting the target data from the intermediate data according to the preset keyword by the target parser; or, When the target data is data output by the target stored procedure, the intermediate data is converted into a target array by the target parser, and the target array is determined as the target data.

6. A stored procedure calling method based on MyBatis framework according to claim 1, characterized in that, After replacing the custom variable in the target stored procedure with the target variable, the method further includes: When the target stored procedure includes an output operation statement, determining the target variable corresponding to the output operation statement as the target output variable; Determine the data type of the custom variable corresponding to the target output variable in the custom storage process as the target output data type; The target output data type is determined as the data type of the target output variable.

7. A stored procedure calling device based on MyBatis framework, characterized in that: include: A first acquisition unit is configured to determine a custom stored procedure from stored procedures precompiled in a MyBatis framework, wherein the custom stored procedure includes at least one custom variable; A second acquisition unit is used to obtain a database object table and a call index table of the MyBatis framework, wherein the database object table is used to record variables and stored procedures defined in the target database, and the call index table records index information of each stored procedure in the MyBatis framework; a variable generating unit, configured to generate a target variable corresponding to the custom variable in the database object table, and determine the parameter value of the custom variable as the parameter value of the target variable; A stored procedure generating unit, configured to generate a target stored procedure identical to the user-defined stored procedure in the database object table, and replace the user-defined variables in the target stored procedure with the target variables; An index information replacement unit, configured to obtain target index information of the target stored procedure, and replace the index information of the custom stored procedure with the target index information in the call index table; a stored procedure calling unit, configured to, upon obtaining a stored procedure calling instruction and the stored procedure corresponding to the stored procedure calling instruction being the target stored procedure, determine a target parser corresponding to the target stored procedure from a plurality of preset optional parsers; wherein each of the optional parsers is configured to parse data of a different data arrangement; The intermediate data is acquired from the target database through the target stored procedure; and the target data is obtained by performing data parsing on the intermediate data according to the target parser.

8. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the stored procedure calling method based on the MyBatis framework as described in any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: The computer program is used to execute the stored procedure calling method based on the MyBatis framework as described in any one of claims 1 to 6.