SQL grammar verification method and device, computer equipment and storage medium

Through the automated SQL syntax verification method, based on the detection range selected by the developer, the SQL statements of the target method are determined and executed, and statistical views are generated, which solves the challenges of SQL management and maintenance, and improves development efficiency and software quality.

CN119336614APending Publication Date: 2025-01-21CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411371064.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In software development, as the project scale expands, the management and maintenance of SQL statements have become a major challenge. It is difficult for existing technology to achieve automated SQL verification and compatibility detection, resulting in heavy burdens on developers, low efficiency and difficult to ensure software quality.

Method used

By receiving the selection signal, the detection range selected by the developer is determined, and the target method and SQL statement are determined based on this range, automatically executed, and a statistical view is generated to display the execution results.

Benefits of technology

The automated SQL grammar verification and compatibility testing, improved the flexibility and efficiency of the test, reduced the workload of developers, and improved software quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336614A_ABST
    Figure CN119336614A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of research and development, is applied to the field of intelligent government affairs, and relates to an SQL grammar verification method which comprises the steps that when a selection signal is received, a detection range selected by a developer is determined according to the selection signal, and a corresponding method is determined based on the detection range to serve as a target method; generating an initial input parameter based on the detection range, and inputting the initial input parameter into the target method for operation to execute an SQL statement corresponding to the target method to obtain an execution result; and generating and displaying a statistical view based on the execution result. The invention further provides an SQL grammar verification device, computer equipment and a storage medium. In addition, the invention also relates to a block chain technology, and the execution result can be stored in a block chain. According to the method and the device, local testing can be automatically carried out on the project, and the accuracy of SQL checking is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of research and development technology, and in particular to a SQL syntax verification method, apparatus, computer equipment and storage medium. Background Art

[0002] In software development technology, Mybatis has been widely used as a mainstream persistence layer framework. However, with the expansion of the project scale, the management and maintenance of SQL statements has become a major challenge. First, after the development of the Dao layer code, a large amount of unit test code needs to be written to detect the correctness of the SQL syntax. For example, if 10 methods are changed, 10 unit test codes need to be written. This method is not only time-consuming and labor-intensive, but also prone to errors. Secondly, database version upgrades often cause SQL compatibility issues. At this time, it is necessary to comprehensively test all Dao layer methods to find SQL that reports errors, which is also time-consuming and labor-intensive, and it is easy to miss tests. Therefore, there is an urgent need for an automated SQL verification and compatibility detection solution to reduce the burden on developers and improve development efficiency and software quality. Summary of the invention

[0003] The purpose of the embodiments of the present application is to propose a SQL syntax verification method and related equipment, so as to realize automatic partial testing of a project and improve the accuracy of SQL checking.

[0004] In order to solve the above technical problems, the embodiment of the present application provides a SQL syntax verification method, which adopts the following technical solution:

[0005] When a selection signal is received, determining the detection range selected by the developer according to the selection signal, and determining a corresponding method based on the detection range as a target method;

[0006] Generate initial input parameters based on the detection scope, and input the initial input parameters into the target method for execution, so as to execute the SQL statement corresponding to the target method and obtain the execution result;

[0007] A statistical view is generated and displayed based on the execution result.

[0008] Furthermore, when a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method, including:

[0009] Determining the detection range selected by the developer according to the selection signal;

[0010] When the detection scope is a module under a project, information of the module is obtained through a preset project monitoring class as module information;

[0011] The module information is transmitted to a preset Mapper class parser for parsing, to obtain a first parsing result;

[0012] Performing a reflection operation on the first parsing result to obtain a first Class object;

[0013] The preset Mapper processor is called to perform a reflection operation on the first Class object to obtain all methods in the class corresponding to the first Class object as the target method.

[0014] Furthermore, the step of transmitting the module information to a preset Mapper class parser for parsing to obtain a first parsing result includes:

[0015] The module information is transmitted to a preset Mapper class parser, and the type of the module information is identified by the Mapper class parser to obtain an input parameter type;

[0016] Selecting a preset parsing strategy as the target strategy according to the input parameter type;

[0017] The module information is parsed using the target strategy to obtain the first parsing result.

[0018] Furthermore, the step of performing a reflection operation on the first parsing result to obtain a first Class object includes:

[0019] A preset reflection API is called, and a reflection operation is performed on the first parsing result through the reflection API to obtain the first Class object.

[0020] Further, when a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method, including:

[0021] Determining the detection range selected by the developer according to the selection signal;

[0022] When the detection range is the class corresponding to the class name, the information corresponding to the class name is obtained through the preset class name monitoring class as the class information;

[0023] The class information is transmitted to a preset Mapper class parser for parsing, to obtain a second parsing result;

[0024] Performing a reflection operation on the second parsing result to obtain a second Class object;

[0025] The preset Mapper processor is called to perform a reflection operation on the second Class object to obtain all methods in the class corresponding to the second Class object as the target method.

[0026] Furthermore, when a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method, including:

[0027] Determining the detection range selected by the developer according to the selection signal;

[0028] When the detection range is the method corresponding to the method name, the information corresponding to the method name is obtained through a preset method name monitoring class as method information;

[0029] The preset Mapper processor is called to perform a reflection operation on the method information to obtain a corresponding method as the target method.

[0030] Furthermore, when the selection signal is received, the step of determining the detection range selected by the developer according to the selection signal includes:

[0031] When it is recognized that the developer clicks the MybatisCheck option under the preset project button in the panel, the detection scope is determined to be the module under the project;

[0032] When it is recognized that the developer clicks the MybatisCheck option under the preset class name button in the panel, the detection scope is determined to be the class corresponding to the class name;

[0033] When it is identified that the developer clicks the MybatisCheck option under the preset method name button in the panel, the detection scope is determined to be the method corresponding to the method name.

[0034] In order to solve the above technical problems, the embodiment of the present application also provides a SQL syntax verification device, which adopts the following technical solution:

[0035] A determination module, configured to, when receiving a selection signal, determine a detection range selected by a developer according to the selection signal, and determine a corresponding method based on the detection range as a target method;

[0036] An execution module, used for generating initial input parameters based on the detection scope, and inputting the initial input parameters into the target method for execution, so as to execute the SQL statement corresponding to the target method and obtain an execution result;

[0037] A generation module is used to generate and display a statistical view based on the execution result.

[0038] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0039] A computer device comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the above-mentioned SQL syntax verification method when executing the computer-readable instructions.

[0040] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0041] A computer-readable storage medium stores computer-readable instructions, which implement the steps of the above-mentioned SQL syntax verification method when executed by a processor.

[0042] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0043] This application determines the detection range selected by the developer according to the selection signal, determines the corresponding method based on the detection range as the target method; generates initial input parameters based on the detection range, and inputs the initial input parameters into the target method for operation to execute the SQL statement corresponding to the target method and obtain the execution result; this application enables developers to select the detection range according to actual needs, and automatically determine the target method and its corresponding SQL statement for execution. This process greatly improves the flexibility and efficiency of the test. Developers can quickly perform local testing on specific parts of the project without writing additional unit test code or configuring a complex test environment. Generate and display statistical views based on the execution results. After executing the SQL statement corresponding to the target method, generate and display the execution results, so that developers can get immediate feedback, which helps developers to quickly locate problematic SQL and effectively improve detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0045] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0046] Figure 2 is a flow chart of an embodiment of a SQL grammar verification method according to the present application;

[0047] Figure 3 It is a structural schematic diagram of an embodiment of an SQL grammar checking device according to the present application;

[0048] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0050] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0051] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0052] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.

[0053] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0054] The terminal device 101 can be any electronic device with a display screen and supporting web browsing. In addition to a laptop computer 1011, a tablet computer 1012 or a mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer, a desktop computer, etc.

[0055] The server 103 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal device 101 .

[0056] It should be noted that the SQL syntax verification method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the SQL syntax verification device is generally set in the server / terminal device.

[0057] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0058] All actions to obtain signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.

[0059] Continue to refer Figure 2 , shows a flow chart of an embodiment of a SQL syntax verification method according to the present application. The SQL syntax verification method comprises the following steps:

[0060] Step S201, when a selection signal is received, determining the detection range selected by the developer according to the selection signal, and determining a corresponding method based on the detection range as a target method.

[0061] In this embodiment, the SQL syntax verification method is executed on the electronic device (eg Figure 1 shown server / Terminal equipment) can receive the selection signal through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.

[0062] In this embodiment, the selection signal is sent by the developer, and the developer can send the selection signal by clicking a button on the panel, or the developer sends an execution instruction to the computer, and the execution instruction carries the selection signal. This application allows developers to select the detection range according to actual needs, and automatically determine the target method and its corresponding SQL statement for execution. This process greatly improves the flexibility and efficiency of the test. Developers can quickly test specific parts of the project without writing additional test code or configuring a complex test environment.

[0063] Step S202: Generate initial input parameters based on the detection scope, and input the initial input parameters into the target method for execution to execute the SQL statement corresponding to the target method and obtain an execution result.

[0064] In this embodiment, the initial input parameters automatically generated based on the detection scope can cover the corresponding usage scenarios of the target method to execute SQL statements, quickly discover SQL syntax errors, and facilitate developers to repair SQL statements in advance to enhance the stability and reliability of the code. Specifically, the detection scope includes three scopes: modules, classes, and methods under the project. According to the selected detection scope, the corresponding information is obtained and initialized to obtain the initial input parameters. For example, when the detection scope is a class, the class information is obtained, and the class information is initialized according to the preset initial value to obtain the initial input parameters.

[0065] Step S203: Generate and display a statistical view based on the execution result.

[0066] In this embodiment, the statistical view generated based on the execution results can intuitively display the problems found during the test, including the error type, location, and impact range, etc., providing developers with a basis for quickly locating and solving problems. This application provides examples of statistical views:

[0067]

[0068] This application determines the detection range selected by the developer according to the selection signal, determines the corresponding method based on the detection range as the target method; generates initial input parameters based on the detection range, and inputs the initial input parameters into the target method for operation to execute the SQL statement corresponding to the target method and obtain the execution result; this application enables developers to select the detection range according to actual needs, and automatically determine the target method and its corresponding SQL statement for execution. This process greatly improves the flexibility and efficiency of the test. Developers can quickly perform local testing on specific parts of the project without writing additional unit test code or configuring a complex test environment. Generate and display statistical views based on the execution results. After executing the SQL statement corresponding to the target method, generate and display the execution results, so that developers can get immediate feedback, which helps developers to quickly locate problematic SQL and effectively improve detection efficiency.

[0069] It should be noted that the method of the present application can be implemented in an IDEA environment, where IDEA mainly refers to IntelliJ IDEA, a Java integrated development environment developed by JetBrains. Of course, in actual operation, the method of the present application can also be implemented in other suitable computer environments.

[0070] In some optional implementations of this embodiment, step S201, i.e., when a selection signal is received, determining the detection range selected by the developer according to the selection signal, and determining a corresponding method based on the detection range, as a target method, includes:

[0071] Determining the detection range selected by the developer according to the selection signal;

[0072] When the detection scope is a module under a project, information of the module is obtained through a preset project monitoring class as module information;

[0073] The module information is transmitted to a preset Mapper class parser for parsing, to obtain a first parsing result;

[0074] Performing a reflection operation on the first parsing result to obtain a first Class object;

[0075] The preset Mapper processor is called to perform a reflection operation on the first Class object to obtain all methods in the class corresponding to the first Class object as the target method.

[0076] In the present embodiment, the present application is integrated into the project monitoring class (ProjectAction) in IDEA. The project monitoring class (ProjectAction) inherits from the AnAction class of IDEA Plugin. Developers can directly right-click on the button of the project to trigger the detection operation, without writing cumbersome unit test code or restarting the project, thereby improving development efficiency. This instant feedback mechanism greatly shortens the development cycle, allowing developers to quickly verify the correctness of SQL statements. The project monitoring class can obtain the information of the module as module information. The module information is transmitted to the preset Mapper class resolver (MapperClassResolver) for parsing operation to obtain the first parsing result. As an intermediate layer, the Mapper class resolver (MapperClassResolver) is responsible for receiving different types of input parameters, for example, receiving module information from the project monitoring class (ProjectAction). The module information is parsed by reflection operation to obtain a specific first Class object. This design not only reduces the redundancy of the code, but also improves the reusability of the code. Developers can easily expand the Mapper class resolver (MapperClassResolver) to support more types of input parameters without modifying each Action class. The MapperHandler traverses all methods in the class under the project's module through reflection operations, which facilitates the computer to dynamically execute code, that is, it can quickly perform local tests on specific parts of the project according to the developer's requirements. After generating the initial input parameters as mentioned above, calling the corresponding target method can simulate different test scenarios and verify the correctness of the SQL statement. This application provides an instant, automated, and flexible SQL detection method to improve development efficiency.

[0077] Specifically, the step of transmitting the module information to a preset Mapper class parser for parsing to obtain a first parsing result includes:

[0078] The module information is transmitted to a preset Mapper class parser, and the type of the module information is identified by the Mapper class parser to obtain an input parameter type;

[0079] Selecting a preset parsing strategy as the target strategy according to the input parameter type;

[0080] The module information is parsed using the target strategy to obtain the first parsing result.

[0081] In this embodiment, the Mapper class resolver (MapperClassResolver) will select the corresponding resolution strategy according to the type of module information (i.e., input parameter). For example, if the input parameter is a class name of string type, Class.forName() will be selected for resolution; if the input parameter is a certain enumeration type, a predefined mapping relationship will be searched according to the enumeration value. In this way, the accuracy of resolution is improved.

[0082] In addition, the step of performing a reflection operation on the first parsing result to obtain a first Class object includes:

[0083] A preset reflection API is called, and a reflection operation is performed on the first parsing result through the reflection API to obtain the first Class object.

[0084] In this embodiment, the reflection API allows the program to dynamically process information at runtime. This capability enables the program to more flexibly deal with different data types and object structures. Through the reflection API, the direct dependencies between codes can be reduced, so that the coupling between modules is reduced. This embodiment can improve the flexibility of the code and improve the detection efficiency by calling a preset reflection API and performing a reflection operation on the first parsing result through the reflection API.

[0085] In some optional implementations of this embodiment, step S201, i.e., when a selection signal is received, determining the detection range selected by the developer according to the selection signal, and determining a corresponding method based on the detection range, as a step of a target method, further includes:

[0086] Determining the detection range selected by the developer according to the selection signal;

[0087] When the detection range is the class corresponding to the class name, the information corresponding to the class name is obtained through the preset class name monitoring class as the class information;

[0088] The class information is transmitted to a preset Mapper class parser for parsing, to obtain a second parsing result;

[0089] Performing a reflection operation on the second parsing result to obtain a second Class object;

[0090] The preset Mapper processor is called to perform a reflection operation on the second Class object to obtain all methods in the class corresponding to the second Class object as the target method.

[0091] In the present embodiment, the application is encapsulated into an independent class name monitoring class (ClassAction) by the right-click operation of the class name button preset on the panel. The class name monitoring class (ClassAction) is also inherited from the AnAction class of IDEA Plugin. This design greatly enhances the extensibility and maintainability of the present application embodiment when used as a plug-in. Developers can easily add new right-click menu items to perform specific operations for different types of code elements without modifying the core logic, thereby improving development efficiency. Class information is transferred to the Mapper class resolver (MapperClassResolver) for parsing operations, and the second parsing result is obtained. Then, by reflection operation, the second Class object is obtained. By reflection, the direct dependency between codes can be reduced, so that the coupling degree between each module or component is reduced. The Mapper processor (MapperHandler) obtains all methods in the class corresponding to the class name by reflection operation, so that the application can be tested quickly and directly for the specified class in the project according to the requirements of the developer.

[0092] In some optional implementations of this embodiment, step S201, i.e., when a selection signal is received, determining the detection range selected by the developer according to the selection signal, and determining a corresponding method based on the detection range, as a step of a target method, further includes:

[0093] Determining the detection range selected by the developer according to the selection signal;

[0094] When the detection range is the method corresponding to the method name, the information corresponding to the method name is obtained through a preset method name monitoring class as method information;

[0095] The preset Mapper processor is called to perform a reflection operation on the method information to obtain a corresponding method as the target method.

[0096] In this embodiment, the present application is integrated into IDEA through a method name monitoring class (MethodAction). The method name monitoring class (MethodAction) is also inherited from the AnAction class of IDEA Plugin. The method name monitoring class (MethodAction) of this embodiment directly transmits the method information (MapperMethod) to the Mapper processor (MapperHandler) for processing. The specific method is obtained through reflection, and the corresponding method is called through the initial input parameter to realize the rapid positioning and testing of the SQL statement corresponding to the method.

[0097] In some optional implementations of this embodiment, step S201, i.e., when a selection signal is received, the step of determining the detection range selected by the developer according to the selection signal includes:

[0098] When it is recognized that the developer clicks the MybatisCheck option under the preset project button in the panel, the detection scope is determined to be the module under the project;

[0099] When it is recognized that the developer clicks the MybatisCheck option under the preset class name button in the panel, the detection scope is determined to be the class corresponding to the class name;

[0100] When it is identified that the developer clicks the MybatisCheck option under the preset method name button in the panel, the detection scope is determined to be the method corresponding to the method name.

[0101] In the present embodiment, the application adds the MybatisCheck menu (Mybatis check menu) when the right mouse button is selected for the developer to select the project, class name, and method name. When the developer operates the MybatisCheck of the right button of the project, the application can automatically screen all Mapper classes under the module under the project, execute all methods in the Mapper class, and output SQL execution statistics. When the developer selects the MybatisCheck of the right button of the class name, the plug-in can automatically identify according to the class name and select the corresponding Mapper class. And through the pop-up window, the developer is asked whether the Mapper class displayed in the pop-up window is selected. If so, the method in the Mapper class is executed and the SQL execution statistics are output. If not, an error prompt is popped up. When the developer selects the MybatisCheck of the right button of the method name, the plug-in can automatically identify and select the corresponding method according to the method name. And through the pop-up window, the developer is asked whether the method under the Mapper class displayed in the pop-up window is selected. If so, the method is executed and the SQL execution statistics are output. If not, an error prompt is popped up.

[0102] It should be emphasized that in order to further ensure the privacy and security of the above execution results, the above execution results can also be stored in a node of a blockchain.

[0103] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0104] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0105] This application can be applied in the field of smart government affairs, thereby promoting the construction of smart cities.

[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0107] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0108] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a SQL syntax checking device, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0109] like Figure 3 As shown, the SQL syntax checking device 400 described in this embodiment includes: a determination module, an execution module and a generation module. Among them:

[0110] A determination module, configured to, when receiving a selection signal, determine a detection range selected by a developer according to the selection signal, and determine a corresponding method based on the detection range as a target method;

[0111] An execution module, used for generating initial input parameters based on the detection scope, and inputting the initial input parameters into the target method for execution, so as to execute the SQL statement corresponding to the target method and obtain an execution result;

[0112] A generation module is used to generate and display a statistical view based on the execution result.

[0113] This application determines the detection range selected by the developer according to the selection signal, determines the corresponding method based on the detection range as the target method; generates initial input parameters based on the detection range, and inputs the initial input parameters into the target method for operation to execute the SQL statement corresponding to the target method and obtain the execution result; this application enables developers to select the detection range according to actual needs, and automatically determine the target method and its corresponding SQL statement for execution. This process greatly improves the flexibility and efficiency of the test. Developers can quickly perform local testing on specific parts of the project without writing additional unit test code or configuring a complex test environment. Generate and display statistical views based on the execution results. After executing the SQL statement corresponding to the target method, generate and display the execution results, so that developers can get immediate feedback, which helps developers to quickly locate problematic SQL and effectively improve detection efficiency.

[0114] In some optional implementations of this embodiment, the determination module includes a first determination submodule, a first monitoring submodule, a first parsing submodule, a first reflection submodule and a first processing submodule. Among them: the first determination submodule is used to determine the detection range selected by the developer according to the selection signal; the first monitoring submodule is used to obtain the information of the module through the preset project monitoring class as the module information when the detection range is the module under the project; the first parsing submodule is used to transmit the module information to the preset Mapper class parser for parsing operation to obtain the first parsing result; the first reflection submodule is used to perform a reflection operation on the first parsing result to obtain the first Class object; the first processing submodule is used to call the preset Mapper processor, perform a reflection operation on the first Class object, and obtain all methods in the class corresponding to the first Class object as the target method.

[0115] The first parsing submodule includes an identification unit, a selection unit and a parsing unit. The identification unit is used to transmit the module information to a preset Mapper class parser, and the Mapper class parser identifies the type of the module information to obtain an input parameter type; the selection unit is used to select a preset parsing strategy as a target strategy according to the input parameter type; the parsing unit is used to parse the module information through the target strategy to obtain the first parsing result.

[0116] In some optional implementations of this embodiment, the first reflection submodule is further used to call a preset reflection API, and perform a reflection operation on the first parsing result through the reflection API to obtain the first Class object.

[0117] In some optional implementations of this embodiment, the determination module further includes a second determination submodule, a second monitoring submodule, a second parsing submodule, a second reflection submodule and a second processing submodule. Wherein: the second determination submodule is used to determine the detection range selected by the developer according to the selection signal; the second monitoring submodule is used to obtain the information corresponding to the class name through the preset class name monitoring class as class information when the detection range is the class corresponding to the class name; the second parsing submodule is used to transmit the class information to the preset Mapper class parser for parsing operation to obtain the second parsing result; the second reflection submodule is used to perform reflection operation on the second parsing result to obtain the second Class object; the second processing submodule is used to call the preset Mapper processor, perform reflection operation on the second Class object, and obtain all methods in the class corresponding to the second Class object as the target method.

[0118] In some optional implementations of this embodiment, the determination module further includes a third determination submodule, a third monitoring submodule and a third reflection submodule. Wherein: the third determination submodule is used to determine the detection range selected by the developer according to the selection signal; the third monitoring submodule is used to obtain the information corresponding to the method name through the preset method name monitoring class as the method information when the detection range is the method corresponding to the method name; the third reflection submodule is used to call the preset Mapper processor, perform reflection operation on the method information, and obtain the corresponding method as the target method.

[0119] In some optional implementations of this embodiment, the determination module also includes a first scope determination submodule, a second scope determination submodule and a third scope determination submodule, wherein the first scope determination submodule is used to determine that the detection scope is the module under the project when it is recognized that the developer clicks the MybatisCheck option under the project button preset in the panel; the second scope determination submodule is used to determine that the detection scope is the class corresponding to the class name when it is recognized that the developer clicks the MybatisCheck option under the class name button preset in the panel; the third scope determination submodule is used to determine that the detection scope is the method corresponding to the method name when it is recognized that the developer clicks the MybatisCheck option under the method name button preset in the panel.

[0120] When the application receives a selection signal, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method; the initial input parameters are generated based on the detection range, and the initial input parameters are input into the target method for operation to execute the SQL statement corresponding to the target method and obtain the execution result; the application enables the developer to select the detection range according to actual needs, and automatically determine the target method and its corresponding SQL statement for execution. This process greatly improves the flexibility and efficiency of the test. Developers can quickly test specific parts of the project without writing additional unit test code or configuring a complex test environment. Generate and display statistical views based on the execution results. After executing the SQL statement corresponding to the target method, generate and display the execution results, so that developers can get feedback immediately, which helps developers to quickly locate problematic SQL and effectively improve detection efficiency.

[0121] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0122] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 4 having a memory 41, a processor 42, and a network interface 43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0123] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0124] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the SQL syntax verification method, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0125] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the computer-readable instructions stored in the memory 41 or process data, such as running the computer-readable instructions of the SQL syntax verification method.

[0126] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0127] When a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method; initial input parameters are generated based on the detection range, and the initial input parameters are input into the target method for operation to execute the SQL statement corresponding to the target method and obtain the execution result; the present application enables developers to select the detection range according to actual needs, and automatically determine the target method and its corresponding SQL statement for execution. This process greatly improves the flexibility and efficiency of testing. Developers can quickly test specific parts of the project without writing additional unit test code or configuring a complex test environment. Statistical views are generated and displayed based on the execution results. After executing the SQL statement corresponding to the target method, the execution results are generated and displayed, so that developers can get immediate feedback, which helps developers to quickly locate problematic SQL and effectively improve detection efficiency.

[0128] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned SQL syntax verification method.

[0129] When a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method; initial input parameters are generated based on the detection range, and the initial input parameters are input into the target method for operation to execute the SQL statement corresponding to the target method and obtain the execution result; the present application enables developers to select the detection range according to actual needs, and automatically determine the target method and its corresponding SQL statement for execution. This process greatly improves the flexibility and efficiency of testing. Developers can quickly test specific parts of the project without writing additional unit test code or configuring a complex test environment. Statistical views are generated and displayed based on the execution results. After executing the SQL statement corresponding to the target method, the execution results are generated and displayed, so that developers can get immediate feedback, which helps developers to quickly locate problematic SQL and effectively improve detection efficiency.

[0130] The non-Company software tools or components appearing in the embodiments of this application are merely examples and do not represent actual use.

[0131] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0132] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A SQL syntax verification method, characterized in that: The steps include: When a selection signal is received, determining the detection range selected by the developer according to the selection signal, and determining a corresponding method based on the detection range as a target method; Generate initial input parameters based on the detection scope, and input the initial input parameters into the target method for execution, so as to execute the SQL statement corresponding to the target method and obtain the execution result; A statistical view is generated and displayed based on the execution result.

2. The SQL syntax verification method according to claim 1, characterized in that: When a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method, including: Determining the detection range selected by the developer according to the selection signal; When the detection scope is a module under a project, information of the module is obtained through a preset project monitoring class as module information; The module information is transmitted to a preset Mapper class parser for parsing, to obtain a first parsing result; Performing a reflection operation on the first parsing result to obtain a first Class object; The preset Mapper processor is called to perform a reflection operation on the first Class object to obtain all methods in the class corresponding to the first Class object as the target method.

3. The SQL syntax verification method according to claim 2, characterized in that: The step of transmitting the module information to a preset Mapper class parser for parsing to obtain a first parsing result comprises: The module information is transmitted to a preset Mapper class parser, and the type of the module information is identified by the Mapper class parser to obtain an input parameter type; Selecting a preset parsing strategy as the target strategy according to the input parameter type; The module information is parsed using the target strategy to obtain the first parsing result.

4. The SQL syntax verification method according to claim 2, characterized in that: The step of performing a reflection operation on the first parsing result to obtain a first Class object includes: A preset reflection API is called, and a reflection operation is performed on the first parsing result through the reflection API to obtain the first Class object.

5. The SQL syntax verification method according to claim 1, characterized in that: When a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method, including: Determining the detection range selected by the developer according to the selection signal; When the detection range is the class corresponding to the class name, the information corresponding to the class name is obtained through the preset class name monitoring class as the class information; The class information is transmitted to a preset Mapper class parser for parsing, to obtain a second parsing result; Performing a reflection operation on the second parsing result to obtain a second Class object; The preset Mapper processor is called to perform a reflection operation on the second Class object to obtain all methods in the class corresponding to the second Class object as the target method.

6. The SQL syntax verification method according to claim 1, characterized in that: When a selection signal is received, the detection range selected by the developer is determined according to the selection signal, and the corresponding method is determined based on the detection range as the target method, including: Determining the detection range selected by the developer according to the selection signal; When the detection range is the method corresponding to the method name, the information corresponding to the method name is obtained through a preset method name monitoring class as method information; The preset Mapper processor is called to perform a reflection operation on the method information to obtain a corresponding method as the target method.

7. The SQL syntax verification method according to claim 1, characterized in that: When the selection signal is received, the step of determining the detection range selected by the developer according to the selection signal includes: When it is recognized that the developer clicks the MybatisCheck option under the preset project button in the panel, the detection scope is determined to be the module under the project; When it is recognized that the developer clicks the MybatisCheck option under the preset class name button in the panel, the detection scope is determined to be the class corresponding to the class name; When it is identified that the developer clicks the MybatisCheck option under the preset method name button in the panel, the detection scope is determined to be the method corresponding to the method name.

8. A SQL syntax checking device, characterized in that: include: A determination module, configured to, when receiving a selection signal, determine a detection range selected by a developer according to the selection signal, and determine a corresponding method based on the detection range as a target method; An execution module, used for generating initial input parameters based on the detection scope, and inputting the initial input parameters into the target method for execution, so as to execute the SQL statement corresponding to the target method and obtain an execution result; A generation module is used to generate and display a statistical view based on the execution result.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the SQL grammar checking method according to any one of claims 1 to 7 when executing the computer-readable instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the SQL syntax checking method according to any one of claims 1 to 7 are implemented.