A SQL extraction method of MyBatis application
By replacing the classes in the MyBatis application with the ClassLoader loader, parsing and constructing dynamic SQL statements, the problem of obtaining dynamic SQL parameters when MyBatis is not running is solved, and dynamic SQL statement parsing and parameter retrieval are realized before the MyBatis application runs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FOCUS TECH
- Filing Date
- 2022-10-25
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technology cannot obtain parameters of dynamic SQL statements without running the MyBatis application, making it impossible to check SQL statements before execution.
The ClassLoader is used to load the subclasses of the OgnlCache and ExpressionEvaluator classes in the MyBatis application. Instead, the corresponding subclasses MicOgnlCache and MicExpressionEvaluator are loaded by parsing, dynamic SQL statements are parsed, unsafe variables are obtained, and SQL statements are constructed.
Without modifying the MyBatis application source code, it dynamically constructs actual SQL statements, identifies and outputs potential injection vulnerabilities in the SQL statements, and achieves dynamic SQL statement parsing and parameter retrieval.
Smart Images

Figure CN115794035B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data security technology, specifically relating to a method for extracting SQL from a MyBatis application. Background Technology
[0002] In SQL development, a preliminary SQL scan is usually required, but this scan necessitates accurate static SQL statements. However, compared to writing static SQL statements, dynamic SQL statements are widely used due to their ease of writing and adaptive nature.
[0003] Dynamic SQL is one of the powerful features of MyBatis. The MyBatis framework's dynamic SQL technology is a function that dynamically assembles SQL statements based on specific conditions. Its purpose is to solve the problem of concatenating SQL statement strings. In current MyBatis application development, dynamic SQL statements are typically written using annotations or XML mapping files. Then, the MyBatis application dynamically assembles the complete SQL statement based on the actual SQL statement parameters. MyBatis supports dynamic SQL elements such as if, choose, when, otherwise, trim, where, set, and foreach. Dynamic SQL actually uses the MyBatis application to check whether the passed parameters are true or false using the if, foreach, etc. tags. If true, the parameters are concatenated; otherwise, they are not concatenated. In other words, without the actual SQL statement parameters, it is impossible to directly obtain the accurate static SQL statement.
[0004] The patent "SQL Extraction Method and Apparatus for MyBatis Applications" (application number: 202010821261.5) proposes that, in a MyBatis application with pre-defined tracking points, the tracking logic in a preset interception chain of the tracking application is executed in a chain before and after loading a loading class, thereby loading the modified loading class; the MyBatis application with added tracking points is run, and the non-pre-compiled dynamically passed parameters in the mapping file of the MyBatis application are replaced to obtain the final mapping file; the mapping file is then parsed to obtain the SQL statements of the MyBatis application. However, this SQL extraction method requires obtaining the SQL statement parameters during the actual operation of the MyBatis application, which is not conducive to checking the SQL statements before execution.
[0005] Therefore, how to obtain SQL statements without running MyBatis is a technical problem that must be solved. Summary of the Invention
[0006] To address the existing technical problems, this invention provides a method for extracting SQL from MyBatis applications, enabling the parsing of dynamic SQL statements before MyBatis actually runs, and dynamically constructing the actual SQL statements without modifying the MyBatis application source code.
[0007] The technical solution of this invention is a method for extracting SQL from a MyBatis application, the specific steps of which include:
[0008] Step 1: Load the inherited classes of the OgnlCache and ExpressionEvaluator classes in the MyBatis application using the ClassLoader. Specifically, the MyBatis application's JAR file and the inherited classes are written into the same ClassLoader. During the loading of the MyBatis application's JAR file using the ClassLoader, the loading of the OgnlCache and ExpressionEvaluator classes is prevented, and the corresponding inherited classes are instead parsed and loaded. These inherited classes include MicOgnlCache, a subclass of OgnlCache, and MicExpressionEvaluator, a subclass of ExpressionEvaluator.
[0009] Step 2: Scan the configuration file of dynamic SQL statements and obtain the statement ID; iterate through the statement IDs, load the MyBatis application using the ClassLoader, and parse the corresponding dynamic SQL statements; specifically, when parsing the ${parameters} of the dynamic SQL statement, call the loading class MicOgnlCache; parsing... <if>The `test` attribute of the tag and <foreach>When the tag's collection attribute is called, the loading class MicExpressionEvaluator is invoked;
[0010] Step 3: Obtain unsafe variables in dynamic SQL statements; specifically: when the MyBatis application calls the OgnlCache class to parse the placeholder ${parameter}, the ClassLoader class loader replaces it with the loaded MicOgnlCache class, parses and obtains the parameters in the MicOgnlCache placeholder ${parameter}, marks the parameters as unsafe variables with the symbols $ and {,}, and stores them in a temporary table;
[0011] Step 4: Obtain the SQL statement; specifically, when the MyBatis application calls the ExpressionEvaluator class for parsing, it uses the ClassLoader class loader to replace the loading class MicExpressionEvaluator for parsing. <if>Dynamic SQL statements using tags and Foreach tags, from <if>The `test` attribute of the tag retrieves a boolean expression parameter, and a constructor parameter is generated based on the boolean expression parameter to make the boolean expression true; according to <foreach>The `collection` attribute value of the tag outputs a list; retrieves... <foreach>The iterable objects in the tags are stored in a list;
[0012] Step 5: After the dynamic SQL statement corresponding to the statement ID is parsed, retrieve the unsafe variable output from the temporary table; using the MyBatis application, combine the constructor parameters obtained in Step 4 and the SQL statement in the IF tag, as well as... <foreach>The list of elements in the tag is concatenated to form a complete SQL statement output; the output result is identified by the statement ID.
[0013] In step 2, the parsing is performed except... <if>When other dynamic tags besides the `<test>` tag contain the `test` attribute, the loading class `MicExpressionEvaluator` is also invoked.
[0014] In step 3, the parameters in the placeholder ${parameter} of the class MicOgnlCache are marked and saved through the defined getValue method; the temporary table is formatted as set; when retrieving the parameters in the placeholder ${parameter} of the class MicOgnlCache, the default value is returned as 1.
[0015] Step 4 specifically includes:
[0016] Step 4-1: The ExpressionEvaluator class obtains the value by defining the evaluateBoolean() method. <if>The variable name and constant value of the Boolean expression in the `test` attribute of the tag;
[0017] Step 4-2: Calculate the preceding and following values of the adjacent constant values obtained in Step 4-1, and combine them with the preset parameter values to form the construction parameter list of the SQL statement; the preset values sequentially include string 1 and string 0, a list containing string 1, a list containing string 0, and null value.
[0018] Step 4-3: Select the parameter values from the list of constructed parameters in sequence as the specific parameter values of the variable, and obtain the SQL statement that makes the Boolean expression true; at the same time, record the parameter values as the constructed parameter values of the SQL statement.
[0019] Step 4-4: The ExpressionEvaluator class, through the defined evaluateIterable() method, does not require consideration. <foreach>The collection attribute value in the tag returns a list; when the list stores the iterated object, it only stores one element of the iterated object.
[0020] In step 4, obtaining the preceding and following values of the adjacent constant values specifically involves performing mathematical operations such as adding 1, adding 2, subtracting 1, and subtracting 2 on the constant value to obtain the preceding and following values of the four adjacent constant values.
[0021] In step 4, the selected parameter value is selected by prioritizing the value of the nearest constant value and then selecting the preset value.
[0022] In step 4, if there are no constant values in the dynamic SQL conditional statement, only the variable names are retrieved; parameters are selected from the parameter list and passed in. <if>The SQL statement that retrieves the true value of a dynamic condition statement within a tag's dynamic SQL statement.
[0023] After the parsing in step 5 is completed, the contents of the temporary table are cleared, and the dynamic SQL parsing of the next statement ID continues.
[0024] Compared with the prior art, the significant advantages and effects of the present invention are as follows:
[0025] 1) In the process of parsing dynamic SQL statements using MyBatis applications, this invention outputs the $ placeholders that may be vulnerable to injection vulnerabilities in the statements. On the other hand, based on the identified expressions of dynamic SQL conditions, it calculates and passes the SQL statement parameter values through the expressions, thereby dynamically constructing the actual SQL statements without modifying the MyBatis application source code.
[0026] 2) This invention uses the ClassLoader to simulate the MyBatis application runtime environment, uses the loader to start the MyBatis JAR package, and controls the replacement of the MyBatis application classes with custom classes. No plugins or MyBatis statement logs are required, and the parsing of dynamic SQL statements and the acquisition of SQL statement parameters are completed before MyBatis actually runs. Attached Figure Description
[0027] Figure 1 This is a flowchart of a SQL extraction method for a MyBatis application according to an embodiment of the present invention;
[0028] Figure 2 This is a schematic diagram of the SQL extraction structure of a MyBatis application according to an embodiment of the present invention; Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0030] In actual dynamic SQL statement parsing, parsing the `test` attribute in dynamic elements is the most crucial step, for example... <if>The tags `<choose>` and `<choose(when, otherwise)` are used to... <if>Taking the tag as an example, the test attribute is used for dynamic condition determination. Only when the determination result is true can the content in the element be concatenated into the SQL statement. <foreach>The `<if>` tag is a dynamic tag used for traversal queries within dynamic elements. It retrieves the content of elements that meet the query conditions through traversal and concatenates them into the SQL statement. Both `if` and `foreach` elements utilize expressions to obtain parameters for judgment and query from external sources. This means that if the MyBatis application is not running, it cannot obtain parameters, and without parameter input, the MyBatis application cannot dynamically assemble SQL statements. Through research on the internal source code of the MyBatis application by the technical personnel of this patent, it was found that MyBatis mainly uses the classes `OgnlCache` and `ExpressionEvaluator` to parse dynamic statements. However, the existing classes are only responsible for parsing and do not involve parameter extraction or storage. Furthermore, they can only complete the concatenation of SQL statements when specific constructor parameter values are passed in. Technicians attempted to directly modify the MyBatis source code, but this modification hindered future upgrades, and the official MyBatis team did not adopt the modified source code. Given the inability to alter the internal source code of the MyBatis application, the present invention modifies the class files that MyBatis runtime depends on using the ClassLoader. When the original class in the MyBatis application parses dynamic SQL statements, it prevents the original class from parsing and loads a custom class instead. Based on the parameter values parsed from the dynamic SQL statement, it generates constructor parameter values to be passed into the dynamic SQL statement, completing the SQL statement concatenation. Simultaneously, it alerts the user to the existence of unsafe variables in the SQL statement.
[0031] Essentially, all class loaders are instances of the java.lang.ClassLoader class. It's used to load classes. It's responsible for converting the bytecode of a class into an in-memory Class object. In addition, the ClassLoader is also responsible for loading resources needed by Java applications, such as image files and configuration files.
[0032] Class loaders in Java can be broadly divided into two categories: one is provided by the system, and the other is written by Java application developers.
[0033] like Figure 1 The diagram shows a flowchart of a SQL extraction method for a MyBatis application according to an embodiment of the present invention. The specific steps include:
[0034] Step 1: Utilize the ClassLoader to control the loading of subclasses of the OgnlCache and ExpressionEvaluator classes in the MyBatis application; specifically, load the MyBatis application's JAR file along with the MicOgnlCache class and its subclass MicExpressionEvaluator into the same ClassLoader. Figure 2 This is a schematic diagram of the SQL extraction structure of a MyBatis application in an embodiment of the present invention; during the process of loading the Jar package of the MyBatis application using the ClassLoader, the loading of the OgnlCache class of the MyBatis application is prevented and replaced by parsing and loading the MicOgnlCache class; the loading of the ExpressionEvaluator class of the MyBatis application is prevented and replaced by parsing and loading the MicExpressionEvaluator class.
[0035] Step 2: Parse dynamic SQL statements by calling the inherited class based on the statement ID: Scan the configuration file of dynamic SQL statements and obtain the statement ID; traverse the statement IDs, and use the MyBatis application loaded by the ClassLoader to parse the corresponding dynamic SQL statements; specifically, when parsing the ${parameters} of the dynamic SQL statement, call the loading class MicOgnlCache; parsing... <if> 、 <choose> 、 <when>The tag with the test attribute in the tag and <foreach>When the collection attribute of a tag is used, the loading class MicExpressionEvaluator is called.
[0036] In the configuration file of the dynamic SQL statement in this embodiment of the invention, taking the dynamic SQL statement with statement ID "selectBlogByIds" as an example, the specific statement content is as follows, where #{parameter}, according to the original parameter output method of MyBatis application, will be replaced with the symbol "?" during output.
[0037]
[0038] Step 3: Record unsafe variables in dynamic SQL statements; retrieve unsafe variables in dynamic SQL statements; specifically: the MyBatis application calls the OgnlCache class to parse the parameters in ${parameter}, replaces the ClassLoader with the MicOgnlCache class to parse and retrieve the parameters in ${parameter}, marks the parameters with the symbol $ as unsafe variables, and stores them in a temporary table; when retrieving the parameters in the placeholder ${parameter} in Step 3, the default value is returned as 1;
[0039] The `MicOgnlCache` class marks and saves parameters in `${parameter}` using the defined `getValue` method. The temporary table is in set format. The following is the implementation code of the `getValue` method in the `MicOgnlCache` class. This code implements the `MicOgnlCache` class to parse `${parameter}` in dynamic SQL statements. In this embodiment, when the `MicOgnlCache` class parses `${order_by_type}` in a dynamic SQL statement, it calls the `getValue()` method to obtain the parameter value `order_by_type` from the placeholder `${`. Then, it adds markers "$" and "{}" to `order_by_type`, records the parameter value as `${order_by_type}` in the temporary table `Dollars`, and returns a default value of 1 to replace `${order_by_type}`.
[0040]
[0041] Step 4: Obtain <if>Label, <foreach>The SQL statement within the tag; specifically: when the MyBatis application calls the ExpressionEvaluator class for parsing, it replaces the ClassLoader with the loaded MicExpressionEvaluator class for parsing. <if>Label, <foreach>The dynamic SQL statement of the IF tag retrieves the variables and constants of the Boolean expression from the dynamic SQL statement of the IF tag, and constructs the parameter values to be passed into the dynamic SQL statement based on the constants; according to <foreach>The value of the collection attribute of the tag outputs a list to store the iterable object;
[0042] Step 4 includes:
[0043] Step 4-1: When the MyBatis application parses the dynamic SQL statement of the IF tag, it obtains the variable names and constant values of the Boolean expression in the statement through the evaluateBoolean() method; if there are no constant values in the dynamic SQL conditional statement, only the variable names are obtained; in this embodiment of the invention, the class MicExpressionEvaluator parses... <if>When using dynamic SQL statements for tags, the `evaluateBoolean()` method is used to obtain... <if>The Boolean expression "state != null" in the tag is used to extract the variable name "state"; since no constant value exists, the constant value is not extracted.
[0044] Step 4-2: Calculate and obtain the preceding and following values of the adjacent constant values, and combine them with the preset parameter values to form the construction parameter list of the SQL statement; the preset values include string 1 and string 0, a list containing string 1, a list containing string 0, and null value; the calculation and obtaining of the values of the adjacent constant values is specifically to perform mathematical operations of adding 1, adding 2, subtracting 1, and subtracting 2 on the constant values, thereby obtaining the preceding and following values of the four adjacent constant values;
[0045] In this embodiment of the invention, since no constant values are stored, the construction parameter list includes strings 1 and 0, a list containing strings 1, a list containing strings 0, and a list of null values.
[0046] Step 4-3: Sequentially select parameter values from the construction parameter list as the specific parameter values of the variable to obtain the SQL statement that makes the Boolean expression true; simultaneously record the parameter values as the construction parameter values of the SQL statement; in this embodiment of the invention, a preset value is selected from the construction parameter list. When the preset value is "1", the Boolean expression "state!=null" is true, and the variable is obtained. <if>The tag contains "And state = #{state}". When the MyBatis application parses #{parameter}, it replaces #{parameter} with the symbol "?" in the output. <if>The dynamic SQL statement output for the tag is: And state = ?; and the preset value "1" is recorded simultaneously.
[0047] If in the embodiments of the present invention <if>The Boolean expression "state>3" in the tag retrieves the variable name "state" and the constant value 3. Based on this constant value, the preceding values of the constant value 3 are calculated as 2 and 1; the following values are calculated as 4 and 5. These preceding and following values are used as the specific parameter values of the variable in ascending order. When the variable "state" is 4, the Boolean expression "state>3" is true, and the variable is retrieved... <if>The tag contains "And state = #{state}", and records state = 4; Step 4-4: The class ExpressionEvaluator obtains the value through the defined evaluateIterable() method. <foreach>The `open` attribute of the tag has the value "ID in(" and the `close` attribute has the value "")"; (Analysis) <foreach>No need to consider when labeling. <foreach>The `collection` attribute value in the tag is used to obtain the iterable object `#{parameter}`, which is then stored in the list `answer`. Ignoring the number of elements to be traversed in the iterable object `#{parameter}`, and following the way Mybatis parses `#{parameter}`, a symbol "?" is output to represent an element stored in the list `answer`. In this embodiment of the invention, <foreach>The SQL statement output by the tag is ID in(?).
[0048] The following code is used to implement the acquisition <if>The variable name and constant value of the Boolean expression in the tag and how to get them <foreach>The iterable object in the tag, where the evaluateIterable() method uses OGNL syntax, through
[0049] Ognl.parseExpression(expression) retrieves <if>The tags contain constants and variables in Boolean expressions; the `checkValue()` method calls `Ognl.getValue` to determine if the passed parameter value makes the Boolean expression true, and records the parameter value that makes the Boolean expression true; the `evaluateIterable()` method stores these values in a List format.
[0050] <foreach>Iterate over one element of the object in the tag;
[0051]
[0052]
[0053]
[0054] Step 5: Output SQL statements according to statement ID: After the dynamic SQL statement corresponding to the statement ID is parsed, retrieve the unsafe variable from the temporary table and output it, such as ${order_by_type} in this embodiment; use the MyBatis application to combine the constructor parameters obtained in Step 4 and the SQL statement in the IF tag, as well as <foreach>The list of elements in the tags is concatenated to output a complete SQL statement; the output result is identified by the statement ID.
[0055] In this embodiment of the invention, the SQL statement output according to the statement id = "selectBlogByIds" is as follows:
[0056] Id:selectBlogByIds;
[0057] Statement: SELECT*FROM BLOG WHERE ID in(?)AND state=? ORDER BY 1;
[0058] Constructor parameters: {state = 1};
[0059] List of insecure parameters: ${order_by_type};
[0060] Compared with the prior art, the significant advantages and effects of the present invention are as follows:
[0061] 1) In the process of parsing dynamic SQL statements using MyBatis applications, this invention outputs the $ placeholders that may be vulnerable to injection vulnerabilities in the statements. On the other hand, based on the identified expressions of dynamic SQL conditions, it calculates and passes the SQL statement parameter values through the expressions, thereby dynamically constructing the actual SQL statements without modifying the MyBatis application source code.
[0062] 2) This invention uses the ClassLoader to simulate the MyBatis application runtime environment, uses the loader to start the MyBatis JAR package, and controls the replacement of the MyBatis application classes with custom classes. No plugins or MyBatis statement logs are required, and the parsing of dynamic SQL statements and the acquisition of SQL statement parameters are completed before MyBatis actually runs.
[0063] The above embodiments do not limit the present invention in any way. Based on the above description, those skilled in the art can make various changes and modifications without departing from the technical concept of the present invention. All other improvements and applications made to the above embodiments by equivalent transformation are within the protection scope of the present invention. The technical scope of the present invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.< / foreach> < / foreach> < / if> < / foreach> < / if> < / foreach> < / foreach> < / foreach> < / foreach> < / if> < / if> < / if> < / if> < / if> < / if> < / foreach> < / foreach> < / if> < / foreach> < / if> < / foreach> < / when> < / choose> < / if> < / foreach> < / if> < / if> < / if> < / foreach> < / if> < / if> < / foreach> < / foreach> < / foreach> < / if> < / if> < / foreach> < / if>
Claims
1. A method for extracting SQL from a Mybatis application, characterized in that, The specific steps include: Step 1: Load the inherited classes of the OgnlCache and ExpressionEvaluator classes in the MyBatis application using the ClassLoader. Specifically, the MyBatis application's JAR file and the inherited classes are written into the same ClassLoader. During the loading of the MyBatis application's JAR file using the ClassLoader, the loading of the OgnlCache and ExpressionEvaluator classes is prevented, and the corresponding inherited classes are instead parsed and loaded. These inherited classes include MicOgnlCache, a subclass of OgnlCache, and MicExpressionEvaluator, a subclass of ExpressionEvaluator. Step 2: Scan the configuration file of dynamic SQL statements and obtain the statement ID; iterate through the statement IDs, load the MyBatis application using the ClassLoader, and parse the corresponding dynamic SQL statements; specifically, when parsing the ${parameters} of the dynamic SQL statement, call the loading class MicOgnlCache; parsing... <if>The `test` attribute of the tag and <foreach> When the tag's collection attribute is called, the loading class MicExpressionEvaluator is invoked;< / foreach> < / if> Step 3: Obtain unsafe variables in dynamic SQL statements; specifically: when the MyBatis application calls the OgnlCache class to parse the placeholder ${parameter}, the ClassLoader class loader replaces it with the loaded MicOgnlCache class, parses and obtains the parameters in the MicOgnlCache placeholder ${parameter}, marks the parameters as unsafe variables with the symbols $ and {,}, and stores them in a temporary table; Step 4: Obtain the SQL statement; specifically, when the MyBatis application calls the ExpressionEvaluator class for parsing, it uses the ClassLoader class loader to load the MicExpressionEvaluator class for parsing. <if>Label, <foreach>Dynamic SQL statements for tags, from <if>The `test` attribute of the tag retrieves the boolean expression parameter, and the constructor parameters are generated based on the boolean expression parameter to make the boolean expression true; according to <foreach>The `collection` attribute value of the tag outputs a list; retrieves... <foreach> The iterable objects in the tags are stored in a list;< / foreach> < / foreach> < / if> < / foreach> < / if> Step 5: After the dynamic SQL statement corresponding to the statement ID is parsed, retrieve the unsafe variable output from the temporary table; using the MyBatis application, combine the constructor parameters obtained in Step 4 with... <if>SQL statements in the tags, and <foreach> The list of elements in the tag is concatenated to output a complete SQL statement; the output result is identified by the statement ID.< / foreach> < / if> 2. The SQL extraction method for a Mybatis application as described in claim 1, characterized in that, In step 2, the parsing is performed except... <if> When other dynamic tags besides the `<test>` tag contain the `test` attribute, the loading class `MicExpressionEvaluator` is also invoked.< / if> 3. The SQL extraction method for a Mybatis application as described in claim 2, characterized in that, In step 3, the parameters in the placeholder ${parameter} of the class MicOgnlCache are marked and saved through the defined getValue method; the temporary table is in set format; when retrieving the parameters in the placeholder ${parameter} of the class MicOgnlCache, the default value is returned as 1.
4. The SQL extraction method for a Mybatis application as described in claim 3, characterized in that: Step 4 specifically includes: Step 4-1: The ExpressionEvaluator class obtains the value by defining the evaluateBoolean() method. <if> The variable name and constant value of the Boolean expression in the `test` attribute of the tag;< / if> Step 4-2: Calculate and obtain the preceding and following values of the adjacent constant values, and combine them with the preset parameter values to form the construction parameter list of the SQL statement; the preset parameter values sequentially include string 1 and string 0, a list containing string 1, a list containing string 0, and null value; In step 4-2, calculating the preceding and following values of the adjacent constant values involves performing mathematical operations of adding 1, adding 2, subtracting 1, and subtracting 2 on the constant value to obtain the preceding and following values of the four adjacent constant values. Step 4-3: Select the parameter values from the parameter list in sequence as the specific parameter values of the variable, and obtain the SQL statement that makes the Boolean expression true; at the same time, record the parameter values as the construction parameter values of the SQL statement. Step 4-4: The ExpressionEvaluator class, through the defined evaluateIterable() method, does not require consideration. <foreach> The collection attribute value in the tag returns a list; when the list stores the iterated object, it only stores one element of the iterated object.< / foreach> 5. The SQL extraction method for a MyBatis application as described in claim 4, characterized in that: In step 4-3, the parameter values selected from the construction parameter list are selected by prioritizing the values of the nearest constant values, and then selecting the preset parameter values. In step 4, if there are no constant values in the dynamic SQL conditional statement, only the variable names are retrieved; parameters are selected from the parameter list and passed in. <if> The SQL statement that retrieves the true value of a dynamic condition statement within a tag's dynamic SQL statement.< / if> 6. The SQL extraction method for a MyBatis application as described in claim 5, characterized in that: After the parsing in step 5 is completed, the contents of the temporary table are cleared, and the dynamic SQL parsing of the next statement ID continues.
Citation Information
Patent Citations
SQL extraction method and device for MyBatis application program
CN111949491A
Configuration method and system based on SQL sentences of MyBatis
CN108121542A
Sql statement construction method and device, server and readable storage medium
CN110866029A