WO2016091068A1 - Method and device for executing special instruction - Google Patents

Method and device for executing special instruction Download PDF

Info

Publication number
WO2016091068A1
WO2016091068A1 PCT/CN2015/095543 CN2015095543W WO2016091068A1 WO 2016091068 A1 WO2016091068 A1 WO 2016091068A1 CN 2015095543 W CN2015095543 W CN 2015095543W WO 2016091068 A1 WO2016091068 A1 WO 2016091068A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
statement
database
special
special instruction
Prior art date
Application number
PCT/CN2015/095543
Other languages
French (fr)
Chinese (zh)
Inventor
朱超
陈非
王超
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2016091068A1 publication Critical patent/WO2016091068A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for performing special instructions.
  • the middleware can be a relay device located between the client and the database, and can be connected to the middle.
  • the middleware provides the function of the database connection pool.
  • the middleware selects an idle connection from the database connection pool and assigns it to the client, and the middleware sends an instruction to the database for the client through the connection, and sends a database return to the client.
  • the execution result of the instruction, and then the middleware reclaims the connection.
  • the middleware may allocate another idle connection to the client.
  • the database when the database executes the special instruction, it will identify the matching instruction of the special instruction sent from the connection for the connection used to send the special instruction, and execute .
  • the middleware sends the special instruction to the client through a connection, and the subsequent connection may send the matching instruction of the special instruction to the client through another connection, thereby causing the database to not correctly recognize.
  • the matching instruction therefore, the database cannot correctly execute the matching instruction, wherein the instruction is an instruction in the form of a Structured Query Language (SQL) statement.
  • SQL Structured Query Language
  • the special instruction may be a PREPARE statement
  • the matching instruction of the PREPARE statement includes: carrying the special identifier included in the PREPARE statement (the special identifier included in the PREPARE statement, that is, the declaration name of the template statement included in the PREPARE statement) EXECUTE statement or DEALLOCATE statement.
  • the middleware sends a PREPARE statement through connection 1, and then sends the corresponding EXECUTE statement through connection 2, the database cannot execute the EXECUTE statement correctly.
  • the special instruction may be a BEGIN statement in a database transaction
  • the matching instruction of the BEGIN statement includes: other SQL statements in the same database transaction as the BEGIN statement, such as a COMMIT statement, a ROLLBACK statement, and the like.
  • the middleware is sent over connection 1
  • the BEGIN statement which then sends the corresponding COMMIT statement through connection 2, the database cannot execute the COMMIT statement correctly.
  • the present invention has been made in order to provide a method and apparatus for executing a special sentence that overcomes the above problems or at least partially solves the above problems.
  • the database can correctly execute the matching instruction of the special instruction.
  • a method for executing a special instruction is provided, which is applied to an intermediate component coupled between a database and a client, the method comprising:
  • the matching instruction is sent to the database for execution by using a preset sending manner corresponding to the related information.
  • a special instruction execution device coupled between a database and a client, and includes:
  • a first sending module configured to send a special instruction, and record related information corresponding to the special instruction, where the related information includes: an identifier of a connection used to send the special instruction, and/or the special instruction includes Template instruction;
  • a receiving module configured to receive a matching instruction of the special instruction
  • the second sending module is configured to send the matching instruction to the database for execution according to the related information recorded by the first sending module by using a preset sending manner corresponding to the related information.
  • the second sending module is specifically configured to send the matching instruction to the connection corresponding to the identifier used to send the special instruction to send Database execution.
  • a computer program comprising computer readable code, when said computer readable code is run on a computing device, causing said computing device to perform a special instruction as described above Execution method.
  • a computer readable medium is provided, wherein Computer program.
  • the middleware sends a special instruction, and records related information corresponding to the special instruction, and when receiving the matching instruction of the special instruction, adopts a preset transmission corresponding to the related information.
  • the method sends the matching command to the database for execution. Since the database can correctly identify the matching instruction sent by using the preset sending manner corresponding to the related information, the database can correctly execute the matching instruction, and the database cannot be correctly solved. The problem of executing the matching instruction.
  • FIG. 1 is a schematic flow chart of a method for executing a special instruction according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a connection structure between a database, a middleware, and a client in an actual application scenario according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a special instruction sent by a client to a database to a middleware and a matching instruction of a matching instruction of the special instruction in an actual application scenario according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram showing the structure of a data table Student stored in a database before a client sends a special instruction in an actual application scenario according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of corresponding data queried by the database after executing the SQL statement S4 in the actual application scenario according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of corresponding data queried by a database after executing a SQL statement S6' in an actual application scenario according to an embodiment of the present invention
  • FIG. 7 is a schematic diagram of an apparatus for executing a special statement according to an embodiment of the present invention.
  • Figure 8 shows a block diagram of a computing device for performing a method in accordance with the present invention
  • Figure 9 shows a storage unit for holding or carrying program code implementing the method according to the invention.
  • FIG. 1 is a schematic diagram of a method for executing a special instruction according to an embodiment of the present invention, which may be applied to an intermediate device coupled between a database and a client, and the method may include the following steps:
  • S101 Send a special instruction, and record related information corresponding to the special instruction.
  • the related information includes: an identifier of a connection used to send the special instruction, and/or a template instruction included in the special instruction.
  • S103 Send the matching instruction to the database for execution according to the related information recorded, by using a preset sending manner corresponding to the related information.
  • the middleware sends a special instruction and records related information corresponding to the special instruction, that is, each time the middleware sends a special instruction, relevant information corresponding to the special instruction is recorded, and the related information is recorded. It is used to determine the sending mode of the matching instruction of the special instruction. Therefore, the related information of the record is different for different types of special instructions. For a certain type of special instruction, the related information recorded is the identifier of the connection used to send the special instruction. For another special type of instruction, the relevant information recorded is the template instruction contained in the special instruction.
  • the middleware When the middleware receives the matching instruction of the special instruction, the middleware sends the matching instruction to the database for execution according to the related information of the record, according to the corresponding information of the related information, because each type of special instruction is used.
  • the middleware has preset the sending manner of the matching instruction of the special instruction, so that the database can correctly identify the matching instruction sent by the sending mode, and therefore, the database can correctly execute the matching instruction.
  • the database since the database executes a special instruction for some special instructions, it will identify a matching instruction of the special instruction sent from the connection for the connection used to send the special instruction, After the middleware sends the special instruction, the related information recorded corresponding to the special instruction may be the identifier of the connection used to send the special instruction.
  • the middleware subsequently receives the matching instruction of the special instruction from the client, the middleware passes the matching instruction The connection corresponding to the recorded identifier is sent to the database for execution.
  • the identifier of the connection used to send the special instruction may be Determines the connection that was used when the special instruction was sent, and then sends the matching instruction to the database for execution through the connection.
  • the middleware since the middleware sends the special instruction and its subsequent matching instructions are sent to the database through the same connection, the database can correctly identify the matching instruction according to the same connection, so that the matching can be correctly performed. instruction.
  • the middleware when the middleware sends a special instruction, and the related information recorded corresponding to the special instruction is the identifier of the connection used to send the special instruction, after the middleware sends the special instruction, the middle The device can also maintain the connection used by the database and the client to send the special instruction, that is, after the middleware sends the special instruction to the database through a connection, the connection is not reclaimed, and the connection is not assigned to other clients.
  • the end uses, therefore, when the middleware subsequently receives the matching instruction of the special instruction, the matching instruction can be directly sent using the connection, which improves the efficiency of the middleware sending the matching instruction.
  • the middleware when the middleware sends a special instruction, and the related information recorded corresponding to the special instruction is an identifier of a connection used to send the special instruction, the instruction is an instruction in the form of a SQL statement
  • a special instruction can be a BEGIN statement (BEGIN statement, that is, a BEGIN TRANSCATION statement in a database transaction) or a PREPARE statement.
  • the matching instruction of the special instruction is a statement that belongs to the same database transaction as the BEGIN statement, such as a COMMIT statement, a ROLLBACK statement, and the like.
  • a database transaction contains multiple SQL statements.
  • a database transaction starts with a BEGIN statement. It can contain several statements in the middle. When both the BEGIN statement and the middle statement are executed successfully, the COMMIT statement can be used to submit the completed operation in the database transaction. When there is a statement execution failure or the database transaction cannot be executed. When you continue execution, you can use the ROLLBACK statement to roll back the database transaction, that is, to undo the completed but uncommitted operations in the database transaction. Obviously, a database transaction ends with a COMMIT statement or a ROLLBACK statement.
  • connection identifier Identity, ID
  • ID connection identifier
  • the database uses the connection identifier (Identity, ID) to identify all statements for a database transaction, where the connection identifies the connection ID of the connection used by the statement that sent the database transaction. If a statement sent by the middleware to the database transaction uses a different connection than the other statements that sent the database transaction, the database considers the statement to be a different database transaction from the other statement and identifies it with the corresponding different connection ID. Therefore, the statement for the database transaction identified by each connection ID is incomplete, causing the database to fail to execute the statements in the database transaction correctly.
  • the database identifies the statements in the same database transaction based on the connection. Therefore, all statements of the same database transaction need to be sent through the same connection.
  • the related information recorded by the middleware is the connection ID of the connection used for transmitting the special instruction, and the special instruction is a BEGIN statement
  • the middleware sends a BEGIN statement, and records the transmission.
  • the connection ID of the connection used by the BEGIN statement When subsequently receiving other statements belonging to the same database transaction as the BEGIN statement, such as a COMMIT statement, a ROLLBACK statement, etc., the other statement is sent to the connection identified by the recorded connection ID.
  • the database can execute the other statements correctly.
  • the matching instruction of the special instruction is an EXECUTE statement or a DEALLOCATE statement (that is, a DEALLOCATE PREPARE statement), wherein the PREPARE statement includes a template statement (a template statement, that is, a template) The instruction), and the declaration name of the template statement, the declaration name of the template statement is also included in the EXECUTE statement and the DEALLOCATE statement.
  • the PREPARE statement predeclares a template statement, the declaration name of the template statement, and the pending parameters of the template statement (the template statement may or may not contain pending parameters).
  • the database executes the PREPARE statement, for each PREPARE statement, a set of content is saved for the PREPARE statement, and the saved content of the group is identified by the connection ID of the connection used to send the PREPARE statement, wherein the group save content includes : The template statement contained in the PREPARE statement, the declaration name of the template statement, and the pending parameters of the template statement.
  • the EXECUTE statement contains the declaration name of the template statement and the parameter values of the template statement.
  • the save content of the PREPARE statement corresponding to the connection ID is queried according to the connection ID of the connection used to send the EXECUTE statement, and the query is obtained.
  • the declaration name of the template statement in each group save content is compared with the declaration name of the template statement included in the EXECUTE statement. If the declaration name of the template statement in the set of saved contents is the same as the declaration name contained in the EXECUTE statement, then According to the parameter value included in the EXECUTE statement, the pending parameter of the template statement in the group save content is assigned, and the template statement after the assignment is executed.
  • the DEALLOCATE statement contains the declaration name of the template statement.
  • the save content of the PREPARE statement corresponding to the connection ID is queried according to the connection ID of the connection used to send the DEALLOCATE statement, and the declared name of the template statement in the saved contents of each group is compared with the DEALLOCATE.
  • the declaration names of the template statements included in the statement are the same. If the declaration name of the template statement in a group of saved contents is the same as the declaration name of the template statement included in the EXECUTE statement, the group save content is deleted.
  • the database recognizes the PREPARE statement according to the connection, and the corresponding EXECUTE statement and DEALLOCATE statement. If the middleware sends a PREPARE statement and uses a different connection to send the corresponding EXECUTE or DEALLOCATE statement, the database cannot query the PREPARE identified by another connection ID according to the connection ID of the connection used to send the corresponding EXECUTE or DEALLOCATE statement. The corresponding content of the statement is saved, so that the database cannot correctly execute the corresponding EXECUTE or DEALLOCATE statement.
  • the related information recorded by the middleware is the connection ID of the connection used to send the special instruction
  • the special instruction is a PREPARE statement (the PREPARE statement contains the template statement and its declared name)
  • the middleware sends a PREPARE statement, and records the connection ID of the connection used to send the PREPARE statement, and when subsequently receives the EXECUTE statement and/or the DEALLOCATE statement containing the declaration name,
  • the EXECUTE statement and/or the DEALLOCATE statement is sent to the database for execution via the connection identified by the recorded connection ID, and the database can correctly execute the EXECUTE statement and/or the DEALLOCATE statement.
  • Executing to the database specifically includes: generating a general instruction according to the template instruction and the matching instruction, and sending the generated general instruction to the database for execution.
  • the generating, according to the template instruction, the matching instruction, the general instruction, the specific component includes: determining, by the middleware, whether the template instruction includes a pending parameter, and if yes, assigning a value to the pending parameter according to the parameter value included in the matching instruction, and assigning the value
  • the subsequent template instruction is used as the generated general instruction.
  • the template instruction is used as the generated general instruction.
  • the instruction is an instruction in the form of a SQL statement
  • the special instruction is a PREPARE statement
  • the matching instruction of the special instruction is an EXECUTE statement containing a declaration name of a template statement included in the PREPARE statement.
  • the middleware sends a PREPARE statement, and for each PREPARE statement, records The template statement included in the PREPARE statement, the middleware also needs to save a set of content for the PREPARE statement, wherein the group save content includes: a template statement included in the PREPARE statement, a declaration name of the template statement, and a pending statement of the template statement parameter.
  • the query is the saved content of each group saved by the PREPARE statement sent from the client, and the declared name of the template statement in each group of saved contents of the query is The name of the declaration contained in the EXECUTE statement is compared.
  • the declaration name of the template statement in the saved content of the group is the same as the declaration name contained in the EXECUTE statement, it is determined whether the template statement in the saved content of the group contains the pending parameter, and if so, Then, the parameter value included in the EXECUTE statement is assigned to the pending parameter of the template statement in the saved content of the group, and the template statement after the assignment is sent to the database as a general statement (general statement, that is, a general instruction), otherwise
  • the template statement in the saved content of the group is sent to the database as a general statement. Since the database can directly execute the general statement, and the execution effect of the general statement is equivalent to the execution effect of the EXECUTE statement, the database is correctly executed.
  • the general statement is equivalent to the correct execution of the EXECUTE statement by the database.
  • Figure 2 shows the connection architecture between the database, middleware, and client in the scenario where middleware is applied.
  • the three clients C1 to C3 access the database through the middleware.
  • the client C1 to C3 respectively establish a communication connection with the middleware based on the Transmission Control Protocol (TCP), and the middleware database connection pool has a pre-requisite.
  • TCP Transmission Control Protocol
  • the database may be a MySQL database
  • the database connection may be a Java Database Connectivity (JDBC).
  • FIG. 3 shows a special instruction sent by the client to the database through the middleware, and an execution process of the matching instruction of the special instruction, specifically including the steps:
  • S301 The client sends a number of special instructions to the middleware.
  • a data table Student (data table Student, hereinafter referred to as Table Student) is stored in the database, and the table Student defines five data items: Sno, Sname, Ssex, Sage, Sdept.
  • the five data items are respectively assigned and inserted into the table A, and a data record of the table Student can be generated.
  • the current table Student includes three data records D1 to D3, and FIG. 4 shows the current structure of the table Student, the table The first row in the Student represents each data item included in the table Student.
  • the first column in the Student table indicates the data records D1 to D3 included in the Student Table, and the column where the data item is located and the row where the data record is located.
  • the value in the cell is the value of the data item in the data record.
  • Client C1 sends SQL statement S1 to the middleware:
  • BEGIN TRANSCATION Means: Start a database transaction.
  • Client C2 sends SQL statement S2 to the middleware:
  • Client C3 sends SQL statement S3 to the middleware:
  • the middleware sends the special instructions to the database through a database connection allocated to the client, and records related information corresponding to the special instruction for each special instruction.
  • the middleware allocates the database connection c1 in the database connection pool to the client C1, sends the SQL statement S1 to the database through the database connection c1, and records the connection ID of the database connection c1.
  • the middleware sends the SQL statement S1
  • the database connection c1 is maintained for the client C1, that is, the database connection c1 is not recycled into the database connection pool of the middleware or allocated to other clients.
  • the middleware allocates the database connection c2 in the database connection pool to the client C2, sends the SQL statement S2 to the database through the database connection c2, and saves a set of related information of the SQL statement S2, including: the template statement included in the SQL statement S2 Incr, the declaration name "incr" of the template statement incr, and the four pending parameters "Sno, Sname, Ssex, Sage" of the template statement incr.
  • the template statement incr is:
  • INSERT INTO Student (Sno, Sname, Ssex, Sage, Sdept) VALUES (?,?,?,?, CS).
  • the middleware allocates the database connection c3 in the database connection pool to the client C3, sends the SQL statement S3 to the database through the database connection c3, and saves a set of related information of the SQL statement S3, including: the template statement included in the SQL statement S3
  • the name of the info, template statement info is "info”.
  • the template statement info is:
  • S303 The database executes the special instruction received from the middleware, and returns the execution result to the client through the middleware.
  • the database successfully executes the SQL statement S1, opens a database transaction, the database uses the connection ID of the database connection c1 to identify the SQL statement S1, and then starts monitoring other statements of the database transaction sent from the database connection c1, and through the middleware to the client The terminal returns a successful response.
  • the database successfully executes the SQL statement S2, and uses the connection ID of the database connection c2 to identify and save a set of related information of the SQL statement S2, including: the template statement incr contained in the SQL statement S2 "INSERT INTO Student (Sno, Sname, Ssex, Sage , Sdept) VALUES (?,?,?,?, 'CS')", the declaration name "incr” of the template statement incr, and the four pending parameters "Sno, Sname, Ssex, Sage” of the template statement incr. Then, it starts monitoring the matching statement of the SQL statement S2 sent from the database connection c2, and returns a successful execution response to the client through the middleware.
  • the database successfully executes the SQL statement S3, and uses the connection ID of the database connection c3 to identify and save a set of related information of the SQL statement S3, including: the template statement info "SELECT*FROM Student" included in the SQL statement S3, and the statement of the template statement info The name "info”. Then, it starts monitoring the matching statement of the SQL statement S3 sent from the database connection c3, and returns a successful execution response to the client through the middleware.
  • S304 The client sends a matching instruction of the special instruction to the middleware.
  • Client C1 sends SQL statement S4 to the middleware:
  • Client C2 sends SQL statement S5 to the middleware:
  • Means Use the parameter value contained in the statement to assign a value to the template statement incr, and execute the statement generated after the assignment.
  • Client C3 sends SQL statement S6 to the middleware:
  • EXECUTE info Means: Execute the template statement info.
  • S305 The middleware sends the matching instruction to the database by using a preset sending manner according to the special instruction and the related information corresponding to the recorded special instruction.
  • the middleware sends the SQL statement S4 to the database through the database connection c1.
  • the middleware assigns a value to the template statement contained in the saved SQL statement S2 according to the parameter value of the template statement included in the SQL statement S5, and generates the SQL statement S5':
  • the generated SQL statement S5' is sent to the database.
  • the middleware generates the SQL statement S6' according to the template statement contained in the saved SQL statement S3:
  • SELECT*FROM Student Means: Query all the data in the table Student.
  • the generated SQL statement S6' is sent to the database.
  • the generated SQL statement S6 is the template statement info included in the SQL statement S3.
  • S306 The database executes the statement received from the middleware, and returns the execution result to the client through the middleware.
  • the database successfully executes the SQL statement S4, and returns the corresponding data queried in the table Student and the successful response to the client through the middleware.
  • 5 shows the corresponding data that is queried.
  • FIG. 6 shows the structure of the table Student after executing the SQL statement S5' in the database.
  • FIG. 6 shows the corresponding data that is queried, that is, the current table Student.
  • the embodiment of the present invention further provides a special instruction execution device, as shown in FIG. 7 .
  • FIG. 7 is a schematic structural diagram of an apparatus for executing a special instruction according to an embodiment of the present invention, which specifically includes:
  • the first sending module 701 is configured to send a special instruction, and record related information corresponding to the special instruction, where the related information includes: an identifier of a connection used to send the special instruction, and/or the special instruction Included template instructions;
  • the receiving module 702 is configured to receive a matching instruction of the special instruction
  • the second sending module 703 is configured to send the matching command to the database for execution according to the related information recorded by the first sending module 701 by using a preset sending manner corresponding to the related information.
  • the second sending module specifically 703 is configured to send the matching instruction by using a connection corresponding to the identifier of the connection used to send the special instruction. Execute to the database.
  • the device also includes:
  • the holding module 704 is configured to, after the first sending module 701 sends the special instruction, maintain the connection used by the first sending module 701 to send the special instruction for the database and the client.
  • the second sending module 703 is specifically configured to: generate a general instruction according to the template instruction, and the matching instruction, and send the generated general instruction to a database carried out.
  • the second sending module 703 is specifically configured to: determine whether the template instruction includes a pending parameter The number, if yes, assigns a value to the pending parameter according to the parameter value included in the matching instruction, and uses the assigned template instruction as the generated general instruction; otherwise, the template instruction is used as the generated general instruction.
  • the instructions include: instructions in the form of a structured query language SQL statement;
  • the special instruction When the related information is an identifier of a connection used to send the special instruction, the special instruction includes a BEGIN statement or a PREPARE statement, and when the special instruction is a BEGIN statement, the matching instruction belongs to the BEGIN statement The statement of the same database transaction, when the special instruction is a PREPARE statement, the matching instruction is an EXECUTE statement or a DEALLOCATE statement;
  • the special instruction includes a PREPARE statement
  • the matching instruction includes an EXECUTE statement.
  • the execution means of the special instruction shown in FIG. 7 above may be located in the middleware.
  • modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
  • Can The modules or units or components in the embodiments are combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
  • Each feature disclosed in this specification may be replaced by alternative features that provide the same, equivalent or similar purpose.
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of the functionality of some or all of the components of the special instructions in accordance with embodiments of the present invention.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Figure 8 shows a block diagram of a computing device for performing the method in accordance with the present invention.
  • the computing device conventionally includes a computer program product or computer readable medium in the form of a processor 810 and a memory 820.
  • the memory 820 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
  • Memory 820 has a memory space 830 that stores program code 831 for performing any of the method steps described above.
  • storage space 830 storing program code may include various program code 831 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • These computer program products include programs such as hard disks, compact discs (CDs), memory cards, or floppy disks. Sequence code carrier.
  • Such a computer program product is typically a portable or fixed storage unit such as that shown in FIG.
  • the storage unit may have a storage section, a storage space, and the like arranged similarly to the storage 820 in the server of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit comprises computer readable code 831' for performing the steps of the method according to the invention, ie code that can be read by a processor, such as 810, which when executed by the computing device causes the computing device Perform the various steps in the method described above.
  • the application can be applied to a computer system/server that can operate with numerous other general purpose or special purpose computing system environments or configurations.
  • Examples of well-known computing systems, environments, and/or configurations suitable for use with computer systems/servers include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, based on Microprocessor systems, set-top boxes, programmable consumer electronics, networked personal computers, small computer systems, mainframe computer systems, and distributed cloud computing technology environments including any of the above, and the like.
  • the computer system/server can be described in the general context of computer system executable instructions (such as program modules) being executed by a computer system.
  • program modules may include routines, programs, target programs, components, logic, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the computer system/server can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices that are linked through a communication network.
  • program modules may be located on a local or remote computing system storage medium including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed are a method and device for executing a special instruction. The method comprises: middleware connecting a database and a client, the middleware sending a special instruction, and recording relevant information corresponding to the special instruction (S101); and when receiving a matching instruction of the special instruction (S102), sending the matching instruction to the database to be executed in a pre-set sending mode corresponding to the relevant information (S103). Due to the fact that the database can correctly identify the matching instruction sent in the pre-set sending mode corresponding to the relevant information, the database can also correctly execute the matching instruction.

Description

一种特殊指令的执行方法及装置Method and device for executing special instructions 技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种特殊指令的执行方法及装置。The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for performing special instructions.
背景技术Background technique
随着互联网的迅速发展,数据库的中间件技术在面向网络的分布式数据库***中得到了广泛的应用。With the rapid development of the Internet, database middleware technology has been widely used in network-oriented distributed database systems.
中间件可以是位于客户端与数据库之间的中转设备,并可以连接两者,中间件提供了数据库连接池的功能。当客户端通过中间件向数据库发送指令时,中间件从数据库连接池中选择一个空闲的连接分配给该客户端,中间件通过该连接为客户端向数据库发送指令,并向客户端发送数据库返回的该指令的执行结果,然后,中间件将该连接回收,当该客户端后续再向数据库发送指令时,则中间件可能会分配另一个空闲的连接给该客户端使用。The middleware can be a relay device located between the client and the database, and can be connected to the middle. The middleware provides the function of the database connection pool. When the client sends an instruction to the database through the middleware, the middleware selects an idle connection from the database connection pool and assigns it to the client, and the middleware sends an instruction to the database for the client through the connection, and sends a database return to the client. The execution result of the instruction, and then the middleware reclaims the connection. When the client subsequently sends an instruction to the database, the middleware may allocate another idle connection to the client.
在现有技术中,对于一些特殊指令而言,当数据库执行该特殊指令后,则会针对发送该特殊指令所使用的连接,识别后续从该连接发送来的该特殊指令的匹配指令,并执行。但是,在使用数据库连接池的情况下,中间件通过某个连接为客户端发送该特殊指令,而后续可能会通过另一个连接为客户端发送该特殊指令的匹配指令,从而导致数据库无法正确识别该匹配指令,因此,数据库也无法正确执行该匹配指令,其中所述的指令是结构化查询语言(Structured Query Language,SQL)语句形式的指令。In the prior art, for some special instructions, when the database executes the special instruction, it will identify the matching instruction of the special instruction sent from the connection for the connection used to send the special instruction, and execute . However, in the case of using a database connection pool, the middleware sends the special instruction to the client through a connection, and the subsequent connection may send the matching instruction of the special instruction to the client through another connection, thereby causing the database to not correctly recognize. The matching instruction, therefore, the database cannot correctly execute the matching instruction, wherein the instruction is an instruction in the form of a Structured Query Language (SQL) statement.
例如,特殊指令可以是PREPARE语句,则该PREPARE语句的匹配指令包括:携带该PREPARE语句所包含的特殊标识(PREPARE语句所包含的特殊标识,也即,PREPARE语句所包含的模板语句的声明名称)的EXECUTE语句或DEALLOCATE语句。假定中间件通过连接1发送PREPARE语句,后续又通过连接2发送对应的EXECUTE语句,则数据库无法正确执行该EXECUTE语句。For example, the special instruction may be a PREPARE statement, and the matching instruction of the PREPARE statement includes: carrying the special identifier included in the PREPARE statement (the special identifier included in the PREPARE statement, that is, the declaration name of the template statement included in the PREPARE statement) EXECUTE statement or DEALLOCATE statement. Assuming that the middleware sends a PREPARE statement through connection 1, and then sends the corresponding EXECUTE statement through connection 2, the database cannot execute the EXECUTE statement correctly.
又例如,特殊指令可以是数据库事务中的BEGIN语句,则该BEGIN语句的匹配指令包括:与该BEGIN语句在同一个数据库事务中的其它的SQL语句,如COMMIT语句、ROLLBACK语句等。假定中间件通过连接1发送 BEGIN语句,后续又通过连接2发送对应的COMMIT语句,则数据库无法正确执行该COMMIT语句。For another example, the special instruction may be a BEGIN statement in a database transaction, and the matching instruction of the BEGIN statement includes: other SQL statements in the same database transaction as the BEGIN statement, such as a COMMIT statement, a ROLLBACK statement, and the like. Assume that the middleware is sent over connection 1 The BEGIN statement, which then sends the corresponding COMMIT statement through connection 2, the database cannot execute the COMMIT statement correctly.
发明内容Summary of the invention
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的特殊语句的执行方法及装置,在使用中间件的情况下,数据库能够正确执行特殊指令的匹配指令。In view of the above problems, the present invention has been made in order to provide a method and apparatus for executing a special sentence that overcomes the above problems or at least partially solves the above problems. In the case of using the middleware, the database can correctly execute the matching instruction of the special instruction.
根据本发明的第一个方面,提出一种特殊指令的执行方法,应用于耦接在数据库与客户端之间的中间件,所述方法包括:According to a first aspect of the present invention, a method for executing a special instruction is provided, which is applied to an intermediate component coupled between a database and a client, the method comprising:
发送特殊指令,并记录与所述特殊指令对应的相关信息,其中,所述相关信息包括:发送所述特殊指令所使用连接的标识,和/或所述特殊指令包含的模板指令;Transmitting a special instruction, and recording related information corresponding to the special instruction, where the related information includes: an identifier of a connection used to send the special instruction, and/or a template instruction included in the special instruction;
接收所述特殊指令的匹配指令;Receiving a matching instruction of the special instruction;
根据记录的所述相关信息,采用预设的与所述相关信息对应的发送方式,将所述匹配指令发送给数据库执行。And according to the recorded related information, the matching instruction is sent to the database for execution by using a preset sending manner corresponding to the related information.
根据本发明的第二个方面,提出一种特殊指令的执行装置,耦接于数据库与客户端之间,包括:According to a second aspect of the present invention, a special instruction execution device is provided, coupled between a database and a client, and includes:
第一发送模块,用于发送特殊指令,并记录与所述特殊指令对应的相关信息,其中,所述相关信息包括:发送所述特殊指令所使用连接的标识,和/或所述特殊指令包含的模板指令;a first sending module, configured to send a special instruction, and record related information corresponding to the special instruction, where the related information includes: an identifier of a connection used to send the special instruction, and/or the special instruction includes Template instruction;
接收模块,用于接收所述特殊指令的匹配指令;a receiving module, configured to receive a matching instruction of the special instruction;
第二发送模块,用于根据所述第一发送模块记录的所述相关信息,采用预设的与所述相关信息对应的发送方式,将所述匹配指令发送给数据库执行。The second sending module is configured to send the matching instruction to the database for execution according to the related information recorded by the first sending module by using a preset sending manner corresponding to the related information.
当所述相关信息为发送所述特殊指令所使用连接的标识时,所述第二发送模块具体用于,将所述匹配指令通过与发送所述特殊指令所使用连接的标识对应的连接发送给数据库执行。When the related information is the identifier of the connection used to send the special instruction, the second sending module is specifically configured to send the matching instruction to the connection corresponding to the identifier used to send the special instruction to send Database execution.
根据本发明的第三个方面,提出了一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行如上文所述的特殊指令的执行方法。According to a third aspect of the invention there is presented a computer program comprising computer readable code, when said computer readable code is run on a computing device, causing said computing device to perform a special instruction as described above Execution method.
根据本发明的第四个方面,提出了一种计算机可读介质,其中存储了上 述的计算机程序。According to a fourth aspect of the present invention, a computer readable medium is provided, wherein Computer program.
根据本发明提供的特殊指令的执行方法,中间件发送特殊指令,并记录与该特殊指令对应的相关信息,当接收到该特殊指令的匹配指令时,采用预设的与该相关信息对应的发送方式,将该匹配指令发送给数据库执行,由于数据库可以正确识别采用预设的与该相关信息对应的发送方式发送的该匹配指令,因此,数据库也可以正确执行该匹配指令,解决了数据库无法正确执行该匹配指令的问题。According to the execution method of the special instruction provided by the present invention, the middleware sends a special instruction, and records related information corresponding to the special instruction, and when receiving the matching instruction of the special instruction, adopts a preset transmission corresponding to the related information. The method sends the matching command to the database for execution. Since the database can correctly identify the matching instruction sent by using the preset sending manner corresponding to the related information, the database can correctly execute the matching instruction, and the database cannot be correctly solved. The problem of executing the matching instruction.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, and the above-described and other objects, features and advantages of the present invention can be more clearly understood. Specific embodiments of the invention are set forth below.
附图说明DRAWINGS
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those skilled in the art from a The drawings are only for the purpose of illustrating the preferred embodiments and are not to be construed as limiting. Throughout the drawings, the same reference numerals are used to refer to the same parts. In the drawing:
图1为依据本发明实施例的特殊指令的执行方法的流程示意图;1 is a schematic flow chart of a method for executing a special instruction according to an embodiment of the present invention;
图2为依据本发明实施例,在实际应用场景下,数据库、中间件、客户端之间的连接架构的示意图;2 is a schematic diagram of a connection structure between a database, a middleware, and a client in an actual application scenario according to an embodiment of the present invention;
图3为依据本发明实施例,在实际应用场景下,客户端通过向中间件向数据库发送的特殊指令,以及该特殊指令的匹配指令的执行过程的示意图;3 is a schematic diagram of a special instruction sent by a client to a database to a middleware and a matching instruction of a matching instruction of the special instruction in an actual application scenario according to an embodiment of the present invention;
图4为依据本发明实施例,在实际应用场景下,客户端发送特殊指令之前,数据库中存储的数据表Student的结构的示意图;4 is a schematic diagram showing the structure of a data table Student stored in a database before a client sends a special instruction in an actual application scenario according to an embodiment of the present invention;
图5为依据本发明实施例,在实际应用场景下,数据库执行SQL语句S4后查询到的对应数据的示意图;FIG. 5 is a schematic diagram of corresponding data queried by the database after executing the SQL statement S4 in the actual application scenario according to an embodiment of the present invention; FIG.
图6为依据本发明实施例,在实际应用场景下,数据库执行SQL语句S6’后查询到的对应数据的示意图;6 is a schematic diagram of corresponding data queried by a database after executing a SQL statement S6' in an actual application scenario according to an embodiment of the present invention;
图7为依据本发明实施例的特殊语句的执行装置的示意图;7 is a schematic diagram of an apparatus for executing a special statement according to an embodiment of the present invention;
图8示出了用于执行根据本发明的方法的计算设备的框图;以及Figure 8 shows a block diagram of a computing device for performing a method in accordance with the present invention;
图9示出了用于保持或者携带实现根据本发明的方法的程序代码的存储单元。 Figure 9 shows a storage unit for holding or carrying program code implementing the method according to the invention.
具体实施例Specific embodiment
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While the embodiments of the present invention have been shown in the drawings, the embodiments Rather, these embodiments are provided so that this disclosure will be more fully understood and the scope of the disclosure will be fully disclosed.
以下结合附图,详细说明本申请各实施例提供的技术方案。The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
图1为依据本发明实施例的特殊指令的执行方法的示意图,其可应用于耦接在数据库与客户端之间的中间件,所述方法可以包括步骤:1 is a schematic diagram of a method for executing a special instruction according to an embodiment of the present invention, which may be applied to an intermediate device coupled between a database and a client, and the method may include the following steps:
S101:发送特殊指令,并记录与该特殊指令对应的相关信息。S101: Send a special instruction, and record related information corresponding to the special instruction.
其中,该相关信息包括:发送该特殊指令所使用连接的标识,和/或该特殊指令包含的模板指令。The related information includes: an identifier of a connection used to send the special instruction, and/or a template instruction included in the special instruction.
S102:接收该特殊指令的匹配指令。S102: Receive a matching instruction of the special instruction.
S103:根据记录的该相关信息,采用预设的与所述相关信息对应的发送方式,将该匹配指令发送给数据库执行。S103: Send the matching instruction to the database for execution according to the related information recorded, by using a preset sending manner corresponding to the related information.
从上述可知,依据该实施例,中间件发送特殊指令,并记录与该特殊指令对应的相关信息,即,中间件每发送一条特殊指令,都会记录与该特殊指令对应的相关信息,该相关信息用于确定该特殊指令的匹配指令的发送方式,因此,针对不同类型的特殊指令,记录的相关信息也不同,对于某一类特殊指令,记录的相关信息为发送该特殊指令所使用连接的标识,对于另一类特殊指令,记录的相关信息为该特殊指令包含的模板指令。后续当中间件接收到该特殊指令的匹配指令时,则根据记录的相关信息,采用预设的与该相关信息对应的发送方式,将该匹配指令发送给数据库执行,由于针对每一类特殊指令,中间件都预先设置了该特殊指令的匹配指令的发送方式,使数据库能够正确识别通过该发送方式发送的匹配指令,因此,数据库能够正确执行该匹配指令。As can be seen from the above, according to the embodiment, the middleware sends a special instruction and records related information corresponding to the special instruction, that is, each time the middleware sends a special instruction, relevant information corresponding to the special instruction is recorded, and the related information is recorded. It is used to determine the sending mode of the matching instruction of the special instruction. Therefore, the related information of the record is different for different types of special instructions. For a certain type of special instruction, the related information recorded is the identifier of the connection used to send the special instruction. For another special type of instruction, the relevant information recorded is the template instruction contained in the special instruction. When the middleware receives the matching instruction of the special instruction, the middleware sends the matching instruction to the database for execution according to the related information of the record, according to the corresponding information of the related information, because each type of special instruction is used. The middleware has preset the sending manner of the matching instruction of the special instruction, so that the database can correctly identify the matching instruction sent by the sending mode, and therefore, the database can correctly execute the matching instruction.
依据本发明的一个实施例,由于对于某些特殊指令而言,数据库执行特殊指令后,会针对发送该特殊指令所使用的连接,识别后续从该连接发送来的该特殊指令的匹配指令,因此,中间件发送特殊指令后,记录的与该特殊指令对应的相关信息可以为发送该特殊指令所使用连接的标识。当中间件后续从该客户端接收到该特殊指令的匹配指令时,则中间件将该匹配指令通过 与记录的标识对应的连接发送给数据库执行。According to an embodiment of the present invention, since the database executes a special instruction for some special instructions, it will identify a matching instruction of the special instruction sent from the connection for the connection used to send the special instruction, After the middleware sends the special instruction, the related information recorded corresponding to the special instruction may be the identifier of the connection used to send the special instruction. When the middleware subsequently receives the matching instruction of the special instruction from the client, the middleware passes the matching instruction The connection corresponding to the recorded identifier is sent to the database for execution.
具体的,当记录的与该特殊指令对应的相关信息为发送该特殊指令所使用连接的标识时,中间件接收该特殊指令的匹配指令后,根据记录的发送该特殊指令所使用连接的标识可确定之前发送特殊指令时所使用的连接,然后,将该匹配指令通过该连接发送给数据库执行。这样,由于中间件发送特殊指令及其后续的匹配指令都是通过同一个连接发送给数据库的,因此,数据库可根据该同一个连接,正确的识别出该匹配指令,从而可正确的执行该匹配指令。Specifically, when the related information recorded corresponding to the special instruction is the identifier of the connection used to send the special instruction, after the middleware receives the matching instruction of the special instruction, the identifier of the connection used to send the special instruction according to the record may be Determines the connection that was used when the special instruction was sent, and then sends the matching instruction to the database for execution through the connection. In this way, since the middleware sends the special instruction and its subsequent matching instructions are sent to the database through the same connection, the database can correctly identify the matching instruction according to the same connection, so that the matching can be correctly performed. instruction.
进一步的,依据本发明的一个实施例,当中间件发送特殊指令,且记录的与该特殊指令对应的相关信息为发送该特殊指令所使用连接的标识时,在中间件发送特殊指令之后,中间件还可为数据库和客户端保持发送该特殊指令所使用的连接,也即,中间件将特殊指令通过一个连接发送给数据库后,并不回收该连接,也不将该连接分配给其它的客户端使用,因此,当中间件后续接收到该特殊指令的匹配指令时,可直接使用该连接发送该匹配指令,提高了中间件发送匹配指令的效率。Further, according to an embodiment of the present invention, when the middleware sends a special instruction, and the related information recorded corresponding to the special instruction is the identifier of the connection used to send the special instruction, after the middleware sends the special instruction, the middle The device can also maintain the connection used by the database and the client to send the special instruction, that is, after the middleware sends the special instruction to the database through a connection, the connection is not reclaimed, and the connection is not assigned to other clients. The end uses, therefore, when the middleware subsequently receives the matching instruction of the special instruction, the matching instruction can be directly sent using the connection, which improves the efficiency of the middleware sending the matching instruction.
依据本发明的一个实施例,当中间件发送特殊指令,且记录的与该特殊指令对应的相关信息为发送该特殊指令所使用连接的标识时,所述的指令为SQL语句形式的指令,该特殊指令可为BEGIN语句(BEGIN语句,也即,数据库事务中的BEGIN TRANSCATION语句)或PREPARE语句。According to an embodiment of the present invention, when the middleware sends a special instruction, and the related information recorded corresponding to the special instruction is an identifier of a connection used to send the special instruction, the instruction is an instruction in the form of a SQL statement, A special instruction can be a BEGIN statement (BEGIN statement, that is, a BEGIN TRANSCATION statement in a database transaction) or a PREPARE statement.
具体的,当特殊指令为BEGIN语句时,则该特殊指令的匹配指令为与该BEGIN语句属于同一个数据库事务的语句,如COMMIT语句、ROLLBACK语句等。Specifically, when the special instruction is a BEGIN statement, the matching instruction of the special instruction is a statement that belongs to the same database transaction as the BEGIN statement, such as a COMMIT statement, a ROLLBACK statement, and the like.
下面针对数据库事务进行说明:The following describes the database transaction:
一个数据库事务包含有多条SQL语句。一个数据库事务以BEGIN语句开始,中间可包含若干语句,当BEGIN语句和中间的语句都成功执行时,可用COMMIT语句提交该数据库事务中已完成的操作,当中间有语句执行失败或该数据库事务不能继续执行时,可用ROLLBACK语句回滚该数据库事务,也即,撤销该数据库事务中已完成但尚未提交的操作,显然,一个数据库事务会以COMMIT语句或ROLLBACK语句结束。A database transaction contains multiple SQL statements. A database transaction starts with a BEGIN statement. It can contain several statements in the middle. When both the BEGIN statement and the middle statement are executed successfully, the COMMIT statement can be used to submit the completed operation in the database transaction. When there is a statement execution failure or the database transaction cannot be executed. When you continue execution, you can use the ROLLBACK statement to roll back the database transaction, that is, to undo the completed but uncommitted operations in the database transaction. Obviously, a database transaction ends with a COMMIT statement or a ROLLBACK statement.
由于在数据库中可同时执行多个数据库事务,为了不混淆各个数据库事 务,数据库使用连接标识(Identity,ID)对一个数据库事务的所有语句进行标识,其中,该连接标识为发送该数据库事务的语句所使用连接的连接ID。若中间件发送数据库事务的某条语句与发送该数据库事务的其它语句使用了不同连接,则数据库认为该条语句与该其它语句属于不同的数据库事务,并分别用对应的不同连接ID对其标识,因此,每个连接ID标识的数据库事务的语句均不完整,导致数据库无法正确执行该数据库事务中的语句。Since multiple database transactions can be executed simultaneously in the database, in order not to confuse each database The database uses the connection identifier (Identity, ID) to identify all statements for a database transaction, where the connection identifies the connection ID of the connection used by the statement that sent the database transaction. If a statement sent by the middleware to the database transaction uses a different connection than the other statements that sent the database transaction, the database considers the statement to be a different database transaction from the other statement and identifies it with the corresponding different connection ID. Therefore, the statement for the database transaction identified by each connection ID is incomplete, causing the database to fail to execute the statements in the database transaction correctly.
根据上述说明,数据库是根据连接识别同一个数据库事务中的语句,因此,需要将同一个数据库事务所有语句通过相同连接发送。则当中间件记录的相关信息为发送特殊指令所使用连接的连接ID,且该特殊指令为BEGIN语句时,在图1所示的步骤S101~S103中,中间件发送BEGIN语句,并记录发送该BEGIN语句所使用连接的连接ID,当后续接收到与该BEGIN语句属于同一个数据库事务的其它语句,如COMMIT语句、ROLLBACK语句等时,将该其它语句通过记录的连接ID所标识的连接发送给数据库执行,则数据库可正确执行该其它语句。According to the above description, the database identifies the statements in the same database transaction based on the connection. Therefore, all statements of the same database transaction need to be sent through the same connection. Then, when the related information recorded by the middleware is the connection ID of the connection used for transmitting the special instruction, and the special instruction is a BEGIN statement, in the steps S101 to S103 shown in FIG. 1, the middleware sends a BEGIN statement, and records the transmission. The connection ID of the connection used by the BEGIN statement. When subsequently receiving other statements belonging to the same database transaction as the BEGIN statement, such as a COMMIT statement, a ROLLBACK statement, etc., the other statement is sent to the connection identified by the recorded connection ID. When the database is executed, the database can execute the other statements correctly.
下面针对PREPARE语句、EXECUTE语句和DEALLOCATE语句进行说明:The following describes the PREPARE statement, the EXECUTE statement, and the DEALLOCATE statement:
当特殊指令为PREPARE语句时,该特殊指令的匹配指令为EXECUTE语句或DEALLOCATE语句(DEALLOCATE语句,也即,DEALLOCATE PREPARE语句),其中,该PREPARE语句中包含有模板语句(模板语句,也即,模板指令),以及该模板语句的声明名称,该EXECUTE语句和该DEALLOCATE语句中也包含有该模板语句的声明名称。When the special instruction is a PREPARE statement, the matching instruction of the special instruction is an EXECUTE statement or a DEALLOCATE statement (that is, a DEALLOCATE PREPARE statement), wherein the PREPARE statement includes a template statement (a template statement, that is, a template) The instruction), and the declaration name of the template statement, the declaration name of the template statement is also included in the EXECUTE statement and the DEALLOCATE statement.
PREPARE语句预声明了一个模板语句、该模板语句的声明名称,以及该模板语句的待定参数(该模板语句也可不包含待定参数)。当数据库执行PREPARE语句时,针对每一个PREPARE语句,会为该PREPARE语句保存一组内容,并采用发送该PREPARE语句所使用连接的连接ID对该组保存内容进行标识,其中,该组保存内容包括:该PREPARE语句中包含的模板语句、该模板语句的声明名称、该模板语句的待定参数。The PREPARE statement predeclares a template statement, the declaration name of the template statement, and the pending parameters of the template statement (the template statement may or may not contain pending parameters). When the database executes the PREPARE statement, for each PREPARE statement, a set of content is saved for the PREPARE statement, and the saved content of the group is identified by the connection ID of the connection used to send the PREPARE statement, wherein the group save content includes : The template statement contained in the PREPARE statement, the declaration name of the template statement, and the pending parameters of the template statement.
EXECUTE语句包含了模板语句的声明名称,以及模板语句的参数值。当数据库执行EXECUTE语句时,会根据发送该EXECUTE语句所使用连接的连接ID查询该连接ID对应的PREPARE语句的保存内容,并将查询到的 各组保存内容中的模板语句的声明名称与该EXECUTE语句中包含的模板语句的声明名称进行比较,若某组保存内容中的模板语句的声明名称与该EXECUTE语句中包含的声明名称相同,则根据该EXECUTE语句包含的参数值为该组保存内容中的模板语句的待定参数赋值,并执行赋值后的该模板语句。The EXECUTE statement contains the declaration name of the template statement and the parameter values of the template statement. When the database executes the EXECUTE statement, the save content of the PREPARE statement corresponding to the connection ID is queried according to the connection ID of the connection used to send the EXECUTE statement, and the query is obtained. The declaration name of the template statement in each group save content is compared with the declaration name of the template statement included in the EXECUTE statement. If the declaration name of the template statement in the set of saved contents is the same as the declaration name contained in the EXECUTE statement, then According to the parameter value included in the EXECUTE statement, the pending parameter of the template statement in the group save content is assigned, and the template statement after the assignment is executed.
DEALLOCATE语句包含了模板语句的声明名称。当数据库执行DEALLOCATE语句时,会根据发送该DEALLOCATE语句所使用连接的连接ID查询该连接ID对应的PREPARE语句的保存内容,并将查询到的各组保存内容中的模板语句的声明名称与该DEALLOCATE语句中包含的模板语句的声明名称相同进行比较,若某一组保存内容中的模板语句的声明名称与该EXECUTE语句中包含的模板语句的声明名称相同,则删除该组保存内容。The DEALLOCATE statement contains the declaration name of the template statement. When the database executes the DEALLOCATE statement, the save content of the PREPARE statement corresponding to the connection ID is queried according to the connection ID of the connection used to send the DEALLOCATE statement, and the declared name of the template statement in the saved contents of each group is compared with the DEALLOCATE. The declaration names of the template statements included in the statement are the same. If the declaration name of the template statement in a group of saved contents is the same as the declaration name of the template statement included in the EXECUTE statement, the group save content is deleted.
根据上述说明,数据库是根据连接识别PREPARE语句,以及对应的EXECUTE语句和DEALLOCATE语句的。若中间件发送PREPARE语句与发送对应的EXECUTE或DEALLOCATE语句使用了不同连接,则数据库根据发送该对应的EXECUTE或DEALLOCATE语句所使用连接的连接ID,就不能查询到使用另一个连接ID标识的该PREPARE语句对应的保存内容,从而数据库不能正确执行该对应的EXECUTE或DEALLOCATE语句。According to the above description, the database recognizes the PREPARE statement according to the connection, and the corresponding EXECUTE statement and DEALLOCATE statement. If the middleware sends a PREPARE statement and uses a different connection to send the corresponding EXECUTE or DEALLOCATE statement, the database cannot query the PREPARE identified by another connection ID according to the connection ID of the connection used to send the corresponding EXECUTE or DEALLOCATE statement. The corresponding content of the statement is saved, so that the database cannot correctly execute the corresponding EXECUTE or DEALLOCATE statement.
因此,需要将PREPARE语句,以及对应的EXECUTE语句和/或DEALLOCATE语句通过相同连接发送。依据本发明的一个实施例,当中间件记录的相关信息为发送特殊指令所使用连接的连接ID,且该特殊指令为PREPARE语句(该PREPARE语句中包含有模板语句及其声明名称)时,在图1所示的步骤S101~S103中,中间件发送PREPARE语句,并记录发送该PREPARE语句所使用连接的连接ID,当后续接收到包含有该声明名称的EXECUTE语句和/或DEALLOCATE语句时,将该EXECUTE语句和/或该DEALLOCATE语句通过记录的连接ID所标识的连接发送给数据库执行,则数据库可正确执行该EXECUTE语句和/或该DEALLOCATE语句。Therefore, you need to send the PREPARE statement, and the corresponding EXECUTE statement and / or DEALLOCATE statement through the same connection. According to an embodiment of the present invention, when the related information recorded by the middleware is the connection ID of the connection used to send the special instruction, and the special instruction is a PREPARE statement (the PREPARE statement contains the template statement and its declared name), In steps S101 to S103 shown in FIG. 1, the middleware sends a PREPARE statement, and records the connection ID of the connection used to send the PREPARE statement, and when subsequently receives the EXECUTE statement and/or the DEALLOCATE statement containing the declaration name, The EXECUTE statement and/or the DEALLOCATE statement is sent to the database for execution via the connection identified by the recorded connection ID, and the database can correctly execute the EXECUTE statement and/or the DEALLOCATE statement.
依据本发明的一个实施例,当中间件发送特殊指令,且记录的与该特殊指令对应的相关信息为所述特殊指令包含的模板指令时,在图1所示的步骤S103中,采用预设的与所述相关信息对应的发送方式,将该匹配指令发送 给数据库执行,具体包括:根据该模板指令,以及该匹配指令生成一般指令,将生成的一般指令发送给数据库执行。其中,根据该模板指令,以及该匹配指令生成一般指令,具体包括:中间件判断该模板指令中是否包含待定参数,若是,则根据该匹配指令中包含的参数值为该待定参数赋值,将赋值后的模板指令作为生成的一般指令,否则,将该模板指令作为生成的一般指令。其中,所述的指令为SQL语句形式的指令,该特殊指令为PREPARE语句,则该特殊指令的匹配指令为包含有该PREPARE语句包含的模板语句的声明名称的EXECUTE语句。According to an embodiment of the present invention, when the middleware sends a special instruction, and the related information recorded corresponding to the special instruction is a template instruction included in the special instruction, in step S103 shown in FIG. Sending the matching instruction corresponding to the related information Executing to the database specifically includes: generating a general instruction according to the template instruction and the matching instruction, and sending the generated general instruction to the database for execution. The generating, according to the template instruction, the matching instruction, the general instruction, the specific component includes: determining, by the middleware, whether the template instruction includes a pending parameter, and if yes, assigning a value to the pending parameter according to the parameter value included in the matching instruction, and assigning the value The subsequent template instruction is used as the generated general instruction. Otherwise, the template instruction is used as the generated general instruction. Wherein, the instruction is an instruction in the form of a SQL statement, and the special instruction is a PREPARE statement, and the matching instruction of the special instruction is an EXECUTE statement containing a declaration name of a template statement included in the PREPARE statement.
当中间件记录的相关信息为特殊指令包含的模板指令,且该特殊指令为PREPARE语句时,在图1所示的步骤S101~S103中,中间件发送PREPARE语句,并针对每一个PREPARE语句,记录该PREPARE语句包含的模板语句,中间件还需要为该PREPARE语句保存一组内容,其中,该组保存内容包括:该PREPARE语句中包含的模板语句、该模板语句的声明名称、该模板语句的待定参数。当后续中间件接收到某客户端发送的EXECUTE语句时,查询为从该客户端发送的PREPARE语句保存的各组保存内容,并将查询到的各组保存内容中的模板语句的声明名称与该EXECUTE语句中包含的声明名称进行比较,若某组保存内容中的模板语句的声明名称与该EXECUTE语句包含的声明名称相同,进而,判断该组保存内容中的模板语句是否包含待定参数,若是,则用该EXECUTE语句包含的参数值为该组保存内容中的模板语句的待定参数赋值,并将赋值后的该模板语句作为一般语句(一般语句,也即,一般指令)发送给数据库执行,否则,将该组保存内容中的模板语句作为一般语句发送给数据库执行,由于数据库可以直接执行该一般语句,且该一般语句的执行效果等价于该EXECUTE语句的执行效果,因此,数据库正确执行了该一般语句即相当于数据库正确执行了该EXECUTE语句。When the related information recorded by the middleware is a template instruction included in the special instruction, and the special instruction is a PREPARE statement, in the steps S101 to S103 shown in FIG. 1, the middleware sends a PREPARE statement, and for each PREPARE statement, records The template statement included in the PREPARE statement, the middleware also needs to save a set of content for the PREPARE statement, wherein the group save content includes: a template statement included in the PREPARE statement, a declaration name of the template statement, and a pending statement of the template statement parameter. When the subsequent middleware receives the EXECUTE statement sent by a client, the query is the saved content of each group saved by the PREPARE statement sent from the client, and the declared name of the template statement in each group of saved contents of the query is The name of the declaration contained in the EXECUTE statement is compared. If the declaration name of the template statement in the saved content of the group is the same as the declaration name contained in the EXECUTE statement, it is determined whether the template statement in the saved content of the group contains the pending parameter, and if so, Then, the parameter value included in the EXECUTE statement is assigned to the pending parameter of the template statement in the saved content of the group, and the template statement after the assignment is sent to the database as a general statement (general statement, that is, a general instruction), otherwise The template statement in the saved content of the group is sent to the database as a general statement. Since the database can directly execute the general statement, and the execution effect of the general statement is equivalent to the execution effect of the EXECUTE statement, the database is correctly executed. The general statement is equivalent to the correct execution of the EXECUTE statement by the database.
结合图2至6,本发明所述的特殊指令的执行方法的具体实际应用如下:2 to 6, the specific practical application of the execution method of the special instruction according to the present invention is as follows:
图2示出了在应用了中间件的场景下,数据库、中间件、以及客户端之间的连接架构。3个客户端C1~C3通过中间件访问数据库,具体的,客户端C1~C3分别与中间件基于传输控制协议(Transmission Control Protocol,TCP)建立有通讯连接,中间件的数据库连接池中有预先建立的数据库连接c1~c3。 其中,数据库可以为MySQL数据库,所述数据库连接可以为java数据库连接(Java Database Connectivity,JDBC)。Figure 2 shows the connection architecture between the database, middleware, and client in the scenario where middleware is applied. The three clients C1 to C3 access the database through the middleware. Specifically, the client C1 to C3 respectively establish a communication connection with the middleware based on the Transmission Control Protocol (TCP), and the middleware database connection pool has a pre-requisite. The established database connection c1 ~ c3. The database may be a MySQL database, and the database connection may be a Java Database Connectivity (JDBC).
图3示出了客户端通过中间件向数据库发送的特殊指令,以及该特殊指令的匹配指令的执行过程,具体包括步骤:FIG. 3 shows a special instruction sent by the client to the database through the middleware, and an execution process of the matching instruction of the special instruction, specifically including the steps:
S301:客户端向中间件发送若干特殊指令。S301: The client sends a number of special instructions to the middleware.
假定数据库中存储有数据表Student(数据表Student,以下简称为表Student),表Student定义了5个数据项:Sno、Sname、Ssex、Sage、Sdept。对该5个数据项分别赋值后向表A中***,可生成表Student的一条数据记录,当前表Student中包含了3条数据记录D1~D3,图4示出了表Student当前的结构,表Student中的第一行表示表Student包含的各个数据项,表Student中的第一列表示表表Student包含的数据记录D1~D3,某数据项所在的列与某数据记录所在的行交汇处的单元格中为在该数据记录中该数据项的取值。It is assumed that a data table Student (data table Student, hereinafter referred to as Table Student) is stored in the database, and the table Student defines five data items: Sno, Sname, Ssex, Sage, Sdept. The five data items are respectively assigned and inserted into the table A, and a data record of the table Student can be generated. The current table Student includes three data records D1 to D3, and FIG. 4 shows the current structure of the table Student, the table The first row in the Student represents each data item included in the table Student. The first column in the Student table indicates the data records D1 to D3 included in the Student Table, and the column where the data item is located and the row where the data record is located. The value in the cell is the value of the data item in the data record.
客户端C1向中间件发送SQL语句S1:Client C1 sends SQL statement S1 to the middleware:
BEGIN TRANSCATION。意为:启动一个数据库事务。BEGIN TRANSCATION. Means: Start a database transaction.
客户端C2向中间件发送SQL语句S2:Client C2 sends SQL statement S2 to the middleware:
PREPARE incr FROM“INSERT INTO Student(Sno,Sname,Ssex,Sage,Sdept)VALUES(?,?,?,?,CS)”。意为:预声明一个声明名称为incr的模板语句,其中,该模板语句incr用于向表Student中***一条数据记录。PREPARE incr FROM "INSERT INTO Student (Sno, Sname, Ssex, Sage, Sdept) VALUES (?,?,?,?, CS)". This means: Predeclaring a template statement with the declaration name incr, which is used to insert a data record into the table Student.
客户端C3向中间件发送SQL语句S3:Client C3 sends SQL statement S3 to the middleware:
PREPARE info FROM“SELECT*FROM Student”。意为:预声明一个声明名称为info的模板语句,其中,该模板语句info用于查询表Student中的全部数据。PREPARE info FROM "SELECT*FROM Student". This means: Pre-declare a template statement with the declaration name info, where the template statement info is used to query all the data in the table Student.
S302:中间件通过分配给该客户端的数据库连接将该若干特殊指令发送给数据库,并针对每个特殊指令,记录该特殊指令对应的相关信息。S302: The middleware sends the special instructions to the database through a database connection allocated to the client, and records related information corresponding to the special instruction for each special instruction.
中间件将数据库连接池中的数据库连接c1分配给客户端C1,通过数据库连接c1将SQL语句S1发送给数据库,并记录数据库连接c1的连接ID。中间件发送SQL语句S1后,为客户端C1保持数据库连接c1,也即,不将数据库连接c1回收放入中间件的数据库连接池或分配给其它客户端使用。 The middleware allocates the database connection c1 in the database connection pool to the client C1, sends the SQL statement S1 to the database through the database connection c1, and records the connection ID of the database connection c1. After the middleware sends the SQL statement S1, the database connection c1 is maintained for the client C1, that is, the database connection c1 is not recycled into the database connection pool of the middleware or allocated to other clients.
中间件将数据库连接池中的数据库连接c2分配给客户端C2,通过数据库连接c2将SQL语句S2发送给数据库,并保存SQL语句S2的一组相关信息,包括:SQL语句S2中包含的模板语句incr、模板语句incr的声明名称“incr”、模板语句incr的四个待定参数“Sno,Sname,Ssex,Sage”。其中,模板语句incr为:The middleware allocates the database connection c2 in the database connection pool to the client C2, sends the SQL statement S2 to the database through the database connection c2, and saves a set of related information of the SQL statement S2, including: the template statement included in the SQL statement S2 Incr, the declaration name "incr" of the template statement incr, and the four pending parameters "Sno, Sname, Ssex, Sage" of the template statement incr. Where the template statement incr is:
INSERT INTO Student(Sno,Sname,Ssex,Sage,Sdept)VALUES(?,?,?,?,CS)。INSERT INTO Student (Sno, Sname, Ssex, Sage, Sdept) VALUES (?,?,?,?, CS).
中间件将数据库连接池中的数据库连接c3分配给客户端C3,通过数据库连接c3将SQL语句S3发送给数据库,并保存SQL语句S3的一组相关信息,包括:SQL语句S3中包含的模板语句info、模板语句info的声明名称“info”。其中,模板语句info为:The middleware allocates the database connection c3 in the database connection pool to the client C3, sends the SQL statement S3 to the database through the database connection c3, and saves a set of related information of the SQL statement S3, including: the template statement included in the SQL statement S3 The name of the info, template statement info is "info". Where the template statement info is:
SELECT*FROM Student。SELECT*FROM Student.
S303:数据库执行从中间件接收到的特殊指令,并通过中间件向客户端返回执行结果。S303: The database executes the special instruction received from the middleware, and returns the execution result to the client through the middleware.
数据库成功执行SQL语句S1,开启了一个数据库事务,数据库用数据库连接c1的连接ID对SQL语句S1进行标识,然后开始监视从数据库连接c1发送的该数据库事务的其它语句,并通过中间件向客户端返回执行成功的响应。The database successfully executes the SQL statement S1, opens a database transaction, the database uses the connection ID of the database connection c1 to identify the SQL statement S1, and then starts monitoring other statements of the database transaction sent from the database connection c1, and through the middleware to the client The terminal returns a successful response.
数据库成功执行SQL语句S2,用数据库连接c2的连接ID标识并保存了SQL语句S2的一组相关信息,包括:SQL语句S2中包含的模板语句incr“INSERT INTO Student(Sno,Sname,Ssex,Sage,Sdept)VALUES(?,?,?,?,‘CS’)”、模板语句incr的声明名称“incr”、模板语句incr的四个待定参数“Sno,Sname,Ssex,Sage”。然后开始监视从数据库连接c2发送的SQL语句S2的匹配语句,并通过中间件向客户端返回执行成功的响应。The database successfully executes the SQL statement S2, and uses the connection ID of the database connection c2 to identify and save a set of related information of the SQL statement S2, including: the template statement incr contained in the SQL statement S2 "INSERT INTO Student (Sno, Sname, Ssex, Sage , Sdept) VALUES (?,?,?,?, 'CS')", the declaration name "incr" of the template statement incr, and the four pending parameters "Sno, Sname, Ssex, Sage" of the template statement incr. Then, it starts monitoring the matching statement of the SQL statement S2 sent from the database connection c2, and returns a successful execution response to the client through the middleware.
数据库成功执行SQL语句S3,用数据库连接c3的连接ID标识并保存了SQL语句S3的一组相关信息,包括:SQL语句S3中包含的模板语句info“SELECT*FROM Student”、模板语句info的声明名称“info”。然后开始监视从数据库连接c3发送的SQL语句S3的匹配语句,并通过中间件向客户端返回执行成功的响应。 The database successfully executes the SQL statement S3, and uses the connection ID of the database connection c3 to identify and save a set of related information of the SQL statement S3, including: the template statement info "SELECT*FROM Student" included in the SQL statement S3, and the statement of the template statement info The name "info". Then, it starts monitoring the matching statement of the SQL statement S3 sent from the database connection c3, and returns a successful execution response to the client through the middleware.
S304:客户端向中间件发送特殊指令的匹配指令。S304: The client sends a matching instruction of the special instruction to the middleware.
客户端C1向中间件发送SQL语句S4:Client C1 sends SQL statement S4 to the middleware:
SELECT Sno,Sname FROM Student Where Ssex=‘男’。意为:查询表Student中数据项Ssex=‘男’的数据记录的数据项Sno、Sname的值。SELECT Sno, Sname FROM Student Where Ssex=‘Male’. This means: the value of the data items Sno and Sname of the data record of the data item Ssex=‘male’ in the query table Student.
客户端C2向中间件发送SQL语句S5:Client C2 sends SQL statement S5 to the middleware:
EXECUTE incr USING‘20145124’,‘赵六’,‘女’,18。意为:用该语句中包含的参数值为模板语句incr赋值,并执行赋值后生成的语句。EXECUTE incr USING‘20145124’, ‘Zhao Liu’, ‘female’, 18. Means: Use the parameter value contained in the statement to assign a value to the template statement incr, and execute the statement generated after the assignment.
客户端C3向中间件发送SQL语句S6:Client C3 sends SQL statement S6 to the middleware:
EXECUTE info。意为:执行模板语句info。EXECUTE info. Means: Execute the template statement info.
S305:中间件根据特殊指令,以及记录的该特殊指令对应的相关信息,使用预设的发送方式将该匹配指令发送给数据库。S305: The middleware sends the matching instruction to the database by using a preset sending manner according to the special instruction and the related information corresponding to the recorded special instruction.
中间件将SQL语句S4通过数据库连接c1发送给数据库。The middleware sends the SQL statement S4 to the database through the database connection c1.
中间件根据SQL语句S5中包含的模板语句的参数值为保存的SQL语句S2包含的模板语句赋值,生成SQL语句S5’:The middleware assigns a value to the template statement contained in the saved SQL statement S2 according to the parameter value of the template statement included in the SQL statement S5, and generates the SQL statement S5':
INSERT INTO Student(Sno,Sname,Ssex,Sage,Sdept)VALUES(‘20145124’,‘赵六’,‘女’,18,‘CS’)。意为:向表Student中***一条数据记录(Sno=‘20145124’,Sname=‘赵六’,Ssex=‘女’,Sage=18,Sdept=‘CS’)。INSERT INTO Student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('20145124', 'Zhao Liu', 'Female', 18, 'CS'). This means: insert a data record into the table Student (Sno=‘20145124’, Sname=‘Zhao Liu’, Ssex=‘Female’, Sage=18, Sdept=‘CS’).
并将生成的SQL语句S5’发送给数据库。The generated SQL statement S5' is sent to the database.
中间件根据保存的SQL语句S3包含的模板语句生成SQL语句S6’:The middleware generates the SQL statement S6' according to the template statement contained in the saved SQL statement S3:
SELECT*FROM Student。意为:查询表Student中的全部数据。SELECT*FROM Student. Means: Query all the data in the table Student.
并将生成的SQL语句S6’发送给数据库。其中,由于SQL语句S3包含的模板语句不包含待定参数,则生成的SQL语句S6即为SQL语句S3包含的模板语句info。The generated SQL statement S6' is sent to the database. Wherein, since the template statement included in the SQL statement S3 does not include a pending parameter, the generated SQL statement S6 is the template statement info included in the SQL statement S3.
S306:数据库执行从中间件接收到的语句,并通过中间件向客户端返回执行结果。S306: The database executes the statement received from the middleware, and returns the execution result to the client through the middleware.
数据库成功执行SQL语句S4,将在表Student中查询到的对应数据,以及执行成功的响应通过中间件向客户端返回。其中,图5示出了查询到的对应数据,在表Student中,数据项Ssex=‘男’的数据记录为D1、D2,D1、D2的数据项Sno和Sname的取值即为SQL语句S4的查询结果。 The database successfully executes the SQL statement S4, and returns the corresponding data queried in the table Student and the successful response to the client through the middleware. 5 shows the corresponding data that is queried. In the table Student, the data record of the data item Ssex='male' is D1, D2, and the value of the data items Sno and Sname of D1 and D2 is the SQL statement S4. Query results.
数据库成功执行SQL语句S5’,向表Student中***了一条新数据项D4,并通过中间件向客户端返回执行成功的响应。图6示出了在数据库执行SQL语句S5’之后表Student的结构,表Student中增加了一条新数据项D4(Sno=‘20145124’,Sname=‘赵六’,Ssex=‘女’,Sage=18,Sdept=‘CS’)。The database successfully executes the SQL statement S5', inserts a new data item D4 into the table Student, and returns a successful execution response to the client through the middleware. Figure 6 shows the structure of the table Student after executing the SQL statement S5' in the database. A new data item D4 is added to the table Student (Sno='20145124', Sname='Zhaoliu', Ssex='female', Sage= 18, Sdept='CS').
数据库成功执行SQL语句S6’,将在表Student中查询到的对应数据,以及执行成功的响应通过中间件向客户端返回。其中,图6示出了查询到的对应数据,即为当前的表Student。The database successfully executes the SQL statement S6', and returns the corresponding data queried in the table Student and the successful response to the client through the middleware. Among them, FIG. 6 shows the corresponding data that is queried, that is, the current table Student.
以上为本发明实施例提供的一种特殊指令的执行方法,基于同样的发明思路,本发明实施例还提供一种特殊指令的执行装置,如图7所示。The above is a method for executing a special instruction according to the embodiment of the present invention. Based on the same inventive concept, the embodiment of the present invention further provides a special instruction execution device, as shown in FIG. 7 .
图7为依据本发明一个实施例的特殊指令的执行装置结构示意图,具体包括:FIG. 7 is a schematic structural diagram of an apparatus for executing a special instruction according to an embodiment of the present invention, which specifically includes:
第一发送模块701,用于发送特殊指令,并记录与所述特殊指令对应的相关信息,其中,所述相关信息包括:发送所述特殊指令所使用连接的标识,和/或所述特殊指令包含的模板指令;The first sending module 701 is configured to send a special instruction, and record related information corresponding to the special instruction, where the related information includes: an identifier of a connection used to send the special instruction, and/or the special instruction Included template instructions;
接收模块702,用于接收所述特殊指令的匹配指令;The receiving module 702 is configured to receive a matching instruction of the special instruction;
第二发送模块703,用于根据所述第一发送模块701记录的所述相关信息,采用预设的与所述相关信息对应的发送方式,将所述匹配指令发送给数据库执行。The second sending module 703 is configured to send the matching command to the database for execution according to the related information recorded by the first sending module 701 by using a preset sending manner corresponding to the related information.
当所述相关信息为发送所述特殊指令所使用连接的标识时,所述第二发送模块具体703用于,将所述匹配指令通过与发送所述特殊指令所使用连接的标识对应的连接发送给数据库执行。When the related information is the identifier of the connection used to send the special instruction, the second sending module specifically 703 is configured to send the matching instruction by using a connection corresponding to the identifier of the connection used to send the special instruction. Execute to the database.
所述装置还包括:The device also includes:
保持模块704,用于在所述第一发送模块701发送特殊指令之后,为所述数据库和所述客户端保持所述第一发送模块701发送所述特殊指令所使用的连接。The holding module 704 is configured to, after the first sending module 701 sends the special instruction, maintain the connection used by the first sending module 701 to send the special instruction for the database and the client.
当所述相关信息为所述特殊指令包含的模板指令时,所述第二发送模块703具体用于,根据所述模板指令,以及所述匹配指令生成一般指令,将生成的一般指令发送给数据库执行。When the related information is a template instruction included in the special instruction, the second sending module 703 is specifically configured to: generate a general instruction according to the template instruction, and the matching instruction, and send the generated general instruction to a database carried out.
所述第二发送模块703具体用于,判断所述模板指令中是否包含待定参 数,若是,则根据所述匹配指令中包含的参数值为所述待定参数赋值,将赋值后的模板指令作为生成的一般指令,否则,将所述模板指令作为生成的一般指令。The second sending module 703 is specifically configured to: determine whether the template instruction includes a pending parameter The number, if yes, assigns a value to the pending parameter according to the parameter value included in the matching instruction, and uses the assigned template instruction as the generated general instruction; otherwise, the template instruction is used as the generated general instruction.
所述指令包括:结构化查询语言SQL语句形式的指令;The instructions include: instructions in the form of a structured query language SQL statement;
当所述相关信息为发送所述特殊指令所使用连接的标识时,所述特殊指令包括BEGIN语句或PREPARE语句,当所述特殊指令为BEGIN语句时,所述匹配指令为与所述BEGIN语句属于同一个数据库事务的语句,当所述特殊指令为PREPARE语句时,所述匹配指令为EXECUTE语句或DEALLOCATE语句;When the related information is an identifier of a connection used to send the special instruction, the special instruction includes a BEGIN statement or a PREPARE statement, and when the special instruction is a BEGIN statement, the matching instruction belongs to the BEGIN statement The statement of the same database transaction, when the special instruction is a PREPARE statement, the matching instruction is an EXECUTE statement or a DEALLOCATE statement;
当所述相关信息为所述特殊指令包含的模板指令时,所述特殊指令包括PREPARE语句,所述匹配指令包括EXECUTE语句。When the related information is a template instruction included in the special instruction, the special instruction includes a PREPARE statement, and the matching instruction includes an EXECUTE statement.
具体的,上述如图7所示的特殊指令的执行装置可以位于中间件中。Specifically, the execution means of the special instruction shown in FIG. 7 above may be located in the middleware.
在此提供的算法和显示不与任何特定计算机、虚拟***或者其它设备固有相关。各种通用***也可以与基于在此的示教一起使用。根据上面的描述,构造这类***所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general purpose systems can also be used with the teaching based on the teachings herein. The structure required to construct such a system is apparent from the above description. Moreover, the invention is not directed to any particular programming language. It is to be understood that the invention may be embodied in a variety of programming language, and the description of the specific language has been described above in order to disclose the preferred embodiments of the invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that the embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of the description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, the various features of the invention are sometimes grouped together into a single embodiment, in the above description of the exemplary embodiments of the invention, Figure, or a description of it. However, the method disclosed is not to be interpreted as reflecting the intention that the claimed invention requires more features than those recited in the claims. Rather, as the following claims reflect, inventive aspects reside in less than all features of the single embodiments disclosed herein. Therefore, the claims following the specific embodiments are hereby explicitly incorporated into the embodiments, and each of the claims as a separate embodiment of the invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以 把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will appreciate that the modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment. Can The modules or units or components in the embodiments are combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components. In addition to such features and/or at least some of the processes or units being mutually exclusive, any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined. Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features that are included in other embodiments and not in other features, combinations of features of different embodiments are intended to be within the scope of the present invention. Different embodiments are formed and formed. For example, in the following claims, any one of the claimed embodiments can be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的特殊指令的执行装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components of the special instructions in accordance with embodiments of the present invention. The invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein. Such a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
例如,图8示出了用于执行根据本发明的方法的计算设备的框图。参见图8,该计算设备传统上包括处理器810和存储器820形式的计算机程序产品或者计算机可读介质。存储器820可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器820具有存储用于执行上述方法中的任何方法步骤的程序代码831的存储空间830。例如,存储程序代码的存储空间830可以包括分别用于实现上面的方法中的各种步骤的各个程序代码831。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程 序代码载体。这样的计算机程序产品通常为例如图9所示的便携式或者固定存储单元。该存储单元可以具有与图8的服务器中的存储器820类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括用于执行根据本发明的方法步骤的计算机可读代码831’,即可以由诸如810之类的处理器读取的代码,当这些代码由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。For example, Figure 8 shows a block diagram of a computing device for performing the method in accordance with the present invention. Referring to Figure 8, the computing device conventionally includes a computer program product or computer readable medium in the form of a processor 810 and a memory 820. The memory 820 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM. Memory 820 has a memory space 830 that stores program code 831 for performing any of the method steps described above. For example, storage space 830 storing program code may include various program code 831 for implementing various steps in the above methods, respectively. The program code can be read from or written to one or more computer program products. These computer program products include programs such as hard disks, compact discs (CDs), memory cards, or floppy disks. Sequence code carrier. Such a computer program product is typically a portable or fixed storage unit such as that shown in FIG. The storage unit may have a storage section, a storage space, and the like arranged similarly to the storage 820 in the server of FIG. The program code can be compressed, for example, in an appropriate form. Typically, the storage unit comprises computer readable code 831' for performing the steps of the method according to the invention, ie code that can be read by a processor, such as 810, which when executed by the computing device causes the computing device Perform the various steps in the method described above.
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。"an embodiment," or "an embodiment," or "an embodiment," In addition, it is noted that the phrase "in one embodiment" is not necessarily referring to the same embodiment.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”或“包括”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It is to be noted that the above-described embodiments are illustrative of the invention and are not intended to be limiting, and that the invention may be devised without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as a limitation. The word "comprising" or "comprising" does not exclude the presence of the elements or the steps in the claims. The word "a" or "an" The invention can be implemented by means of hardware comprising several distinct elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means can be embodied by the same hardware item. The use of the words first, second, and third does not indicate any order. These words can be interpreted as names.
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。In addition, it should be noted that the language used in the specification has been selected for the purpose of readability and teaching, and is not intended to be construed or limited. Therefore, many modifications and changes will be apparent to those skilled in the art without departing from the scope of the invention. The disclosure of the present invention is intended to be illustrative, and not restrictive, and the scope of the invention is defined by the appended claims.
本申请可以应用于计算机***/服务器,其可与众多其它通用或专用计算***环境或配置一起操作。适于与计算机***/服务器一起使用的众所周知的计算***、环境和/或配置的例子包括但不限于:个人计算机***、服务器计算机***、瘦客户机、厚客户机、手持或膝上设备、基于微处理器的***、机顶盒、可编程消费电子产品、网络个人电脑、小型计算机***、大型计算机***和包括上述任何***的分布式云计算技术环境,等等。 The application can be applied to a computer system/server that can operate with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments, and/or configurations suitable for use with computer systems/servers include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, based on Microprocessor systems, set-top boxes, programmable consumer electronics, networked personal computers, small computer systems, mainframe computer systems, and distributed cloud computing technology environments including any of the above, and the like.
计算机***/服务器可以在由计算机***执行的计算机***可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括例程、程序、目标程序、组件、逻辑、数据结构等等,它们执行特定的任务或者实现特定的抽象数据类型。计算机***/服务器可以在分布式云计算环境中实施,分布式云计算环境中,任务是由通过通信网络链接的远程处理设备执行的。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算***存储介质上。 The computer system/server can be described in the general context of computer system executable instructions (such as program modules) being executed by a computer system. Generally, program modules may include routines, programs, target programs, components, logic, data structures, and the like that perform particular tasks or implement particular abstract data types. The computer system/server can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices that are linked through a communication network. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including storage devices.

Claims (14)

  1. 一种特殊指令的执行方法,应用于耦接在数据库与客户端之间的中间件,所述方法包括:A method for executing a special instruction is applied to a middleware coupled between a database and a client, and the method includes:
    发送特殊指令,并记录与所述特殊指令对应的相关信息,其中,所述相关信息包括:发送所述特殊指令所使用连接的标识,和/或所述特殊指令包含的模板指令;Transmitting a special instruction, and recording related information corresponding to the special instruction, where the related information includes: an identifier of a connection used to send the special instruction, and/or a template instruction included in the special instruction;
    接收所述特殊指令的匹配指令;以及Receiving a matching instruction of the special instruction;
    根据记录的所述相关信息,采用预设的与所述相关信息对应的发送方式,将所述匹配指令发送给数据库执行。And according to the recorded related information, the matching instruction is sent to the database for execution by using a preset sending manner corresponding to the related information.
  2. 如权利要求1所述的方法,其中,当所述相关信息为发送所述特殊指令所使用连接的标识时,采用预设的与所述相关信息对应的发送方式,将所述匹配指令发送给数据库执行,具体包括:The method according to claim 1, wherein when the related information is an identifier of a connection used to send the special instruction, the matching instruction is sent to the sending mode corresponding to the related information by using a preset Database execution, including:
    将所述匹配指令通过与发送所述特殊指令所使用连接的标识对应的连接发送给数据库执行。The matching instruction is sent to the database for execution via a connection corresponding to the identity of the connection used to send the special instruction.
  3. 如权利要求2所述的方法,其中,发送特殊指令之后,所述方法还包括:The method of claim 2, wherein after transmitting the special instruction, the method further comprises:
    为所述数据库和所述客户端保持发送所述特殊指令所使用的连接。The connection used to send the special instruction is maintained for the database and the client.
  4. 如权利要求1所述的方法,其中,当所述相关信息为所述特殊指令包含的模板指令时,采用预设的与所述相关信息对应的发送方式,将所述匹配指令发送给数据库执行,具体包括:The method according to claim 1, wherein when the related information is a template instruction included in the special instruction, the matching instruction is sent to a database execution by using a preset sending manner corresponding to the related information. Specifically, including:
    根据所述模板指令,以及所述匹配指令生成一般指令;Generating a general instruction according to the template instruction and the matching instruction;
    将生成的一般指令发送给数据库执行。Send the generated general instructions to the database for execution.
  5. 如权利要求4所述的方法,其中,根据所述模板指令,以及所述匹配指令生成一般指令,具体包括:The method of claim 4, wherein the generating the general instruction according to the template instruction and the matching instruction comprises:
    判断所述模板指令中是否包含待定参数;Determining whether the template instruction includes a pending parameter;
    若是,则根据所述匹配指令中包含的参数值为所述待定参数赋值,将赋值后的模板指令作为生成的一般指令;If yes, assigning a value to the undetermined parameter according to the parameter value included in the matching instruction, and using the assigned template instruction as the generated general instruction;
    否则,将所述模板指令作为生成的一般指令。Otherwise, the template instruction is taken as the generated general instruction.
  6. 如权利要求1~5任一所述的方法,其中,所述指令包括:结构化查 询语言SQL语句形式的指令;The method of any one of claims 1 to 5, wherein the instructions comprise: structural checking Instruct the instruction in the form of a language SQL statement;
    当所述相关信息为发送所述特殊指令所使用连接的标识时,所述特殊指令包括BEGIN语句或PREPARE语句,当所述特殊指令为BEGIN语句时,所述匹配指令为与所述BEGIN语句属于同一个数据库事务的语句,当所述特殊指令为PREPARE语句时,所述匹配指令为EXECUTE语句或DEALLOCATE语句;When the related information is an identifier of a connection used to send the special instruction, the special instruction includes a BEGIN statement or a PREPARE statement, and when the special instruction is a BEGIN statement, the matching instruction belongs to the BEGIN statement The statement of the same database transaction, when the special instruction is a PREPARE statement, the matching instruction is an EXECUTE statement or a DEALLOCATE statement;
    当所述相关信息为所述特殊指令包含的模板指令时,所述特殊指令包括PREPARE语句,所述匹配指令包括EXECUTE语句。When the related information is a template instruction included in the special instruction, the special instruction includes a PREPARE statement, and the matching instruction includes an EXECUTE statement.
  7. 一种特殊指令的执行装置,耦接于数据库与客户端之间,所述装置包括:A special instruction execution device is coupled between the database and the client, and the device includes:
    第一发送模块,用于发送特殊指令,并记录与所述特殊指令对应的相关信息,其中,所述相关信息包括:发送所述特殊指令所使用连接的标识,和/或所述特殊指令包含的模板指令;a first sending module, configured to send a special instruction, and record related information corresponding to the special instruction, where the related information includes: an identifier of a connection used to send the special instruction, and/or the special instruction includes Template instruction;
    接收模块,用于接收所述特殊指令的匹配指令;a receiving module, configured to receive a matching instruction of the special instruction;
    第二发送模块,用于根据所述第一发送模块记录的所述相关信息,采用预设的与所述相关信息对应的发送方式,将所述匹配指令发送给数据库执行。The second sending module is configured to send the matching instruction to the database for execution according to the related information recorded by the first sending module by using a preset sending manner corresponding to the related information.
  8. 如权利要求7所述的装置,其中,当所述相关信息为发送所述特殊指令所使用连接的标识时,所述第二发送模块具体用于,将所述匹配指令通过与发送所述特殊指令所使用连接的标识对应的连接发送给数据库执行。The apparatus according to claim 7, wherein when the related information is an identifier of a connection used to send the special instruction, the second sending module is specifically configured to: pass the matching instruction and send the special The connection corresponding to the identity of the connection used by the instruction is sent to the database for execution.
  9. 如权利要求8所述的装置,其中,所述装置还包括:The device of claim 8 wherein said device further comprises:
    保持模块,用于在所述第一发送模块发送特殊指令之后,为所述数据库和所述客户端保持所述第一发送模块发送所述特殊指令所使用的连接。And a holding module, configured to: after the first sending module sends the special instruction, maintain the connection used by the first sending module to send the special instruction for the database and the client.
  10. 如权利要求7所述的装置,其中,当所述相关信息为所述特殊指令包含的模板指令时,所述第二发送模块具体用于,根据所述模板指令,以及所述匹配指令生成一般指令,将生成的一般指令发送给数据库执行。The device according to claim 7, wherein when the related information is a template instruction included in the special instruction, the second sending module is specifically configured to generate a general according to the template instruction and the matching instruction. The instruction sends the generated general instructions to the database for execution.
  11. 如权利要求10所述的装置,其中,所述第二发送模块具体用于,判断所述模板指令中是否包含待定参数,若是,则根据所述匹配指令中包含的参数值为所述待定参数赋值,将赋值后的模板指令作为生成的一般指令,否则,将所述模板指令作为生成的一般指令。 The device according to claim 10, wherein the second sending module is specifically configured to: determine whether the template instruction includes a pending parameter, and if yes, determine the parameter to be determined according to the parameter value included in the matching instruction. Assignment, the assigned template instruction is used as the generated general instruction, otherwise, the template instruction is taken as the generated general instruction.
  12. 如权利要求6~11任一所述的装置,其中,所述指令包括:结构化查询语言SQL语句形式的指令;The apparatus of any one of claims 6 to 11, wherein the instructions comprise: instructions in the form of a structured query language SQL statement;
    当所述相关信息为发送所述特殊指令所使用连接的标识时,所述特殊指令包括BEGIN语句或PREPARE语句,当所述特殊指令为BEGIN语句时,所述匹配指令为与所述BEGIN语句属于同一个数据库事务的语句,当所述特殊指令为PREPARE语句时,所述匹配指令为EXECUTE语句或DEALLOCATE语句;When the related information is an identifier of a connection used to send the special instruction, the special instruction includes a BEGIN statement or a PREPARE statement, and when the special instruction is a BEGIN statement, the matching instruction belongs to the BEGIN statement The statement of the same database transaction, when the special instruction is a PREPARE statement, the matching instruction is an EXECUTE statement or a DEALLOCATE statement;
    当所述相关信息为所述特殊指令包含的模板指令时,所述特殊指令包括PREPARE语句,所述匹配指令包括EXECUTE语句。When the related information is a template instruction included in the special instruction, the special instruction includes a PREPARE statement, and the matching instruction includes an EXECUTE statement.
  13. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据权利要求1-6中的任一项所述的特殊指令的执行方法。A computer program comprising computer readable code, when the computer readable code is run on a computing device, causing the computing device to perform the method of executing the special instructions of any one of claims 1-6 .
  14. 一种计算机可读介质,其中存储了如权利要求13所述的计算机程序。 A computer readable medium storing the computer program of claim 13.
