Database operation processing method, storage medium and computer device

By creating multiple sessions within the database and enabling multi-cursor mode, the problem of users frequently establishing physical connections in existing technologies is solved, enabling efficient execution and convenient use of multiple database operations.

CN115905299BActive Publication Date: 2026-04-17CETC JINCANG (BEIJING) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CETC JINCANG (BEIJING) TECH CO LTD
Filing Date
2023-01-09
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In existing technologies, when a user executes multiple database operation statements within a single connection, it is necessary to frequently establish physical connections, resulting in high operational complexity and a poor user experience.

Method used

By creating multiple sessions within the database and enabling multi-cursor mode, result sets can be dynamically processed. Clients only need to create a new session and execute multiple operation statements through a single connection, while the database system automatically manages physical connections.

Benefits of technology

It reduces the complexity of client operations, improves the convenience and performance of database use, and enables the interleaved execution of multiple operation statements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115905299B_ABST
    Figure CN115905299B_ABST
Patent Text Reader

Abstract

The application provides a database operation processing method, a storage medium and a computer device. The method comprises the following steps: obtaining a client session through a client connection established in advance by a database and a client; executing an operation statement obtained from the client session; detecting whether an event requiring re-execution occurs; if the event occurs, creating a first execution session in the database, establishing a physical connection between the first execution session and the database; and re-executing the operation statement through the physical connection. This operation method only needs to newly create a corresponding session connection to the connection interface preset by the database system according to each request when the client needs to process multiple operation statements, and the database server will independently create a corresponding session according to the corresponding operation statement to execute. Therefore, the complexity of database use is reduced, and the interlaced execution of multiple operation statements can be realized, thereby improving the convenience of database use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to database technology, and in particular to a database operation processing method, storage medium, and computer equipment. Background Technology

[0002] In some database use cases, when a user uses a database query within a single connection, the database first stores the result set of the database operation within the connection. The user then needs to retrieve the data from the result set using a data retrieval operation. If, after querying the database, no data is retrieved from the result set, another database operation needs to be performed. Currently, one approach is for the application to process or cancel the existing result set within the connection before performing other database operations on that connection. Furthermore, in the application's code logic, multiple operation statements must be executed through multiple physical connections. This makes the user's database operation process very cumbersome, especially when multiple database operation statements need to be executed simultaneously, increasing the complexity of database operations and resulting in a poor user experience. Summary of the Invention

[0003] One object of this invention is to allow the interleaving execution of multiple different types of database operation statements.

[0004] A further objective of this invention is to reduce the complexity of manipulating multi-activity result sets using database engines.

[0005] A further objective of this invention is to improve the ease of database usage for clients.

[0006] Specifically, the present invention provides a method for processing database operations, comprising:

[0007] Obtain the client session through a pre-established client connection with the database;

[0008] Execute the operation statements obtained from the client session;

[0009] Check if any events require re-execution;

[0010] If an event occurs, a first execution session is created within the database, and a physical connection is established between the first execution session and the database.

[0011] The operation statement is re-executed via the physical connection.

[0012] Optionally, the triggering events include:

[0013] A client session is the only session within a client connection, and the client sends new sessions within the connection.

[0014] Optionally, the step of obtaining a client session via a pre-established client connection to the database further includes:

[0015] Pre-set the parameters to enable the multi-cursor function;

[0016] Get the parameters for enabling the multi-cursor function;

[0017] If the multi-cursor functionality enable parameter indicates that multi-cursor functionality is enabled, then after the step in which the event occurs, the creation of the first execution session within the database and subsequent steps are executed.

[0018] Optionally, the steps of re-executing the operation statement via a physical connection include:

[0019] Determine if the operation statement has already been defined;

[0020] If not, determine whether the operation statement is a query statement;

[0021] If the operation statement is a query statement, then rewrite the query statement;

[0022] The rewritten query statement is executed via a physical connection to obtain the result set data of the query statement and its cursor.

[0023] The result set data is retrieved from the database using the cursor in the first execution session and then returned to the client session.

[0024] Optionally, the step of determining whether an operation statement is a query statement may be followed by:

[0025] If not, the operation statement is executed via the physical connection, and then the operation ends.

[0026] Optionally, the step of rewriting the query statement includes:

[0027] Rewrite the operation statement into an operation statement that returns the server cursor.

[0028] Optionally, after executing the rewritten operation statement through the physical connection to obtain the result set data of the query statement and its cursor, the following steps are included:

[0029] Record the association between the result set cursor and the client session in a pre-defined relationship table;

[0030] Before the step of retrieving the result set data from the database based on the result set cursor in the first execution session and returning the result set data to the client session, the following steps are included:

[0031] Locate the result set cursor corresponding to the client session in the relation table and pass the cursor to the first execution session.

[0032] Optionally, the step of retrieving result set data from the database based on the cursor in the first execution session further includes:

[0033] If the result set cursor has reached the end, create a new second execution session and establish a physical connection between the second execution session and the database;

[0034] Modify the query statement in the client session into a rewrite statement for the cursor that returns the result data;

[0035] The rewritten statement is executed through a physical connection to obtain the result set data of the query statement and its cursor.

[0036] Associate the cursor with the client session;

[0037] In the second execution session, the result set data is retrieved from the database using the result set cursor, and then returned to the client session.

[0038] According to another aspect of the present invention, a machine-readable storage medium is also provided, on which a machine-executable program is stored, wherein the machine-executable program, when executed by a processor, implements a processing method for any of the above-described database operations.

[0039] According to another aspect of the present invention, a computer device is also provided, including a memory, a processor, and a machine-executable program stored in the memory and running on the processor, and a processing method for implementing any of the above-described database operations when the processor executes the machine-executable program.

[0040] The database operation processing method of this invention allows the client to perform a single operation using the database engine simply by creating a new session, connecting to the database, and then executing the operation statement. However, when the client has already executed a query operation but has not yet processed or completed the processing of the result set, and then needs to execute a new operation statement, the client only needs to create a new session, still using the previous connection between the client and the server, without needing to create a new physical connection. Internally, when the database system detects that the client has two or more operation statements to execute within a single connection, it will use a multi-cursor method to process the result set. That is, internally, a new session is created for each operation statement in the client. When a query statement is encountered retrieving the result set, it is determined whether a multi-cursor mode is used to retrieve the result set data. If not, the statement will be re-executed according to the logic of the multi-cursor mode. The multi-cursor mode refers to the database's assessment of the statement. If the statement has not been modified and is a query statement, it is rewritten as a query statement that returns a server cursor, and then executed. After execution, the corresponding data is returned to the client session according to this cursor. This approach allows the system to dynamically use a multi-cursor model when a client needs to execute other statements while performing a query. Multiple sessions are created within the database for each statement, and these sessions operate independently, all using transaction processing. This reduces client-side complexity; for multiple statements, the client only needs to create multiple sessions and connect to the server through a single connection, eliminating the need to manually create physical connections for each session. This improves user convenience when using the database engine. Furthermore, the independent execution of multiple statements enhances database performance.

[0041] Furthermore, the database operation processing method of the present invention presets parameters for enabling multi-cursor mode in the database, and the client can freely choose whether to enable this function, thereby improving the convenience of using the database engine.

[0042] The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments of the invention in conjunction with the accompanying drawings. Attached Figure Description

[0043] The following sections will describe some specific embodiments of the invention in detail by way of example and not limitation, with reference to the accompanying drawings. The same reference numerals in the drawings denote the same or similar parts or portions. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:

[0044] Figure 1This is a schematic diagram of the database operation architecture of a database operation processing method according to an embodiment of the present invention;

[0045] Figure 2 This is a schematic flowchart of a database operation processing method according to an embodiment of the present invention;

[0046] Figure 3 This is a schematic diagram of the process of executing multiple sessions in a database according to another embodiment of the present invention.

[0047] Figure 4 This is a schematic flowchart of a database operation processing method for obtaining result set data according to another embodiment of the present invention.

[0048] Figure 5 This is a schematic diagram illustrating an example of rewriting a database query statement in a database operation processing method according to an embodiment of the present invention;

[0049] Figure 6 This is a schematic diagram illustrating the relationship of a single session in the database operation processing method according to an embodiment of the present invention.

[0050] Figure 7 This is a schematic diagram illustrating the relationship between processing query statements when a database executes multiple sessions, according to a database operation processing method based on an embodiment of the present invention.

[0051] Figure 8 This is a schematic diagram illustrating the relationship between the database return result set data in a database operation processing method according to an embodiment of the present invention;

[0052] Figure 9 This is a schematic diagram of the overall process of database operation processing method according to another embodiment of the present invention, which executes multiple sessions in a database.

[0053] Figure 10 This is a schematic diagram of a machine-readable storage medium in a database operation processing method according to an embodiment of the present invention; and

[0054] Figure 11 This is a schematic diagram of a computer device in a database operation processing method according to an embodiment of the present invention. Detailed Implementation

[0055] Those skilled in the art should understand that the embodiments described below are merely a part of the embodiments of the present invention, and not all of the embodiments of the present invention. These partial embodiments are intended to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those skilled in the art without creative effort should still fall within the scope of protection of the present invention.

[0056] In existing database operating systems, when a user uses database operation statements within a connection, the database first stores the result set of the database operation within the connection. Then, the user needs to use data retrieval operations to obtain the data from the result set.

[0057] When a user executes a database operation statement but does not retrieve data from the result set, and then needs to execute another database operation, a common practice is that the application must first process or cancel the existing result set in the connection before performing other database operations on that connection. Furthermore, in the application's code logic, multiple operation statements must be executed through multiple physical connections. This makes the user's database operation steps very cumbersome, especially when multiple database operation statements need to be executed simultaneously, increasing the complexity of database operations and resulting in a poor user experience. The method in this embodiment ensures that the client, regardless of whether it is processing a single or multiple operation statements, reaches the database server through only one connection. This remains unchanged when the database is processing a single session. When the client is processing the result set of a query operation and then needs to process another operation statement, the multi-cursor mode is triggered, allowing the client to process multiple operation statements simultaneously through only one connection. This reduces the complexity of client operations.

[0058] Figure 1 This is a schematic diagram of the database operation architecture of a database operation processing method according to an embodiment of the present invention. The schematic diagram includes:

[0059] When client 101 sends a request, a new session is established and the database operation statements are communicated and exchanged with the Server DB database server 204 through the Network network 203 via connection 202. The Server DB database server 204 then returns the result set data to the client through the Network network 203.

[0060] Figure 2 This is a flowchart illustrating a database operation processing method according to an embodiment of the present invention. The method generally includes the following steps:

[0061] Step S201: Obtain a client session through a pre-established client connection between the database and the client. This pre-established client connection refers to a method class provided by the database server that the client can call at any time. After establishing a new session, the client only needs to call this method to connect to the database server and transmit information from the client session to the database server.

[0062] Step S202: Execute the operation statement obtained from the client session.

[0063] Step S203: Determine if an event requiring re-execution occurs. An event requiring re-execution here refers to a situation where, during a single query operation by the client session, the database returns the corresponding result set and stores it in the connection's cache. If, before or while the client session has processed this result set, the client establishes a new session and sends it to the database server through the existing connection, this will trigger the multi-cursor mode.

[0064] The so-called multi-cursor mode means that when a client session is processing the result set of a query statement, it does not directly retrieve the result set data, but instead retrieves the cursor corresponding to the result set data. However, at this time, there is no cursor in the result set corresponding to this query statement, so the database server will re-operate according to the multi-cursor mode based on the query statement in this session.

[0065] Step S204: If the result of step S203 is yes, a first execution session is created within the database, and a physical connection is established between the first execution session and the database. This step occurs after the client session triggers the multi-cursor mode. The database server dynamically creates a new session, called the first execution session, for each operation statement passed in by the client session, and establishes a corresponding physical connection between each first execution session and the database.

[0066] Step S205: Re-execute the operation statements through the physical connection. Re-execution means that after receiving a signal indicating the need for re-execution, the database server begins executing each operation statement in multi-cursor mode. The execution method after multi-cursor mode is triggered is as follows: Figure 3 and Figure 4 There will be a detailed introduction later.

[0067] In this embodiment of the database operation processing method, the client only needs to reach the database server through one connection, regardless of whether it is a single or multiple operation statements. There is no change when the database is processing a single session. When the client needs to process another operation statement while processing the result set of a query operation, the multi-cursor mode method will be triggered, so that the client only needs to meet the requirement of processing multiple operation statements at the same time through one connection.

[0068] The above operations reduce the complexity of client-side request sending. Whether it's one or multiple requests, the client only needs to create a corresponding session for each request. Then, it only needs to call a connection method class provided by the database server that the client can invoke at any time to access the database through the same connection, and it can also achieve interleaved execution of multiple operation statements. This improves the convenience for users using the database engine.

[0069] Figure 3 This is a schematic diagram of the process of executing multiple sessions in a database according to another embodiment of the present invention.

[0070] It should be noted that this method, when the multi-cursor mode is triggered, involves the database server creating a corresponding session for each operation statement and establishing a corresponding physical connection with the database. Each operation statement is then executed internally within the database. The operation flow within each physical connection is as follows:

[0071] Step S301: Determine if it is a query result set. This means determining whether the operation statement being executed is a query statement, because a query statement requires returning result set data.

[0072] Step S302: If the determination in step S301 is yes, rewrite the query statement. The purpose of rewriting the query statement is to rewrite it into a query statement that returns a cursor to the server.

[0073] Step S303: If the determination in step S301 is negative, or if the rewriting in step S302 is complete, the operation statements are executed. That is, the rewritten query statements and other operation statements are executed on the database through a physical connection created internally within the database.

[0074] Step S304: Determine whether the execution was successful.

[0075] Step S305: If the determination in step S304 is yes, determine whether it is a query statement.

[0076] Step S306: If the determination in step S305 is yes, the cursor is associated with the client session and recorded in the relation table. Because step S302 rewrote the query statement into a query statement that returns the server cursor, the obtained server cursor is returned to the corresponding client session here. The relation table refers to a table in the database used to record the correspondence between cursors and client sessions.

[0077] Step S307: The operation ends if the determination in step S305 is negative or if step S306 is completed.

[0078] In this embodiment, when the database server begins executing the multi-cursor mode method, a new corresponding session is created for each operation statement and a connection is established with the database. Then, execution begins according to this process, thus distinguishing query statements from other operation statements. Each session is a complete closed loop and is not affected by other statements. This achieves interleaved execution of multiple operation statements.

[0079] Figure 4 This is a schematic flowchart of a database operation processing method for obtaining result set data according to another embodiment of the present invention.

[0080] It should be noted that this method, when the multi-cursor mode is triggered, involves the database server creating a corresponding session for each operation statement and establishing a physical connection with the database. Each operation statement is then executed internally within the database. The process of retrieving the result set data for a query statement is as follows:

[0081] Step S401: The client session retrieves data. Here, the client session retrieves the result set obtained after the current query statement has been executed.

[0082] Step S402: Determine if the corresponding cursor exists in the data obtained in step S401. Because in multi-cursor mode, all query statements are rewritten as query statements that return server cursors during execution, this step checks if the corresponding cursor exists in the completed results.

[0083] Step S403: If the determination in step S402 is negative, execute the operation statement again. If the determination in step S402 is negative, it means that the database status at this time is that the client was executing a query statement before triggering the multi-cursor mode, and is currently processing the result set. Before triggering the multi-cursor mode, the query statement returns result set data without cursors, so the determination is negative, and therefore it needs to be re-executed according to the processing method of multi-cursor mode.

[0084] Step S404: If the determination in step S402 is yes, determine whether the cursor has reached the end. If the determination in step S402 is yes, it means that this query statement has been executed in the multi-cursor mode. Therefore, it is necessary to determine whether the cursor has reached the end, because the cursor is irreversible. If the cursor has reached the end, no data can be obtained.

[0085] Step S405: If the determination in step S404 is yes, a second execution session is created. If the determination in step S404 is yes, it indicates that the cursor has reached the end. Since the cursor is irreversible, no data can be obtained at this time, and a second execution session needs to be created. It should be noted that the second execution session here is only to distinguish it from the previously created session, and those skilled in the art can name it as they wish.

[0086] Step S406: Execute the operation statement. This step refers to executing the original operation statement in the database again in multi-cursor mode after establishing the second execution session, thereby obtaining the latest data and its cursor.

[0087] Step S407: Associate the result set with the client session. This step refers to associating the server cursor obtained in step S406 with the client session, enabling the client session to continue retrieving data based on the cursor.

[0088] Step S408: After step S403 or step S407 has been completed, continue acquiring data.

[0089] In this embodiment, after the database triggers the multi-cursor mode processing method, the corresponding result set in the database is obtained based on the cursor when retrieving the result set data.

[0090] Figure 5 This is a schematic diagram illustrating an example of rewriting a database query statement using a database operation processing method according to an embodiment of the present invention; it includes the following steps;

[0091] The parameter columns in the database are represented as shown in Table 1:

[0092] Table 1

[0093] connstr Server Username Password Database Port MoreCursor **** **** **** **** **** **** ****

[0094] It should be noted that the parameters in this embodiment are only an example of multiple cursor parameters, and those skilled in the art can set the parameter list according to the actual situation.

[0095] Where connstr is the sequence number identifier for the database connection;

[0096] The server is the service name identifier corresponding to the client session;

[0097] Username is the account identifier;

[0098] Password is the password;

[0099] Database is the database name;

[0100] Port is the port corresponding to the client;

[0101] MoreCursor is the flag that enables multi-cursor mode; when this flag is set to enabled, the database server will start executing operations in multi-cursor mode after a specific time is triggered.

[0102] 501-505 is an example of a query statement, Select * from Table…., which means to retrieve all data from a specific table. The query statement here is only an example to illustrate this method.

[0103] Then in step S506, it is determined whether the starting character is "declare". "Declare" is a symbol used to define database operation statements. If this character is present at the beginning, it indicates that the operation statement has a special purpose and will not be modified, and execution will continue.

[0104] Step S507: If the determination in step S506 is yes, determine whether the starting character is "select". Operation statements starting with "Select" indicate that this statement is a query statement and needs to return result set information.

[0105] Step S508: If the determination in step S507 is yes, begin executing the rewritten statement and its subsequent operations. If the determination is yes, and multi-cursor mode is triggered, this query statement needs to be rewritten into a query statement that returns a server cursor. An example of the format of the rewritten query statement is shown in Table 2:

[0106] Table 2

[0107] DECLARE cursorl CURSOR FOR Select * From Table ……

[0108] Figure 6 This is a schematic diagram illustrating the relationship of a single session in the database operation processing method according to an embodiment of the present invention.

[0109] As shown in the figure, client session 601 is associated with physical connection 602. Then, client session 601 calls operation statement 603 and executes it. After preparing the message, operation statement 603 interacts with database 604 through physical connection 602, thereby realizing the client session's operation on the database.

[0110] Figure 7 This is a schematic diagram illustrating the relationship between processing query statements when a database executes multiple sessions, according to a database operation processing method based on an embodiment of the present invention.

[0111] As shown in the figure: Client session 701 is associated with physical connection 702, and then the operation statement is called to enter the database. Inside the database, a new execution session 705 is created and associated with the new physical connection 706. Then, execution session 705 performs the step 707 of rewriting the query statement and executes the operation statement 708, where the operation statement refers to the rewritten query statement. Then, the execution operation statement module 708 prepares the message and interacts with the database 709 through physical connection 706 to obtain the corresponding result. The obtained cursor-client session correspondence is recorded in the cursor-client session relationship table 703.

[0112] Figure 8 This is a schematic diagram of the process of returning a database result set data in a database operation processing method according to an embodiment of the present invention;

[0113] As shown in the figure: Client session 802 starts executing the data retrieval instruction 801. The data retrieval module 801 will find the corresponding cursor in the cursor-client session relationship table 803 and pass the cursor to the newly created execution session 804 inside the database. Inside the database, the server will create a new physical connection 805 associated with the execution session 804. Then, the execution session 804 will call the cursor to retrieve data statement (Fetch all in**) to start execution. Subsequently, the cursor data retrieval module 806 will prepare the message and interact with the database 807 through the physical connection 805 to obtain the corresponding result set data.

[0114] It should be noted that the cursor data acquisition statement in this example is only a specific example, and those skilled in the art can choose different statements to execute according to the actual situation.

[0115] pass Figure 7 and Figure 8 This method allows the database to create multiple corresponding sessions and physical connections for multiple operation statements, and to perform special processing on the query statements. The results of the processed queries are then returned to the client session and recorded in the corresponding relational table. When the client session begins retrieving the corresponding result set data based on the cursor, the server creates a new session, finds the corresponding result set data using the cursor passed in by the client session, and returns the data to the client. This achieves the processing of multiple operation statements in a multi-cursor mode.

[0116] Figure 9 This is a schematic diagram of the overall process of database operation processing method according to another embodiment of the present invention, which executes multiple sessions in a database.

[0117] It should be noted that the embodiments described herein are merely examples illustrating the proposed method flow. Those skilled in the art can select information such as the number of client sessions based on the actual situation.

[0118] When a client session executes multiple operation statements, triggering a multi-cursor mode, client session 1901 establishes a new session and physical connection within the database via external connection 902. Then, it passes through operation module 903 to obtain the result set and cursor information, recording the corresponding relationship in a relation table. Next, it finds the corresponding cursor 904 in the relation table. Based on the cursor, it establishes a new session and physical connection via the temp cache 1 905 corresponding to client session 1, executing operation statement 906. Based on cursor 1 907, it finds the corresponding result set information in database 920 and returns it to the client. Similarly, 908-913 and 914-919 represent the corresponding processing flows for client session 2 902 and client session 3 914, respectively. Since their flows are similar to those of 901 to 907, they will not be described in detail here. This achieves the synchronous execution of multiple operation statements. The client only needs to create client session 1 901, client session 2 908, and client session 3914 externally, and connect to the database through external connection 902. All subsequent operations are executed internally on the database server, thereby improving the convenience of user operations on the database and reducing the complexity of operating multiple operation statements.

[0119] This embodiment also provides a machine-readable storage medium and a computer device. Figure 10 This is a schematic diagram of a machine-readable storage medium 1001 according to an embodiment of the present invention. Figure 11 This is a schematic diagram of a computer device 1103 according to an embodiment of the present invention.

[0120] The machine-readable storage medium 1001 stores a machine-executable program 1002 thereon, which, when executed by a processor, implements the database operation processing method of any of the above embodiments.

[0121] Computer device 1103 may include memory 1101, processor 1102 and machine executable program 1002 stored on memory 1101 and running on processor 1102, and processor 1102 executes the machine executable program 1002 to implement the processing method of database operation of any of the above embodiments.

[0122] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, such as creating a physical connection, may be specifically implemented in any machine-readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device).

[0123] For the purposes of this embodiment, the machine-readable storage medium 1001 can be any means capable of containing, storing, communicating, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the machine-readable storage medium 1001 include: an electrical connection (electronic device) having one or more wires, a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, the machine-readable storage medium 1001 can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0124] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system.

[0125] Computer device 1103 can be, for example, a server, desktop computer, laptop computer, tablet computer, or smartphone. In some examples, computer device 1103 can be a cloud computing node. Computer device 1103 can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., that perform specific tasks or implement specific abstract data types. Computer device 1103 can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked via a communication network. In a distributed cloud computing environment, program modules can reside on local or remote computing system storage media, including storage devices.

[0126] Computer device 1103 may include a processor 1102 adapted to execute stored instructions and a memory 1101 that provides temporary storage space for the operation of said instructions during operation. The processor 1102 may be a single-core processor, a multi-core processor, a computing cluster, or any other configuration. The memory 1101 may include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0127] The processor 1102 can be connected via a system interconnect (e.g., PCI, PCI-Express, etc.) to an I / O interface (input / output interface) suitable for connecting the computer device 1103 to one or more I / O devices (input / output devices). The I / O devices may include, for example, a keyboard and indicating devices, where the indicating devices may include a touchpad or touchscreen, etc. The I / O devices may be built into the computer device 1103 or may be external devices connected to the computing device.

[0128] The processor 1102 may also be linked via a system interconnect to a display interface suitable for connecting the computer device 1103 to a display device. The display device may include a display screen that is a built-in component of the computer device 1103. The display device may also include an external computer monitor, television, or projector connected to the computer device 1103. Furthermore, a network interface controller (NIC) may be adapted to connect the computer device 1103 to a network via a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as an Internet Minicomputer System Interface) to transmit data. The network may be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, etc. Remote devices may connect to the computing device via the network.

[0129] The flowcharts provided in this embodiment are not intended to indicate that the operations of the method will be performed in any particular order, or that all operations of the method are included in every case. Furthermore, the method may include additional operations. Within the scope of the technical concept provided by the method in this embodiment, additional variations can be made to the above method.

[0130] Therefore, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications conforming to the principles of the present invention can be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Thus, the scope of the present invention should be understood and construed as covering all such other variations or modifications.

Claims

1. A method for processing database operations, comprising: The client session is obtained through the pre-established client connection between the database and the client. Execute the operation statement obtained from the client session; Detect whether an event requires re-execution occurs, including events where the client session is the only session in the client connection and the client sends a new session in the connection; If the event occurs, a first execution session is created within the database, and a physical connection is established between the first execution session and the database; The operation statement is re-executed through the physical connection.

2. The database operation processing method according to claim 1, wherein, The step of obtaining a client session through a pre-established client connection with the client via the database also includes: Pre-set the parameters to enable the multi-cursor function; Get the parameters for enabling the multi-cursor function; If the multi-cursor function enable parameter indicates that the multi-cursor function is enabled, then after the step in which the event occurs, the creation of a first execution session within the database and subsequent steps are executed.

3. The database operation processing method according to claim 1, wherein, The step of re-executing the operation statement through the physical connection includes: Determine whether the operation statement has been defined; If not, determine whether the operation statement is a query statement; If the operation statement is a query statement, then rewrite the query statement; The rewritten query statement is executed through the physical connection to obtain the result set data of the query statement and its cursor. The result set data is obtained from the database in the first execution session based on the cursor, and the result set data is returned to the client session.

4. The database operation processing method according to claim 3, wherein, After the step of determining whether the operation statement is a query statement, the following is also included: If not, the operation statement is executed through the physical connection, and then the operation ends.

5. The database operation processing method according to claim 3, wherein, The steps of rewriting the query statement include: Rewrite the operation statement as an operation statement that returns the server cursor.

6. The database operation processing method according to claim 3, wherein, The step of executing the rewritten operation statement through the physical connection to obtain the result set data of the query statement and its cursor includes: The association between the result set cursor and the client session is recorded in a preset relationship table; Before the step of retrieving result set data from the database in the first execution session based on the result set cursor and returning the result set data to the client session, the following steps are included: Locate the result set cursor corresponding to the client session in the relation table and pass the cursor to the first execution session.

7. The database operation processing method according to claim 3, wherein, The step of retrieving result set data from the database in the first execution session based on the cursor further includes: If the result set cursor has reached the end, create a new second execution session and establish a physical connection between the second execution session and the database; Modify the query statement of the client session into a rewrite statement for the cursor of the returned result data; The rewritten statement is executed through the physical connection to obtain the result set data of the query statement and its cursor. Associate the cursor with the client session; The result set cursor retrieves the result set data from the database in the second execution session and returns the result set data to the client session.

8. A machine-readable storage medium having a machine-executable program stored thereon, wherein the machine-executable program, when executed by a processor, implements a processing method for database operations according to any one of claims 1 to 7.

9. A computer device comprising a memory, a processor, and a machine-executable program stored in the memory and running on the processor, wherein the processor, when executing the machine-executable program, implements a processing method for database operations according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Database access method, apparatus and system

    CN107766526A

  • Cursor traversal storage method and device

    CN110543495A