Structured query language review method and device, equipment and medium
By reviewing the primary key and index matching between SQL and database tables in the review system, the problem of low SQL review efficiency is solved, an efficient and accurate SQL review process is realized, and multiple database types are supported.
Patent Information
- Application Number
- CN202410975919.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-22
AI Technical Summary
SQL review efficiency in the existing technology is low and mainly relies on manual interaction, resulting in a complex, cumbersome, time-consuming and labor-intensive review process.
By judging the matching degree of the primary key and index between the SQL to be reviewed and the target database table in the review system, it automatically reviews and provides modification suggestions, and supports SQL reviews of multiple database types.
It improves the timeliness and efficiency of SQL review, simplifies the review process, supports multiple database types, reduces the number of manual interactions, and improves the accuracy and efficiency of review.
Smart Images

Figure CN118820274A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a review method, device, equipment and medium for structured query language. Background Art
[0002] In the process of database application, new scenarios of Structured Query Language (SQL) and changes to the original SQL are often involved. Therefore, in order to better manage the database, it is necessary to review the SQL to determine whether the corresponding SQL meets the requirements.
[0003] Currently, SQL review is mainly conducted through manual review interaction. For example, the initiator and the database administrator (DBA) confirm the SQL content based on offline verbal statements or emails, and conduct subsequent reviews. It often takes multiple interactions to complete the overall review work. The review process is complicated, tedious, time-consuming and labor-intensive.
[0004] Therefore, how to efficiently perform SQL review becomes an urgent problem to be solved. Summary of the invention
[0005] The present application provides a structured query language review method, device, equipment and medium to solve the problem of low SQL review efficiency in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a structured query language review method, the method comprising:
[0007] Determine the target database table corresponding to the structured query language SQL to be reviewed in the database of the review system; determine the matching degree between the SQL and the primary key and / or index corresponding to the target database table based on the primary key and / or index corresponding to the target database table; review the SQL according to the matching degree to obtain the review result of the SQL.
[0008] Based on this method, the embodiment of the present application adopts a review system, which effectively increases the timeliness of SQL review, simplifies the review process, improves the review efficiency, and supports SQL review of multiple database types by judging the matching degree between the SQL to be reviewed and the primary key or index of the table involved, and then judging whether it meets expectations based on the matching degree. For example, for SQL that does not meet expectations, the DBA will communicate with the initiator to modify it, and the information and review results of this SQL can be recorded in the table for subsequent review.
[0009] As an optional manner, the method further includes:
[0010] According to the SQL review operation triggered by the user in the review system, the review page in the review system is entered; according to the filled-in content submitted by the user in the review page, the SQL is determined.
[0011] As an optional manner, the method further includes:
[0012] When it is determined that the target database table corresponding to the SQL is a newly added table, the SQL is entered into the database, and the primary key and / or index corresponding to the target database table is recorded.
[0013] As an optional manner, determining the matching degree between the SQL and the primary key and / or index of the target database table includes:
[0014] According to the requirements of the review, a target matching scheme is determined; based on the target matching scheme, a primary key and / or index of the target database table is determined from the database; the target matching scheme includes a database table DLL and a database execution plan.
[0015] As an optional method, before determining the target database table corresponding to the SQL to be reviewed in the database of the review system, the method further includes:
[0016] Based on preset SQL grammar rules, it is determined that the SQL complies with the grammar rules.
[0017] As an optional manner, after reviewing the SQL according to the matching degree and obtaining the review result of the SQL, the method further includes:
[0018] If the matching degree is not higher than the matching threshold, the review result is determined to be failed and displayed in the review page, and a modification task based on the SQL is automatically established; in response to the modification operation triggered by the user in the review system, the modification page of the review system is entered; in response to the user's operation on the modification task in the modification page, the SQL is modified to obtain an updated SQL; and the review process is re-executed based on the updated SQL.
[0019] As an optional method, the review system also has the function of analyzing and obtaining modification prompts based on the review results.
[0020] As an optional manner, the method further includes:
[0021] Based on the modification suggestions of the reviewer for the modification task record in the review system, the SQL is modified to obtain an updated SQL.
[0022] As an optional manner, the reviewing the SQL according to the matching degree to obtain the review result of the SQL includes:
[0023] If the matching degree is higher than the matching threshold, the review result is determined to be passed and displayed in the review page; in response to the user's determination operation on the review result in the review system, the review process of the SQL is ended.
[0024] As an optional manner, the method further includes:
[0025] Record all review processes and review results for the SQL in the review system.
[0026] In a second aspect, an embodiment of the present application provides a SQL review device, which includes modules / units / technical means for executing the methods in the above aspects.
[0027] Exemplarily, the device may include:
[0028] A determination module is used to determine the target database table corresponding to the structured query language SQL to be reviewed in the database of the review system; based on the primary key and / or index corresponding to the target database table, determine the matching degree between the SQL and the primary key and / or index corresponding to the target database table;
[0029] A processing module is used to review the SQL according to the matching degree to obtain a review result of the SQL.
[0030] As an optional manner, the processing module is further used for:
[0031] According to the SQL review operation triggered by the user in the review system, the review page in the review system is entered; according to the filled-in content submitted by the user in the review page, the SQL is determined.
[0032] As an optional manner, the determining module is further used for:
[0033] When it is determined that the target database table corresponding to the SQL is a newly added table, the SQL is entered into the database, and the primary key and / or index corresponding to the target database table is recorded.
[0034] As an optional manner, the determining module is further used for:
[0035] According to the requirements of the review, a target matching scheme is determined; based on the target matching scheme, a primary key and / or index of the target database table is determined from the database; the target matching scheme includes a database table DLL and a database execution plan.
[0036] As an optional manner, the determining module is further used for:
[0037] Based on preset SQL grammar rules, it is determined that the SQL complies with the grammar rules.
[0038] As an optional manner, the processing module is further used for:
[0039] If the matching degree is not higher than the matching threshold, the review result is determined to be failed and displayed in the review page, and a modification task based on the SQL is automatically established; in response to the modification operation triggered by the user in the review system, the modification page of the review system is entered; in response to the user's operation on the modification task in the modification page, the SQL is modified to obtain an updated SQL; and the review process is re-executed based on the updated SQL.
[0040] As an optional method, the review system also has the function of analyzing and obtaining modification prompts based on the review results.
[0041] As an optional manner, the processing module is further used for:
[0042] Based on the modification suggestions of the reviewer for the modification task record in the review system, the SQL is modified to obtain an updated SQL.
[0043] As an optional manner, the processing module is further used for:
[0044] If the matching degree is higher than the matching threshold, the review result is determined to be passed and displayed in the review page; in response to the user's determination operation on the review result in the review system, the review process of the SQL is ended.
[0045] As an optional manner, the processing module is further used for:
[0046] Record all review processes and review results for the SQL in the review system.
[0047] In a third aspect, an embodiment of the present application provides an SQL review system, the system comprising a database and a server;
[0048] The server is used to: determine the target database table corresponding to the structured query language SQL to be reviewed in the database of the review system; determine the matching degree between the SQL and the primary key and / or index corresponding to the target database table based on the primary key and / or index corresponding to the target database table; review the SQL according to the matching degree to obtain the review result of the SQL;
[0049] The database is used to store database tables.
[0050] In a fourth aspect, the present application provides an electronic device, comprising: at least one processor; and a memory and a communication interface communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor executes the instructions stored in the memory, so that the device executes the first aspect or any optional implementation of the first aspect.
[0051] In a fifth aspect, a computer-readable storage medium is provided for storing instructions, which, when executed, enable the above-mentioned first aspect or any optional implementation of the first aspect.
[0052] In a sixth aspect, the application provides a computer program product, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the above-mentioned first aspect or any optional implementation of the first aspect.
[0053] The embodiments of the present application can produce the following beneficial effects:
[0054] Because in the embodiment of the present application, this review system allows the initiator to fill in the relevant content on the web page and then submit it. The background will determine whether there is any content that does not conform to the grammar based on the SQL. If so, it will be fed back in the results. If not, it will further determine the matching degree of this SQL and the primary key or index of the table involved, and then determine whether it meets expectations based on the matching degree. For SQL that does not meet expectations, the review system will prompt to modify it, and the review system also supports the DBA to communicate with the initiator to make modifications and give modification suggestions, so that the initiator can quickly and more specifically modify the SQL that does not meet expectations, and the information and review results of this SQL can be recorded in the table for subsequent review, thereby increasing the timeliness of SQL review, simplifying the review process, improving review efficiency, and supporting SQL review of multiple database types. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only 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.
[0056] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present application;
[0057] Figure 2 A flowchart of a structured query language review method provided in an embodiment of the present application;
[0058] Figure 3 A schematic diagram showing a first system interface provided in an embodiment of the present application;
[0059] Figure 4 A schematic diagram showing a second system interface provided in an embodiment of the present application;
[0060] Figure 5 A schematic diagram showing a third system interface provided in an embodiment of the present application;
[0061] Figure 6 A fifth system interface display schematic diagram provided in an embodiment of the present application;
[0062] Figure 7 A sixth system interface display schematic diagram provided in an embodiment of the present application;
[0063] Figure 8 A structural diagram of a SQL review device provided in an embodiment of the present application;
[0064] Fig. 9 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0066] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.
[0067] The term "and / or" in the embodiments of the present application is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0068] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0069] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0070] Before introducing the review method of the structured query language provided in the embodiment of the present application, in order to facilitate understanding, the technical background of the embodiment of the present application is first introduced in detail below.
[0071] In the process of database application, new scenarios of Structured Query Language (SQL) and changes to the original SQL are often involved. Therefore, in order to better manage the database, it is necessary to review the SQL to determine whether the corresponding SQL meets the requirements.
[0072] At present, the SQL review is mainly conducted manually. For example, the initiator and the database administrator (DBA) confirm the SQL content through offline verbal statements or emails, and conduct subsequent reviews. It often takes multiple interactions to complete the overall review work. The review process is complicated, time-consuming and labor-intensive. Therefore, how to efficiently perform SQL reviews has become an urgent problem to be solved.
[0073] In view of this, a technical solution according to an embodiment of the present application is provided to improve the efficiency, flexibility and accuracy of SQL review.
[0074] See also Figure 1 , an SQL review system is provided for an embodiment of the present application, the system comprising: a database and a server.
[0075] Among them, the database in the embodiment of the present application can be diversified. For example, the data in the embodiment of the present application can be an Oracle-based database, or a Mysql-based database, etc., which is not limited here.
[0076] Optionally, the SQL review system described in the embodiment of the present application may also include a front-end device, which is used to display the system interface, for example, displaying the login page, query page, SQL review page, modification page, review communication page, etc. of the SQL review system.
[0077] See also Figure 2 , is a flowchart of a SQL review method provided in an embodiment of the present application, the method is applied to Figure 1 The system shown in the figure is taken as an example. The specific steps of the method are as follows:
[0078] S201: Determine the target database table corresponding to the SQL to be reviewed in the database of the review system.
[0079] As an example, the embodiment of the present application needs to obtain the SQL before determining the target database table corresponding to the SQL.
[0080] For example, in an embodiment of the present application, a user can input information of the SQL to be reviewed in the SQL review page in the front-end display interface of the system, so that the review system can determine the SQL according to the filled-in content submitted on the SQL review page; for another example, in an embodiment of the present application, the SQL to be reviewed can be found in the query page, and in response to the user's review operation on the target SQL in the query page, the information of the target SQL is automatically obtained and the review page for the target SQL is jumped to.
[0081] Among them, when filling in the SQL review page, the user of this application can choose to add a new table or use the original table according to actual needs.
[0082] For example, Figure 3 As shown, it is a schematic diagram of the interface when the target database table corresponding to the SQL in the embodiment of the present application is a newly added table. Among them, when the target database table is a newly added table, the SQL needs to be entered into the database, and the primary key and / or index corresponding to the target database table is recorded.
[0083] S202: Determine the matching degree between the SQL and the primary key and / or index corresponding to the target database table based on the primary key and / or index corresponding to the target database table.
[0084] Furthermore, in the embodiment of the present application, after obtaining the SQL, the system will first determine whether the syntax of the SQL statement conforms to the judgment rules, and then determine the degree of matching.
[0085] As an example, when the target database table corresponding to the SQL in the embodiment of the present application is an existing table, a target matching scheme is determined according to the requirements of the review, so as to determine the primary key and / or index of the target database table from the database based on the target matching scheme. Among them, the target matching scheme in the embodiment of the present application includes but is not limited to matching based on the database table DLL and matching based on the database execution plan.
[0086] For example, Figure 4 As shown, it is a schematic diagram of the display interface when the target database table corresponding to the SQL in the embodiment of the present application already exists and there is no need to obtain the execution plan in the database.
[0087] Among them, based on the above Figure 4 In the scenario described above, the embodiment of the present application can determine the matching degree between the SQL and the primary key and / or index of the target database table in a variety of ways, which are not limited to the following:
[0088] Method 1: When calculating the matching degree, the embodiment of the present application provides a method for determining the matching by matching the primary key fields with the corresponding SQL in order, that is, when the primary key fields are the same and the position order is also the same, it is confirmed that the primary key fields match successfully.
[0089] Exemplarily, assuming that the SQL is ...A...B...D, the primary key field of the target database table corresponding to the SQL is ABC.
[0090] Among them, you can see that the first and second fields of the primary key are equal, but the third field is not equal. At this time, only two primary key fields are matched, not a complete match.
[0091] Exemplarily, assuming that the SQL is…A(=target value 1)…and…B(=target value 2)…and…C(=target value 3), the primary key field of the target database table corresponding to the SQL is…A(=target value 1)…and…B(=target value 2)…and…C(=target value 3).
[0092] Among them, you can see that the first field, the second field, and the third field of the primary key are all equal and in the same order, which means they are completely matched.
[0093] For example, assuming that the SQL is…A(=target value 1)…and…B(=target value 2)…and…C(=target value 3), the primary key field of the target database table corresponding to the SQL is…A(=target value 1)…and…B(>target value 2)…and…C(=target value 3).
[0094] Among them, you can see that the first and third fields of the primary key are equal, but the second field is a range, so only the second field can be matched. Since the condition of the second field is not met, the third field cannot be executed. At this time, the third field is not equal in the order of the primary key. Therefore, even if the third primary key field is the same, it is not a complete match.
[0095] Method 2: When calculating the matching degree, the embodiment of the present application provides a method for determining the matching by matching the primary key field with the corresponding SQL, that is, if the primary key fields are the same, it is confirmed that the primary key field matches successfully.
[0096] Exemplarily, assuming that the SQL is ...A...C...B, the primary key field of the target database table corresponding to the SQL is ABC.
[0097] It can be seen that the primary key of the SQL and the primary key of the target database table both include A, B, and C, and it is confirmed that the match is completed.
[0098] It should be noted that the above-mentioned matching method of the embodiment of the present application is only an example and does not constitute a limitation of the embodiment of the present application. Any other matching method applicable to the embodiment of the present application falls within the protection scope of the embodiment of the present application.
[0099] For example, Figure 5 As shown, it is a schematic diagram of the display interface when the target database table corresponding to the SQL in the embodiment of the present application already exists and the execution plan is obtained from the database.
[0100] Among them, from Figure 5 As can be seen from the content shown, the main information of this scenario includes the information of the AP server (the server that can connect to the database) and the information of the database connection string (port, IP, user, password, database name).
[0101] As an example, based on the above Figure 5 In the described scenario, the embodiment of the present application can determine the degree of matching through the execution code of the SQL in the library.
[0102] Exemplarily, the embodiments of the present application can determine which index is being used based on the field above the number of bytes (KEY_LEN) field used in the target index in the corresponding execution statement, and then further determine how many columns are matched based on the length of the field corresponding to the index.
[0103] S203: Review the SQL according to the matching degree to obtain a review result of the SQL.
[0104] As an example, the present application reviews the SQL according to the matching degree to obtain the review results of the SQL in the following two situations, which are respectively introduced below:
[0105] Case 1: Failure to pass the review
[0106] Exemplarily, if the matching degree is not higher than the matching threshold, the review result is determined to be failed and displayed on the review page, and a modification task based on the SQL is automatically established. Then, the embodiment of the present application can respond to the modification operation triggered by the user in the review system, enter the modification page of the review system; and respond to the user's operation on the modification task in the modification page, modify the SQL, and obtain an updated SQL; finally, the review process can be re-executed based on the updated SQL.
[0107] Furthermore, the embodiment of the present application can modify the SQL based on the modification suggestions of the reviewer for the modification task record in the review system to obtain an updated SQL.
[0108] Case 2: Review passed
[0109] Exemplarily, if the matching degree is higher than the matching threshold, the review result is determined to be passed and displayed in the review page; then, the embodiment of the present application can respond to the user's confirmation operation on the review result in the review system and end the review process of the SQL.
[0110] Furthermore, the embodiment of the present application can also record all review processes and review results for the SQL in the review system, so as to perform operations such as related data query.
[0111] Exemplarily, the present application provides the following embodiments: Figure 6 The query page diagram shown in the figure and the following Figure 7 Schematic diagram of the review record page is shown.
[0112] It should be noted that the page display diagram provided in the embodiment of the present application is only an example of the embodiment of the present application and does not constitute a limitation of the embodiment of the present application.
[0113] Through the above method, since in the embodiment of the present application, this review system allows the initiator to fill in the relevant content into the web page and then submit it, the background will determine whether there is any content that does not conform to the grammar based on the SQL. If so, it will be fed back in the results. If not, it will further determine the matching degree of this SQL and the primary key or index of the table involved, and then determine whether it meets expectations based on the matching degree. For SQL that does not meet expectations, the review system will prompt to modify it, and the review system also supports the DBA to communicate with the initiator to make modifications and give modification suggestions, so that the initiator can quickly and more specifically modify the SQL that does not meet expectations, and the information and review results of this SQL can be recorded in the table for subsequent review, thereby increasing the timeliness of SQL review, simplifying the review process, improving review efficiency, and supporting SQL review of multiple database types.
[0114] Based on the same technical concept, the embodiment of the present application provides a SQL review device 800, which includes a module / unit / means for executing the method executed by the above method embodiment. The module / unit / means can be implemented by software, or by hardware, or the corresponding software can be implemented by hardware.
[0115] See also Figure 8 The device 800 may include a determination module 801 and a processing module 802, and the determination module 801 and the processing module 802 cooperate to perform part or all of the operations of the above method embodiment.
[0116] The determination module 801 is used to determine the target database table corresponding to the structured query language SQL to be reviewed in the database of the review system; based on the primary key and / or index corresponding to the target database table, determine the matching degree between the SQL and the primary key and / or index corresponding to the target database table;
[0117] The processing module 802 is used to review the SQL according to the matching degree to obtain the review result of the SQL.
[0118] As an optional manner, the processing module 802 is further configured to:
[0119] According to the SQL review operation triggered by the user in the review system, the review page in the review system is entered; according to the filled-in content submitted by the user in the review page, the SQL is determined.
[0120] As an optional manner, the determining module 801 is further configured to:
[0121] When it is determined that the target database table corresponding to the SQL is a newly added table, the SQL is entered into the database, and the primary key and / or index corresponding to the target database table is recorded.
[0122] As an optional manner, the determining module 801 is further configured to:
[0123] According to the requirements of the review, a target matching scheme is determined; based on the target matching scheme, a primary key and / or index of the target database table is determined from the database; the target matching scheme includes a database table DLL and a database execution plan.
[0124] As an optional manner, the determining module 801 is further configured to:
[0125] Based on preset SQL grammar rules, it is determined that the SQL complies with the grammar rules.
[0126] As an optional manner, the processing module 802 is further configured to:
[0127] If the matching degree is not higher than the matching threshold, the review result is determined to be failed and displayed in the review page, and a modification task based on the SQL is automatically established; in response to the modification operation triggered by the user in the review system, the modification page of the review system is entered; in response to the user's operation on the modification task in the modification page, the SQL is modified to obtain an updated SQL; and the review process is re-executed based on the updated SQL.
[0128] As an optional method, the review system also has the function of analyzing and obtaining modification prompts based on the review results.
[0129] As an optional manner, the processing module 802 is further configured to:
[0130] Based on the modification suggestions of the reviewer for the modification task record in the review system, the SQL is modified to obtain an updated SQL.
[0131] As an optional manner, the processing module 802 is further configured to:
[0132] If the matching degree is higher than the matching threshold, the review result is determined to be passed and displayed in the review page; in response to the user's determination operation on the review result in the review system, the review process of the SQL is ended.
[0133] As an optional manner, the processing module 802 is further configured to:
[0134] Record all review processes and review results for the SQL in the review system.
[0135] It should be understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0136] As a possible product form of the above device, see Fig. 9 The embodiment of the present application further provides an electronic device 900, including:
[0137] At least one processor 901; and a communication interface 903 that is communicatively connected to the at least one processor 901; the at least one processor 901 executes instructions stored in the memory 902, so that the electronic device 900 executes the method steps performed by any device in the above method embodiment through the communication interface 903.
[0138] Optionally, the memory 902 is located outside the electronic device 900 .
[0139] Optionally, the electronic device 900 includes the memory 902, the memory 902 is connected to the at least one processor 901, and the memory 902 stores instructions that can be executed by the at least one processor 901. Fig. 9 The dashed lines indicate that the memory 902 is optional for the electronic device 900 .
[0140] The processor 901 and the memory 902 may be coupled via an interface circuit or may be integrated together, which is not limited here.
[0141] The specific connection medium between the processor 901, the memory 902 and the communication interface 903 is not limited in the embodiment of the present application. Fig. 9 In the embodiment, the processor 901, the memory 902 and the communication interface 903 are connected via a bus 904. Fig. 9 The connections between the other components are shown in bold lines, which are only for illustration and are not intended to be limiting. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0142] It should be understood that the processor mentioned in the embodiments of the present application can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor implemented by reading software code stored in a memory.
[0143] Exemplarily, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0144] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DirectRambus RAM, DR RAM).
[0145] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) can be integrated into the processor.
[0146] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0147] As another possible product form, an embodiment of the present application also provides a computer-readable storage medium, which is used to store instructions. When the instructions are executed, the computer executes the method steps performed by the client or server in the above method example.
[0148] As another possible product form, an embodiment of the present application also provides a computer program product comprising instructions, wherein the computer program product stores instructions that, when executed on a computer, enable the computer to execute the method steps performed by the client or server in the above method embodiment.
[0149] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0150] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0151] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0152] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes. Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A review method for structured query language, characterized in that: The method comprises: Determine the target database table corresponding to the structured query language SQL to be reviewed in the database of the review system; Based on the primary key and / or index corresponding to the target database table, determining the matching degree between the SQL and the primary key and / or index corresponding to the target database table; The SQL is reviewed according to the matching degree to obtain a review result of the SQL.
2. The method according to claim 1, characterized in that: The method further comprises: According to the SQL review operation triggered by the user in the review system, entering the review page in the review system; The SQL is determined according to the filled-in content submitted by the user in the review page.
3. The method according to claim 2, characterized in that The method further comprises: When it is determined that the target database table corresponding to the SQL is a newly added table, the SQL is entered into the database, and the primary key and / or index corresponding to the target database table is recorded.
4. The method according to claim 1, characterized in that: Determining the matching degree between the SQL and the primary key and / or index of the target database table includes: Determine the target matching plan based on the requirements of the review; Based on the target matching scheme, determining a primary key and / or index of the target database table from the database; The target matching solution includes a database table DLL and a database execution plan.
5. The method according to claim 1, characterized in that Before determining the target database table corresponding to the SQL to be reviewed in the database of the review system, the method further includes: Based on preset SQL grammar rules, it is determined that the SQL complies with the grammar rules.
6. The method according to claim 1, characterized in that After reviewing the SQL according to the matching degree and obtaining the review result of the SQL, the method further includes: If the matching degree is not higher than the matching threshold, the review result is determined and displayed as failed on the review page, and a modification task based on the SQL is automatically established; In response to a modification operation triggered by a user in the review system, entering a modification page of the review system; In response to the user's operation on the modification task in the modification page, modify the SQL to obtain an updated SQL; The review process is re-executed based on the updated SQL.
7. The method according to claim 6, characterized in that The method further comprises: Based on the modification suggestions of the reviewer for the modification task record in the review system, the SQL is modified to obtain an updated SQL.
8. The method according to claim 1, characterized in that The step of reviewing the SQL according to the matching degree to obtain a review result of the SQL includes: If the matching degree is higher than the matching threshold, the review result is determined to be passed and displayed on the review page; In response to the user's confirmation operation on the review result in the review system, the review process of the SQL is ended.
9. The method according to claim 6, characterized in that The method further comprises: Record all review processes and review results for the SQL in the review system.
10. A structured query language review device, characterized in that: include: A determination module is used to determine the target database table corresponding to the structured query language SQL to be reviewed in the database of the review system; Based on the primary key and / or index corresponding to the target database table, determining the matching degree between the SQL and the primary key and / or index corresponding to the target database table; A processing module is used to review the SQL according to the matching degree to obtain a review result of the SQL.
11. A review system for structured query language, characterized in that: include: Databases and servers; The server is used to: determine the target database table corresponding to the structured query language SQL to be reviewed in the database of the review system; Based on the primary key and / or index corresponding to the target database table, determine the matching degree between the SQL and the primary key and / or index corresponding to the target database table; review the SQL according to the matching degree to obtain the review result of the SQL; The database is used to store database tables.
12. An electronic device, characterized in that: include: at least one processor; and a memory and a communication interface communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, and the at least one processor executes the instructions stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 9 through the communication interface.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 9.
14. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Evaluation method and device for database change script
CN113110866A
SQL statement optimization method and device, equipment, storage medium and product
CN113590647A
Grammar parser generation method, SQL (Structured Query Language) access control method, device and equipment
CN114675832A
Sql code checking method and device
CN117667882A