PCT/CN2015/095543 2014-12-12 2015-11-25 Method and device for executing special instruction WO2016091068A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410768908.7 2014-12-12
CN201410768908.7A CN104636131B (en) 2014-12-12 2014-12-12 A kind of execution method and device of special instruction

Publications (1)

Publication Number Publication Date
WO2016091068A1 true WO2016091068A1 (en) 2016-06-16

Family

ID=53214932

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/095543 WO2016091068A1 (en) 2014-12-12 2015-11-25 Method and device for executing special instruction

Country Status (2)

Country Link
CN (1) CN104636131B (en)
WO (1) WO2016091068A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3989064A4 (en) * 2019-07-17 2022-08-10 ZTE Corporation Distributed database preprocessing method, agent layer, system and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636131B (en) * 2014-12-12 2018-07-27 北京奇虎科技有限公司 A kind of execution method and device of special instruction
CN107122633B (en) * 2016-02-24 2020-05-12 阿里巴巴集团控股有限公司 Instruction execution method and device of application program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477496A (en) * 2002-08-23 2004-02-25 梁国恩 Intermedium software tool for server access SQL data base
CN102156720A (en) * 2011-03-28 2011-08-17 中国人民解放军国防科学技术大学 Method, device and system for restoring data
CN103678632A (en) * 2013-12-19 2014-03-26 成都市卓睿科技有限公司 System and method for updating data fast in data system
CN103761240A (en) * 2013-12-12 2014-04-30 北京奇虎科技有限公司 Database access method and database access device
CN104636131A (en) * 2014-12-12 2015-05-20 北京奇虎科技有限公司 Special instruction execution method and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100337235C (en) * 2003-06-23 2007-09-12 华为技术有限公司 Method and apparatus for accessing database
US8041821B2 (en) * 2003-11-26 2011-10-18 International Business Machines Corporation Connection pool management
CN101753552A (en) * 2008-12-01 2010-06-23 鸿富锦精密工业(深圳)有限公司 Network communication system and method
US8484242B1 (en) * 2010-08-24 2013-07-09 ScalArc, Inc. Method and system for transparent database connection pooling and query queuing
CN103365929B (en) * 2012-04-10 2016-09-28 阿里巴巴集团控股有限公司 The management method of a kind of data base connection and system
CN102750384A (en) * 2012-06-28 2012-10-24 用友软件股份有限公司 Device and method for acquiring data from multidatabase engine
CN103810203B (en) * 2012-11-13 2018-02-27 深圳市腾讯计算机***有限公司 A kind of data base management system connection multiplexing method and device
CN103559204A (en) * 2013-10-08 2014-02-05 北京奇虎科技有限公司 Database operation request processing method, unit and system
CN103544284B (en) * 2013-10-25 2018-06-12 北京奇虎科技有限公司 Character code update the system and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477496A (en) * 2002-08-23 2004-02-25 梁国恩 Intermedium software tool for server access SQL data base
CN102156720A (en) * 2011-03-28 2011-08-17 中国人民解放军国防科学技术大学 Method, device and system for restoring data
CN103761240A (en) * 2013-12-12 2014-04-30 北京奇虎科技有限公司 Database access method and database access device
CN103678632A (en) * 2013-12-19 2014-03-26 成都市卓睿科技有限公司 System and method for updating data fast in data system
CN104636131A (en) * 2014-12-12 2015-05-20 北京奇虎科技有限公司 Special instruction execution method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3989064A4 (en) * 2019-07-17 2022-08-10 ZTE Corporation Distributed database preprocessing method, agent layer, system and storage medium
US11847116B2 (en) 2019-07-17 2023-12-19 Xi'an Zhongxing New Software Co., Ltd. Distributed database preprocessing method, agent layer, system and storage medium

