CN111459982A - Data query method and device, terminal device and storage medium - Google Patents
Data query method and device, terminal device and storage medium Download PDFInfo
- Publication number
- CN111459982A CN111459982A CN202010227701.4A CN202010227701A CN111459982A CN 111459982 A CN111459982 A CN 111459982A CN 202010227701 A CN202010227701 A CN 202010227701A CN 111459982 A CN111459982 A CN 111459982A
- Authority
- CN
- China
- Prior art keywords
- field
- data
- information
- queried
- fields
- 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
Links
Images
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/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the application is applicable to the technical field of data processing, and provides a data query method, a data query device, terminal equipment and a storage medium, wherein the method comprises the following steps: when a data query instruction is received, extracting information to be queried carried in the instruction, wherein the information to be queried comprises table information of a data table to be queried and field information of a field to be queried; determining the table structure of the data table to be inquired according to the table information; generating a data configuration table according to the table structure and the field information; reading a plurality of field values corresponding to the field to be queried, and separating the field values through preset separators; and sequentially writing the read field values into data bits corresponding to target fields of the data configuration table to obtain a data query result, so that the problem that the data records are easy to generate wrong rows or wrong columns in the prior art is solved, and the accuracy of data query is ensured.
Description
Technical Field
The present application belongs to the technical field of data processing, and in particular, to a data query method, apparatus, terminal device, and storage medium.
Background
Big data generally refers to a large set of data that cannot be processed over a certain time frame using traditional computer technology. In the actual processing of each item related to big data, it is often necessary to find out the data related to the item from the big database and perform other processing such as testing based on the data. In order to ensure the normal operation of the project, the accuracy of the data obtained by querying is very important.
At present, for the query of big data, corresponding data records need to be found according to a query instruction, and then the data records are exported to data tables such as excel for the user to check. The whole process is complex to operate, and errors are easy to occur when data records are exported, so that the accuracy of query results is affected. For example, when a certain field value in the searched data record is empty, a condition of wrong rows or wrong columns occurs when the searched data record is exported to the excel data table, so that an error occurs in the whole query result.
Disclosure of Invention
In view of this, embodiments of the present application provide a data query method, an apparatus, a terminal device, and a storage medium, so as to solve the problems that in the prior art, when querying big data, not only operation is complicated, but also the accuracy of a query result is affected due to the fact that a wrong row or a wrong column is easy to occur when a queried data record is derived.
A first aspect of an embodiment of the present application provides a data query method, which is applicable to a terminal device, and the method includes:
when a data query instruction is received, extracting information to be queried carried in the instruction, wherein the information to be queried comprises table information of a data table to be queried and field information of a field to be queried;
determining the table structure of the data table to be inquired according to the table information;
generating a data configuration table according to the table structure and the field information, wherein the data configuration table comprises a target field corresponding to the field to be inquired;
reading a plurality of field values corresponding to the field to be queried, and separating the field values through preset separators;
and writing the read field values into data bits corresponding to target fields of the data configuration table in sequence to obtain a data query result.
A second aspect of the embodiments of the present application provides a data query apparatus, which is suitable for a terminal device, and the apparatus includes:
the device comprises an extraction module, a query module and a query module, wherein the extraction module is used for extracting information to be queried carried in a data query instruction when the data query instruction is received, and the information to be queried comprises table information of a data table to be queried and field information of a field to be queried;
the determining module is used for determining the table structure of the data table to be inquired according to the table information;
the generating module is used for generating a data configuration table according to the table structure and the field information, and the data configuration table comprises a target field corresponding to the field to be inquired;
the reading module is used for reading a plurality of field values corresponding to the field to be queried and separating the field values through preset separators;
and the writing module is used for sequentially writing the read field values into data bits corresponding to target fields of the data configuration table to obtain a data query result.
A third aspect of embodiments of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the data query method according to the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the data query method according to the first aspect.
Compared with the prior art, the embodiment of the application has the following advantages:
according to the data query method and device, when a data query instruction is received, the information to be queried carried in the instruction is extracted, the table structure of the data table to be queried can be determined according to the table information of the data table to be queried, then the corresponding data configuration table is generated according to the table structure and the field information of the field to be queried, when a plurality of field values corresponding to the field to be queried are read, the field values are separated through the preset separators, it is guaranteed that the field values can accurately correspond, and accurate data query results can be obtained after the read field values are written into data bits corresponding to target fields of the data configuration table. According to the embodiment, the data are directly read from the data table according to the query instruction and are separated, the problem that row errors or column errors are prone to occurring when data records are processed in the prior art is solved, and the accuracy of the queried data is guaranteed.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
FIG. 1 is a flow chart illustrating steps of a data query method according to an embodiment of the present application;
FIG. 2 is a flow chart illustrating steps of another data query method according to an embodiment of the present application;
FIG. 3 is a flow chart illustrating steps of another data query method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a data query device according to an embodiment of the present application;
fig. 5 is a schematic diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The technical solution of the present application will be described below by way of specific examples.
Referring to fig. 1, a schematic flowchart illustrating steps of a data query method according to an embodiment of the present application is shown, which may specifically include the following steps:
s101, when a data query instruction is received, extracting information to be queried carried in the instruction, wherein the information to be queried comprises table information of a data table to be queried and field information of a field to be queried;
it should be noted that the method may be applied to a terminal device, and the terminal device may communicate with a server where the database is located, and query data in each data table stored in the database.
In this embodiment, the data query instruction may refer to an instruction for querying data stored in a part of or all fields of a certain data table in the database, and the instruction may be generated by inputting specific table information and field information in the terminal device by a user.
Therefore, when receiving a data query instruction, the terminal device can extract information to be queried from the instruction, and confirm which data table and which fields in the data table the user currently wants to query.
S102, determining a table structure of the data table to be inquired according to the table information;
in general, a data table is composed of three parts, a table name, fields in the table, and data records of the table. Thus, the table structure of the data table may include information such as the file name of the data table, which fields the data table contains, the field names of the fields, and the like. The table structure of the data table is often obtained from attribute information of the data table. That is, after the table information of the data table to be queried is extracted from the data query instruction, a specific data table can be found according to the table data, and then the attribute information of the data table is obtained and a specific table structure is determined from the attribute information.
S103, generating a data configuration table according to the table structure and the field information, wherein the data configuration table comprises a target field corresponding to the field to be inquired;
the data configuration table generated according to the table structure of the data table and the field information of the field to be queried may be a blank data table containing the field to be queried, which is generated according to the table structure of the corresponding data table to be queried. The blank cells in the configuration table can be used for storing specific data after reading the data from the data table to be queried subsequently.
S104, reading a plurality of field values corresponding to the field to be queried, and separating the field values through preset separators;
in this embodiment, the field values corresponding to the field to be queried may refer to the field values recorded in the field to be queried.
In a specific implementation, the field values recorded in the field to be queried may be read one by one. When the field to be queried includes a plurality of fields, it is necessary that the field value of the next field is not read until all the field values recorded in all the fields to be queried are read.
It should be noted that, in order to ensure that each data record can accurately correspond when generating a query result, in this embodiment, each field value may be separated by a preset separator. For example, any two field values may be split using a Slash (Slash) "/" separator. Of course, according to actual requirements, other separators may also be used to separate the field values, which is not limited in this embodiment.
And S105, writing the read field values into data bits corresponding to target fields of the data configuration table in sequence to obtain a data query result.
The data bits corresponding to the target fields in the data configuration table are blank cells under each target field in the data configuration table, and the blank cells can be used for writing each field value read in the previous step.
Since the target field in the data configuration table corresponds to the field to be queried, a plurality of field values read from a certain field to be queried can be written into the blank cells under the corresponding target field. If the field to be queried comprises a plurality of fields, writing can be performed on each field respectively until all the read field values are written into the data configuration table. The data configuration table written with the field value is the final data query result, and the data query result can be displayed in the interface of the terminal device in a visual mode, so that a user can process the data intuitively.
In the embodiment of the application, when a data query instruction is received, a table structure of a data table to be queried can be determined according to table information of the data table to be queried by extracting information to be queried carried in the instruction, and then a corresponding data configuration table is generated according to the table structure and field information of a field to be queried, so that when a plurality of field values corresponding to the field to be queried are read, the field values are separated through a preset separator, each field value can be ensured to accurately correspond, and accurate data query results can be obtained after the read field values are written into data bits corresponding to target fields of the data configuration table. According to the embodiment, the data are directly read from the data table according to the query instruction and are separated, the problem that row errors or column errors are prone to occurring when data records are processed in the prior art is solved, and the accuracy of the queried data is guaranteed.
Referring to fig. 2, a schematic flow chart illustrating steps of another data query method according to an embodiment of the present application is shown, which may specifically include the following steps:
s201, acquiring equipment information of terminal equipment, and sending the equipment information to a server for storing the data table to be inquired;
it should be noted that the present embodiment may be applied to a terminal device. That is, the execution subject of this embodiment is the terminal device, and the queried data result can be presented to the user through the processing of the terminal device.
The IDE (Integrated Development Environment) is an application program used for providing a program Development Environment, and generally comprises a code editor, a compiler, a debugger, a graphical user interface and other tools.
In order to query and display data records in the database through the IDE tool, the IDE tool needs to be configured with a right to access the database, and the IDE tool is allowed to access each data table in the database.
In a specific implementation, device information of the terminal device configured with the IDE tool may be first obtained, where the device information may include information such as an IP address of the terminal device, and then the terminal device may send the device information to a server storing a data table to be queried, where the device information may be used to instruct the server to configure data access rights for the terminal device and the IDE tool.
S202, receiving login information returned by the server according to the data access authority;
after receiving the device information, the server in which the database is located can allocate login information to the terminal device based on the device information, and configure the authority for accessing the large database for the device corresponding to the IP address. The login information is sent to the terminal equipment, and a subsequent terminal can establish a data transmission channel between the terminal equipment and the server through the login information.
It should be noted that the IDE tool in this embodiment may be designed based on a web format, and allows a user to directly log in through a browser on a terminal. When logging in, a user can input pre-allocated login information, and the login information is transmitted to a server where a DataBase is located in a JDBC (Java DataBase Connectivity) manner.
JDBC provides a reference from which to build higher level tools and interfaces that enable database developers to write database applications.
When the server where the database is located receives the login information from the configured IP address, the server can verify the login information, and after the verification is passed, the IDE tool can be allowed to access the database.
S203, when a data query instruction is received, extracting information to be queried carried in the instruction;
the data query instruction in this embodiment may be entered by the user via the IDE tool. Because the IDE tool is designed based on a web form, a data query interface can be provided externally through a browser, and a user can directly input the table information of the data table to be queried and the field information of a specific field to be queried through the interface. For example, the user may query the data in the three fields of "customer number", "insurance type", and "insurance date" in the "policy information" data table by entering information.
S204, acquiring attribute information of the data table to be inquired according to the table information;
after receiving a data query instruction input by a user, the IDE tool may find the policy information data table from the database based on a connection that has been established in advance, and obtain attribute information of the data table.
S205, determining a plurality of fields contained in the data table to be queried and field names corresponding to the fields according to the attribute information; determining a storage mode of the fields;
the specific table structure of the data table can be determined from the attribute information of the data table. The table structure of the data table may include information such as the file name of the data table, which fields the data table contains, the field names of the fields, and the like.
Meanwhile, when determining which fields are contained in the data table, the storage mode of the fields can be judged.
The storage mode in this embodiment may include that the field names corresponding to the plurality of fields are located in the same row or the same column, that is, the three field names of "client number", "insurance seed", and "insurance date" are determined to be located in the same row or the same column.
If the field names are located in the same row, it means that a plurality of field values belonging to the same field should be recorded in the data bits of the same column, and if the field names are located in the same column, a plurality of field values belonging to the same field should be recorded in the data bits of the same row.
S206, generating a data configuration table according to the table structure and the field information;
the data configuration table generated according to the table structure of the data table and the field information of the field to be queried may be a blank data table containing the target field generated according to the table structure of the corresponding data table to be queried. The target fields correspond to the fields to be inquired one by one.
In a specific implementation, a blank data table may be first generated in the browser, and then the field names of the fields to be queried may be filled in the blank data table according to the table structure of the data table to be queried, so as to obtain a corresponding data configuration table.
If the field names corresponding to the fields are located in the same row, the field names corresponding to the fields to be inquired can be written into a target row of the blank data table; if the field names corresponding to the fields are in the same column, the field names corresponding to the fields to be queried can be written into the target column of the blank data table, and the data configuration table is obtained. The target row may be any row of the blank data table, and the target column may also be any column of the blank data table.
For example, if the field names of the fields in the data table to be queried are located in the same row, the field names of the fields to be queried may be filled in the first row in the pre-generated blank data table; if the field names of the fields in the data table to be queried are in the same column, the field names of the fields to be queried can be filled in the first column in the blank data table.
If the field names of the fields to be queried are located in the same behavior example, and the information under the three fields of the client number, the insurance application risk type and the insurance application date needs to be queried from the policy information, the generated data configuration table can be as shown in the following table one.
Table one, data configuration table example
1 | Customer number | Throwing security dangerous seeds | Date of insuring |
2 | |||
3 | |||
…… |
S207, reading a plurality of field values corresponding to the field to be queried, and separating the field values through preset separators;
in this embodiment, the values of the various fields under the field to be queried can be read through the full-scale loop of the IDE tool.
In order to distinguish field values of a plurality of different fields, it is necessary to read the field values and also read the field names of the fields.
In a specific implementation, if the field names corresponding to a plurality of fields are located in the same row, the field names of the fields to be queried and a plurality of field values corresponding to the field names can be read column by column; if the field names corresponding to the fields are located in the same column, the field names of the fields to be queried and the field values corresponding to the field names can be read line by line.
For example, when a field value under the field "client number" is read, the field value of each line in the field may be read line by line, starting from the field value of the first line record under the field name. And after the field of the client number is read, sequentially reading the field values under the field of the insurance date until all the field values recorded under the field to be inquired are read.
In this embodiment, in order to ensure that each data record can accurately correspond when generating a query result, when reading a field value, the IDE tool may separate the read field names and field values by preset separators. For example, any two field values may be separated using a slash "/".
Also taking the above example as an example, the data read by the IDE tool may be represented as follows:
{/client number/0001/0002/0003/… …/1000/insurance seed/heavy risk A/… …/heavy risk A/insurance date/20190301/20190301/20190301/… …/20190721/}
S208, writing the read field values into data bits corresponding to the target fields of the data configuration table in sequence to obtain data query results.
After the read field values are written into the data bits corresponding to the target fields of the data configuration table, a final data query result can be obtained, and the query result can be displayed to a user through a browser interface on the terminal equipment.
In the embodiment, the IDE tool is configured on the terminal equipment, and after the server where the database is located distributes corresponding data access permission to the terminal equipment, the operations of querying, reading, writing and the like of the data table can be completed through the IDE tool, so that the operation complexity of data query is greatly simplified; the field values are separated through separators, and the accuracy of the data is effectively guaranteed.
Referring to fig. 3, a schematic flow chart illustrating steps of another data query method according to an embodiment of the present application is shown, which may specifically include the following steps:
s301, acquiring equipment information of the terminal equipment, and sending the equipment information to a server storing the data table to be inquired, wherein the equipment information is used for indicating the server to configure data access permission for the terminal equipment;
s302, receiving login information returned by the server according to the data access authority, wherein the login information is used for establishing a data transmission channel between the terminal equipment and the server;
s303, when a data query instruction is received, extracting information to be queried carried in the instruction, wherein the information to be queried comprises table information of a data table to be queried and field information of a field to be queried;
s304, determining a table structure of the data table to be inquired according to the table information;
it should be noted that steps S301 to S304 of this embodiment are similar to steps S101 to S102 and S201 to S205 of the previous embodiment, and they may refer to each other, which is not described herein again.
S305, generating a blank data table, and writing the field name corresponding to the field to be inquired into a target row of the blank data table to obtain a data configuration table; the target behavior is any row of the blank data table, and the data configuration table contains target fields corresponding to the fields to be inquired;
different storage modes in the data table may cause a certain difference between reading data and writing data, but the operation principle is basically the same. Therefore, for convenience of understanding, the following description will be given by taking a data storage manner in which field names corresponding to a plurality of fields are located in the same row as an example.
When the field names corresponding to the multiple fields are located in the same row, the generated data configuration table may be as shown in table one in the foregoing embodiment.
S306, reading the field name of the field to be queried and a plurality of field values corresponding to the field name column by column, and separating the field values through preset separators;
for example, when a field value under the field "client number" is read, the field value of each line in the field may be read line by line, starting from the field value of the first line record under the field name. And after the field of the client number is read, sequentially reading the field values under the field of the insurance date until all the field values recorded under the field to be inquired are read.
For each field value read, it may be separated using a slash "/" or other separator.
S307, if the field value corresponding to the first field is not read, adopting preset characters as the field value corresponding to the first field, wherein the first field is any field in the fields to be inquired;
in general, in some cases, specific data may not be recorded in individual cells in some fields, and the existence of such missing values is extremely easy to cause a wrong row condition when data is subsequently written into other data tables.
In this embodiment, the missing value that cannot be read may be replaced with a preset character, which may be "NU LL".
In a specific implementation, if the IDE tool does not read any field value in a certain row, it may record that the field value is null, and write "NU LL" in the corresponding position in the read information.
For example, when the partial field value is empty, the above example may be expressed as:
{/client number/0001/0002/0003/… …/1000/insurance seed/heavy risk A/NU LL/… …/heavy risk A/insurance date/20190301/20190301/NU LL/… …/20190721/}
S308, determining each field name in the read data, and determining a target field corresponding to each field name in the data configuration table one by one;
after the read data are sequentially written into the data configuration table, a visual data query result table can be generated.
In a specific implementation, each field name in the read data may be determined first, and a target field corresponding to the field name one to one may be determined, where the target field is one already existing in the data configuration table.
Generally, when a data configuration table is generated according to a table structure of a data table to be queried and field information of a field to be queried, a target field is the same field as the field to be queried. Therefore, the field names of both may be the same.
In some cases, after determining the one-to-one correspondence between the target field and the field to be queried according to actual needs, the field name of the target field may also be different from the field name of the field to be queried, which is not limited in this embodiment.
And S309, sequentially writing the field values after the field names into corresponding data bits of the target field according to the preset separators to obtain a data query result, wherein the data bits are blank cells used for filling the field values in the data configuration table.
In this embodiment, the field name of the first field in the read data may be determined first, and then the field values after the field name are written into the blank cells under the corresponding target field in the data configuration table in sequence, after all the field values of the first field are written, if the second field name is read, the subsequent information is continuously written into the blank cells under the second target field until all the data are written.
As shown in table two, it is an example of a data query result obtained by writing various field values in the data configuration table.
TABLE II data query results example
1 | Customer number | Throwing security dangerous seeds | Date of insuring |
2 | 0001 | Severe disease risk A | 20190301 |
3 | 0002 | Severe disease risk A | 20190301 |
4 | 0003 | NULL | NULL |
…… | …… | Severe disease risk A | …… |
…… | …… | Severe disease risk A | …… |
1001 | 1000 | Severe disease risk A | 20190721 |
When a field value is not read, the default character is used as the corresponding field value, so that even if a missing value occurs, the missing value can be visually displayed in a subsequent data query result, the problem that the data query result is in wrong rows or columns due to the existence of the missing value is solved, and the accuracy of data is further ensured.
It should be noted that, the sequence numbers of the steps in the foregoing embodiments do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Referring to fig. 4, a schematic diagram of a data query apparatus according to an embodiment of the present application is shown, where the apparatus may be applied to a terminal device, and specifically may include the following modules:
the extracting module 401 is configured to extract information to be queried carried in a data query instruction when the data query instruction is received, where the information to be queried includes table information of a data table to be queried and field information of a field to be queried;
a determining module 402, configured to determine a table structure of the to-be-queried data table according to the table information;
a generating module 403, configured to generate a data configuration table according to the table structure and the field information, where the data configuration table includes a target field corresponding to the field to be queried;
a reading module 404, configured to read a plurality of field values corresponding to the field to be queried, and separate the field values by using preset separators;
a writing module 405, configured to write the read field values into data bits corresponding to target fields of the data configuration table in sequence, so as to obtain a data query result.
In this embodiment, the apparatus may further include the following modules:
the device information sending module is used for obtaining device information of the terminal device and sending the device information to a server storing the data table to be inquired, wherein the device information is used for indicating the server to configure data access permission for the terminal device;
and the login information receiving module is used for receiving login information returned by the server according to the data access authority, and the login information is used for establishing a data transmission channel between the terminal equipment and the server.
In this embodiment of the application, the determining module 402 may specifically include the following sub-modules:
the attribute information acquisition submodule is used for acquiring the attribute information of the data table to be inquired according to the table information;
the field and field name determining submodule is used for determining a plurality of fields contained in the data table to be inquired and field names corresponding to the fields according to the attribute information; and the number of the first and second groups,
and the field storage mode determining submodule is used for determining the storage modes of the fields, and the storage modes comprise that the field names corresponding to the fields are positioned in the same row or the same column.
In this embodiment, the generating module 403 may specifically include the following sub-modules:
the blank data table generating submodule is used for generating a blank data table;
the field name writing sub-module is used for writing the field names corresponding to the fields to be inquired into the target row of the blank data table if the field names corresponding to the fields are positioned in the same row; if the field names corresponding to the fields are in the same column, writing the field names corresponding to the fields to be inquired into a target column of the blank data table to obtain a data configuration table; the target row is any row of the blank data table, and the target column is any column of the blank data table.
In this embodiment of the application, the reading module 404 may specifically include the following sub-modules:
the field name and field value reading sub-module is used for reading the field names of the fields to be inquired and a plurality of field values corresponding to the field names column by column if the field names corresponding to the fields are positioned in the same row; if the field names corresponding to the fields are located in the same column, reading the field name of the field to be queried and the field values corresponding to the field name line by line, and separating the read field names and the field values through preset separators.
In this embodiment, the reading module 404 may further include the following sub-modules:
and the field value replacing submodule is used for adopting preset characters as the field value corresponding to the first field if the field value corresponding to the first field is not read, wherein the first field is any field in the fields to be inquired.
In this embodiment, the writing module 405 may specifically include the following sub-modules:
the field name and target field determining submodule is used for determining each field name in the read data and determining a target field corresponding to each field name in the data configuration table;
the field value writing sub-module is used for sequentially writing the field values after the field names into the data bits of the corresponding target fields according to the preset separators to obtain data query results; the data bit is a blank cell in the data configuration table for filling in a field value.
For the apparatus embodiment, since it is substantially similar to the method embodiment, it is described relatively simply, and reference may be made to the description of the method embodiment section for relevant points.
Referring to fig. 5, a schematic diagram of a terminal device according to an embodiment of the present application is shown. As shown in fig. 5, the terminal device 500 of the present embodiment includes: a processor 510, a memory 520, and a computer program 521 stored in the memory 520 and executable on the processor 510. The processor 510 implements the steps in various embodiments of the data query method described above, such as the steps S101 to S105 shown in fig. 1, when executing the computer program 521. Alternatively, the processor 510, when executing the computer program 521, implements the functions of each module/unit in each device embodiment described above, for example, the functions of the modules 401 to 405 shown in fig. 4.
Illustratively, the computer program 521 may be partitioned into one or more modules/units that are stored in the memory 520 and executed by the processor 510 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which may be used for describing the execution process of the computer program 521 in the terminal device 500. For example, the computer program 521 may be divided into an extracting module, a determining module, a generating module, a reading module and a writing module, and the specific functions of each module are as follows:
the device comprises an extraction module, a query module and a query module, wherein the extraction module is used for extracting information to be queried carried in a data query instruction when the data query instruction is received, and the information to be queried comprises table information of a data table to be queried and field information of a field to be queried;
the determining module is used for determining the table structure of the data table to be inquired according to the table information;
the generating module is used for generating a data configuration table according to the table structure and the field information, and the data configuration table comprises a target field corresponding to the field to be inquired;
the reading module is used for reading a plurality of field values corresponding to the field to be queried and separating the field values through preset separators;
and the writing module is used for sequentially writing the read field values into data bits corresponding to target fields of the data configuration table to obtain a data query result.
The terminal device 500 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device 500 may include, but is not limited to, a processor 510, a memory 520. Those skilled in the art will appreciate that fig. 5 is only an example of the terminal device 500, and does not constitute a limitation to the terminal device 500, and may include more or less components than those shown, or combine some components, or different components, for example, the terminal device 500 may further include an input-output device, a network access device, a bus, etc.
The Processor 510 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 520 may be an internal storage unit of the terminal device 500, such as a hard disk or a memory of the terminal device 500. The memory 520 may also be an external storage device of the terminal device 500, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so on, provided on the terminal device 500. Further, the memory 520 may also include both an internal storage unit and an external storage device of the terminal device 500. The memory 520 is used for storing the computer program 521 and other programs and data required by the terminal device 500. The memory 520 may also be used to temporarily store data that has been output or is to be output.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (10)
1. A data query method, which is applied to a terminal device, the method comprising:
when a data query instruction is received, extracting information to be queried carried in the instruction, wherein the information to be queried comprises table information of a data table to be queried and field information of a field to be queried;
determining the table structure of the data table to be inquired according to the table information;
generating a data configuration table according to the table structure and the field information, wherein the data configuration table comprises a target field corresponding to the field to be inquired;
reading a plurality of field values corresponding to the field to be queried, and separating the field values through preset separators;
and writing the read field values into data bits corresponding to target fields of the data configuration table in sequence to obtain a data query result.
2. The method according to claim 1, before extracting the information to be queried carried in the instruction, further comprising:
acquiring equipment information of terminal equipment, and sending the equipment information to a server for storing the data table to be inquired, wherein the equipment information is used for indicating the server to configure data access permission for the terminal equipment;
and receiving login information returned by the server according to the data access authority, wherein the login information is used for establishing a data transmission channel between the terminal equipment and the server.
3. The method according to claim 1, wherein the determining the table structure of the data table to be queried according to the table information comprises:
acquiring attribute information of the data table to be inquired according to the table information;
determining a plurality of fields contained in the data table to be inquired and field names corresponding to the fields according to the attribute information; and the number of the first and second groups,
and determining storage modes of the fields, wherein the storage modes comprise that the field names corresponding to the fields are positioned in the same row or the same column.
4. The method of claim 3, wherein generating a data configuration table according to the table structure and the field information comprises:
generating a blank data table;
if the field names corresponding to the fields are located in the same row, writing the field names corresponding to the fields to be inquired into a target row of the blank data table;
if the field names corresponding to the fields are in the same column, writing the field names corresponding to the fields to be inquired into a target column of the blank data table to obtain a data configuration table; the target row is any row of the blank data table, and the target column is any column of the blank data table.
5. The method according to claim 3, wherein the reading a plurality of field values corresponding to the field to be queried and separating the plurality of field values by preset separators comprises:
if the field names corresponding to the fields are located in the same row, reading the field name of the field to be queried and the field values corresponding to the field name column by column;
if the field names corresponding to the fields are located in the same column, reading the field name of the field to be queried and the field values corresponding to the field name line by line, and separating the read field names and the field values through preset separators.
6. The method of claim 5, further comprising:
if the field value corresponding to the first field is not read, adopting preset characters as the field value corresponding to the first field, wherein the first field is any field in the fields to be inquired.
7. The method according to claim 1, wherein said sequentially writing the read field values into data bits corresponding to target fields of the data configuration table to obtain a data query result comprises:
determining each field name in the read data, and determining a target field corresponding to each field name in the data configuration table;
according to the preset separators, sequentially writing the field values after the field names into the data bits of the corresponding target fields to obtain data query results; the data bit is a blank cell in the data configuration table for filling in a field value.
8. A data query apparatus, adapted to a terminal device, the apparatus comprising:
the device comprises an extraction module, a query module and a query module, wherein the extraction module is used for extracting information to be queried carried in a data query instruction when the data query instruction is received, and the information to be queried comprises table information of a data table to be queried and field information of a field to be queried;
the determining module is used for determining the table structure of the data table to be inquired according to the table information;
the generating module is used for generating a data configuration table according to the table structure and the field information, and the data configuration table comprises a target field corresponding to the field to be inquired;
the reading module is used for reading a plurality of field values corresponding to the field to be queried and separating the field values through preset separators;
and the writing module is used for sequentially writing the read field values into data bits corresponding to target fields of the data configuration table to obtain a data query result.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the data query method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the data query method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010227701.4A CN111459982A (en) | 2020-03-27 | 2020-03-27 | Data query method and device, terminal device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010227701.4A CN111459982A (en) | 2020-03-27 | 2020-03-27 | Data query method and device, terminal device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111459982A true CN111459982A (en) | 2020-07-28 |
Family
ID=71683314
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010227701.4A Pending CN111459982A (en) | 2020-03-27 | 2020-03-27 | Data query method and device, terminal device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111459982A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112181995A (en) * | 2020-11-06 | 2021-01-05 | 深圳视界信息技术有限公司 | Data processing method, device and equipment of data table and storage medium |
CN112433673A (en) * | 2020-11-13 | 2021-03-02 | 苏州浪潮智能科技有限公司 | Method and device for storing data in solid state disk |
CN112445873A (en) * | 2020-12-02 | 2021-03-05 | 深圳市镜玩科技有限公司 | List display processing method, related device, equipment and medium |
CN112765175A (en) * | 2021-01-21 | 2021-05-07 | 恒安嘉新(北京)科技股份公司 | Interface data processing method and device, computer equipment and medium |
CN113271307A (en) * | 2021-05-18 | 2021-08-17 | 中国工商银行股份有限公司 | Data assembling method, device, computer system and storage medium |
CN113656430A (en) * | 2021-08-12 | 2021-11-16 | 上海二三四五网络科技有限公司 | Control method and device for automatic expansion of batch table data |
CN113806373A (en) * | 2021-09-29 | 2021-12-17 | 中国平安人寿保险股份有限公司 | Data processing method and device, electronic equipment and storage medium |
CN114048238A (en) * | 2022-01-12 | 2022-02-15 | 树根互联股份有限公司 | Storage method and device for industrial equipment time sequence data and electronic equipment |
CN114185890A (en) * | 2021-12-09 | 2022-03-15 | 北京航星永志科技有限公司 | Database retrieval method and device, storage medium and electronic equipment |
CN114610959A (en) * | 2022-05-12 | 2022-06-10 | 恒生电子股份有限公司 | Data processing method, device, equipment and storage medium |
CN117874133A (en) * | 2023-12-19 | 2024-04-12 | 广州极点三维信息科技有限公司 | Mass data storage processing method, system, electronic equipment and storage medium |
CN113806373B (en) * | 2021-09-29 | 2024-07-26 | 中国平安人寿保险股份有限公司 | Data processing method, device, electronic equipment and storage medium |
-
2020
- 2020-03-27 CN CN202010227701.4A patent/CN111459982A/en active Pending
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112181995A (en) * | 2020-11-06 | 2021-01-05 | 深圳视界信息技术有限公司 | Data processing method, device and equipment of data table and storage medium |
CN112181995B (en) * | 2020-11-06 | 2023-08-29 | 深圳数阔信息技术有限公司 | Data processing method, device, equipment and storage medium of data table |
CN112433673B (en) * | 2020-11-13 | 2022-08-09 | 苏州浪潮智能科技有限公司 | Method and device for storing data in solid state disk |
CN112433673A (en) * | 2020-11-13 | 2021-03-02 | 苏州浪潮智能科技有限公司 | Method and device for storing data in solid state disk |
CN112445873A (en) * | 2020-12-02 | 2021-03-05 | 深圳市镜玩科技有限公司 | List display processing method, related device, equipment and medium |
CN112445873B (en) * | 2020-12-02 | 2024-03-26 | 深圳市镜玩科技有限公司 | List display processing method, related device, equipment and medium |
CN112765175A (en) * | 2021-01-21 | 2021-05-07 | 恒安嘉新(北京)科技股份公司 | Interface data processing method and device, computer equipment and medium |
CN112765175B (en) * | 2021-01-21 | 2024-05-24 | 恒安嘉新(北京)科技股份公司 | Interface data processing method and device, computer equipment and medium |
CN113271307A (en) * | 2021-05-18 | 2021-08-17 | 中国工商银行股份有限公司 | Data assembling method, device, computer system and storage medium |
CN113656430B (en) * | 2021-08-12 | 2024-02-27 | 上海二三四五网络科技有限公司 | Control method and device for automatic expansion of batch table data |
CN113656430A (en) * | 2021-08-12 | 2021-11-16 | 上海二三四五网络科技有限公司 | Control method and device for automatic expansion of batch table data |
CN113806373A (en) * | 2021-09-29 | 2021-12-17 | 中国平安人寿保险股份有限公司 | Data processing method and device, electronic equipment and storage medium |
CN113806373B (en) * | 2021-09-29 | 2024-07-26 | 中国平安人寿保险股份有限公司 | Data processing method, device, electronic equipment and storage medium |
CN114185890A (en) * | 2021-12-09 | 2022-03-15 | 北京航星永志科技有限公司 | Database retrieval method and device, storage medium and electronic equipment |
CN114048238B (en) * | 2022-01-12 | 2022-04-12 | 树根互联股份有限公司 | Storage method and device for industrial equipment time sequence data and electronic equipment |
CN114048238A (en) * | 2022-01-12 | 2022-02-15 | 树根互联股份有限公司 | Storage method and device for industrial equipment time sequence data and electronic equipment |
CN114610959A (en) * | 2022-05-12 | 2022-06-10 | 恒生电子股份有限公司 | Data processing method, device, equipment and storage medium |
CN117874133A (en) * | 2023-12-19 | 2024-04-12 | 广州极点三维信息科技有限公司 | Mass data storage processing method, system, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111459982A (en) | Data query method and device, terminal device and storage medium | |
CN109740122B (en) | Method and device for converting thinking guide graph use case file | |
CN109558525B (en) | Test data set generation method, device, equipment and storage medium | |
CN110955661B (en) | Data fusion method and device, readable storage medium and electronic equipment | |
CN110019116B (en) | Data tracing method, device, data processing equipment and computer storage medium | |
CN108460068B (en) | Method, device, storage medium and terminal for importing and exporting report | |
CN112860777B (en) | Data processing method, device and equipment | |
CN115827895A (en) | Vulnerability knowledge graph processing method, device, equipment and medium | |
CN111475494A (en) | Mass data processing method, system, terminal and storage medium | |
CN106547658A (en) | A kind of automated testing method and device | |
CN113688288A (en) | Data association analysis method and device, computer equipment and storage medium | |
CN110750440A (en) | Data testing method and terminal equipment | |
CN111125220A (en) | Information user-defined export method and device | |
CN112948233A (en) | Interface testing method, device, terminal equipment and medium | |
CN114064657A (en) | Multi-table integration method, device, equipment and storage medium | |
CN113434542B (en) | Data relationship identification method and device, electronic equipment and storage medium | |
CN110866382A (en) | Document generation method, device, terminal equipment and medium | |
CN109241163B (en) | Electronic certificate generation method and terminal equipment | |
CN112947911A (en) | Interface script generation method, device, equipment and storage medium | |
CN117493309A (en) | Standard model generation method, device, equipment and storage medium | |
CN111933228B (en) | Method and device for realizing project distribution and management system in clinical research | |
CN108255823B (en) | Method and device for reading invoice information | |
CN112559331A (en) | Test method and device | |
CN104915352B (en) | A kind of method and apparatus that data correctness is handled under verification MapReduce environment | |
CN112463633A (en) | Method, device, equipment and medium for checking address decoding of on-chip memory |
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 |