CN114238407A - Pre-compiling method and system based on sub-library and sub-table middleware - Google Patents

Pre-compiling method and system based on sub-library and sub-table middleware Download PDF

Info

Publication number
CN114238407A
CN114238407A CN202111562664.3A CN202111562664A CN114238407A CN 114238407 A CN114238407 A CN 114238407A CN 202111562664 A CN202111562664 A CN 202111562664A CN 114238407 A CN114238407 A CN 114238407A
Authority
CN
China
Prior art keywords
template
compiling
target
database
precompilation
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202111562664.3A
Other languages
Chinese (zh)
Inventor
蒲兆楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An E Wallet Electronic Commerce Co Ltd
Original Assignee
Ping An E Wallet Electronic Commerce Co Ltd
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 Ping An E Wallet Electronic Commerce Co Ltd filed Critical Ping An E Wallet Electronic Commerce Co Ltd
Priority to CN202111562664.3A priority Critical patent/CN114238407A/en
Publication of CN114238407A publication Critical patent/CN114238407A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Abstract

The invention discloses a precompilation method based on a library-based and table-based middleware, which comprises the following steps: receiving a first pre-compiling request sent by a client, wherein the first pre-compiling request comprises a compiling parameter, a target template identifier of a target pre-compiling template and a first pre-compiling identifier; inquiring a target precompiled template corresponding to the target template identifier from a storage unit based on the target template identifier, and filling the compiling parameters into the target precompiled template to obtain a target compiling template; sending the target compiling template to a database based on a preset routing rule so that the database executes a corresponding structured query statement according to the target compiling template to obtain a target result set; and returning the target result set returned by the database to the client. The invention can effectively solve the problem of low compiling efficiency.

Description

