A SQL refactoring analysis method, system, device and readable storage medium

By automating the analysis of system SQL, Java source code, and binary JAR files, a relationship graph between the SQL to be modified and related system functions is established, solving the problem of evaluation omissions in the system's O removal transformation and achieving efficient and accurate transformation analysis.

CN115729950BActive Publication Date: 2026-06-19PINGAN YIQIANBAO E COMMERCE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PINGAN YIQIANBAO E COMMERCE CO LTD
Filing Date
2022-11-16
Publication Date
2026-06-19

Smart Images

  • Figure CN115729950B_ABST
    Figure CN115729950B_ABST
Patent Text Reader

Abstract

This invention relates to an SQL transformation analysis method, system, device, and readable storage medium. The method includes: obtaining Oracle characteristic syntax by identifying the MyBatis XML file of the system to be transformed; establishing a mapping relationship between the Oracle characteristic syntax and SQL IDs; establishing a mapping relationship between the SQL IDs and Java methods by identifying the Java source code of the system to be transformed; generating a call chain of Java methods by identifying the Java JAR file of the system to be transformed; finding the call chain corresponding to each SQL ID based on the Java methods associated with the SQL ID; obtaining a mapping relationship between the SQL ID and the corresponding call entry point by parsing the call chain corresponding to each SQL ID; and obtaining a list of system functions associated with each SQL ID based on the mapping relationship between the SQL ID and the corresponding call entry point. This automatic scanning and efficient analysis of the SQL transformation results saves manpower and avoids omissions caused by manual review.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically to an SQL transformation and analysis method, system, device, and readable storage medium. Background Technology

[0002] Currently, removing Oracle databases from systems has become a strategic project for most enterprises. During the removal process, assessing the removal points and their related functional impacts, and ensuring that the assessment and processing list is complete, is a time-consuming and labor-intensive task. It also requires a certain level of familiarity with the project from the personnel responsible for the removal process.

[0003] In practice, the manual method of checking and analyzing modification points often results in problems such as missing modification points in the assessment or omitting the assessment of related functions affected by the modification points. Summary of the Invention

[0004] Based on this, embodiments of this application provide an SQL modification analysis method, system, device, and readable storage medium that automatically scans and efficiently analyzes the results of SQL modification, saving manpower and avoiding omissions caused by manual investigation.

[0005] To achieve the above objectives, the embodiments of this application provide the following technical solutions:

[0006] According to a first aspect of the embodiments of this application, a SQL transformation analysis method is provided, the method comprising:

[0007] Oracle characteristic syntax is obtained by identifying the MyBatis XML file of the system to be modified;

[0008] Establish the mapping relationship between the Oracle feature syntax and SQL ID;

[0009] By identifying the Java source code of the system to be modified, a mapping relationship between the SQL ID and the JAVA method is established;

[0010] By identifying the Java jar file of the system to be modified, a call chain of Java methods is generated;

[0011] Find the call chain corresponding to each SQL ID based on the JAVA method associated with the SQL ID;

[0012] The mapping relationship between SQL ID and corresponding call entry point is obtained by parsing the call chain corresponding to each SQL ID;

[0013] Based on the mapping relationship between SQL ID and the corresponding call entry point, a list of system functions associated with each SQL ID is obtained.

[0014] Optionally, by identifying the Java source code of the system to be modified, a mapping relationship between the SQL ID and the JAVA method is established, including:

[0015] The Java source code of the system to be modified was scanned and identified one by one.

[0016] Convert Java source code into an AST tree;

[0017] Traverse each node in the AST tree to obtain all Java methods that use SQL IDs;

[0018] Establish the mapping relationship between the SQL ID and the JAVA method.

[0019] Optionally, the step of generating a Java method call chain by identifying the Java jar file of the system to be modified includes:

[0020] Scan the compiled Java jar files of the system to be modified and generate Java method call relationships;

[0021] Generate a Java method call chain based on Java method call relationships.

[0022] Optionally, a list of system functions associated with each SQL ID is obtained based on the mapping relationship between the SQL ID and the corresponding call entry point, including:

[0023] Based on the mapping relationship between SQL ID and the corresponding call entry point, a list of call entry points corresponding to each SQL ID is obtained;

[0024] The system function list associated with each SQL ID is obtained from the list of call entry points corresponding to each SQL ID.

[0025] Optionally, Oracle characteristic syntax can be obtained by identifying the MyBatis XML file of the system to be modified, including:

[0026] Scan the MyBatis XML files of the system to be modified and use regular expressions to identify Oracle characteristic syntax.

[0027] Optionally, after obtaining the list of system functions associated with each SQL ID based on the mapping relationship between SQL ID and the corresponding call entry point, the method further includes:

[0028] Output a list of system functions associated with each SQL ID as a table.

[0029] According to a second aspect of the embodiments of this application, an SQL transformation analysis system is provided, the system comprising:

[0030] The Oracle Feature Syntax module is used to obtain Oracle feature syntax by recognizing the MyBatis XML files of the system to be modified.

[0031] The first mapping module is used to establish the mapping relationship between the Oracle feature syntax and the SQL ID;

[0032] The second mapping module is used to establish a mapping relationship between the SQL ID and the JAVA method by identifying the Java source code of the system to be modified;

[0033] The JAVA method call chain module is used to generate a JAVA method call chain by identifying the Java jar file of the system to be modified.

[0034] The SQL Id call chain module is used to find the call chain corresponding to each SQL Id based on the JAVA method associated with the SQL Id;

[0035] The third mapping module is used to obtain the mapping relationship between SQL Id and the corresponding call entry point by parsing the call chain corresponding to each SQL Id;

[0036] The SQL ID analysis module is used to obtain a list of system functions associated with each SQL ID based on the mapping relationship between the SQL ID and the corresponding call entry point.

[0037] Optionally, the second mapping module is specifically used for:

[0038] The Java source code of the system to be modified was scanned and identified one by one.

[0039] Convert Java source code into an AST tree;

[0040] Traverse each node in the AST tree to obtain all Java methods that use SQL IDs;

[0041] Establish the mapping relationship between the SQL ID and the JAVA method.

[0042] Optionally, the JAVA method call chain module is specifically used for:

[0043] Scan the compiled Java jar files of the system to be modified and generate Java method call relationships;

[0044] Generate a Java method call chain based on Java method call relationships.

[0045] Optionally, the SQL ID analysis module is specifically used for:

[0046] Based on the mapping relationship between SQL ID and the corresponding call entry point, a list of call entry points corresponding to each SQL ID is obtained;

[0047] The system function list associated with each SQL ID is obtained from the list of call entry points corresponding to each SQL ID.

[0048] Optionally, the Oracle feature syntax module is specifically used for:

[0049] Scan the MyBatis XML files of the system to be modified and use regular expressions to identify Oracle characteristic syntax.

[0050] Optionally, after obtaining the list of system functions associated with each SQL ID based on the mapping relationship between SQL ID and the corresponding call entry point, the method further includes:

[0051] Output a list of system functions associated with each SQL ID as a table.

[0052] According to a third aspect of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0053] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided having computer-readable instructions stored thereon, the computer-readable instructions being executable by a processor to implement the method described in the first aspect above.

[0054] In summary, this application provides an SQL transformation analysis method, system, device, and readable storage medium. It obtains Oracle characteristic syntax by identifying the MyBatis XML file of the system to be transformed; establishes a mapping relationship between the Oracle characteristic syntax and SQL IDs; establishes a mapping relationship between SQL IDs and JAVA methods by identifying the Java source code of the system to be transformed; generates a call chain of JAVA methods by identifying the Java JAR file of the system to be transformed; finds the call chain corresponding to each SQL ID based on the JAVA methods associated with the SQL ID; obtains the mapping relationship between the SQL ID and the corresponding call entry point by parsing the call chain corresponding to each SQL ID; and obtains a list of system functions associated with each SQL ID based on the mapping relationship between the SQL ID and the corresponding call entry point. This automatic scanning and efficient analysis of SQL transformation results saves manpower and avoids omissions caused by manual review. Attached Figure Description

[0055] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.

[0056] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0057] Figure 1 A flowchart for SQL modification analysis provided in this application embodiment;

[0058] Figure 2 This is a logical diagram of SQL modification analysis provided in the embodiments of this application;

[0059] Figure 3 This is a schematic diagram of the SQL modification analysis process provided in the embodiments of this application;

[0060] Figure 4 A block diagram of an SQL modification and analysis system provided in this application embodiment;

[0061] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0062] Figure 6 This is a schematic diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation

[0063] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0064] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.

[0065] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0066] De-O (de-Oracle) is a complex system engineering project with certain technical barriers. Business systems vary widely; some have small data volumes, simple business logic, and low system pressure, while others have large data volumes, complex business logic, and high performance requirements. This application's embodiments utilize tools to automatically analyze system SQL, Java source code, and binary JAR files, establishing a relationship graph between the SQL to be modified and related system functions, guiding the analysis, development, and testing processes of the de-O project.

[0067] Figure 1 This application illustrates a SQL transformation analysis method flow provided by an embodiment of the present application. The method includes:

[0068] Step 101: Obtain Oracle characteristic syntax by identifying the MyBatis XML file of the system to be modified;

[0069] Step 102: Establish the mapping relationship between the Oracle feature syntax and the SQL ID;

[0070] Step 103: By identifying the Java source code of the system to be modified, establish the mapping relationship between the SQL ID and the JAVA method;

[0071] Step 104: Generate the Java method call chain by identifying the Java jar file of the system to be modified;

[0072] Step 105: Locate the call chain corresponding to each SQL ID based on the JAVA method associated with the SQL ID;

[0073] Step 106: Obtain the mapping relationship between SQL ID and corresponding call entry point by parsing the call chain corresponding to each SQL ID;

[0074] Step 107: Obtain the list of system functions associated with each SQL ID based on the mapping relationship between SQL ID and the corresponding call entry point.

[0075] In one possible implementation, in step 101, the MyBatis XML file of the system to be modified is scanned, and Oracle characteristic syntax is identified using regular expressions. Examples may include rules such as merge, rownum, to_char, and sysdate. Here, a regular expression is a logical formula for string manipulation; it uses predefined specific characters and combinations of these characters to form a "rule string," which expresses a filtering logic for the string.

[0076] In one possible implementation, step 103 involves establishing a mapping relationship between the SQL ID and the JAVA method by identifying the Java source code of the system to be modified, including:

[0077] The Java source code of the system to be modified is scanned and identified one by one; the Java source code is converted into an AST tree; each node in the AST tree is traversed to obtain all Java methods that use SQL IDs; and the mapping relationship between the SQL IDs and the Java methods is established.

[0078] In one possible implementation, step 104, which involves generating a call chain of Java methods by identifying the Java jar file of the system to be modified, includes:

[0079] Scan the compiled Java JAR files of the system to be modified and generate Java method call relationships; generate the Java method call chain based on the Java method call relationships.

[0080] In one possible implementation, in step 107, a list of system functions associated with each SQL ID is obtained based on the mapping relationship between the SQL ID and the corresponding call entry point, including:

[0081] Based on the mapping relationship between SQL ID and its corresponding call entry point, a list of call entry points corresponding to each SQL ID is obtained; based on the list of call entry points corresponding to each SQL ID, a list of system functions associated with each SQL ID is obtained.

[0082] In one possible implementation, after obtaining the list of system functions associated with each SQL ID in step 107 based on the mapping relationship between SQL ID and the corresponding call entry point, the method further includes:

[0083] Output a list of system functions associated with each SQL ID as a table.

[0084] In Java backend development projects, there are numerous XML configuration files and Java annotation code. This is determined by the persistence layer framework of Java projects. When performing SQL auditing on Java projects, it is essential to extract and parse the SQL in the project code. The SQL transformation analysis method provided in this application is universal and applicable to various Java projects. It can be used for impact point analysis before system O removal transformation, and also as a code inspection tool after O removal transformation to prevent system failures caused by overlooked special syntax. Compared to manual inspection and analysis of transformation points, this solution uses tools for automatic scanning and analysis, which greatly saves manpower and avoids omissions caused by manual inspection. At the same time, the tool-based approach can also avoid errors caused by subjective factors such as the project manager's familiarity with the project, ability, and attitude.

[0085] The SQL modification analysis method provided in this application embodiment will be further described in detail below with reference to the accompanying drawings. For the system to be modified, the SQL change impact analysis process is as follows through source code analysis: Figure 2 The steps are as follows:

[0086] Step 201: Scan the system's MyBatis XML files and use regular expressions to identify Oracle-specific syntax, including 24 rules such as merge, rownum, to_char, and sysdate;

[0087] Step 202: Establish the mapping relationship between Oracle feature syntax and SQL ID;

[0088] Step 203: Scan the system's Java source code one by one, convert the Java code into an AST tree, traverse each node in the AST tree, find all Java methods that use the SQL ID in step 202, and establish a mapping relationship between SQL ID and Java method;

[0089] Step 204: Scan the pre-compiled Java jar files and generate Java method call relationships;

[0090] Step 205: Based on the Java method call relationship in Step 204, generate a complete upward call chain of Java methods;

[0091] Step 206: Based on the mapping relationship between the SQL ID in Step 203 and the Java method in Step 204, find the call chain list corresponding to each SQL ID according to the Java method associated with the SQL ID;

[0092] Step 207: Parse the call chain obtained in step 206 to establish the mapping relationship between SQL ID and call entry point, and you can get the call entry point list corresponding to each SQL ID, thereby obtaining the system function list associated with each SQL ID;

[0093] Step 208: Output the results as an Excel file for R&D and testing purposes.

[0094] In step 201, for the system to be modified, the following information can also be collected: system functions and users; peak and off-peak business hours of the system; information about the application servers involved, including CPU, memory, disk space, network card, etc.; information about the Oracle database servers involved, including CPU, memory, disk space, network card, etc.; information about the database objects on the Oracle databases involved. Information about the disk space occupied by the database objects on the Oracle databases involved, mainly the disk space occupied by tables and indexes; statistical information on the total number of records in each table on the Oracle databases involved; whether the Oracle databases involved have logical standby databases, and whether the physical standby databases provide read services; what type of queries and calculations are performed on the Oracle databases involved, whether they are OLAP statistical report types or OLTP transaction query types.

[0095] Regular expressions are logical formulas for string manipulation. They use predefined specific characters and combinations of these characters to form a "rule string," which is used to express a filtering logic for strings.

[0096] The method provided in this application is universal and applicable to various Java projects. It can be used for impact point analysis before system O removal and as a code inspection tool after O removal to prevent system failures caused by overlooked special syntax. Compared to manual inspection and analysis of modification points, this solution uses tools for automatic scanning and analysis, which greatly saves manpower and avoids omissions caused by manual inspection. At the same time, the tool-based approach can also avoid errors caused by subjective factors such as the project manager's familiarity with the project, ability, and attitude.

[0097] This application also provides a SQL transformation analysis method flow, such as... Figure 3 As shown, it includes the following steps:

[0098] Step 301: By identifying the MyBatis XML file of the system to be modified, use regular expressions to obtain the Oracle characteristic syntax, including commonly used Oracle fields NUMBER, DATE, CLOB, BLOB, XMLTYPE, CHAR, FLOAT, TIMESTAMP, VARCHAR2, and NVARCHAR2.

[0099] Step 302: Establish the mapping relationship between the Oracle feature syntax and the SQL ID;

[0100] Step 303: Scan and identify the Java source code of the system to be modified one by one; convert the Java source code into an AST tree; traverse each node in the AST tree to obtain all Java methods that use SQL IDs;

[0101] Step 304: Establish the mapping relationship between the SQL ID and the JAVA method;

[0102] Step 305: Scan the compiled Java jar files of the system to be modified and generate Java method call relationships;

[0103] Step 306: Generate a complete upward call chain of Java methods based on the Java method call relationship;

[0104] Step 307: Obtain a list of call entry points corresponding to each SQL ID based on the mapping relationship between SQL ID and the corresponding call entry point;

[0105] Step 308: Obtain the list of system functions associated with each SQL ID based on the list of call entry points corresponding to each SQL ID;

[0106] Step 309: Output the list of system functions associated with each SQL ID as a table.

[0107] As can be seen, this embodiment first scans the MyBatis XML file of the system to be modified, using regular expressions to identify Oracle-specific syntax; further, it establishes a mapping relationship between Oracle characteristic syntax and SQL IDs; it also scans the Java source code of the system to be modified one by one, converts the Java code into an AST tree, traverses each node in the AST tree, finds all Java methods that use SQL IDs, and establishes a mapping relationship between SQL IDs and Java methods; it also scans the compiled Java JAR file of the system to be modified, generating Java method call relationships; based on the Java method call relationships, it generates a complete upward call chain of Java methods; based on the mapping relationship between SQL IDs and Java methods, it finds the call chain list corresponding to each SQL ID based on the JAVA methods associated with the SQL ID; it parses the call chain to establish a mapping relationship between SQL IDs and call entry points, thus obtaining the call entry list corresponding to each SQL ID, thereby obtaining the system function list associated with each SQL ID; the results are output as an Excel file for R&D and testing use.

[0108] This application also provides an SQL transformation analysis method, including the following steps:

[0109] Step 1: Obtain Oracle characteristic syntax by identifying the MyBatis XML file of the system to be modified;

[0110] Step 2: Establish the mapping relationship between the Oracle feature syntax and SQL ID;

[0111] Step 3: Scan and identify the Java source code of the system to be modified one by one; convert the Java source code into an AST tree; traverse each node in the AST tree to obtain all Java methods that use SQL IDs; establish the mapping relationship between the SQL IDs and the Java methods;

[0112] Step 4: By identifying the Java jar file of the system to be modified, generate the call chain of Java methods;

[0113] Step 5: Locate the call chain corresponding to each SQL ID based on the Java methods associated with it;

[0114] Step 6: Obtain the mapping relationship between SQL ID and corresponding call entry point by parsing the call chain corresponding to each SQL ID;

[0115] Step 7: Obtain the list of call entry points corresponding to each SQL ID based on the mapping relationship between SQL ID and the corresponding call entry point; obtain the list of system functions associated with each SQL ID based on the list of call entry points corresponding to each SQL ID.

[0116] Step 8: Output the list of system functions associated with each SQL ID as a table.

[0117] In one possible implementation, in step 1, the MyBatis XML files of the system to be modified are scanned, and Oracle characteristic syntax is identified using regular expressions. Examples may include rules such as merge, rownum, to_char, and sysdate.

[0118] In one possible implementation, step 4, which involves generating a call chain of Java methods by identifying the Java jar file of the system to be modified, includes:

[0119] Scan the compiled Java JAR files of the system to be modified and generate Java method call relationships; generate the Java method call chain based on the Java method call relationships.

[0120] In summary, this application provides an SQL transformation analysis method. It obtains Oracle characteristic syntax by identifying the MyBatis XML file of the system to be transformed; establishes a mapping relationship between the Oracle characteristic syntax and SQL IDs; establishes a mapping relationship between SQL IDs and JAVA methods by identifying the Java source code of the system to be transformed; generates a call chain of JAVA methods by identifying the Java JAR file of the system to be transformed; finds the call chain corresponding to each SQL ID based on the JAVA methods associated with the SQL ID; obtains the mapping relationship between the SQL ID and the corresponding call entry point by parsing the call chain corresponding to each SQL ID; and obtains a list of system functions associated with each SQL ID based on the mapping relationship between the SQL ID and the corresponding call entry point. This automatic scanning and efficient analysis of SQL transformation results saves manpower and avoids omissions caused by manual review.

[0121] Based on the same technical concept, embodiments of this application also provide an SQL transformation analysis system, such as... Figure 4 As shown, the system includes:

[0122] Oracle Feature Syntax Module 401 is used to obtain Oracle feature syntax by recognizing the MyBatis XML file of the system to be modified;

[0123] The first mapping module 402 is used to establish the mapping relationship between the Oracle feature syntax and the SQL ID;

[0124] The second mapping module 403 is used to establish a mapping relationship between the SQL ID and the JAVA method by identifying the Java source code of the system to be modified;

[0125] The JAVA method call chain module 404 is used to generate a JAVA method call chain by identifying the Java jar file of the system to be modified.

[0126] SQL Id call chain module 405 is used to find the call chain corresponding to each SQL Id based on the JAVA method associated with the SQL Id;

[0127] The third mapping module 406 is used to obtain the mapping relationship between SQL Id and the corresponding call entry by parsing the call chain corresponding to each SQL Id;

[0128] The SQL Id analysis module 407 is used to obtain a list of system functions associated with each SQL Id based on the mapping relationship between the SQL Id and the corresponding call entry point.

[0129] Optionally, the second mapping module 403 is specifically used for:

[0130] The Java source code of the system to be modified was scanned and identified one by one.

[0131] Convert Java source code into an AST tree;

[0132] Traverse each node in the AST tree to obtain all Java methods that use SQL IDs;

[0133] Establish the mapping relationship between the SQL ID and the JAVA method.

[0134] Optionally, the JAVA method call chain module 404 is specifically used for:

[0135] Scan the compiled Java jar files of the system to be modified and generate Java method call relationships;

[0136] Generate a Java method call chain based on Java method call relationships.

[0137] Optionally, the SQL ID analysis module 407 is specifically used for:

[0138] Based on the mapping relationship between SQL ID and the corresponding call entry point, a list of call entry points corresponding to each SQL ID is obtained;

[0139] The system function list associated with each SQL ID is obtained from the list of call entry points corresponding to each SQL ID.

[0140] Optionally, the Oracle feature syntax module 401 is specifically used for:

[0141] Scan the MyBatis XML files of the system to be modified and use regular expressions to identify Oracle characteristic syntax.

[0142] For the system to be upgraded, the following information can also be collected: system functions and users; peak and off-peak business hours for system operation; information about the application servers involved, including CPU, memory, disk space, and network interface cards (NICs); information about the Oracle database servers involved, including CPU, memory, disk space, and NICs; information about the database objects on the Oracle databases involved; information about the disk space occupied by the database objects on the Oracle databases involved, mainly the disk space occupied by tables and indexes; statistical information on the total number of records in each table on the Oracle databases involved; whether the Oracle databases involved have logical standby databases, and whether the physical standby databases provide read services; and the type of queries and calculations performed on the Oracle databases involved, whether they are OLAP statistical reporting types or OLTP transaction query types.

[0143] Regular expressions are logical formulas for string manipulation. They use predefined specific characters and combinations of these characters to form a "rule string," which is used to express a filtering logic for strings.

[0144] Optionally, after obtaining the list of system functions associated with each SQL ID based on the mapping relationship between SQL ID and the corresponding call entry point, the system is further used for:

[0145] Output a list of system functions associated with each SQL ID as a table.

[0146] This application also provides an electronic device corresponding to the method provided in the foregoing embodiments. Please refer to... Figure 5 The diagram illustrates an electronic device provided by some embodiments of this application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202, and a communication interface 203, wherein the processor 200, the communication interface 203, and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can run on the processor 200, and when the processor 200 runs the computer program, it executes the method provided by any of the foregoing embodiments of this application.

[0147] The memory 201 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one physical port 203 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network.

[0148] Bus 202 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs. After receiving an execution instruction, the processor 200 executes the program. The method disclosed in any of the foregoing embodiments of this application can be applied to the processor 200, or implemented by the processor 200.

[0149] The processor 200 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 200 or by instructions in software form. The processor 200 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 201. The processor 200 reads the information in memory 201 and, in conjunction with its hardware, completes the steps of the above method.

[0150] The electronic devices and methods provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods they employ, operate, or implement.

[0151] This application also provides a computer-readable storage medium corresponding to the method provided in the foregoing embodiments. Please refer to... Figure 6The computer-readable storage medium shown is an optical disc 30, on which a computer program (i.e., a program product) is stored, which, when run by a processor, executes the methods provided in any of the foregoing embodiments.

[0152] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.

[0153] The computer-readable storage medium provided in the above embodiments of this application and the method provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.

[0154] It should be noted that:

[0155] The algorithms and displays provided herein are not inherently related to any particular computer, virtual device, or other equipment. Various general-purpose devices can also be used in conjunction with the teachings herein. The required structure for constructing such devices is apparent from the above description. Furthermore, this application is not directed to any particular programming language. It should be understood that the content of this application described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of this application.

[0156] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0157] Similarly, it should be understood that, in order to simplify this application and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of this application, various features of this application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be construed as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.

[0158] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0159] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of this application and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.

[0160] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the virtual machine creation apparatus according to embodiments of this application. This application can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such an implementation of this application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0161] It should be noted that the above embodiments are illustrative of this application and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

[0162] The above description is merely a preferred embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of protection of the claims. Those skilled in the art can understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM).

[0163] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0164] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A SQL transformation analysis method, characterized in that, The method includes: Oracle characteristic syntax is obtained by identifying the MyBatis XML file of the system to be modified; Establish the mapping relationship between the Oracle feature syntax and SQL ID; By identifying the Java source code of the system to be modified, a mapping relationship between the SQL ID and the JAVA method is established; By identifying the Java jar file of the system to be modified, a call chain of Java methods is generated; Find the call chain corresponding to each SQL ID based on the JAVA method associated with the SQL ID; The mapping relationship between SQL ID and corresponding call entry point is obtained by parsing the call chain corresponding to each SQL ID; Based on the mapping relationship between SQL ID and the corresponding call entry point, a list of system functions associated with each SQL ID is obtained; The process of identifying the Java source code of the system to be modified and establishing a mapping relationship between the SQL ID and the JAVA methods includes: scanning and identifying the Java source code of the system to be modified one by one; converting the Java source code into an AST tree; traversing each node in the AST tree to obtain all Java methods that use the SQL ID; and establishing a mapping relationship between the SQL ID and the JAVA methods.

2. The method as described in claim 1, characterized in that, The step of generating a Java method call chain by identifying the Java jar file of the system to be modified includes: Scan the compiled Java jar files of the system to be modified and generate Java method call relationships; Generate a Java method call chain based on Java method call relationships.

3. The method as described in claim 1, characterized in that, Based on the mapping relationship between SQL ID and corresponding call entry point, a list of system functions associated with each SQL ID is obtained, including: Based on the mapping relationship between SQL ID and the corresponding call entry point, a list of call entry points corresponding to each SQL ID is obtained; The system function list associated with each SQL ID is obtained from the list of call entry points corresponding to each SQL ID.

4. The method as described in claim 1, characterized in that, By identifying the MyBatis XML file of the system to be modified, Oracle characteristic syntax can be obtained, including: Scan the MyBatis XML files of the system to be modified and use regular expressions to identify Oracle characteristic syntax.

5. The method as described in claim 1, characterized in that, After obtaining the list of system functions associated with each SQL ID based on the mapping relationship between SQL ID and the corresponding call entry point, the method further includes: Output a list of system functions associated with each SQL ID as a table.

6. An SQL transformation analysis system, characterized in that, The system includes: The Oracle Feature Syntax module is used to obtain Oracle feature syntax by recognizing the MyBatis XML files of the system to be modified. The first mapping module is used to establish the mapping relationship between the Oracle feature syntax and the SQL ID; The second mapping module is used to establish a mapping relationship between the SQL ID and JAVA methods by identifying the Java source code of the system to be modified. Specifically, the second mapping module is used to: scan and identify the Java source code of the system to be modified one by one; convert the Java source code into an AST tree; traverse each node in the AST tree to obtain all Java methods that use the SQL ID; and establish a mapping relationship between the SQL ID and the JAVA methods. The JAVA method call chain module is used to generate a JAVA method call chain by identifying the Java jar file of the system to be modified. The SQL Id call chain module is used to find the call chain corresponding to each SQL Id based on the JAVA method associated with the SQL Id; The third mapping module is used to obtain the mapping relationship between SQL Id and the corresponding call entry point by parsing the call chain corresponding to each SQL Id; The SQL ID analysis module is used to obtain a list of system functions associated with each SQL ID based on the mapping relationship between the SQL ID and the corresponding call entry point.

7. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the method as claimed in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, It stores computer-readable instructions that can be executed by a processor to implement the method as described in any one of claims 1-5.