Also Published As

Publication number Publication date
CN104636131A (en) 2015-05-20
CN104636131B (en) 2018-07-27

Similar Documents

Publication Publication Date Title
CN108537543B (en) Parallel processing method, device, equipment and storage medium for blockchain data
WO2019140828A1 (en) Electronic apparatus, method for querying logs in distributed system, and storage medium
WO2016091069A1 (en) Data operation method and device
CN108664650B (en) Transaction processing method, device, equipment and storage medium of block chain network
US10162735B2 (en) Distributed system test automation framework
TWI726573B (en) Block chain-based data compression and query method and device and electronic equipment
US20150310209A1 (en) Executing third-party application
US10901621B2 (en) Dual-level storage device reservation
CN105468300B (en) The management method and device of IP hard disks
US10963888B2 (en) Payment complaint method, device, server and readable storage medium
WO2017101642A1 (en) Method and apparatus for upgrading data node of distributed system
US20180081683A1 (en) Task assignment using machine learning and information retrieval
US10261767B2 (en) Data integration job conversion
CN109951553B (en) Data processing method, system, electronic device and computer readable storage medium
WO2016091068A1 (en) Method and device for executing special instruction
JP2023036774A (en) Access control method of shared memory, access control device of shared memory, electronic apparatus, and autonomous vehicle
WO2019033741A1 (en) Investment commodity resource processing method, device, storage medium and computer apparatus
CN110018935A (en) Store apparatus testing method, system, device and computer readable storage medium
US20180011886A1 (en) Parallel transfers of electronic data
US20210160253A1 (en) Methods and systems for identifying an iot device
CN109086380B (en) Method and system for compressing and storing historical data
WO2016155384A1 (en) Search optimization method, apparatus, and system
CN116304079A (en) Timing-based profile data management method, apparatus, and readable storage medium
WO2021027328A1 (en) Vulnerability processing tracking method and apparatus, computer system, and readable storage medium
WO2015196844A1 (en) Task assignment method, apparatus, system and server

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15867754

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15867754

Country of ref document: EP

Kind code of ref document: A1