Pre-compiling method and system based on sub-library and sub-table middleware
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a precompilation method and a precompilation system based on a database and table division middleware.
Background
With the increase of services and flow, the requirements on the library and table splitting middleware are higher and higher. For the middle of the sub-base and the sub-table, the function of supporting oracle precompilation of the sql statement can effectively improve the access efficiency and the execution speed of the sql. The database and table division middleware can greatly reduce the interaction times with the database and reduce the size of the data packet interacting with the database by realizing the pre-compiling function of the sql. At present, the inventor finds that the existing library and table dividing middleware mainly has the following problems: the existing library and table division middleware has poor compatibility when being precompiled; and pre-compilation cannot perfectly support routing rules of different sub-libraries.
Disclosure of Invention
In view of the above, an object of the embodiments of the present invention is to provide a precompilation method and system based on a library-based and table-based middleware, so as to solve the problem of low precompilation efficiency in the prior art.
In order to achieve the above object, an embodiment of the present invention provides a precompilation method based on a library and table splitting middleware, including:
receiving a first pre-compiling request sent by a client, wherein the first pre-compiling request comprises a compiling parameter, a target template identifier of a target pre-compiling template and a first pre-compiling identifier;
inquiring a precompiled template corresponding to the target template identifier from a storage unit based on the target template identifier, and filling the compiling parameters into the precompiled template corresponding to the target template identifier to obtain a target compiling template;
sending the target compiling template to a database based on a preset routing rule so that the database executes a corresponding structured query statement according to the target compiling template to obtain a target result set; and are
And returning the target result set returned by the database to the client.
Further, before the target compiling template is sent to a database based on a preset routing rule, so that the database executes a corresponding structured query statement according to the target compiling template, and a target result set is obtained, the method further includes:
receiving a second pre-compiling request sent by a client, wherein the second pre-compiling request comprises a pre-compiling template and a second pre-compiling identifier;
analyzing the second precompilation request according to the second precompilation identifier to obtain the precompilation template;
analyzing the precompiled template to obtain template parameters contained in the precompiled template;
generating a template identifier of the precompiled template according to the template parameter;
and returning the template identifier and the template parameters to the client, so that the client can associate the precompiled template with the template identifier and store the precompiled template and the template identifier in the storage unit.
Further, the storage unit stores a plurality of precompiled templates in advance, and each precompiled template is used for executing different structured query statements on the compiling parameters.
Further, the storage unit is a storage module of the library-splitting table-splitting middleware or the storage unit is an external cache.
Further, when the database is provided with a plurality of databases and receives a plurality of first precompilation requests sent by the client, the method further comprises:
and respectively sending the target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule.
Further, the sending, based on the preset routing rule, the target compilation templates corresponding to the plurality of first pre-compilation requests to the plurality of databases respectively includes:
averagely sending target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule; or
Acquiring the execution condition of each database;
and respectively sending the target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule and the execution condition.
Further, when the database is provided with a plurality of databases and receives a first precompilation request sent by the client, the method further comprises:
acquiring the execution condition of each database;
determining a target database from the plurality of databases according to the execution condition of each database;
and sending the target compiling template corresponding to the first pre-compiling request to a target database based on the preset routing rule.
To achieve the above object, an embodiment of the present invention provides a precompilation system based on a library and table splitting middleware, including:
the system comprises a receiving module, a compiling module and a compiling module, wherein the receiving module is used for receiving a first pre-compiling request sent by a client, and the first pre-compiling request comprises a compiling parameter, a target template identifier of a target pre-compiling template and a first pre-compiling identifier;
the query module is used for querying a precompiled template corresponding to the target template identifier from a storage unit based on the target template identifier, and filling the compiling parameters into the precompiled template corresponding to the target template identifier to obtain a target compiling template;
the sending module is used for sending the target compiling template to a database based on a preset routing rule so that the database executes a corresponding structured query statement according to the target compiling template to obtain a target result set; and
and the return module is used for returning the target result set returned by the database to the client.
In order to achieve the above object, an embodiment of the present invention provides a computer device, where the computer device includes a memory and a processor, where the memory stores a computer program that is executable on the processor, and the computer program, when executed by the processor, implements the steps of the foregoing precompilation method based on the library and table middleware.
To achieve the above object, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, where the computer program is executable by at least one processor, so as to cause the at least one processor to execute the steps of the foregoing precompilation method based on a sub-library and sub-table middleware.
According to the precompilation method and system based on the sub-library and sub-table middleware provided by the embodiment of the invention, the corresponding target precompilation template is inquired through the target template identifier, the compiling parameter is filled into the target precompilation template to obtain the target compiling template, and then the target compiling template is transmitted to the database to be operated to obtain the corresponding result set, so that the time for compiling codes by the sub-library and sub-table middleware for compiling each compiling request is saved, and the compiling efficiency is improved.
Drawings
FIG. 1 is a flowchart of a first embodiment of a precompilation method based on a library-based and table-based middleware according to the present invention.
FIG. 2 is a schematic diagram of program modules of a second embodiment of a pre-compilation system based on a library-based and table-based middleware according to the present invention.
Fig. 3 is a schematic diagram of a hardware structure of a third embodiment of the computer device according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the descriptions relating to "first", "second", etc. in the embodiments of the present invention are only for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Example one
Referring to fig. 1, a flowchart illustrating steps of a precompilation method based on a library-table middleware according to a first embodiment of the present invention is shown. It is to be understood that the flow charts in the embodiments of the present method are not intended to limit the order in which the steps are performed. The following description is made by way of example with the computer device 2 as the execution subject. The details are as follows.
Step S100, receiving a first pre-compiling request sent by a client, wherein the first pre-compiling request comprises a compiling parameter, a target template identifier of a target pre-compiling template and a first pre-compiling identifier.
Specifically, the first pre-compilation request is used for performing pre-compilation operation on the compilation parameter based on the target pre-compilation template based on the first pre-compilation identifier, and the pre-compilation operation includes sql pre-compilation operation and Oracle pre-compilation operation. The compiling parameter comprises data compiled by the target precompiling template, and the first precompiling identifier is used for indicating the database to carry out precompiling operation. The target template identifier is used for acquiring a corresponding precompiled template and acquiring the corresponding target template identifier from the first precompiled request.
And S102, inquiring a precompiled template corresponding to the target template identifier from a storage unit based on the target template identifier, and filling the compiling parameters into the precompiled template corresponding to the target template identifier to obtain a target compiling template.
Specifically, if a plurality of precompiled templates are stored in a storage module of the sub-library and sub-table middleware in advance, the sub-library and sub-table middleware acquires a corresponding target precompiled template according to a target template identifier, and fills the precompiled template with compiling parameters to obtain the target precompiled template.
In an exemplary embodiment, in order to better perform a precompilation operation according to a structured query statement, the storage unit stores a plurality of precompilation templates in advance, and each precompilation template is used for executing a different structured query statement on the compilation parameter.
In an exemplary embodiment, the storage unit is a storage module of the sub-library and sub-table middleware or the storage unit is an external cache. When the storage unit is a storage module, the database-based and table-based middleware can conveniently query the precompiled template. When the storage unit is an external cache, the client side can conveniently maintain the mapping relation between the template identifier sqlId and the precompiled template. The sub-library and sub-table middleware can also access an external cache to query the precompiled template.
And step S104, sending the target compiling template to a database based on a preset routing rule, so that the database executes a corresponding structured query statement according to the target compiling template to obtain a target result set.
Specifically, after the target compiling template is obtained, the target compiling template and the first pre-compiling identifier are sent to a corresponding database according to a preset routing rule, the database performs pre-compiling on the target compiling template according to the first pre-compiling identifier, corresponding structured query statements are executed, the executed structured query statements are sql statements, and a corresponding target result set is obtained. The routing rule comprises a routing path for accessing the database, is used for realizing routing forwarding of the target compiling template, and can send different target compiling templates to different databases according to the routing path.
And step S106, returning the target result set returned by the database to the client.
Specifically, the sub-library and sub-table middleware receives a target result set responded by the database and returns the target result set to the client. The method can ensure that the client side has no perception in use, and can perfectly support the database to pre-compile the sql statements, thereby greatly reducing the interaction times between the client side and the database, and reducing the size of each interaction data packet, namely increasing the concurrency and improving the interaction efficiency.
In an exemplary embodiment, before the step S104, the method further includes:
step S110, receiving a second precompilation request sent by the client, where the second precompilation request includes a precompilation template and a second precompilation identifier. Step S112, the second precompilation request is analyzed according to the second precompilation identifier, and the precompilation template is obtained. And S114, analyzing the precompiled template to obtain template parameters contained in the precompiled template. And step S116, generating a template identifier of the precompiled template according to the template parameter. Step S118, returning the template identifier and the template parameter to the client, so that the client associates the pre-compiled template with the template identifier and stores the pre-compiled template in the storage unit.
Specifically, when the client initiates a precompilation request for the first time, namely a second precompilation request, the library-based sub-table middleware analyzes and records the precompilation statement sql of the client, analyzes the precompilation statement to obtain the function of each sql statement, and converts the precompilation statement sql into a precompilation template according to the function. For example: sql statements for querying data, sql statements for processing query data: the sorted sql sentences, the averaging sql sentences, the maximum-value sql sentences and the like are determined by the corresponding keywords in the sql sentences. For example: the sql statement of select username from userinfo is the sql statement of query data, the keyword is select … from, and no other keywords appear; the sql statement of select username from userinfo order by is an order sql statement, and the keyword is order by. And simultaneously generating a template identifier sqlId from the corresponding precompiled template, and returning the template identifier sqlId and template parameters, wherein the template parameters comprise the template parameters of the precompiled statement sql, the number of columns to be inquired and the like. The client side can maintain the mapping relation between the template identification sqlId and the pre-compiling template in the cache, and then the initiated pre-compiling request can comprise the template identification sqlId and the corresponding sql template parameter so as to carry out pre-compiling operation. And after receiving the precompilation request, the library-based sub-table middleware finds a corresponding precompilation template according to the template identifier sqlId, and fills template parameters into the precompilation template. And then the library-based and table-divided middleware forwards the filled precompiled templates to corresponding Database nodes according to the routing rules for precompiling (by using a jdbc (Java Database Connectivity, Database link for short) native precompiled strategy). And returning the result set returned by the database node to the client after the database sub-table middleware receives the result set. After the operations, when the client sends the same request of the pre-compiling operation for the second time, namely when the first pre-compiling request is sent, the result set can be inquired only by sending the corresponding template identifier sqlId and the template parameter to the database sub-table middleware without sending the pre-compiling template again, so that the pre-compiling efficiency is greatly improved.
To improve the efficiency of compilation, a pre-compilation operation is performed prior to performing compilation. The pre-compiling is to cache the execution code compiled by the compiler of the database DB each time the pre-compiled statement is compiled, and the cached execution code forms a pre-compiling template. When calling next time, the compiling is not needed as long as the same precompiled statement is used, and the compiling parameters are executed as long as the compiling parameters are directly transmitted into the precompiled template. The precompiled template after precompilation can be directly executed under most conditions, the database DBMS does not need to be recompiled, the more complicated sql is, the higher the compiling complexity is, multiple compiling operations can be combined into one operation in the precompilation stage, and the performance can be further improved.
In an exemplary embodiment, when the database is provided with a plurality of precompilation requests and a plurality of first precompilation requests sent by the client are received, in order to prevent the database from being over stressed, the method further includes:
and respectively sending the target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule.
In an exemplary embodiment, the sending, based on the preset routing rule, target compilation templates corresponding to a plurality of the first precompilation requests to a plurality of databases respectively includes:
averagely sending target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule; or
Acquiring the execution condition of each database;
and respectively sending the target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule and the execution condition.
Specifically, when the number of the first precompilation requests is too large, in order to prevent the pressure on the single database from being too large and further influence the execution efficiency of the database, the target compilation templates corresponding to the number of the first precompilation requests are respectively sent to the number of databases based on the execution condition, that is, the running condition, of each database.
In an exemplary embodiment, when the database is provided with a plurality of databases and receives a first precompilation request sent by the client, for better precompilation operation, the method further includes:
and step S120, acquiring the execution condition of each database. And step S122, determining a target database from the plurality of databases according to the execution condition of each database. And step S124, sending the target compiling template corresponding to the first pre-compiling request to a target database based on the preset routing rule.
Specifically, in order to improve the execution efficiency, the target compiling template is sent to a target database with a better execution condition, namely, a target database with a low database execution pressure.
Example two
Referring to fig. 2, a program module diagram of a second embodiment of the precompilation system based on the library and table middleware of the present invention is shown. In this embodiment, the pre-compiling system 20 based on the sub-library and sub-table middleware may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to implement the present invention and implement the above-mentioned pre-compiling method based on the sub-library and sub-table middleware. The program module referred to in the embodiments of the present invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable for describing the execution process of the pre-compiling system 20 based on the sub-library and sub-table middleware in the storage medium than the program itself. The following description will specifically describe the functions of the program modules of the present embodiment:
the receiving module 200 is configured to receive a first pre-compilation request sent by a client, where the first pre-compilation request includes a compilation parameter, a target template identifier of a target pre-compilation template, and a first pre-compilation identifier.
Specifically, the first pre-compilation request is used for performing pre-compilation operation on the compilation parameter based on the target pre-compilation template based on the first pre-compilation identifier, and the pre-compilation operation includes sql pre-compilation operation and Oracle pre-compilation operation. The compiling parameter comprises data compiled by the target precompiling template, and the first precompiling identifier is used for indicating the database to carry out precompiling operation. The target template identifier is used for acquiring a corresponding precompiled template and acquiring the corresponding target template identifier from the first precompiled request.
The query module 202 is configured to query, based on the target template identifier, a precompiled template corresponding to the target template identifier from a storage unit, and fill the compiling parameter into the precompiled template corresponding to the target template identifier to obtain a target compiling template.
Specifically, if a plurality of precompiled templates are stored in a storage module of the sub-library and sub-table middleware in advance, a corresponding target precompiled template is obtained according to a target template identifier, and the target precompiled template is obtained by filling the precompiled template with compiling parameters.
In an exemplary embodiment, for better performing a precompilation operation, the storage unit stores a plurality of precompilation templates in advance, each precompilation template being used for performing a different precompilation operation on the compilation parameters.
In an exemplary embodiment, the storage unit is a storage module of the sub-library and sub-table middleware or the storage unit is an external cache. When the storage unit is a storage module, the database-based and table-based middleware can conveniently query the precompiled template. When the storage unit is an external cache, the client side can conveniently maintain the mapping relation between the template identifier sqlId and the precompiled template. The sub-library and sub-table middleware can also access an external cache to query the precompiled template.
A sending module 204, configured to send the target compiling template to a database based on a preset routing rule, so that the database executes a corresponding structured query statement according to the target compiling template to obtain a target result set.
Specifically, after the target compiling template is obtained, the target compiling template and the first pre-compiling identifier are sent to a corresponding database according to a preset routing rule, the database performs pre-compiling on the target compiling template according to the first pre-compiling identifier, corresponding structured query statements are executed, the executed structured query statements are sql statements, and a corresponding target result set is obtained. The routing rule comprises a routing path for accessing the database, is used for realizing routing forwarding of the target compiling template, and can send different target compiling templates to different databases according to the routing path.
A returning module 206, configured to return the target result set returned by the database to the client.
Specifically, the sub-library and sub-table middleware receives a target result set responded by the database and returns the target result set to the client. The method can ensure that the client side has no perception in use, and can perfectly support the database to pre-compile the sql statements, thereby greatly reducing the interaction times between the client side and the database, and reducing the size of each interaction data packet, namely increasing the concurrency and improving the interaction efficiency.
EXAMPLE III
Fig. 3 is a schematic diagram of a hardware architecture of a computer device according to a third embodiment of the present invention. In the present embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a preset or stored instruction. The computer device 2 may be a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers), and the like. As shown in fig. 3, the computer device 2 includes, but is not limited to, at least a memory 21, a processor 22, a network interface 23, and a precompilation system 20 based on a sub-library and sub-table middleware, which are communicatively connected to each other through a system bus. Wherein:
in this embodiment, the memory 21 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 21 may be an internal storage unit of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the computer device 2. Of course, the memory 21 may also comprise both internal and external memory units of the computer device 2. In this embodiment, the memory 21 is generally used for storing an operating system and various application software installed on the computer device 2, such as the program codes of the precompilation system 20 based on the library-based and table-divided middleware in the second embodiment. Further, the memory 21 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 22 is typically used to control the overall operation of the computer device 2. In this embodiment, the processor 22 is configured to run the program codes stored in the memory 21 or process data, for example, run the precompilation system 20 based on the sub-library and sub-table middleware, so as to implement the precompilation method based on the sub-library and sub-table middleware of the first embodiment.
The network interface 23 may comprise a wireless network interface or a wired network interface, and the network interface 23 is generally used for establishing communication connection between the server 2 and other electronic devices. For example, the network interface 23 is used to connect the server 2 to an external terminal via a network, establish a data transmission channel and a communication connection between the server 2 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), Wi-Fi, and the like. It is noted that fig. 3 only shows the computer device 2 with components 20-23, but it is to be understood that not all shown components are required to be implemented, and that more or less components may be implemented instead.
In this embodiment, the pre-compiling system 20 based on the sub-library and sub-table middleware stored in the memory 21 can be further divided into one or more program modules, and the one or more program modules are stored in the memory 21 and executed by one or more processors (in this embodiment, the processor 22) to complete the present invention.
For example, fig. 2 shows a schematic diagram of program modules of the second embodiment of implementing the pre-compiling system 20 based on the sub-library and sub-table middleware, in this embodiment, the pre-compiling system 20 based on the sub-library and sub-table middleware may be divided into the receiving module 200, the querying module 202, the sending module 204, and the returning module 206. The program module referred to in the present invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable than a program for describing the execution process of the pre-compiling system 20 based on the sub-library and sub-table middleware in the computer device 2. The specific functions of the program modules 200 and 206 have been described in detail in the second embodiment, and are not described herein again.
Example four
The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer-readable storage medium of this embodiment is used for a computer program, and when executed by a processor, the computer program implements the method for precompilation based on a sub-library and sub-table middleware of the first embodiment.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A precompilation method based on sub-library and sub-table middleware is characterized by comprising the following steps:
receiving a first pre-compiling request sent by a client, wherein the first pre-compiling request carries a compiling parameter, a target template identifier of a target pre-compiling template and a first pre-compiling identifier;
inquiring a precompiled template corresponding to the target template identifier from a storage unit, and filling the compiling parameters into the precompiled template corresponding to the target template identifier to obtain a target compiling template;
sending the target compiling template to a database based on a preset routing rule so that the database executes a corresponding structured query statement according to the target compiling template to obtain a target result set; and are
And returning the target result set returned by the database to the client.
2. The method for precompilation based on a library-table middleware according to claim 1, wherein before the target compilation template is sent to a database based on a preset routing rule, so that the database executes a corresponding structured query statement according to the target compilation template, and a target result set is obtained, the method further comprises:
receiving a second pre-compiling request sent by a client, wherein the second pre-compiling request comprises a pre-compiling template and a second pre-compiling identifier;
analyzing the second precompilation request according to the second precompilation identifier to obtain the precompilation template;
analyzing the precompiled template to obtain template parameters contained in the precompiled template;
generating a template identifier of the precompiled template according to the template parameter;
and returning the template identifier and the template parameters to the client, so that the client can associate the precompiled template with the template identifier and store the precompiled template and the template identifier in the storage unit.
3. The library-based and table-splitting middleware of claim 2, wherein the storage unit stores a plurality of precompiled templates in advance, and each precompiled template is used for executing different structured query statements on the compiling parameters.
4. The pre-compiling method based on the sub-library and sub-table middleware of claim 3, wherein the storage unit is a storage module of the sub-library and sub-table middleware or the storage unit is an external cache.
5. The method for precompilation based on library-table middleware of claim 1, wherein when the database is provided with a plurality of databases and receives a plurality of first precompilation requests sent by the client, the method further comprises:
and respectively sending the target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule.
6. The method for precompilation based on library-dividing and table-dividing middleware according to claim 5, wherein the sending the target compilation templates corresponding to the first precompilation requests to the databases based on the preset routing rule comprises:
averagely sending target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule; or
Acquiring the execution condition of each database;
and respectively sending the target compiling templates corresponding to the first pre-compiling requests to a plurality of databases based on the preset routing rule and the execution condition.
7. The method for precompilation based on library-table middleware of claim 1, wherein when the database is provided with a plurality of databases and receives a first precompilation request sent by the client, the method further comprises:
acquiring the execution condition of each database;
determining a target database from the plurality of databases according to the execution condition of each database;
and sending the target compiling template corresponding to the first pre-compiling request to a target database based on the preset routing rule.
8. A precompilation system based on a library and table middleware, comprising:
the system comprises a receiving module, a compiling module and a compiling module, wherein the receiving module is used for receiving a first pre-compiling request sent by a client, and the first pre-compiling request carries a compiling parameter, a target template identifier of a target pre-compiling template and a first pre-compiling identifier;
the query module is used for querying the precompiled template corresponding to the target template identifier from the storage unit based on the target template identifier, and filling the compiling parameters into the target precompiled template corresponding to the target template identifier to obtain a target compiling template;
the sending module is used for sending the target compiling template to a database based on a preset routing rule so that the database executes a corresponding structured query statement according to the target compiling template to obtain a target result set; and
and the return module is used for returning the target result set returned by the database to the client.
9. A computer device, characterized in that the computer device comprises a memory, a processor, the memory having stored thereon a computer program being executable on the processor, the computer program, when executed by the processor, implementing the steps of the method for precompilation based on a banking and sub-table middleware according to any one of claims 1-7.
10. A computer-readable storage medium, having stored therein a computer program executable by at least one processor to cause the at least one processor to perform the steps of the method for pre-compiling based on a sub-library and sub-table middleware according to any one of claims 1-7.
CN202111562664.3A 2021-12-20 2021-12-20 Pre-compiling method and system based on sub-library and sub-table middleware Pending CN114238407A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111562664.3A CN114238407A (en) 2021-12-20 2021-12-20 Pre-compiling method and system based on sub-library and sub-table middleware

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111562664.3A CN114238407A (en) 2021-12-20 2021-12-20 Pre-compiling method and system based on sub-library and sub-table middleware

Publications (1)

Publication Number Publication Date
CN114238407A true CN114238407A (en) 2022-03-25

Family

ID=80759364

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111562664.3A Pending CN114238407A (en) 2021-12-20 2021-12-20 Pre-compiling method and system based on sub-library and sub-table middleware

Country Status (1)

Country Link
CN (1) CN114238407A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996361A (en) * 2022-07-29 2022-09-02 阿里巴巴(中国)有限公司 Data processing method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996361A (en) * 2022-07-29 2022-09-02 阿里巴巴(中国)有限公司 Data processing method and system
CN114996361B (en) * 2022-07-29 2022-11-22 阿里巴巴(中国)有限公司 Data processing method and system

Similar Documents

Publication Publication Date Title
WO2020233367A1 (en) Blockchain data storage and query method, apparatus and device, and storage medium
CN111259036B (en) Cross-library and cross-table query method, device, server and storage medium
CN107250983B (en) Apparatus and method for query just-in-time JIT compilation and execution
CN110019080B (en) Data access method and device
CN111339041A (en) File parsing and warehousing and file generating method and device
CN111611207B (en) State data processing method and device and computer equipment
CN111444455A (en) Browser compatible method, system, computer device and storage medium
CN111209298A (en) Method, device, equipment and storage medium for querying database data
CN111177776A (en) Multi-tenant data isolation method and system
CN112416964A (en) Data processing method, device and system, computer equipment and computer readable storage medium
CN111654542B (en) Proxy server, execution server, reception device, and task execution method
CN110674205B (en) Single table query method, device, terminal and readable storage medium
CN110674427B (en) Method, device, equipment and storage medium for responding to webpage access request
CN114238407A (en) Pre-compiling method and system based on sub-library and sub-table middleware
CN116166700A (en) Query method, device, system, electronic equipment and storage medium
CN112422450A (en) Computer equipment, and flow control method and device for service request
CN109388651B (en) Data processing method and device
CN112541001A (en) Data query method, device, storage medium and equipment
CN111291137A (en) Entity relationship-based searching method and system
CN113268507B (en) Database data reading system, method and device and electronic equipment
CN115905310A (en) Data query method, data storage method, corresponding equipment, system and medium
CN112749189A (en) Data query method and device
CN112527792A (en) Data storage method, device, equipment and storage medium
CN113392131A (en) Data processing method and device and computer equipment
CN112597162A (en) Data set acquisition method, system, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination