Dynamic sql statement optimization method and device, storage medium and computer equipment

By optimizing MyBatis dynamic SQL statements, identifying and deleting invalid conditions, and performing pre-compilation, the problem of complex dynamic SQL writing is solved, and writing efficiency is improved.

CN115544063BActive Publication Date: 2026-06-09E SURFING VISION TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
E SURFING VISION TECHNOLOGY CO LTD
Filing Date
2022-11-10
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, MyBatis uses complex dynamic SQL writing with too much invalid syntax, resulting in low writing efficiency.

Method used

By obtaining the parameter descriptors and their execution conditions in the dynamic SQL statement, it is determined whether the pre-compilation conditions are met, the execution conditions that do not meet the conditions are deleted, and the code segments that meet the conditions are pre-compiled to simplify the dynamic SQL statement.

Benefits of technology

It reduces meaningless code in dynamic SQL statements, improves writing efficiency, simplifies syntax, and avoids complex foreach code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115544063B_ABST
    Figure CN115544063B_ABST
Patent Text Reader

Abstract

The dynamic SQL statement optimization method, device, storage medium and computer device provided by the application can determine all parameter descriptors and corresponding execution conditions in the dynamic SQL statement after obtaining the dynamic SQL statement to be optimized, and determine whether each parameter descriptor satisfies a pre-compiled condition. If not, the execution condition corresponding to the parameter descriptor in the dynamic SQL statement is deleted to reduce meaningless code of the dynamic SQL statement. If yes, the code segment containing the execution condition in the dynamic SQL statement is pre-compiled according to the parameter descriptor and the corresponding execution condition to reduce the use of complex syntax, for example, when the execution condition of the dynamic SQL statement contains in or not in, complex foreach code can no longer be written. The dynamic syntax optimization method adopted by the application has simple syntax and can reduce a large amount of meaningless code, thereby improving the coding efficiency of the dynamic SQL statement.
Need to check novelty before this filing date? Find Prior Art