CN114064733B - Database query method, device, equipment and medium suitable for local client - Google Patents
Database query method, device, equipment and medium suitable for local client Download PDFInfo
- Publication number
- CN114064733B CN114064733B CN202111435534.3A CN202111435534A CN114064733B CN 114064733 B CN114064733 B CN 114064733B CN 202111435534 A CN202111435534 A CN 202111435534A CN 114064733 B CN114064733 B CN 114064733B
- Authority
- CN
- China
- Prior art keywords
- query
- database
- data
- result
- configuration
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2379—Updates performed during online database operations; commit processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/248—Presentation of query results
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/258—Data format conversion from or to a database
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application relates to the technical field of clients and discloses a database query method, a device, equipment and a medium suitable for a local client, wherein the method comprises the following steps: acquiring a query request sent by a local client; responding to the query request, and performing query condition configuration page rendering according to the acquired data table query configuration data in a display interface of the local client; acquiring a query condition configuration result sent by the query condition configuration page; generating a database query statement according to the data table query configuration data and the query condition configuration result; the database query statement is sent to a server side, and a database query result sent by the server side according to the database query statement is obtained; and in the display interface, performing query result display page rendering according to the database query result. Thereby improving maintainability of the client and reducing workload of client developers.
Description
Technical Field
The present application relates to the field of client technologies, and in particular, to a method, an apparatus, a device, and a medium for querying a database suitable for a local client.
Background
With the development of electronic technology and internet technology, the functions of the client are more and the version iteration is more and more frequent, so that the maintenance difficulty of the client is increased. In order to query the database of the server through the page of the client, when the client developer develops the client, different query types and different HTML (hypertext markup language) pages are required to be developed aiming at different databases and different data tables, so that the workload of the client developer is increased, the functions of query of the client and the database of the server are highly coupled, and the maintenance difficulty of the client is further increased.
Disclosure of Invention
The application mainly aims to provide a database query method, a device, equipment and a medium suitable for a local client, and aims to solve the technical problems that in order to query a database of a server through a page of the client, when a client developer develops the client, different query types and different HTML pages are required to be developed aiming at different databases and different data tables, the workload of the client developer is increased, the query functions of the databases of the client and the server are highly coupled, and the maintenance difficulty of the client is further increased.
In order to achieve the above object, the present application proposes a database query method suitable for a local client, the method comprising:
Acquiring a query request sent by a local client;
responding to the query request, and performing query condition configuration page rendering according to the acquired data table query configuration data in a display interface of the local client;
acquiring a query condition configuration result sent by the query condition configuration page;
Generating a database query statement according to the data table query configuration data and the query condition configuration result;
the database query statement is sent to a server side, and a database query result sent by the server side according to the database query statement is obtained;
And in the display interface, performing query result display page rendering according to the database query result.
Further, in the display interface of the local client, the step of performing query condition configuration page rendering according to the obtained data table query configuration data includes:
acquiring the data table query configuration data;
And in the display interface, inquiring configuration data according to the data table and carrying out the rendering of the configuration page of the inquiring condition according to the configuration page display parameters carried by the inquiring request, wherein the configuration page display parameters comprise: the first page identifier, the first presentation location data, and the first pattern identifier.
Further, before the step of obtaining the configuration data of the data table query, the method further includes:
acquiring a configuration request sent by the local client;
responding to the configuration request, and rendering a basic configuration page in the display interface;
Acquiring data table configuration data sent by the basic configuration page as configuration data to be stored;
and updating the configuration data to be stored into the data table in the local storage space to inquire the configuration data.
Further, the step of generating a database query statement according to the data table query configuration data and the query condition configuration result includes:
Acquiring a piece of inquiry condition configuration data from the inquiry condition configuration result as single condition configuration data;
acquiring a database type corresponding to the single piece of configuration data from the data table query configuration data as a target database type;
Generating a single query statement according to the acquired SQL implementation class corresponding to the target database type and the single condition configuration data;
Repeatedly executing the step of determining the single condition configuration data until the single condition query statement corresponding to each piece of the query condition configuration data in the query condition configuration result is determined;
And taking each single condition query statement as the database query statement.
Further, the step of sending the database query statement to a server to obtain a database query result sent by the server according to the database query statement includes:
The database query statement is sent to the server, wherein the server is used for calling JDBC, performing data query from a database according to each single condition query statement of the database query statement to obtain an initial query result, performing format conversion on the initial query result to obtain the database query result, and sending a data return request according to the database query result;
acquiring the data return request sent by the server;
And analyzing the database query result for the data return request.
Further, in the display interface, the step of rendering the query result display page according to the database query result includes:
And in the display interface, rendering the query result display page according to the database query result and a result page display parameter carried by the query request, wherein the result page display parameter comprises: the second page identifier, second display position data and second style identifier.
Further, after the step of rendering the query result display page according to the database query result in the display interface, the method further includes:
Acquiring a data operation result sent by the query result display page;
And sending the data operation result to the server, wherein the server is used for updating a database according to the data operation result.
The application also provides a database query device suitable for the local client, which comprises:
The request acquisition module is used for acquiring a query request sent by the local client;
The query condition configuration page rendering module is used for responding to the query request and performing query condition configuration page rendering according to the acquired data table query configuration data in the display interface of the local client;
The query condition configuration result determining module is used for obtaining the query condition configuration result sent by the query condition configuration page;
The database query statement determining module is used for generating a database query statement according to the data table query configuration data and the query condition configuration result;
The database query result determining module is used for sending the database query statement to a server to acquire a database query result sent by the server according to the database query statement;
And the query result display page rendering module is used for rendering the query result display page according to the database query result in the display interface.
The application also proposes a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
The application also proposes a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method of any of the above.
The database query method, device, equipment and medium suitable for the local client side, wherein the method improves the maintainability of the client side by decoupling the client side from the database of the server side, does not need client side developers to develop different query types and different HTML pages aiming at different databases and different data tables, and reduces the workload of the client side developers.
Drawings
FIG. 1 is a flowchart of a database query method suitable for a local client according to an embodiment of the present application;
FIG. 2 is a schematic block diagram illustrating a database query apparatus suitable for a local client according to an embodiment of the present application;
Fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Referring to fig. 1, in an embodiment of the present application, a database query method suitable for a local client is provided, where the method includes:
S1: acquiring a query request sent by a local client;
s2: responding to the query request, and performing query condition configuration page rendering according to the acquired data table query configuration data in a display interface of the local client;
s3: acquiring a query condition configuration result sent by the query condition configuration page;
s4: generating a database query statement according to the data table query configuration data and the query condition configuration result;
S5: the database query statement is sent to a server side, and a database query result sent by the server side according to the database query statement is obtained;
s6: and in the display interface, performing query result display page rendering according to the database query result.
According to the embodiment, the client is decoupled from the database of the server, so that maintainability of the client is improved, client developers are not required to develop different query types and different HTML pages aiming at different databases and different data tables, and workload of the client developers is reduced.
It can be understood that, the program for realizing the application is packaged into JDK (Java SE Development Kit) to obtain the target JDK, the target JDK obtained by packaging is put into Maven (Java project building system), when the client installation package is packaged by Maven, the target JDK in Maven is packaged into the client installation package as a dependency together, and the function of the target JDK is embedded into the client of the client installation package when packaging.
Java is an object oriented programming language.
After the client installation package is installed, the component for realizing the application and the local client are obtained, and the component for realizing the application and the local client can be mutually called.
For S1, a query request sent by a user through a local client may be obtained.
The query request is a request for querying a database of the server.
The local client may be a terminal of a mobile device or a terminal of a personal computer.
For S2, when the query request is received, the data table query configuration data may be obtained from the local storage space, or the data table query configuration data may be obtained from the server, or the data table query configuration data obtained from the server may be updated first, and then the data table query configuration data may be obtained from the local storage space.
The data table querying configuration data includes: database identification, database type, data table configuration data, and table field configuration data. Database types include, but are not limited to: mysql (relational database management system) type and Oracle (relational database management system) type. The data table configuration data includes: table names, table chinese names, and whether query is supported. The table field configuration data includes: data table identification, field chinese name, field type, whether query is supported, whether ordering is supported, whether default presentation is performed, whether scope query is supported, and field order is supported. The database identifier is data uniquely identifying one database such as a database name, a database ID, and the like. The data table identifier is data uniquely identifying one data table such as a data table name, a data table ID, and the like.
Page elements in the query condition configuration page include, but are not limited to: data table screening, field name screening, query condition configuration and field value configuration of table display.
Optionally, when the query request is received, in a display interface of the local client, a preset query condition configuration page display rule is adopted, and the query condition configuration page rendering is performed according to the acquired data table query configuration data. Therefore, the query condition configuration page is displayed in the display interface of the local client, and the client is not required to develop the query condition configuration page.
Optionally, the query condition configuration page is a stand-alone page.
S3, the user performs query condition configuration on the query condition configuration page, and the configuration is finished by clicking a submit button; when the submit button is clicked, a query condition configuration result is generated according to the data in the query condition configuration page.
The query condition configuration result comprises one or more pieces of query condition configuration data. It is understood that each query condition configuration data in the query condition configuration result may correspond to one or more databases of the server. That is, the query condition configuration results may query data from one or more databases.
And S4, inquiring configuration data according to the data table, determining a database type corresponding to each piece of inquiry condition configuration data in the inquiry condition configuration result, generating inquiry sentences according to the corresponding database type by each piece of inquiry condition configuration data in the inquiry condition configuration result, and taking all generated inquiry sentences as database inquiry sentences.
And S5, sending the database query statement to a preset query interface of the server through communication connection with the server. And then acquiring a database query result sent by the server according to the database query statement.
And S6, in the display interface, adopting preset query result display page display rules, and performing query result display page rendering according to the database query results. Therefore, the display page of the query result is displayed in the display interface of the local client, and the client is not required to develop the display page of the query result.
Optionally, the query result presentation page is a stand-alone page.
In one embodiment, the step of performing query condition configuration page rendering according to the obtained data table query configuration data in the display interface of the local client includes:
s21: acquiring the data table query configuration data;
S22: and in the display interface, inquiring configuration data according to the data table and carrying out the rendering of the configuration page of the inquiring condition according to the configuration page display parameters carried by the inquiring request, wherein the configuration page display parameters comprise: the first page identifier, the first presentation location data, and the first pattern identifier.
According to the embodiment, the query condition configuration page rendering is carried out according to the data table query configuration data and the configuration page display parameters carried by the query request, so that the query condition configuration page of the personalized style is embedded into the page of the local client corresponding to the first page identifier.
For S21, the data table query configuration data is acquired from the local storage space.
For S22, the first page identification is a page ID for uniquely identifying one page.
The first style identification is a style ID for uniquely identifying a page style.
And displaying the page corresponding to the first page identifier in the configuration page display parameters in the display interface, and rendering the query condition configuration page according to the pattern corresponding to the first pattern identifier in the region corresponding to the first display position data of the page corresponding to the first page identifier. Thereby realizing embedding the query condition configuration page into the page of the client.
In another embodiment, the configuration page presentation parameters include: a first page identification and first presentation location data. That is, the query condition configuration page rendering may be performed according to a preset style in an area corresponding to the first display position data of the page corresponding to the first page identifier.
In one embodiment, before the step of obtaining the configuration data of the data table query, the method further includes:
S211: acquiring a configuration request sent by the local client;
S212: responding to the configuration request, and rendering a basic configuration page in the display interface;
s213: acquiring data table configuration data sent by the basic configuration page as configuration data to be stored;
s214: and updating the configuration data to be stored into the data table in the local storage space to inquire the configuration data.
According to the embodiment, the basic configuration page is rendered in the display interface of the local client to acquire the configuration data to be stored, which is input by the user, so that personalized user requirements are met, and user experience is improved.
And S211, acquiring a configuration request sent by a user at the local client.
The configuration request is a request for configuring the data table query configuration data.
For S212, when a preset configuration request is received, a preset basic configuration interface display rule is adopted, and basic configuration page rendering is performed in the display interface.
Optionally, the base configuration page does not directly expose the data table query configuration data in the local storage space.
Optionally, the base configuration page directly exposes the data table query configuration data in the local storage space.
For S213, the user inputs data table configuration data in the basic configuration page, and inputs a configuration submit button after clicking; when the configuration submit button is clicked, the base configuration page will generate configuration data to be stored from the data in the page.
And for S214, replacing and updating the configuration data to be stored, and inquiring the configuration data of the data table in the local storage space.
In one embodiment, the step of generating a database query statement according to the data table query configuration data and the query condition configuration result includes:
s41: acquiring a piece of inquiry condition configuration data from the inquiry condition configuration result as single condition configuration data;
S42: acquiring a database type corresponding to the single piece of configuration data from the data table query configuration data as a target database type;
S43: generating a single query statement according to the acquired SQL implementation class corresponding to the target database type and the single condition configuration data;
S44: repeatedly executing the step of determining the single condition configuration data until the single condition query statement corresponding to each piece of the query condition configuration data in the query condition configuration result is determined;
S45: and taking each single condition query statement as the database query statement.
According to the method, the device and the system, single query statement generation is carried out according to the obtained SQL implementation class corresponding to the target database type and the single condition configuration data, so that a user can query one or more databases through one query condition configuration result without concern about which database is queried for data, the operation of the user is reduced, and the user experience is improved.
For S41, one piece of query condition configuration data is sequentially obtained from the query condition configuration result, and the obtained query condition configuration data is used as single condition configuration data.
And S42, carrying out data table identification search from the data table query configuration data on the data table identification of the single piece of configuration data, and taking the database type corresponding to the data table identification searched in the data table query configuration data as a target database type, thereby determining the target database type corresponding to each single piece of configuration data.
For S43, the obtained SQL (structured query language) implementation class corresponding to the target database type; and generating a single query statement according to the acquired SQL implementation class and the single condition configuration data, so that the query statement is accurately generated.
SQL implementation classes are used to assemble classes of query statements.
There are differences in SQL implementation classes for different database types. For example, the function in the SQL implementation class corresponding to Mysql that obtains the current time call is now (), while the function in the SQL implementation class corresponding to Oracle that obtains the current time call is sysdate ().
For S44, the step of determining the single-condition configuration data is repeatedly performed, that is, steps S41 to S44 are repeatedly performed. And when the single condition query statement corresponding to each piece of query condition configuration data in the query condition configuration results is determined, traversing the query condition configuration results is completed.
For S45, each of the single condition query statement is taken as the database query statement.
In one embodiment, the step of sending the database query statement to a server to obtain a database query result sent by the server according to the database query statement includes:
S51: the database query statement is sent to the server, wherein the server is used for calling JDBC, performing data query from a database according to each single condition query statement of the database query statement to obtain an initial query result, performing format conversion on the initial query result to obtain the database query result, and sending a data return request according to the database query result;
S52: acquiring the data return request sent by the server;
S53: and analyzing the database query result for the data return request.
According to the embodiment, the database query statement is sent to the server, the server converts the format of the queried data and returns the data as the database query result, and the format conversion is carried out on the server, so that the rendering speed of the query result display page is improved, and the user experience is improved.
And for S51, the database query statement is sent to the server through communication connection with the server.
The server calls JDBC, acquires the single condition query statement from the database query statement, executes the acquired single condition query statement, performs data query from the database corresponding to the acquired single condition query statement to obtain an initial query result, performs format conversion on the initial query result by adopting a preset format conversion rule to obtain the database query result, generates a data return request when the database query result corresponding to each single condition query statement in the database query statement is determined, and takes each database query result as a parameter carried by the data return request.
JDBC refers to Java database connectivity.
And S52, acquiring the data return request sent by the server through communication connection with the server.
And S53, analyzing the database query result of the data return request, so as to obtain the database query result corresponding to the query condition configuration result.
In one embodiment, in the foregoing step of rendering a query result display page in the display interface according to the database query result, the method includes:
S611: and in the display interface, rendering the query result display page according to the database query result and a result page display parameter carried by the query request, wherein the result page display parameter comprises: the second page identifier, second display position data and second style identifier.
According to the embodiment, the query result display page rendering is carried out according to the database query result and the result page display parameters carried by the query request, so that the query result display page in the personalized style is embedded into the page of the local client corresponding to the second page identifier.
For S611, the second page identification is a page ID for uniquely identifying one page.
The second style identification is a style ID for uniquely identifying one page style.
And displaying the page corresponding to the second page identifier in the display interface, and rendering the query result display page according to the style corresponding to the second style identifier in the region corresponding to the second display position data of the page corresponding to the second page identifier. Thereby realizing embedding the query result display page into the page of the client.
In another embodiment, the configuration page presentation parameters include: the second page identification and the second presentation location data. That is, the query result display page rendering may be performed according to a preset style in an area corresponding to the second display position data of the page corresponding to the second page identifier.
In one embodiment, after the step of rendering the query result display page according to the database query result in the display interface, the method further includes:
s71: acquiring a data operation result sent by the query result display page;
s72: and sending the data operation result to the server, wherein the server is used for updating a database according to the data operation result.
According to the embodiment, the data operation result is obtained through the display page based on the query result, and then the database of the server is updated according to the data operation result.
For S71, clicking a data operation button on the query result display page by a user; when the data operation button is clicked, a data operation result is generated according to the data identifier and the operation type associated with the data operation button.
The data operation result includes: data identification, operation type, and data modification results. The range of values of the operation type includes: deletion and modification. Wherein when the operation type is modification, the data operation result includes a data modification result.
And for S72, the data operation result is sent to the server through communication connection with the server, wherein the server is used for updating a database of the server according to the data operation result. Therefore, the data in the database of the server can be operated without logging in the database of the server.
Referring to fig. 2, the present application further provides a database query device suitable for a local client, where the device includes:
a request acquisition module 100, configured to acquire a query request sent by a local client;
The query condition configuration page rendering module 200 is configured to respond to the query request, and perform query condition configuration page rendering in the display interface of the local client according to the obtained data table query configuration data;
the query condition configuration result determining module 300 is configured to obtain a query condition configuration result sent by the query condition configuration page;
a database query statement determining module 400, configured to generate a database query statement according to the data table query configuration data and the query condition configuration result;
The database query result determining module 500 is configured to send the database query statement to a server, and obtain a database query result sent by the server according to the database query statement;
And the query result display page rendering module 600 is configured to perform, in the display interface, rendering of a query result display page according to the database query result.
According to the embodiment, the client is decoupled from the database of the server, so that maintainability of the client is improved, client developers are not required to develop different query types and different HTML pages aiming at different databases and different data tables, and workload of the client developers is reduced.
In one embodiment, the query condition configuration page rendering module 200 includes: a configuration data acquisition sub-module and a query condition configuration page rendering sub-module;
The configuration data acquisition sub-module is used for acquiring the data table query configuration data;
The query condition configuration page rendering sub-module is configured to query configuration data and configuration page display parameters carried by the query request in the display interface according to the data table, where the configuration page display parameters include: the first page identifier, the first presentation location data, and the first pattern identifier.
In one embodiment, the apparatus further comprises: the data table inquires a configuration data configuration module;
the data table query configuration data configuration module is used for acquiring a configuration request sent by the local client, responding to the configuration request, performing basic configuration page rendering in the display interface, acquiring data table configuration data sent by the basic configuration page as configuration data to be stored, and updating the configuration data to be stored into the data table query configuration data in a local storage space.
In one embodiment, the database query statement determination module 400 includes: a single-condition query statement generation submodule and a database query statement determination submodule;
The single condition query statement generation sub-module is configured to acquire a piece of query condition configuration data from the query condition configuration result as single condition configuration data, acquire a database type corresponding to the single condition configuration data from the data table query configuration data as a target database type, generate a single condition query statement according to the acquired SQL implementation class corresponding to the target database type and the single condition configuration data, and repeatedly execute the step of determining the single condition configuration data until the single condition query statement corresponding to each piece of query condition configuration data in the query condition configuration result is determined;
The database query statement determination submodule is used for taking each single condition query statement as the database query statement.
In one embodiment, the database query result determining module 500 includes: a database query statement sending sub-module and a database query result analyzing sub-module;
The database query statement sending submodule is used for sending the database query statement to the server side to obtain the data return request sent by the server side, wherein the server side is used for calling JDBC, carrying out data query from a database according to each single condition query statement of the database query statement to obtain an initial query result, carrying out format conversion on the initial query result to obtain the database query result, and sending a data return request according to the database query result;
And the database query result analysis sub-module is used for analyzing the database query result for the data return request.
In one embodiment, the query result presentation page rendering module 600 includes: the query result display page is embedded into the rendering sub-module;
the query result display page embedding rendering sub-module is configured to render, in the display interface, the query result display page according to the database query result and a result page display parameter carried by the query request, where the result page display parameter includes: the second page identifier, second display position data and second style identifier.
In one embodiment, the apparatus further comprises: a data updating module;
The data updating module is used for acquiring the data operation result sent by the query result display page and sending the data operation result to the server, wherein the server is used for updating the database according to the data operation result.
Referring to fig. 3, in an embodiment of the present application, there is further provided a computer device, which may be a server, and an internal structure thereof may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as a database query method suitable for a local client. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a database query method suitable for a local client. The database query method suitable for the local client comprises the following steps: acquiring a query request sent by a local client; responding to the query request, and performing query condition configuration page rendering according to the acquired data table query configuration data in a display interface of the local client; acquiring a query condition configuration result sent by the query condition configuration page; generating a database query statement according to the data table query configuration data and the query condition configuration result; the database query statement is sent to a server side, and a database query result sent by the server side according to the database query statement is obtained; and in the display interface, performing query result display page rendering according to the database query result.
According to the embodiment, the client is decoupled from the database of the server, so that maintainability of the client is improved, client developers are not required to develop different query types and different HTML pages aiming at different databases and different data tables, and workload of the client developers is reduced.
An embodiment of the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a database query method suitable for a local client, comprising the steps of: acquiring a query request sent by a local client; responding to the query request, and performing query condition configuration page rendering according to the acquired data table query configuration data in a display interface of the local client; acquiring a query condition configuration result sent by the query condition configuration page; generating a database query statement according to the data table query configuration data and the query condition configuration result; the database query statement is sent to a server side, and a database query result sent by the server side according to the database query statement is obtained; and in the display interface, performing query result display page rendering according to the database query result.
The database query method suitable for the local client improves maintainability of the client by decoupling the client from the database of the server, and does not need client developers to develop different query types and different HTML pages for different databases and different data tables, thereby reducing workload of the client developers.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present application and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the application.
Claims (7)
1. A database query method suitable for a local client, the method comprising:
Acquiring a query request sent by a local client;
responding to the query request, and performing query condition configuration page rendering according to the acquired data table query configuration data in a display interface of the local client;
acquiring a query condition configuration result sent by the query condition configuration page;
Generating a database query statement according to the data table query configuration data and the query condition configuration result;
the database query statement is sent to a server side, and a database query result sent by the server side according to the database query statement is obtained;
in the display interface, rendering a query result display page according to the database query result;
the step of performing query condition configuration page rendering according to the obtained data table query configuration data in the display interface of the local client comprises the following steps:
acquiring the data table query configuration data;
And in the display interface, inquiring configuration data according to the data table and carrying out the rendering of the configuration page of the inquiring condition according to the configuration page display parameters carried by the inquiring request, wherein the configuration page display parameters comprise: a first page identifier, first presentation location data, and a first pattern identifier;
Before the step of obtaining the data table query configuration data, the method further comprises:
acquiring a configuration request sent by the local client;
responding to the configuration request, and rendering a basic configuration page in the display interface;
Acquiring data table configuration data sent by the basic configuration page as configuration data to be stored;
updating the configuration data to be stored into the data table in the local storage space to inquire the configuration data;
The step of generating database query sentences according to the data table query configuration data and the query condition configuration result comprises the following steps:
Acquiring a piece of inquiry condition configuration data from the inquiry condition configuration result as single condition configuration data;
acquiring a database type corresponding to the single piece of configuration data from the data table query configuration data as a target database type;
Generating a single query statement according to the acquired SQL implementation class corresponding to the target database type and the single condition configuration data;
Repeatedly executing the step of determining the single condition configuration data until the single condition query statement corresponding to each piece of the query condition configuration data in the query condition configuration result is determined;
And taking each single condition query statement as the database query statement.
2. The database query method applicable to a local client according to claim 1, wherein the step of sending the database query statement to a server to obtain a database query result sent by the server according to the database query statement includes:
The database query statement is sent to the server, wherein the server is used for calling JDBC, performing data query from a database according to each single condition query statement of the database query statement to obtain an initial query result, performing format conversion on the initial query result to obtain the database query result, and sending a data return request according to the database query result;
acquiring the data return request sent by the server;
And analyzing the database query result for the data return request.
3. The method for querying a database suitable for a local client according to claim 1, wherein the step of rendering a query result presentation page according to the query result of the database in the presentation interface comprises:
And in the display interface, rendering the query result display page according to the database query result and a result page display parameter carried by the query request, wherein the result page display parameter comprises: the second page identifier, second display position data and second style identifier.
4. The method for querying a database suitable for a local client according to claim 1, wherein after the step of rendering a query result presentation page according to the query result of the database in the presentation interface, the method further comprises:
Acquiring a data operation result sent by the query result display page;
And sending the data operation result to the server, wherein the server is used for updating a database according to the data operation result.
5. A database querying device adapted for use with a local client for implementing the method of any of claims 1-4, the device comprising:
The request acquisition module is used for acquiring a query request sent by the local client;
The query condition configuration page rendering module is used for responding to the query request and performing query condition configuration page rendering according to the acquired data table query configuration data in the display interface of the local client;
The query condition configuration result determining module is used for obtaining the query condition configuration result sent by the query condition configuration page;
The database query statement determining module is used for generating a database query statement according to the data table query configuration data and the query condition configuration result;
The database query result determining module is used for sending the database query statement to a server to acquire a database query result sent by the server according to the database query statement;
And the query result display page rendering module is used for rendering the query result display page according to the database query result in the display interface.
6. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 4 when the computer program is executed.
7. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111435534.3A CN114064733B (en) | 2021-11-29 | 2021-11-29 | Database query method, device, equipment and medium suitable for local client |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111435534.3A CN114064733B (en) | 2021-11-29 | 2021-11-29 | Database query method, device, equipment and medium suitable for local client |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114064733A CN114064733A (en) | 2022-02-18 |
CN114064733B true CN114064733B (en) | 2024-07-30 |
Family
ID=80277004
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111435534.3A Active CN114064733B (en) | 2021-11-29 | 2021-11-29 | Database query method, device, equipment and medium suitable for local client |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114064733B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114860249A (en) * | 2022-04-21 | 2022-08-05 | 深圳市酷开网络科技股份有限公司 | Configuration-based interface development and use method, device, terminal equipment and medium |
CN115640447A (en) * | 2022-12-07 | 2023-01-24 | 百融至信(北京)科技有限公司 | Data query method and device |
CN118093654B (en) * | 2024-02-19 | 2024-10-18 | 中国科学院空间应用工程与技术中心 | Large-scale data query and retrieval method and system supporting aerospace engineering |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109977317A (en) * | 2019-04-03 | 2019-07-05 | 恒生电子股份有限公司 | Data query method and device |
CN111090666A (en) * | 2019-11-29 | 2020-05-01 | 江苏苏宁物流有限公司 | Data processing method, device and system and computer readable storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10268704B1 (en) * | 2017-10-12 | 2019-04-23 | Vast.com, Inc. | Partitioned distributed database systems, devices, and methods |
US11580068B2 (en) * | 2017-12-15 | 2023-02-14 | Palantir Technologies Inc. | Systems and methods for client-side data analysis |
CN111259037B (en) * | 2020-01-14 | 2023-09-19 | 重庆特斯联智慧科技股份有限公司 | Data query method and device based on rule configuration, storage medium and terminal |
CN111309991B (en) * | 2020-01-16 | 2023-03-31 | 广州三七互娱科技有限公司 | Query statement generation method and device and data query method and system |
CN111414407A (en) * | 2020-02-13 | 2020-07-14 | 中国平安人寿保险股份有限公司 | Data query method, device, computer equipment and storage medium for database |
CN112732742B (en) * | 2021-01-12 | 2023-03-28 | 深圳平安医疗健康科技服务有限公司 | Query page creating method and device, computer equipment and storage medium |
-
2021
- 2021-11-29 CN CN202111435534.3A patent/CN114064733B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109977317A (en) * | 2019-04-03 | 2019-07-05 | 恒生电子股份有限公司 | Data query method and device |
CN111090666A (en) * | 2019-11-29 | 2020-05-01 | 江苏苏宁物流有限公司 | Data processing method, device and system and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN114064733A (en) | 2022-02-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114064733B (en) | Database query method, device, equipment and medium suitable for local client | |
US7716591B2 (en) | System and method for dynamically generating a web page | |
US8131753B2 (en) | Apparatus and method for accessing and indexing dynamic web pages | |
CN107766344B (en) | Template rendering method and device and browser | |
CN113064584B (en) | Idempotent implementation method, device, equipment and medium | |
CN112732742B (en) | Query page creating method and device, computer equipment and storage medium | |
CN109710220B (en) | Relational database query method, relational database query device, relational database query equipment and storage medium | |
CN110221871B (en) | Webpage acquisition method and device, computer equipment and storage medium | |
US10452730B2 (en) | Methods for analyzing web sites using web services and devices thereof | |
CN114238811A (en) | Page loading method, page request response method, device, equipment and medium | |
WO2020155765A1 (en) | Data crawling method for mobile terminal, device, mobile terminal, and storage medium | |
CN111966704A (en) | ORM framework implementation method, system, computer equipment and storage medium | |
CN113721973A (en) | Configuration file generation method, device, equipment and medium | |
CN113419784A (en) | Page resource caching method, device, equipment and medium | |
CN112631701A (en) | Page request method and device, computer equipment and storage medium | |
CN116991872A (en) | Data query method, device and computer readable storage medium | |
CN112231379A (en) | API audit method, device, device and storage medium based on microservice architecture | |
CN113918193A (en) | Grayscale calling method, device, device and storage medium suitable for microservices | |
CN112579459A (en) | Method and device for testing application program and computer equipment | |
CN113486267B (en) | Method, device, equipment and storage medium for analyzing application entry page | |
CN114048367A (en) | Metadata information query method, device, equipment and storage medium | |
CN113885897A (en) | Packaging method, device and equipment of client installation package and storage medium | |
CN114020319B (en) | Interface calling method, device, server and computer readable storage medium | |
CN114721929B (en) | Test method, device, storage medium and equipment | |
CN114936237A (en) | Behavior data analysis method, behavior data analysis device, behavior data analysis equipment 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |