A data processing method and device, computer equipment and storage medium

By defining extended interfaces and asynchronous communication mechanisms in the target program, the program blocking problem caused by synchronous communication is solved, and efficient database interaction operations are achieved.

CN114661804BActive Publication Date: 2026-03-31NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-21
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

When interacting with Redis, the synchronous communication mechanism causes the program to block, affecting its running speed.

Method used

By designing an extension class for the target program, defining multiple extension interfaces, receiving operation implementation parameters, and converting them into message class instances, an asynchronous communication mechanism is used to interact with the target database, avoiding waiting for operation results.

Benefits of technology

It improved the efficiency of program-database interaction, simplified the logic, and increased program speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661804B_ABST
    Figure CN114661804B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment and a storage medium. The present application discloses a data processing method and device, computer equipment
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a data processing method, apparatus, computer equipment, and storage medium. Background Technology

[0002] When interacting with Redis (Remote Dictionary Server, an open-source, high-performance key-value in-memory database), synchronous communication mechanisms are typically used. Under synchronous communication, the program blocks every time a command request is sent to the Redis server until a response is received and processed. While synchronous communication makes the program logic clearer and requires less code, the need to pause and wait for a response after each request can impact program speed. Summary of the Invention

[0003] This application provides a data processing method, apparatus, computer equipment, and storage medium, which can improve the efficiency of interactive operations between programs and databases.

[0004] This application provides a data processing method, including:

[0005] The system receives calls from the target program to each extended interface and receives operation implementation parameters passed by the target program through each extended interface. The order in which the operation implementation parameters are passed matches the execution order of each database interaction operation in the database request processing process.

[0006] Convert the operation implementation parameters corresponding to each extended interface into message class instances. The message class instances corresponding to each operation implementation parameter are used to implement the database interaction operations corresponding to each extended interface.

[0007] Based on the order of parameter passing in the operation implementation, and the database interaction operation between each message class instance and the target database, the processing result corresponding to each message class instance is obtained.

[0008] The processing result is returned to the target program.

[0009] Accordingly, embodiments of this application also provide a data processing apparatus, including:

[0010] The receiving unit is used to receive the target program's calls to each extended interface, and to receive the operation implementation parameters passed by the target program through each extended interface. The order in which the operation implementation parameters are passed matches the execution order of each database interaction operation in the database request processing process.

[0011] The conversion unit is used to convert the operation implementation parameters corresponding to each extended interface into message class instances, wherein the message class instances corresponding to each operation implementation parameter are used to implement the database interaction operations corresponding to each extended interface.

[0012] An operation unit is used to implement the parameter passing order based on the operation, and to perform database interaction operations between each message class instance and the target database to obtain the processing result corresponding to each message class instance.

[0013] The return unit is used to return the processing result to the target program.

[0014] In some embodiments, the operating unit includes:

[0015] The acquisition subunit is used to sequentially acquire message class instances according to the passing order of the operation implementation parameters;

[0016] The operation subunit is used to perform database interaction operations with the target database based on the acquired message class instances to obtain the processing results corresponding to each message class instance.

[0017] In some embodiments, obtaining the subunit is specifically used for:

[0018] Based on the order in which the operation implementation parameters are passed, the message class instances corresponding to each operation implementation parameter are sequentially written into the event queue.

[0019] Message class instances are retrieved sequentially from the event queue according to the transmission order.

[0020] In some embodiments, obtaining the subunit is specifically used for:

[0021] The first thread sequentially writes the message class instances corresponding to each operation implementation parameter into the event queue based on the passing order of the operation implementation parameters.

[0022] Message class instances are retrieved sequentially from the event queue according to the transmission order.

[0023] In some embodiments, obtaining the subunit is specifically used for:

[0024] The first thread sequentially writes the message class instances corresponding to each operation implementation parameter into the event queue based on the passing order of the operation implementation parameters.

[0025] The first thread sends a new message event to the second thread; based on the new message event, the second thread is triggered to retrieve message class instances from the event queue in the order of transmission.

[0026] In some embodiments, the operation subunit is specifically used for:

[0027] From the execution logic of message class instances corresponding to all database interaction operations, determine the target execution logic corresponding to the obtained message class instance;

[0028] From the multiple asynchronous interfaces of the target database, determine the target asynchronous interface that matches the target execution logic;

[0029] The target execution logic is completed by calling the target asynchronous interface through the second thread.

[0030] In some embodiments, the receiving unit includes:

[0031] The receiving subunit is used to receive calls from the target program to each extended interface through the first thread, and to receive operation implementation parameters passed by the target program through each extended interface.

[0032] In some embodiments, the return unit includes:

[0033] A sending subunit is used to send the processing result to the first thread via a second thread;

[0034] The return subunit is used to return the processing result to the target program through the first thread.

[0035] Accordingly, this application also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes any of the data processing methods provided in this application.

[0036] Accordingly, this application also provides a storage medium that stores multiple instructions, which are adapted for a processor to load and execute the data processing method described above.

[0037] This application embodiment designs an extension class for the target program in the driver component, defining multiple extension interfaces that can be called by the target program. Different extension interfaces correspond to different database interaction operations. When the driver component receives calls from the target program to each extension interface, it receives operation implementation parameters through each extension interface. This allows the driver component to execute the event execution logic corresponding to each operation implementation parameter and interact with the target database. This avoids the target program waiting for the operation results from the target database, enabling asynchronous communication between the target program and the target database, thereby improving the efficiency of program-database interaction operations. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 This is a flowchart illustrating a data processing method provided in an embodiment of this application.

[0040] Figure 2 This is a structural block diagram of a data processing device provided in an embodiment of this application.

[0041] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0043] This application provides a data processing method, apparatus, storage medium, and computer device. Specifically, the data processing method of this application can be executed by a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet computer, laptop computer, touch screen, personal computer (PC), personal digital assistant (PDA), or other terminal device. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0044] For example, the computer device can be a terminal that can receive calls from the target program to each extended interface, and receive operation implementation parameters passed by the target program through each extended interface. The order in which the operation implementation parameters are passed matches the execution order of each database interaction operation in the database request processing process. The terminal converts the operation implementation parameters corresponding to each extended interface into message class instances, wherein the message class instances corresponding to each operation implementation parameter are used to implement the database interaction operations corresponding to each extended interface. Based on the order in which the operation implementation parameters are passed, and the database interaction operations between each message class instance and the target database, the terminal obtains the processing results corresponding to each message class instance. The terminal then returns the processing results to the target program.

[0045] In view of the above problems, the embodiments of this application provide a first data processing method, apparatus, computer equipment and storage medium, which can improve the efficiency of interactive operation between programs and databases.

[0046] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.

[0047] This application provides a data processing method that can be executed by a terminal or a server. This application uses the execution of the data processing method by a terminal as an example for illustration.

[0048] Please see Figure 1 , Figure 1 This is a flowchart illustrating a data processing method provided in an embodiment of this application. The specific flow of this data processing method can be as follows:

[0049] 101. Receive the target program's calls to each extended interface, and receive the operation implementation parameters passed by the target program through each extended interface.

[0050] In this embodiment, a driver component is pre-designed, and an extension class is defined in the driver component. The extension class includes extension interfaces corresponding to each database interaction operation in the database request processing process of the target program.

[0051] The target program's programming language is the target programming language, which can be Python. Therefore, the target program can be a Python program written in Python.

[0052] Specifically, the design of the driver component can be achieved by defining an event loop `work_loop` in C++ code using the `ev_loop_new` method of the libev library; then, a new thread is started to run this event loop, and the signals `stop_loop` and `get_msg` are registered through `ev_async` to handle the logic of stopping the event loop and processing new messages obtained in the event loop, respectively. The implementation code is as follows:

[0053]

[0054]

[0055]

[0056] Furthermore, in the C++ code, a Python extension class, PyRedis, is implemented. Within the PyRedis class, extended interfaces corresponding to various database interaction operations during the database request processing are defined and implemented, allowing Python programs to access them. For example, these extended interfaces could include: connect, disconnect, and command interfaces. The connect interface corresponds to database connection operations, the disconnect interface to database disconnect operations, and the command interface to database command operations.

[0057] Specifically, the implementation code for defining the extension interface can be as follows:

[0058]

[0059]

[0060] In this embodiment of the application, the target program can interact with the target database, such as database connection operation, database command operation, database disconnection operation, etc., wherein the database command operation can be to operate on the data in the database, including data writing or data reading, etc.

[0061] Specifically, when writing data to the target database through the target program, the target program can call the extended interface, the implementation code of which is as follows:

[0062] def testCb(t, r, *args):

[0063] print("\n{}cb status: {}, result: {}".format(args[0], t, r))

[0064] def testset():

[0065] cli=MyRedis("127.0.0.1",6379)

[0066] key="ping"

[0067] value = "pong"

[0068] cli.async_command("set",key,value,callback=lambda t,r:testCb(t,r,"SET"))

[0069] Alternatively, when reading data from the target database through the target program, the target program can call the extended interface, the implementation code of which is as follows:

[0070] def testGet():

[0071] cli = MyRedis()

[0072] key="ping"

[0073] cli.async_command("get",key,callback=lambda t,r:testCb(t,r,"GET"))

[0074] When the driver component receives a call from the target program to each extended interface, it can receive the operation implementation parameters passed by the target program through each extended interface.

[0075] In this context, the parameters passed when calling `async_command` from the Python program ("set", key, value, callback) refer to the operation implementation parameters. `async_command` is an extension interface implemented in the C++ layer and exposed to the Python layer, allowing the C++ layer to receive these parameters. The "set" parameter indicates that the operation will perform a `set` operation on the target database, i.e., a write operation; the "key" parameter represents the key value of this `set` operation; the "value" parameter represents the value value of this `set` operation; and the "callback" parameter is the function that the `set` operation returns to the Python program after the asynchronous operation in the C++ layer is completed.

[0076] For example, in the above implementation code for writing data to the target database through the target program, the operation implementation parameters can be: key, value, callback; and in the above implementation code for reading data from the target database through the target program, the operation implementation parameters can be: key, callback.

[0077] In this embodiment, the database request processing procedure of the target program includes: database connection operation, database command operation, and database disconnection operation. When the target program requests processing from the target database, it can sequentially call the connect interface, command interface, and disconnect interface. The connect interface transmits the implementation parameters for the database connection operation to the driver component; the command interface transmits the implementation parameters for the database command operation to the driver component; and the disconnect interface transmits the implementation parameters for the database disconnection operation to the driver component. The target program interacts with the database by calling extended interfaces, sending the instructions for the request processing procedure to the driver component. The driver component then completes the specific operation tasks with the database, avoiding the target program waiting for the target database's return results. This allows the target program to continue executing other tasks, thereby achieving asynchronous communication between the target program and the target database.

[0078] The order in which the parameters of each extended interface are passed matches the execution order of each database interaction operation during the database request processing.

[0079] For example, extended interfaces may include: connect interface, command interface, and disconnect interface. Database interaction operations may include: database connection operation, database command operation, and database disconnect operation. The execution order of these database interaction operations can be: database connection operation, database command operation, and database disconnect operation. Therefore, the order in which the operation implementation parameters are passed to each extended interface can be: operation implementation parameters passed to the connect interface, operation implementation parameters passed to the command interface, and operation implementation parameters passed to the disconnect interface.

[0080] In some embodiments, since the program logic becomes very complex under asynchronous communication, and the writing of callback functions needs to be considered, an additional thread can be opened in the driver component to handle asynchronous events. Therefore, the step "receiving the target program's calls to each extended interface, and receiving the operation implementation parameters passed by the target program through each extended interface" can include the following operations:

[0081] The first thread receives the target program's calls to each extended interface, as well as the operation implementation parameters passed by the target program through each extended interface.

[0082] The first thread is used to receive calls from the target program to each extension interface, and to receive operation implementation parameters passed by the target program through each extension interface.

[0083] For example, the target program can be a Python program, and the extended interfaces can include: connect, command, and disconnect interfaces. When the Python program calls the connect, disconnect, or command interfaces, the first thread receives the operation implementation parameters passed by the Python program. After sending the database processing request, the Python program does not need to wait for a response from the target database and can continue doing other things, thereby improving the program's running speed.

[0084] In some embodiments, in order to support asynchronous communication between different language versions of the target programming language and the target database, multiple language version extension classes of the target programming language can be designed in the driver component. Each language version extension class includes extension interfaces corresponding to the database interaction operations during the database processing request process under the language version.

[0085] For example, the target program can be a Python program, and the target programming language can be Python. The Python language can include both Python 2 and Python 3 versions. The extended class PyRedis is compatible with the CPython interface of both Python 2 and Python 3, and its definition can be as follows:

[0086]

[0087] 102. Convert the operation implementation parameters corresponding to each extended interface into message class instances.

[0088] Among them, the message class instance corresponding to each operation implementation parameter is used to implement the database interaction operation corresponding to each extended interface.

[0089] Specifically, the first thread converts the operation implementation parameters corresponding to each extended interface into message class instances.

[0090] 103. Based on the order of parameter passing in the operation implementation and the database interaction operation between each message class instance and the target database, the processing results corresponding to each message class instance are obtained.

[0091] In this embodiment of the application, the target database can be Redis (Remote Dictionary Server), an open-source, high-performance key-value in-memory database that provides application programming interfaces in multiple languages.

[0092] In some embodiments, in order to complete the interaction between the target program and the database, the step "based on the passing order of operation implementation parameters and the database interaction operation between each message class instance and the target database" may include the following operations:

[0093] Message class instances are obtained sequentially according to the order in which the operation implementation parameters are passed.

[0094] Based on the obtained message class instances, database interaction operations are performed with the target database to obtain the processing results corresponding to each message class instance.

[0095] For example, the operation implementation parameters include: connection operation implementation parameters received through the connect interface, instruction operation implementation parameters received through the command interface, and disconnection operation implementation parameters received through the disconnect interface; message class instances include: a first message class instance corresponding to the connection operation implementation parameters, a second message class instance corresponding to the instruction operation implementation parameters, and a third message class instance corresponding to the disconnection operation implementation parameters.

[0096] The order in which operation implementation parameters are passed can be: connection operation implementation parameters, instruction operation implementation parameters, and disconnection operation implementation parameters. Therefore, message class instances are obtained sequentially according to this order: first message class instance, second message class instance, and third message class instance. Then, based on these sequentially obtained message class instances, interactive operations are performed with the target database to generate processing results.

[0097] In some embodiments, to facilitate the sequential interaction between the driver components and the target database according to the execution order, the step "obtain message class instances sequentially according to the order in which the operation implementation parameters are passed" may include the following operations:

[0098] Based on the order in which the operation implementation parameters are passed, the message class instances corresponding to each operation implementation parameter are written into the event queue in sequence.

[0099] Retrieve message class instances from the event queue in the order they were passed.

[0100] In this embodiment of the application, an event queue deque is pre-designed. After converting each operation implementation parameter into a message class instance, the message class instances corresponding to each operation implementation parameter can be written into the event queue in sequence according to the passing order of each operation implementation parameter.

[0101] Furthermore, message class instances can be retrieved sequentially from the event queue according to their writing order, i.e., their delivery order.

[0102] In some embodiments, to improve processing efficiency, the step "writing the message class instances corresponding to each operation implementation parameter sequentially into the event queue based on the passing order of the operation implementation parameters" may include the following operations:

[0103] The first thread writes the message class instances corresponding to each operation implementation parameter into the event queue in sequence based on the order in which the operation implementation parameters are passed.

[0104] In some embodiments, in order to trigger the interaction between the driver component and the target database, the step "retrieves message class instances from the event queue in the order of transmission" may include the following operations:

[0105] The event of sending a new message from the first thread to the second thread;

[0106] A second thread is triggered based on a new message event to retrieve message class instances from the event queue in the order they were passed.

[0107] The new message event refers to the get_msg event. The first thread sends the get_msg event to the second thread. After receiving the get_msg event, the second thread can retrieve message class instances from the event queue in the order they were passed, and then execute the processing logic of the get_msg event. The first thread completes its work after sending the get_msg event and does not need to wait for the event to be processed. The event processing can be triggered in the second thread, thus achieving asynchronous processing.

[0108] In some embodiments, the execution logic of the message class instance corresponding to each database interaction operation is defined in the second thread. In order to realize the interaction between the target program and the target database, the step "perform database interaction operations with the target database based on the obtained message class instances to obtain the processing results corresponding to each message class instance" may include the following operations:

[0109] Determine the target execution logic corresponding to the obtained message class instance from the execution logic of all message class instances corresponding to database interaction operations;

[0110] Identify the target asynchronous interface that matches the target execution logic from among multiple asynchronous interfaces of the target database;

[0111] The target execution logic is completed by calling the target's asynchronous interface through a second thread.

[0112] In this embodiment, the execution logic of different message class instances may be different. Therefore, after obtaining a message class instance through the second thread, the target execution logic corresponding to that message class instance can be determined first. Then, a target asynchronous interface matching the target execution logic can be determined from multiple asynchronous interfaces of the target database. Finally, the second thread calls the target asynchronous interface to interact with the target database and complete the target execution logic corresponding to the message class instance. Specifically, the implementation code can be as follows:

[0113]

[0114] In the processing logic of the get_msg event, the asynchronous interfaces of hiredis (a lightweight C client for Redis) are called respectively, based on the message class instance retrieved from the deque: redisAsyncConnect interface, redisAsyncDisconnect interface, and redisAsyncCommandArgv interface.

[0115] In the code above, taking redisAsyncCommandArgv as an example, a command request is sent to Redis, and a custom callback function is registered. After Redis executes the command request, it will asynchronously call back the callback function, thereby obtaining the processing result corresponding to the message class instance.

[0116] 104. Return the processing result to the target program.

[0117] In some embodiments, in order to accurately return the processing result to the target program, the step "return the processing result to the target program" may include the following operations:

[0118] The processing result is sent from the second thread to the first thread;

[0119] The processing result is returned to the target program through the first thread.

[0120] Specifically, the implementation code can be as follows:

[0121]

[0122] The callback function retrieves the execution result from Redis, which is then passed back to the first thread via the second thread. Finally, the PyObject_Call method returns the result to the target program, i.e., the Python program.

[0123] This application discloses a data processing method, which includes: receiving calls from a target program to various extended interfaces, and receiving operation implementation parameters passed by the target program through each extended interface, wherein the order of passing the operation implementation parameters matches the execution order of each database interaction operation in the database request processing process; converting the operation implementation parameters corresponding to each extended interface into message class instances, wherein the message class instances corresponding to each operation implementation parameter are used to implement the database interaction operations corresponding to each extended interface; based on the order of passing the operation implementation parameters and the database interaction operations between each message class instance and the target database, obtaining the processing result corresponding to each message class instance; and returning the processing result to the target program. This improves the efficiency of program-database interaction operations.

[0124] To facilitate better implementation of the data processing method provided in the embodiments of this application, the embodiments of this application also provide a data processing apparatus based on the above-described data processing method. The meanings of the terms used are the same as in the data processing method described above, and specific implementation details can be found in the descriptions within the method embodiments.

[0125] Please see Figure 2 , Figure 2 A structural block diagram of a data processing apparatus provided in this application embodiment, the apparatus comprising:

[0126] The receiving unit 301 is used to receive the target program's calls to each extended interface, and to receive the operation implementation parameters passed by the target program through each extended interface. The order in which the operation implementation parameters are passed matches the execution order of each database interaction operation in the database request processing process.

[0127] The conversion unit 302 is used to convert the operation implementation parameters corresponding to each extended interface into message class instances, wherein the message class instances corresponding to each operation implementation parameter are used to implement the database interaction operations corresponding to each extended interface.

[0128] The operation unit 303 is used to implement the parameter passing order based on the operation, and to perform database interaction operations between each message class instance and the target database to obtain the processing result corresponding to each message class instance.

[0129] Return unit 304 is used to return the processing result to the target program.

[0130] In some embodiments, the operation unit 303 may include:

[0131] The acquisition subunit is used to sequentially acquire message class instances according to the passing order of the operation implementation parameters;

[0132] The operation subunit is used to perform database interaction operations with the target database based on the acquired message class instances to obtain the processing results corresponding to each message class instance.

[0133] In some embodiments, obtaining the subunit can specifically be used for:

[0134] Based on the order in which the operation implementation parameters are passed, the message class instances corresponding to each operation implementation parameter are sequentially written into the event queue.

[0135] Message class instances are retrieved sequentially from the event queue according to the transmission order.

[0136] In some embodiments, obtaining the subunit can specifically be used for:

[0137] The first thread sequentially writes the message class instances corresponding to each operation implementation parameter into the event queue based on the passing order of the operation implementation parameters.

[0138] Message class instances are retrieved sequentially from the event queue according to the transmission order.

[0139] In some embodiments, obtaining the subunit can specifically be used for:

[0140] The first thread sequentially writes the message class instances corresponding to each operation implementation parameter into the event queue based on the passing order of the operation implementation parameters.

[0141] The first thread sends a new message event to the second thread; based on the new message event, the second thread is triggered to retrieve message class instances from the event queue in the order of transmission.

[0142] In some embodiments, the operation subunit may specifically be used for:

[0143] From the execution logic of message class instances corresponding to all database interaction operations, determine the target execution logic corresponding to the obtained message class instance;

