CN116226161A - Method for improving efficiency of developing MyBatis - Google Patents
Method for improving efficiency of developing MyBatis Download PDFInfo
- Publication number
- CN116226161A CN116226161A CN202211588412.2A CN202211588412A CN116226161A CN 116226161 A CN116226161 A CN 116226161A CN 202211588412 A CN202211588412 A CN 202211588412A CN 116226161 A CN116226161 A CN 116226161A
- Authority
- CN
- China
- Prior art keywords
- sql
- translation
- mybatis
- custom
- java
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2452—Query translation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/252—Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Debugging And Monitoring (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The patent describes an IDE plug-in for SQL translation and optimization based on Java acquisition of MyBatis log, which is mainly divided into two parts: 1. based on the XML page which is currently active, an error correction module for detecting SQL sentences in XML, preventing risks such as SQL injection and the like from being generated in the sentences and carrying out corresponding prompt is provided. 2. The method has the advantages that custom notes are innovatively used, memory is saved, accurate and efficient processing is achieved, and SQL translation, detection and splicing are achieved. This patent is applicable to projects that require development using mybatis and that possess a significant amount of database development effort. The patent realizes the automatic detection of SQL and provides the capability of prompting the developer of SQL loopholes and automatically modifying basic problems. The method realizes the translation of SQL precompiled by Mybatis, helps developers compare the difference between the current SQL and the expected SQL, facilitates the use of the SQL when the database is queried, and does not need manual assembly.
Description
Technical Field
IT and software development.
Background
During daily development, in the encoding process, developers often cause defects to SQL codes due to incomplete run-up or misuse, so that bug is generated in the starting, compiling and running processes, and normal use of the program is affected. In the development process, mybatis or Mybatis Plus can not run immediately after being printed with a log, wild cards need to be copied out to be filled manually, and when complex sql is encountered, time is wasted to read again and write. Most of the existing solutions are to grasp related information by scanning keywords of a console, and the following problems exist in the mode:
and (3) a step of: inefficient processing of large output logs requires more memory.
And II: the problem of redundant warning can appear in current solution, extravagant resource.
Disclosure of Invention
The patent describes an IDE plug-in for SQL translation and optimization based on Java acquisition, which is different from the prior art, creatively uses custom annotations, saves memory, processes accurately and efficiently, and realizes SQL translation, detection and splicing.
Drawings
FIG. 1 is a schematic diagram of an error correction module.
FIG. 2 is a schematic diagram of a translation module.
Detailed Description
This patent describes a method to improve the efficiency of developing MyBatis, and the patent mainly includes two parts:
1. the error correction module, fig. 1, automatically checks the SQL grammar or the corresponding label of the currently active window by using the IDEA native instruction mechanism, acquires the corresponding SQL sentence after checking the keyword, judges the risk according to the grammar, prompts if the risk exists, and modifies the simple error.
The method comprises the following steps:
(1) writing MyInject inheritance injection, acquiring a window which is currently active, and scanning a current code segment according to the expansion of the window.
(2) Comments corresponding to errors are described by using the insactiondescriptions, and corresponding html (such as warning comments of SQL injection risk abnormality) is written and displayed on the corresponding SQL.
(3) And configuring a corresponding localInspec and Tion configuration item in the plugin.xml, and binding our myInspec class for custom code detection opening.
(4) Quick repair can be performed in the html of the partial warning, and basic CodeFix is realized by calling the visitNewExpress () through an Abstract BaseJavaCalInjectTool () method when detecting codes.
2. The translation module, FIG. 2, uses the internal intersector to intercept the custom annotation mode generated by mybatis, obtain parameters, and reassemble the corresponding parameters
The method comprises the following steps:
(1) and writing plug-in class to realize an internetwor interface so as to prepare for obtaining a configeration object subsequently.
(2) The part which needs to be filtered when the program runs is specified through the @ internets label, and the corresponding data is fetched.
The system comprises four processing modules of Executor, parameterHandler, resultSetHandler, statementHandler, an execution component corresponding to mybatis, a parameter processing module, a result set module and a JDBC operation module.
(3) And injecting a corresponding plug-in implementation class into the Mybatis configuration, allowing the user-defined annotation interceptor to intercept the Mybatis, and completing capturing and binding of the interceptor.
(4) Executor in IDEA is created (creating an IDEA self-contained output console) while adding dependencies to Plgin. Xml to point to this output.
(5) And re-assembling the obtained data and outputting the data in the created Console_Executor.
Claims (5)
1. The patent describes an IDE plug-in for SQL translation and optimization based on Java acquisition, which is different from the prior art, creatively uses custom annotations, saves memory, processes accurately and efficiently, and realizes SQL translation, detection and splicing.
2. The patent mainly comprises two parts: the error correction module is used for automatically checking SQL grammar or corresponding labels of a currently active window by utilizing an IDEA original instrumentation mechanism, acquiring corresponding SQL sentences after checking keywords, judging risks according to the grammars, prompting if the risks exist, modifying the translation module for simple errors, intercepting a custom annotation mode generated by mybatis by using an internal interconnector, acquiring parameters, and re-assembling the corresponding parameters.
3. And scanning the code segment of the current active window by the custom instrumentation (1), and realizing intelligent error correction (2) according to the custom rule.
4. The JAVA-based language acquires SQL translation capability (3) and is characterized in that the translation capability is realized by custom JAVA class (4) through realizing an intersector interface.
5. The patent is developed according to claims 1 and 2 as a plug-in (5) to be put on a plug-in market for downloading by developers.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211588412.2A CN116226161A (en) | 2022-12-12 | 2022-12-12 | Method for improving efficiency of developing MyBatis |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211588412.2A CN116226161A (en) | 2022-12-12 | 2022-12-12 | Method for improving efficiency of developing MyBatis |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116226161A true CN116226161A (en) | 2023-06-06 |
Family
ID=86579392
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211588412.2A Pending CN116226161A (en) | 2022-12-12 | 2022-12-12 | Method for improving efficiency of developing MyBatis |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116226161A (en) |
-
2022
- 2022-12-12 CN CN202211588412.2A patent/CN116226161A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Kästner et al. | CompCert: Practical experience on integrating and qualifying a formally verified optimizing compiler | |
JP2602205B2 (en) | Database access control method | |
US7478367B2 (en) | Dynamic source code analyzer | |
CN109408528B (en) | Database script generation method and device, calculation device and storage medium | |
CN106919612B (en) | Processing method and device for online structured query language script | |
CN109783195A (en) | A kind of real-time adjustment method of intelligent contract based on container | |
EP3974964A1 (en) | Automated generation of software patches | |
CN110908894A (en) | Visual report tool automatic testing method and device based on vuex | |
CN110851514B (en) | ETL (extract transform load) processing method based on FLINK (Linear rotation injection) | |
US20060041873A1 (en) | Computer system and method for verifying functional equivalence | |
Whalen et al. | An approach to automatic code generation for safety-critical systems | |
Whalen et al. | On the requirements of high-integrity code generation | |
CN117992111A (en) | Version management method, system and medium of automobile software | |
US11119740B2 (en) | Parsability of code snippets | |
CN117707499A (en) | Multi-source model algorithm analyzer plug-in and compiling algorithm based on virtualization technology | |
CN117076296A (en) | Control system, method, equipment and medium of network embedded equipment | |
CN116226161A (en) | Method for improving efficiency of developing MyBatis | |
CN116126731A (en) | Code standardization method based on generation type pre-training | |
Ribeiro | Large Language Models for Automated Program Repair | |
EP2535813B1 (en) | Method and device for generating an alert during an analysis of performance of a computer application | |
CN115310095A (en) | Block chain intelligent contract mixed formal verification method and system | |
Qiujun et al. | Research on the Quality of Automotive Electronic Software Based on Code Checking | |
Li et al. | Research and Implementation of a Software Runtime Fault Propagation Path Acquisition Method | |
de Jager et al. | Hybrid Analysis of BPEL Models with Grammars. | |
CN115964295A (en) | Method and device for quickly replacing compiled front-end file preprocessed in chip |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication |