Control system and method thereof during execution of stored procedure

By introducing the collaborative work of execution sessions and debugging sessions into the database management system, the problem of insufficient flexibility in the execution of stored procedures in the existing technology is solved, real-time monitoring and control is achieved, and the reliability and performance of the database are improved.

CN118394774BActive Publication Date: 2024-10-29TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410867642.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-10-29
Estimated Expiration
2044-07-01

AI Technical Summary

Technical Problem

Existing database management systems lack flexibility when executing stored procedures, are unable to provide real-time, condition-based execution control and advanced error handling mechanisms, and are difficult to meet debugging and modification needs in complex business scenarios.

Method used

By introducing the collaborative work of execution sessions and debugging sessions during the execution of stored procedures, using condition variables to control interaction, the segmentation and marking of stored procedures are realized, real-time monitoring and control functions are provided, variable modification and logging are supported, and concurrency control and Error handling.

Benefits of technology

It improves the flexibility and debugging efficiency of stored procedure execution, enables more precise error location and diagnosis, dynamically adjusts execution strategies, and improves database reliability and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394774B_ABST
    Figure CN118394774B_ABST
Patent Text Reader

Abstract

The present invention provides a control system and method for the execution of a stored procedure, including an execution session and a debugging session, which work together to control the execution of the stored procedure, the execution session is used to actually execute the stored procedure, and the debugging session is used to send control commands and debugging instructions; conditional variables are used to control the interaction between the execution session and the debugging session; the debugging instructions include access debugging information and process control, and the process control instructions are used to ensure concurrent control when other debugging instructions are queued during the execution process. The present invention has the following beneficial effects: the flexibility and strength of the existing database management function are enhanced, and more efficient error diagnosis and debugging support can be provided, which greatly improves the reliability and performance of database applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of database management, and in particular relates to a control system and method thereof during the execution of a stored procedure. Background Art

[0002] In the application of database management systems, stored procedures play a key role. They are a set of pre-written SQL statements that can be compiled and stored in the database for quick and repeated calls later. The use of stored procedures not only improves the execution efficiency of SQL statements, but also effectively encapsulates business logic and ensures data consistency and security. However, there are still some challenges in the management and control of stored procedures. In practical applications, especially in complex business scenarios, developers and database administrators may need to intervene in real time during the execution of stored procedures to debug or modify them to adapt to specific operating conditions or solve problems that arise during the execution process. This includes but is not limited to operations such as pausing execution, modifying variable values, and monitoring execution status. Although modern database management systems provide basic debugging tools and partial control functions, these tools often lack flexibility and are not sufficient to meet more fine-grained operational requirements. For example, existing systems may not provide real-time, condition-based execution control, or cannot dynamically adjust execution strategies at various stages of stored procedure execution. In addition, existing solutions often show inadequacies in concurrency control and advanced error handling mechanisms during execution. Summary of the invention

[0003] In view of this, the present invention aims to propose a controlled system and method during the execution of a stored procedure to enhance the flexibility and strength of existing database management functions, and to provide more efficient error diagnosis and debugging support, thereby greatly improving the reliability and performance of database applications.

[0004] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0005] The controlled system during the execution of stored procedures.

[0006] Further, it includes an execution session and a debugging session, which work together to control the execution of the stored procedure, the execution session is used to actually execute the stored procedure, and the debugging session is used to send control commands and debugging instructions;

[0007] Use condition variables to control the interaction between the execution session and the debugging session;

[0008] Debugging instructions include accessing debugging information and process control. Flow control instructions are used to queue other debugging instructions during execution to ensure concurrent control.

[0009] Furthermore, the controlled method during the execution of the stored procedure is based on the controlled system during the execution of the stored procedure, including:

[0010] T1. Segmentation and marking of stored procedures: The system will use lexical and syntax analysis tools to segment and mark stored procedures to ensure that each statement can be individually identified and controlled;

[0011] T2, Execution session and debugging session: The system creates execution session and debugging session. The execution session is used to run the stored procedure, and the debugging session is used to monitor and control the execution session. The execution session runs the stored procedure continuously without external interruption.

[0012] T3, Execution Control: The debugging session can monitor the execution session in real time and send control commands as needed. When the execution session is paused, it goes to T4.

[0013] T4. Variable monitoring and modification: The debugging session can query or modify the variable values ​​in the stored procedure, which is used to dynamically adjust the variables during execution to respond to changes in the program's running status or external input;

[0014] T5. Logging and error handling: The system will record all key events and error information during the execution process for subsequent analysis.

[0015] Furthermore, in T1, each SQL statement in the stored procedure is segmented and marked with line numbers for reference in subsequent steps.

[0016] Furthermore, in the T2, the instructions during the debugging session runtime include debugging information access class and process control class. The debugging information access class is used for user link access information. When the process control class controls the session exec, during the execution of the instruction, the execution of other debugging instructions will be added to the queue to control concurrency.

[0017] Furthermore, in T1, the segmentation logic is:

[0018] T11. Use tools such as lex to perform lexical analysis on the input stored procedure text and decompose the SQL code into tokens. Variable names, keywords, operators, etc. are all identified and marked as different types of tokens.

[0019] T12, determine the location information of each token, including the line number, by identifying specific characters;

[0020] T13, the parser combines tokens into logically complete sentences according to the defined grammatical rules;

[0021] T14. The combined statements will be translated into specific execution instructions according to the line number information of the tokens they contain.

[0022] Furthermore, in said T4, the debugging session includes the following command to interrupt the execution session:

[0023] The debug session sends a break command to the execution session, pausing the execution of the stored procedure;

[0024] The debug session sends a continue command to the execution session to resume execution of the stored procedure;

[0025] The debugging session sends commands to modify variable values ​​to the execution session, dynamically modifying the variables in the stored procedure.

[0026] Furthermore, an electronic device includes a processor and a memory that is communicatively connected to the processor and is used to store executable instructions of the processor, and the processor is used to execute the controlled method during the execution of the stored process.

[0027] Furthermore, a server includes at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor to enable the at least one processor to execute the controlled method during the execution of the stored procedure.

[0028] Furthermore, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the controlled method in the execution process of the stored procedure is implemented.

[0029] Compared with the prior art, the control system and method thereof during the execution of a stored procedure of the present invention has the following beneficial effects:

[0030] By allowing real-time monitoring and control of the execution of stored procedures, the system can provide more precise error location and debugging capabilities. When a stored procedure encounters a problem during execution, developers can intervene immediately to view or modify the values ​​of related variables, or adjust the execution process to quickly solve the problem. This not only shortens the time to solve the problem, but also improves the efficiency of development and maintenance; by finely controlling the execution process, the system can adjust the execution strategy of the stored procedure according to the current database load and external environment, such as optimizing the execution order or dynamically adjusting resource allocation. This flexibility enables the database to respond more effectively to various operating conditions, thereby improving overall performance and response speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0032] Figure 1 A schematic diagram of the basic timing of a debugging session and an execution session according to an embodiment of the present invention;

[0033] Figure 2 This is a schematic diagram of a session execution flow chart according to an embodiment of the present invention;

[0034] Figure 3 A schematic diagram of a debugging session flow chart according to an embodiment of the present invention;

[0035] Figure 4 This is a schematic diagram of a segmentation logic flow chart according to an embodiment of the present invention. DETAILED DESCRIPTION

[0036] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0037] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0038] like Figure 1 As shown, the controlled system during the execution of the stored procedure includes an execution session and a debugging session. The two work together to control the execution of the stored procedure. The execution session is used to actually execute the stored procedure, and the debugging session is used to send control commands and debugging instructions. Condition variables are used to control the interaction between the execution session and the debugging session. The debugging instructions include accessing debugging information and process control. The process control instructions are used to queue up other debugging instructions during the execution process to ensure concurrent control.

[0039] Furthermore, the controlled method during the execution of the stored procedure is based on the controlled system during the execution of the stored procedure, including:

[0040] T1, split and mark the stored procedure: Figure 4 As shown, the system will use lexical and grammatical analysis tools to segment and mark the stored procedure to ensure that each statement can be identified and controlled individually;

[0041] T2, Execution session and debugging session: The system creates execution session and debugging session. The execution session is used to run stored procedures such as Figure 2 As shown, the debug session is used to monitor and control the execution session such as Figure 3 As shown, the execution session runs the stored procedure continuously without external interruptions;

[0042] T3, Execution Control: The debugging session can monitor the execution session in real time and send control commands as needed. When the execution session is paused, it goes to T4.

[0043] T4. Variable monitoring and modification: The debugging session can query or modify the variable values ​​in the stored procedure, which is used to dynamically adjust the variables during execution to respond to changes in the program's running status or external input;

[0044] T5. Logging and error handling: The system will record all key events and error information during the execution process for subsequent analysis.

[0045] Specifically, in T1, each SQL statement in the stored procedure is segmented and marked with line numbers for reference in subsequent steps.

[0046] Specifically, in T2, the instructions during the debugging session runtime include debugging information access class and process control class. The debugging information access class is used for user link access information. When the process control class controls the session exec, during the execution of the instruction, the execution of other debugging instructions will be added to the queue to control concurrency.