[0144] From the multiple asynchronous interfaces of the target database, determine the target asynchronous interface that matches the target execution logic;

[0145] The target execution logic is completed by calling the target asynchronous interface through the second thread.

[0146] In some embodiments, the receiving unit 301 may include:

[0147] The receiving subunit is used to receive calls from the target program to each extended interface through the first thread, and to receive operation implementation parameters passed by the target program through each extended interface.

[0148] In some embodiments, the return unit 304 may include:

[0149] A sending subunit is used to send the processing result to the first thread via a second thread;

[0150] The return subunit is used to return the processing result to the target program through the first thread.

[0151] This application discloses a data processing apparatus. A receiving unit 301 receives calls from a target program to various extended interfaces and receives operation implementation parameters passed by the target program through each extended interface. The transmission order of the operation implementation parameters matches the execution order of each database interaction operation in the database request processing process. A conversion unit 302 converts the operation implementation parameters corresponding to each extended interface into message class instances. Each message class instance corresponding to each operation implementation parameter is used to implement the database interaction operation corresponding to each extended interface. An operation unit 303 performs database interaction operations with the target database based on the transmission order of the operation implementation parameters and each message class instance, obtaining the processing result corresponding to each message class instance. A return unit 304 returns the processing result to the target program. This improves the efficiency of program-database interaction operations.

[0152] Accordingly, embodiments of this application also provide a computer device, which can be a server. For example... Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 and the memory 502 are electrically connected. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0153] The processor 501 is the control center of the computer device 500. It connects various parts of the computer device 500 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, it performs various functions of the computer device 500 and processes data, thereby monitoring the computer device 500 as a whole.

[0154] In this embodiment, the processor 501 in the computer device 500 loads the instructions corresponding to the processes of one or more applications into the memory 502 according to the following steps, and the processor 501 runs the applications stored in the memory 502 to achieve various functions:

[0155] The system receives calls from the target program to each extended interface, as well as operation implementation parameters passed by the target program through each extended interface. The order in which the operation implementation parameters are passed matches the execution order of each database interaction operation during the database request processing. It converts the operation implementation parameters corresponding to each extended interface into message class instances, where each message class instance is used to implement the database interaction operation corresponding to each extended interface. Based on the order in which the operation implementation parameters are passed and the database interaction operation between each message class instance and the target database, it obtains the processing result corresponding to each message class instance. Finally, it returns the processing result to the target program.

[0156] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0157] Optional, such as Figure 3 As shown, the computer device 500 also includes: a touch screen display 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen display 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507. Those skilled in the art will understand that... Figure 3 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0158] The touch display screen 503 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 503 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, guidance information, icons, videos, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), an organic light-emitting diode (OLED), or other similar devices. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 501. It can also receive and execute commands from the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 503 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 503 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 503 can also be used as part of the input unit 506 to achieve input functions.

[0159] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other computer devices, and to transmit and receive signals with network devices or other computer devices.

[0160] Audio circuitry 505 can be used to provide an audio interface between a user and a computer device via a speaker and a microphone. Audio circuitry 505 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 505, converted back into audio data, and output to processor 501 for processing. The audio data is then transmitted via radio frequency circuitry 504 to, for example, another computer device, or output to memory 502 for further processing. Audio circuitry 505 may also include an earphone jack to facilitate communication between peripheral headphones and the computer device.

[0161] The input unit 506 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.

[0162] Power supply 507 is used to supply power to various components of computer device 500. Optionally, power supply 507 can be logically connected to processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 507 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0163] although Figure 3 As not shown in the diagram, the computer device 500 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0164] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0165] As can be seen from the above, the computer device provided in this embodiment receives calls from the target program to each extended interface, and receives operation implementation parameters passed by the target program through each extended interface. The order in which the operation implementation parameters are passed matches the execution order of each database interaction operation in the database request processing process. The operation implementation parameters corresponding to each extended interface are converted into message class instances, wherein the message class instances corresponding to each operation implementation parameter are used to implement the database interaction operations corresponding to each extended interface. Based on the order in which the operation implementation parameters are passed, and the database interaction operations between each message class instance and the target database, the processing results corresponding to each message class instance are obtained. The processing results are then returned to the target program.

[0166] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0167] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute steps in any of the data processing methods provided in embodiments of this application. For example, the computer program can execute the following steps:

[0168] It receives calls from the target program to each extended interface, and receives operation implementation parameters passed by the target program through each extended interface. The order in which the operation implementation parameters are passed matches the execution order of each database interaction operation in the database request processing process.

[0169] Convert the operation implementation parameters corresponding to each extended interface into message class instances. The message class instances corresponding to each operation implementation parameter are used to implement the database interaction operations corresponding to each extended interface.

[0170] Based on the order in which the operation implementation parameters are passed, and the database interaction operations between each message class instance and the target database, the processing results corresponding to each message class instance are obtained.

[0171] Return the processing result to the target program.

[0172] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0173] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0174] Since the computer program stored in the storage medium can execute the steps of any of the data processing methods provided in the embodiments of this application, the beneficial effects that any of the data processing methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0175] The data processing method, apparatus, storage medium, and computer device provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A data processing method, characterized by, The method is applied to a driving component, the driving component defines an extension class, the extension class includes extension interfaces corresponding to each database interaction operation in a database request processing process of a target program, a program language of the target program is a target programming language, and the method includes the following steps: receiving a call of each extension interface by the target program and receiving operation implementation parameters transmitted by the target program through each extension interface, a transmission order of the operation implementation parameters matches an execution order of each database interaction operation in the database request processing process; converting operation implementation parameters corresponding to each extension interface into message class instances, wherein the message class instances corresponding to each operation implementation parameter are used to implement the database interaction operation corresponding to each extension interface; writing the message class instances corresponding to each operation implementation parameter into an event queue in sequence based on the transmission order of the operation implementation parameters by a first thread; sending a new message event to a second thread by the first thread; triggering the second thread to take out the message class instances from the event queue in sequence according to the transmission order based on the new message event; performing a database interaction operation with a target database based on the obtained message class instances to obtain processing results corresponding to each message class instance; returning the processing results to the target program.

2. The method of claim 1, wherein, The second thread defines execution logic of the message class instances corresponding to each database interaction operation; the database interaction operation with the target database based on the obtained message class instances to obtain the processing results corresponding to each message class instance includes the following steps: determining target execution logic corresponding to the obtained message class instance from execution logic of all message class instances corresponding to database interaction operations; determining a target asynchronous interface matched with the target execution logic from a plurality of asynchronous interfaces of the target database; completing the target execution logic by calling the target asynchronous interface by the second thread.

3. The method of claim 1, wherein, The receiving of the call of each extension interface by the target program and the receiving of the operation implementation parameters transmitted by the target program through each extension interface includes the following steps: receiving the call of each extension interface by the target program and receiving the operation implementation parameters transmitted by the target program through each extension interface by a first thread.

4. The method of claim 1, wherein, The returning of the processing results to the target program includes the following steps: sending the processing results to a first thread by a second thread; returning the processing results to the target program by the first thread.

5. The method according to any one of claims 1 to 4, characterized in that, The driving component includes extension classes of a plurality of language versions of the target programming language, and each language version of the extension class includes extension interfaces corresponding to each database interaction operation in a database processing request process under the language version.

6. A data processing apparatus, characterized by The method is applied to a driving component, the driving component defines an extension class, the extension class includes extension interfaces corresponding to each database interaction operation in a database request processing process of a target program, a program language of the target program is a target programming language, and the method includes the following steps: receive the target program calling each extension interface and receiving operation implementation parameters passed by the target program through each extension interface, wherein a passing order of the operation implementation parameters matches an execution order of each database interaction operation in the database request processing process; a conversion unit, configured to convert the operation implementation parameters corresponding to each extension interface into message class instances, wherein each operation implementation parameter corresponds to a message class instance used to implement a database interaction operation corresponding to each extension interface; an operation unit, configured to: write the message class instances corresponding to each operation implementation parameter into an event queue in sequence based on the passing order of the operation implementation parameters through a first thread; send a new message event to a second thread through the first thread; trigger the second thread to take out the message class instances from the event queue in sequence according to the passing order based on the new message event; perform database interaction operations with a target database based on the obtained message class instances to obtain processing results corresponding to each message class instance; and a return unit, configured to return the processing results to the target program.

7. A computer device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein, The processor implements the data processing method in any one of claims 1 to 6 when executing the program.

8. A storage medium, characterized by The storage medium stores a plurality of instructions adapted to be loaded by the processor to execute the data processing method in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Message processing method and device based on mobile terminal and mobile terminal

    CN106201748A

  • Generating method and device of interface use case set

    CN107436844A