[0047] Specifically, in the T1, if Figure 4 As shown, the segmentation logic is:

[0048] T11. Use tools such as lex to perform lexical analysis on the input stored procedure text and decompose the SQL code into tokens. Variable names, keywords, operators, etc. are all identified and marked as different types of tokens.

[0049] T12, determine the location information of each token, including the line number, by identifying specific characters;

[0050] T13, the parser combines tokens into logically complete sentences according to the defined grammatical rules;

[0051] T14. The combined statements will be translated into specific execution instructions according to the line number information of the tokens they contain.

[0052] Specifically, in T4, the debugging session includes the following command to interrupt the execution session:

[0053] The debug session sends a break command to the execution session, pausing the execution of the stored procedure;

[0054] The debug session sends a continue command to the execution session to resume execution of the stored procedure;

[0055] The debugging session sends commands to modify variable values ​​to the execution session, dynamically modifying the variables in the stored procedure.

[0056] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0057] In the several embodiments provided in the present application, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the division of the units described above is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The above-mentioned units may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.

[0058] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

[0059] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A controlled system during the execution of a stored procedure, characterized in that: Includes execution session and debugging session, which work together to control the execution of stored procedures. The execution session is used to actually execute the stored procedure, and the debugging session is used to send control commands and debugging instructions. Use condition variables to control the interaction between the execution session and the debugging session; Debugging instructions include accessing debugging information and flow control. Flow control instructions are used to queue other debugging instructions during execution to ensure concurrent control. The controlled method during the execution of the stored procedure is based on the controlled system during the execution of the stored procedure, including: T1. Segmentation and marking of stored procedures: The system will use lexical and syntax analysis tools to segment and mark stored procedures to ensure that each statement can be individually identified and controlled; T2, Execution session and debugging session: The system creates execution session and debugging session. The execution session is used to run the stored procedure, and the debugging session is used to monitor and control the execution session. The execution session runs the stored procedure continuously without external interruption. T3, Execution Control: The debugging session can monitor the execution session in real time and send control commands as needed. When the execution session is paused, it goes to T4. T4. Variable monitoring and modification: The debugging session can query or modify the variable values ​​in the stored procedure, which is used to dynamically adjust the variables during execution to respond to changes in the program's running status or external input; T5. Log and error handling: The system will record all key events and error information during the execution process for subsequent analysis; In T1, the segmentation logic is: T11. Use tools such as lex to perform lexical analysis on the input stored procedure text and decompose the SQL code into tokens. Variable names, keywords, operators, etc. are all identified and marked as different types of tokens. T12, determine the location information of each token, including the line number, by identifying specific characters; T13, the parser combines tokens into logically complete sentences according to the defined grammatical rules; T14. The combined statements will be translated into specific execution instructions according to the line number information of the tokens they contain.

2. The method for controlling the execution of a stored procedure according to claim 1, characterized in that: In the T1, each SQL statement in the stored procedure is segmented and marked with line numbers for easy reference in subsequent steps.

3. The method for controlling the execution of a stored procedure according to claim 1, characterized in that: In the T2, the instructions during the debugging session runtime include debugging information access class and process control class. The debugging information access class is used for user link access information. When the process control class controls the session exec, during the execution of the instruction, the execution of other debugging instructions will be added to the queue to control concurrency.

4. The method for controlling the execution of a stored procedure according to claim 1, characterized in that: In said T4, the debugging session includes the following command to interrupt the execution session: The debug session sends a break command to the execution session, pausing the execution of the stored procedure; The debug session sends a continue command to the execution session to resume execution of the stored procedure; The debugging session sends commands to modify variable values ​​to the execution session, dynamically modifying the variables in the stored procedure.

5. An electronic device, comprising a processor and a memory connected to the processor for storing instructions executable by the processor, characterized in that: The processor is used to execute the controlled method in the execution process of the stored procedure described in any one of claims 2-4 above.

6. A server, characterized in that: It includes at least one processor and a memory that is communicatively connected to the processor, wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the processor to enable the at least one processor to execute the controlled method in the storage process execution process as described in any one of claims 2-4.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the controlled method in the execution process of the stored procedure described in any one of claims 2 to 6 is implemented.

Citation Information

Patent Citations

  • Method and system for realizing secure interaction between systems

    CN108734033A

  • Information interaction method, device and equipment, and storage medium

    CN111818046A

  • Lightweight PL / SQL language debugger implementation method

    CN117076314A

  • Code debugging method, electronic equipment and computer readable storage medium

    CN117971635A

  • Method and device for processing abnormal data

    US20200104282A1