Multi-valued data query method and system under same condition

By splitting and integrating multi-value queries in the query interface, the problems of low efficiency and low accuracy in the traditional query mode are solved, and efficient and accurate multi-value data query under the same conditions is achieved, which improves the stability of the system and the readability of data display.

CN120631934APending Publication Date: 2025-09-12WUHAN MARINE MACHINERY PLANT
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510725981.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In the traditional data query mode, users need to input data one by one and query multiple times, resulting in low query efficiency and low data accuracy. Especially in the query scenario with multiple values ​​under the same condition, the query results are scattered, time-consuming and prone to human errors.

Method used

Enter a string containing multiple query values ​​in the query interface, split it into independent query values ​​using a delimiter, store it in a temporary array and traverse the query, generate a temporary table to consolidate the results, display the query results in the table, set up an exception capture mechanism and paging/grouping processing, and finally safely clean up temporary resources.

Benefits of technology

It achieves efficient completion of batch processing of multi-value queries, ensures the accuracy and completeness of query results, improves query efficiency and data accuracy, lowers the operation threshold, and enhances system stability and the orderliness of data display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631934A_ABST
    Figure CN120631934A_ABST
Patent Text Reader

Abstract

The invention discloses a method and system for querying data under the same condition of multiple values, and the method comprises the steps: reading a query character string containing separators, splitting and cleaning independent query values, and storing the independent query values into a temporary array after legality verification (data type, field existence and duplicate removal); creating a temporary table to store each value query result, and displaying after integration; the system comprises a query data pre-reading processing module (multi-separator analysis and invalid value filtering), a query result storage module (temporary table dynamic creation), a multi-valued condition query module (multi-valued database query), a query result display module (result association integration) and a space cleaning and log recording module (resource recovery and operation recording). According to the design, the problem of low efficiency of single-value one-by-one query is avoided through a batch processing mechanism, and the multi-value query efficiency is improved; the validity of input data is ensured by means of pre-verification and deduplication technologies, invalid queries are reduced, and the result accuracy is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method and system for data query, belonging to the technical field of database query, and in particular to a method and system for data query under multi-value identical conditions. Background Art

[0002] Data query is a core function in the daily use of information systems. Currently, system front-end interfaces generally utilize paging queries or conventional query modes based on one or multiple conditions, such as filtering orders by time or retrieving employee information by department. However, as business scenarios become increasingly complex, the limitations of traditional data query modes are gradually exposed when users need to query multiple values ​​simultaneously under the same condition.

[0003] Taking e-commerce systems as an example, if operators need to simultaneously monitor the inventory status of multiple products, they can only query by entering the product numbers one by one. Similarly, in customer relationship management systems, sales staff who want to batch-retrieve transaction records for multiple customers must perform multiple queries. Similarly, in library management systems, administrators who want to check the borrowing status of multiple books must similarly initiate queries one by one. This traditional data query model of "entering one by one, querying multiple times" results in fragmented display, forcing users to manually record and aggregate data. Furthermore, batch query operations are time-consuming and lengthy, and frequent repetitions can easily lead to human errors, such as missing data and confusing results. Overall, this traditional data query model of "entering one by one, querying multiple times" is inefficient and lacks high data accuracy.

[0004] A Chinese patent application with application number CN202411068003.9 and application date August 6, 2024 discloses a database-based data indexing and query optimization system and method, the system including a query optimization module, an index construction module and a data storage module; the data storage module is used to store data records in the database; the data records are stored in columnar format to improve data compression rate and query performance storage, and reduce disk I / O operations; the index construction module is used to construct an index based on the data records in the data storage module, and the index adopts a B+ tree design to reduce the number of I / O operations when data is transferred between disk and memory; the query optimization module is used to receive query requests and optimize the query path according to the index constructed by the index construction module.

[0005] This design improves the data indexing efficiency and query performance of the database system by optimizing the underlying storage, indexing, and query paths. It solves the problems of low indexing efficiency, long query response time, and frequent disk I / O operations when traditional databases process large-scale data. However, it still has not been optimized for the front-end input mode, and has not solved the problems of low query efficiency and low data accuracy caused by the traditional data query mode of "input one by one, multiple queries".

[0006] The information disclosed in this background technology section is only intended to increase understanding of the overall background of the application and should not be considered as an admission or any form of suggestion that the information constitutes the prior art already known to ordinary technicians in this field. Summary of the Invention

[0007] The purpose of the present invention is to overcome the problems of low query efficiency and low data accuracy in the existing search, and to provide a method and system for multi-value data query under the same conditions with high query efficiency and high data accuracy.

[0008] To achieve the above objectives, the technical solution of the present invention is: A method for querying data under multiple conditions, comprising the following steps: Step 1: First, enter a string consisting of at least one query value in the query box of the query interface, and then separate each query value in the string with a delimiter to make each query value an independent query value; Step 2: first create a temporary array, and then store the independent query value in the temporary array; Step 3: First, create a temporary table, then traverse and query the independent query values ​​in the temporary array, and then store the query results generated by each independent query value under the same query condition into the temporary table in sequence; Step 4: First, create a display table, which includes a header area for recording the string input in the first step, and a content area for displaying independent query values ​​and their corresponding query results. Then, fill the string into the header area, and then, according to the order of traversing the independent query values ​​in the temporary query array in the third step, fill each independent query value and its corresponding query result in the temporary table into the content area in turn to obtain a query result table for the string. Finally, display the query result table on the query interface to complete the query for the string.

[0009] The method also includes a fifth step: after confirming that the query result table is successfully displayed on the query interface, first deleting the data in the temporary array and the temporary table, then releasing the memory space occupied by the temporary array and the temporary table, and finally recording an operation log, wherein the content of the operation log includes the time of the string query, the content of the input string, and the number of string query result records.

[0010] In the fifth step, when deleting the data in the temporary array and the temporary table, the temporary array and the temporary table are first locked to prevent interference from other operations, and then it is verified whether the query result table has been successfully displayed on the query interface. If it has not been successfully displayed, the deletion of the temporary array and the temporary table is suspended. If it has been successfully displayed, the data in the temporary table and the temporary table and the temporary array are cleared in batches, and finally the memory space occupied by the temporary table and the temporary array is released.

[0011] In the first step, the delimiter is at least one of a comma, a semicolon, a space, and a colon.

[0012] In the first step, after entering a string in the query box of the query interface, the number of query values ​​contained in the string is first determined. If the string contains only a single query value, the query value is directly queried and the query results are displayed on the query interface; If the string contains multiple query values, separate the query values ​​with a delimiter so that each query value becomes an independent query value before proceeding to the subsequent steps.

[0013] If the string contains only one query value, before querying the query value, first remove the spaces at the beginning and end of the query value and clean up invalid characters, then verify the query value. If the verification passes, directly query the query value and display the query result on the query interface; If the string contains multiple query values, after using the delimiter to separate the query values ​​in the string to form independent query values, remove the leading and trailing spaces of each independent query value and clean up invalid characters, then verify each independent query value, and finally retain the independent query values ​​that pass the verification for subsequent processing steps.

[0014] The verification content includes: First, perform format validation on the query value or independent query value to check whether the format of the query value or independent query value is correct. Then, perform uniqueness check on the query value or independent query value that passes the format validation, remove duplicate query values ​​or independent query values, and finally directly query or retain the query value or independent query value that passes the format validation and is unique.

[0015] In the third step, when traversing and querying the independent query values ​​in the temporary array, an exception capture mechanism is set for the query operation of each independent query value. When a query exception is captured, the independent query value corresponding to the query exception, the type of the exception, and the time when the exception occurred are first recorded, and then it is determined whether the type of the exception is a recoverable exception. If it is a recoverable exception, the query operation of the independent query value is re-executed after a preset time, and the query result of the successful retry is stored in the temporary table; if it is an unrecoverable exception, the query operation of the independent query value is skipped and marked as an abnormal value, and the next independent query value is queried. After all independent query values ​​are queried, the number and type of abnormal values ​​are counted to generate an exception record.

[0016] In the fourth step, when the query result table is displayed on the query interface, the query result table is paged or grouped, specifically including: Paging: Take an independent query value and its query result as a record, and divide all records in the content area into multiple pages. Each page contains a fixed number of records. Grouping processing: Take an independent query value and its query result as a record. First, classify according to the category of the independent query value or query result, and then group all records in the content area, and put records of the same type into one group.

[0017] A system for a method of querying data under multiple conditions under the same conditions, comprising a query data reading preprocessing module, a query result storage module, a multiple condition query module, a query result display module, a space cleaning and log recording module; The query data reading preprocessing module is used to execute the first and second steps of the method, first reading a string consisting of query values ​​inputted from the query interface, splitting the string into independent query values ​​based on a delimiter, then creating a temporary array and storing the independent query values, and finally passing the temporary array storing the independent query values ​​to the multi-value condition query module; The multi-value condition query module is used to execute the third step of the method to traverse and query the independent query values ​​in the temporary array, call the system database query language to query the independent query values ​​in the temporary array one by one under the same condition, and notify the query result storage module that the query is complete after the query results of all independent query values ​​are stored in the temporary table; The query result storage module is used to execute the creation of the temporary table in the third step of the method, and after the multi-value condition query module completes the query, transfer the temporary table storing the query results of all independent query values ​​and the temporary array storing the independent query values ​​to the query result display module; The query result display module is used to execute the fourth step of the method, first creating a display table including a header area and a content area, then filling the header area with a string, and then filling the content area with independent query values ​​and their query results in the order of traversing the independent query values, and then passing the query result table to the query interface. After the query result table is displayed on the query interface, the query result display module then transmits a query result table display completion signal to the space cleaning and logging module; The space cleaning and logging module is used to execute the fifth step of the method. After confirming that the query result table is successfully displayed on the query interface, the temporary array and temporary table are cleared to release system space, and the operating parameters of each module during this query process are recorded to generate an operation log.

[0018] Compared with the prior art, the present invention has the following beneficial effects: 1. A method and system for data query under multiple values ​​and the same condition of the present invention comprises the following steps: first, inputting a string consisting of at least one query value in a query box of a query interface, separating each query value in the string with a delimiter so that each query value becomes an independent query value; second, establishing a temporary array and storing the independent query values ​​in the temporary array; third, creating a temporary table, traversing and querying the independent query values ​​in the temporary array, and sequentially storing the query results generated by each independent query value under the same query condition in the temporary table; fourth, creating a display table, the display table comprising a header area for recording the string input in the first step, and a content area for displaying the independent query values ​​and their corresponding query results, The string is filled into the header area, and according to the order of the independent query values ​​in the temporary array in the third step, each independent query value and its corresponding query result in the temporary table are filled into the content area in sequence to obtain a query result table for the string. The query result table is displayed on the query interface to complete the query for the string. Compared with the traditional method of inputting one by one and querying multiple times, this method only needs to input a string containing all query values ​​in the query box at one time, and the retrieval of all query values ​​can be completed synchronously through batch processing, which greatly shortens the total time consumption. At the same time, the split independent query values ​​are stored by the temporary array, and the intermediate results are integrated using the temporary table, which avoids the data deviation that may be caused by multiple queries and ensures the accuracy and completeness of the query results. Therefore, the present invention has high query efficiency and high data accuracy.

[0019] 2. The present invention provides a method and system for data query under multiple conditions, the method further comprising a fifth step, which involves clearing temporary array and temporary table data in batches after locking a temporary data structure and verifying the result display status, simultaneously releasing memory space and recording an operation log containing key information. This not only prevents long-term occupation of temporary resources from affecting system performance, but also ensures the stability of the data clearing process through security verification and batch processing. Furthermore, the complete log records provide a reliable basis for subsequent tracing and maintenance. Therefore, the present invention achieves the unity of efficient resource recovery, safe and controllable operation, and traceability.

[0020] 3. In a method and system for querying data under multiple conditions under the same conditions, in the first step, the delimiter used is at least one of a comma, a semicolon, a space, and a colon. When inputting a character string, a comma, a semicolon, a space, or a colon can be freely selected according to input habits, and a mixture of multiple delimiters can be used to separate the query values ​​in the character string. This eliminates the need for a specific format when inputting, and whether it is a commonly used delimiter in a Chinese or English environment, or a mixture of multiple delimiters, or even directly pasting multi-source data in different formats, the query values ​​can be quickly and accurately identified and split, lowering the threshold for use and demonstrating extremely high flexibility and ease of use. Therefore, the present invention has high flexibility when inputting queries and lowers the threshold for query operations.

[0021] 4. The present invention provides a method and system for data query under multiple values ​​under the same condition. In the first step, after entering a character string in the query box of the query interface, the number of query values ​​contained in the character string is first determined. If it is a single query value, the first and last spaces are removed, invalid characters are cleaned, and then the format and uniqueness are verified. After the verification is passed, the query is queried and the results are displayed. If it is multiple query values, the values ​​are first split into independent query values ​​using a separator, and the first and last spaces are removed, invalid characters are cleaned, and then the format and uniqueness are verified one by one. After retaining the query values ​​that pass the verification, subsequent processing is performed. This case-by-case processing mechanism directly enters the fast verification process for single-value queries, avoiding unnecessary segmentation operations. For multi-value queries, invalid data is eliminated in the verification stage, reducing the processing burden of subsequent steps. At the same time, the format verification ensures that each query value meets expectations, avoiding query resource waste caused by invalid data, and the uniqueness check avoids repeated queries, further optimizing resource utilization. Therefore, the present invention achieves dual optimization of query efficiency and resource consumption by finely processing single and multiple query values ​​according to the situation when querying.

[0022] 5. A method and system for data query under multiple values ​​under the same condition of the present invention, in the third step, when traversing the independent query values ​​in the temporary array, an exception capture mechanism is set for the query operation of each independent query value. When a query exception is captured, the independent query value corresponding to the query exception, the type of the exception and the time when the exception occurs are first recorded, and then the type of the exception is determined to be a recoverable exception. If it is a recoverable exception, the query operation of the independent query value is re-executed after a preset time, and the query result of the successful retry is stored in a temporary table; if it is an unrecoverable exception, the query operation of the independent query value is skipped and marked as an exception value, and the next independent query value is continued to be queried. After all independent query values ​​have been queried, the number and type of exception values ​​are counted to generate an exception record; the exception capture mechanism effectively improves the stability and fault tolerance of the system during the query process, can reduce query interruptions caused by occasional exceptions, and can protect the integrity of batch queries through an intelligent retry mechanism, ensuring the stability and reliability of the multi-value same condition query process. Therefore, the present invention improves the stability and fault tolerance of the data query process by setting an exception capture mechanism during the query process, ensuring the continuous and reliable operation of the query process.

[0023] 6. In a method and system for data query under the same conditions of multiple values ​​of the present invention, in the fourth step, when the query result table is displayed on the query interface, the query result table is paged or grouped, specifically including: paging processing: taking an independent query value and its query result as a record, all records in the content area are divided into multiple pages, each page containing a fixed number of records; grouping processing: taking an independent query value and its query result as a record, first classify according to the category of the independent query value or query result, and then group all records in the content area, and group records of the same type into one group; through the paging function, the data display density can be flexibly controlled to avoid interface jams caused by loading a large amount of data at one time, thereby improving browsing efficiency and operating experience; the grouping function helps to quickly locate and compare query results of different categories or dimensions by classifying the data by field type, which is particularly suitable for business scenarios that require multi-dimensional analysis of data, significantly enhancing the orderliness and readability of data display, and making the presentation of query results more in line with actual analysis needs. Therefore, the present invention improves browsing efficiency and data orderliness by adding paging and grouping functions to the query result table, facilitating multi-dimensional analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a schematic diagram of the overall process of the method of the present invention.

[0025] Figure 2 It is a schematic diagram of the functional module structure of the system in the present invention. DETAILED DESCRIPTION

[0026] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0027] See also Figure 1 — Figure 2 A method for querying data under multiple conditions, comprising the following steps: Step 1: First, enter a string consisting of at least one query value in the query box of the query interface, and then separate each query value in the string with a delimiter to make each query value an independent query value; Step 2: first create a temporary array, and then store the independent query value in the temporary array; Step 3: First, create a temporary table, then traverse and query the independent query values ​​in the temporary array, and then store the query results generated by each independent query value under the same query condition into the temporary table in sequence; Step 4: First, create a display table, which includes a header area for recording the string input in the first step, and a content area for displaying independent query values ​​and their corresponding query results. Then, fill the string into the header area, and then, according to the order of traversing the independent query values ​​in the temporary query array in the third step, fill each independent query value and its corresponding query result in the temporary table into the content area in turn to obtain a query result table for the string. Finally, display the query result table on the query interface to complete the query for the string.

[0028] The method also includes a fifth step: after confirming that the query result table is successfully displayed on the query interface, first deleting the data in the temporary array and the temporary table, then releasing the memory space occupied by the temporary array and the temporary table, and finally recording an operation log, wherein the content of the operation log includes the time of the string query, the content of the input string, and the number of string query result records.

[0029] In the fifth step, when deleting the data in the temporary array and the temporary table, the temporary array and the temporary table are first locked to prevent interference from other operations, and then it is verified whether the query result table has been successfully displayed on the query interface. If it has not been successfully displayed, the deletion of the temporary array and the temporary table is suspended. If it has been successfully displayed, the data in the temporary table and the temporary table and the temporary array are cleared in batches, and finally the memory space occupied by the temporary table and the temporary array is released.

[0030] In the first step, the delimiter is at least one of a comma, a semicolon, a space, and a colon.

[0031] In the first step, after entering a string in the query box of the query interface, the number of query values ​​contained in the string is first determined. If the string contains only a single query value, the query value is directly queried and the query results are displayed on the query interface; If the string contains multiple query values, separate the query values ​​with a delimiter so that each query value becomes an independent query value before proceeding to the subsequent steps.

[0032] If the string contains only one query value, before querying the query value, first remove the spaces at the beginning and end of the query value and clean up invalid characters, then verify the query value. If the verification passes, directly query the query value and display the query result on the query interface; If the string contains multiple query values, after using the delimiter to separate the query values ​​in the string to form independent query values, remove the leading and trailing spaces of each independent query value and clean up invalid characters, then verify each independent query value, and finally retain the independent query values ​​that pass the verification for subsequent processing steps.

[0033] The verification content includes: First, perform format validation on the query value or independent query value to check whether the format of the query value or independent query value is correct. Then, perform uniqueness check on the query value or independent query value that passes the format validation, remove duplicate query values ​​or independent query values, and finally directly query or retain the query value or independent query value that passes the format validation and is unique.

[0034] In the third step, when traversing and querying the independent query values ​​in the temporary array, an exception capture mechanism is set for the query operation of each independent query value. When a query exception is captured, the independent query value corresponding to the query exception, the type of the exception, and the time when the exception occurred are first recorded, and then it is determined whether the type of the exception is a recoverable exception. If it is a recoverable exception, the query operation of the independent query value is re-executed after a preset time, and the query result of the successful retry is stored in the temporary table; if it is an unrecoverable exception, the query operation of the independent query value is skipped and marked as an abnormal value, and the next independent query value is queried. After all independent query values ​​are queried, the number and type of abnormal values ​​are counted to generate an exception record.

[0035] In the fourth step, when the query result table is displayed on the query interface, the query result table is paged or grouped, specifically including: Paging: Take an independent query value and its query result as a record, and divide all records in the content area into multiple pages. Each page contains a fixed number of records. Grouping processing: Take an independent query value and its query result as a record. First, classify according to the category of the independent query value or query result, and then group all records in the content area, and put records of the same type into one group.

[0036] A system for a method of querying data under multiple conditions under the same conditions, comprising a query data reading preprocessing module, a query result storage module, a multiple condition query module, a query result display module, a space cleaning and log recording module; The query data reading preprocessing module is used to execute the first and second steps of the method, first reading a string consisting of query values ​​inputted from the query interface, splitting the string into independent query values ​​based on a delimiter, then creating a temporary array and storing the independent query values, and finally passing the temporary array storing the independent query values ​​to the multi-value condition query module; The multi-value condition query module is used to execute the third step of the method to traverse and query the independent query values ​​in the temporary array, call the system database query language to query the independent query values ​​in the temporary array one by one under the same condition, and notify the query result storage module that the query is complete after the query results of all independent query values ​​are stored in the temporary table; The query result storage module is used to execute the creation of the temporary table in the third step of the method, and after the multi-value condition query module completes the query, transfer the temporary table storing the query results of all independent query values ​​and the temporary array storing the independent query values ​​to the query result display module; The query result display module is used to execute the fourth step of the method, first creating a display table including a header area and a content area, then filling the header area with a string, and then filling the content area with independent query values ​​and their query results in the order of traversing the independent query values, and then passing the query result table to the query interface. After the query result table is displayed on the query interface, the query result display module then transmits a query result table display completion signal to the space cleaning and logging module; The space cleaning and logging module is used to execute the fifth step of the method. After confirming that the query result table is successfully displayed on the query interface, the temporary array and temporary table are cleared to release system space, and the operating parameters of each module during this query process are recorded to generate an operation log.

[0037] Example 1: See also Figure 1A method for querying data under multiple conditions with the same value includes the following steps: first, inputting a string consisting of at least one query value in a query box of a query interface, and then separating each query value in the string with a delimiter so that each query value becomes an independent query value; second, establishing a temporary array and then storing the independent query values ​​in the temporary array; third, creating a temporary table, then traversing and querying the independent query values ​​in the temporary array, and then sequentially storing the query results generated by each independent query value under the same query condition in the temporary table; fourth, creating a display table, the display table including a header area for recording the string input in the first step and a content area for displaying the independent query values ​​and their corresponding query results, then filling the string into the header area, and then, in the order of traversing and querying the independent query values ​​in the temporary array in the third step, sequentially filling each independent query value and its corresponding query result in the temporary table into the content area to obtain a query result table for the string, and finally displaying the query result table on the query interface to complete the query of the string.

[0038] In applications such as e-commerce systems, users want to query the inventory status of multiple products at the same time: Step 1: The user enters a string consisting of multiple product IDs in the query box of the query interface, such as "product1, product2, product3". Use commas as delimiters to separate each product ID into independent query values ​​"product1", "product2", and "product3".

[0039] Step 2: Create a temporary array and store "product1", "product2", and "product3" in the temporary array in sequence.

[0040] Step 3: Create a temporary table, and then traverse and query "product1", "product2", and "product3" in the temporary array under the same inventory query conditions, and store the inventory query results corresponding to "product1", "product2", and "product3" in the temporary table in sequence.

[0041] Step 4: Create a display table. First, fill the user-entered "product1, product2, product3" into the header area. Then, in the order of traversal query "product1", "product2", and "product3", fill "product1", "product2", and "product3" and their corresponding inventory query results in the temporary table into the content area to generate a product inventory query result table. Finally, display the query result table on the query interface to complete the query on the inventory status of multiple products.

[0042] Example 2: The basic content is the same as Example 1, except that: The method also includes a fifth step: after confirming that the query result table is successfully displayed on the query interface, first deleting the data in the temporary array and the temporary table, then releasing the memory space occupied by the temporary array and the temporary table, and finally recording an operation log, wherein the content of the operation log includes the time of the string query, the content of the input string, and the number of string query result records; in the fifth step, when deleting the data in the temporary array and the temporary table, first locking the temporary array and the temporary table to prevent interference from other operations, and then verifying whether the query result table has been successfully displayed on the query interface. If it has not been successfully displayed, suspending the deletion of the temporary array and the temporary table. If it has been successfully displayed, using a batch deletion method to clear the data in the temporary table and the temporary table and the temporary array, and finally releasing the memory space occupied by the temporary table and the temporary array.

[0043] When applied, such as after batch querying product inventory on a shopping platform: after confirming that the inventory information has been fully displayed on the query interface, first "lock" to protect the temporary array storing product IDs and the temporary table with detailed inventory data. Then check whether the inventory quantity of all products on the page is displayed (for example, if a product is found to be displayed as "Loading"), if not all are displayed, pause the cleanup. If the display is normal, delete the data in the temporary table in batches. After deleting the data, completely delete the temporary table and clear the memory occupied by the product ID list. The entire process will be recorded in the log (such as "May 19, 16:30: The inventory temporary table has been cleared, freeing 128MB of memory").

[0044] Example 3: The basic content is the same as Example 1, except that: In the first step, the delimiter is at least one of a comma, a semicolon, a space, and a colon.

[0045] When applied, if you enter "001,002; 003, 004" in the query box, and use a mixture of commas, semicolons, spaces, and colons to separate the values, it will be split into four independent query values: "001", "002", "003", and "004".

[0046] Example 4: The basic content is the same as Example 1, except that: In the first step, after entering a string in the query box of the query interface, the number of query values ​​contained in the string is first determined. If the string contains only a single query value, the query value is directly queried and the query results are displayed on the query interface. If the string contains multiple query values, each query value is separated by a delimiter so that each query value becomes an independent query value before proceeding to the subsequent steps. If the string contains only one query value, before querying the query value, the spaces at the beginning and end of the query value are removed and invalid characters are cleaned, and then the query value is verified. If the verification passes, the query value is directly queried and the query results are displayed on the query interface. If the string contains multiple query values, after using a delimiter to separate the query values ​​in the string to form independent query values, remove the leading and trailing spaces of each independent query value and clean up invalid characters, then verify each independent query value, and finally retain the independent query values ​​that pass the verification for subsequent processing; the verification content includes: first performing format verification on the query value or independent query value to check whether the format of the query value or independent query value is correct, then performing a uniqueness check on the query value or independent query value that passes the format verification, removing duplicate query values ​​or independent query values, and finally directly querying or retaining the query value or independent query value that passes the format verification and is unique.

[0047] When applying, if you need to query book borrowing information: if you only want to query the borrowing status of one book, enter "001" (including spaces at the beginning and end), first remove the spaces at the beginning and end to get "001", and verify whether it conforms to the data type and exists in the corresponding field of the book information database; if the verification passes, directly query and display the results on the query interface. If you need to query multiple books, for example, enter "001,002,003,003", split it into multiple independent query values ​​based on the delimiter, remove the spaces to get "001", "002", "003", "003", identify and remove duplicate "003", and then verify whether "001", "002", "003" conform to the data type and exist in the corresponding field of the book information database. After the verification passes, store them in a temporary array.

[0048] Example 5: The basic content is the same as Example 1, except that: In the third step, when traversing the independent query values ​​in the query temporary array, an exception capture mechanism is set for the query operation of each independent query value. When a query exception is captured, the independent query value corresponding to the query exception, the type of exception and the time when the exception occurred are recorded first, and then it is determined whether the type of exception is a recoverable exception. If it is a recoverable exception, the query operation of the independent query value is re-executed after a preset time, and the query result of the successful retry is stored in the temporary table; if it is an unrecoverable exception, the query operation of the independent query value is skipped and marked as an abnormal value, and the next independent query value is queried. After all independent query values ​​are queried, the number and type of abnormal values ​​are counted to generate an exception record.

[0049] When applied, for example, in a batch query of order status on an e-commerce platform: enter "2025001, 2025002, 2025003" to query the logistics information of three orders. The system performs independent queries on each order number and sets an exception capture mechanism: when querying "2025001", the database connection exception occurs for the first time due to server fluctuations. The system immediately records the exception type (connection exception), order number and occurrence time. Because it is a recoverable exception, the query is re-executed after the preset time. When automatically reconnecting, it records "reconnected 1 time". If the reconnection fails for 3 consecutive times (that is, the preset number of retries is exhausted), it is determined to be an unrecoverable exception and the system is terminated. The order query is stopped and "Query failed, please try again later" is displayed on the front end; when querying "2025002", a timeout exception occurs due to high concurrency. The system records the exception information and determines it as a recoverable exception. The order is marked as "pending retry" and the query priority is adjusted to low. After the system load is reduced (that is, the preset waiting time is reached), the query is repeated. After success, "[After retry] Shipped" is displayed in the result; when querying "2025003", the query result is empty due to the invalid order number. The system identifies it as an unrecoverable exception, marks the order result as "no matching data", skips subsequent query operations, and continues to process the next order.

[0050] Example 6: The basic content is the same as Example 1, except that: In the fourth step, when the query result table is displayed on the query interface, the query result table is paged or grouped, specifically including: paging processing: taking an independent query value and its query result as a record, all records in the content area are divided into multiple pages, and each page contains a fixed number of records; grouping processing: taking an independent query value and its query result as a record, first classify according to the category of the independent query value or query result, and then group all records in the content area, and group records of the same type together.

[0051] When applied, in the scenario of batch querying historical order data on the e-commerce platform, after entering multiple order numbers, the system supports flexible paging and grouping when displaying the query result table on the query interface: the paging function displays order records at a density of 20 per page by default, and the user can dynamically adjust the number of single-page displays through the interface drop-down menu (optional: 50 or 100 records per page). The system calculates the total number of records in real time and displays it in the page navigation bar (such as "Total 160"). Records"), the current page number and the total number of pages (such as "Current page 5 / 8 pages"), and supports users to directly enter the target page number to quickly jump (such as going directly from page 1 to page 5); the grouping function allows users to intelligently categorize results based on order field types: when choosing to group by "Order Date", the system automatically aggregates order records by year and month dimensions (such as "May 2025", "April 2025"); if choosing to group by "Order Status" (a category field), the records are divided into categories such as "Paid", "Shipped", "Completed", and "Canceled". Each group is collapsed by default, and users can click the group name to expand it to view specific order details. In this way, users can quickly compare the distribution of order data under different time periods or status types.

[0052] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by ordinary technicians in this field based on the contents disclosed in the present invention should be included in the protection scope recorded in the claims.

Claims

1. A method for querying data under multiple conditions, characterized by: The method comprises the following steps: Step 1: First, enter a string consisting of at least one query value in the query box of the query interface, and then separate each query value in the string with a delimiter to make each query value an independent query value; Step 2: first create a temporary array, and then store the independent query value in the temporary array; Step 3: First, create a temporary table, then traverse and query the independent query values ​​in the temporary array, and then store the query results generated by each independent query value under the same query condition into the temporary table in sequence; Step 4: First, create a display table, which includes a header area for recording the string input in the first step, and a content area for displaying independent query values ​​and their corresponding query results. Then, fill the string into the header area, and then, according to the order of traversing the independent query values ​​in the temporary query array in the third step, fill each independent query value and its corresponding query result in the temporary table into the content area in turn to obtain a query result table for the string. Finally, display the query result table on the query interface to complete the query for the string.

2. The method for querying data under multiple conditions according to claim 1, characterized in that: The method also includes a fifth step: after confirming that the query result table is successfully displayed on the query interface, first deleting the data in the temporary array and the temporary table, then releasing the memory space occupied by the temporary array and the temporary table, and finally recording an operation log, wherein the content of the operation log includes the time of the string query, the content of the input string, and the number of string query result records.

3. The method for querying data under multiple conditions according to claim 2, characterized in that: In the fifth step, when deleting the data in the temporary array and the temporary table, the temporary array and the temporary table are first locked to prevent interference from other operations, and then it is verified whether the query result table has been successfully displayed on the query interface. If it has not been successfully displayed, the deletion of the temporary array and the temporary table is suspended. If it has been successfully displayed, the data in the temporary table and the temporary table and the temporary array are cleared in batches, and finally the memory space occupied by the temporary table and the temporary array is released.

4. A method for querying data under multiple conditions according to claim 1, 2 or 3, characterized in that: In the first step, the delimiter is at least one of a comma, a semicolon, a space, and a colon.

5. The method for querying data under multiple conditions according to claim 1, 2 or 3, characterized in that: In the first step, after entering a string in the query box of the query interface, the number of query values ​​contained in the string is first determined. If the string contains only a single query value, the query value is directly queried and the query results are displayed on the query interface; If the string contains multiple query values, separate the query values ​​with a delimiter so that each query value becomes an independent query value before proceeding to the subsequent steps.

6. The method for querying data under multiple conditions according to claim 5, characterized in that: If the string contains only one query value, before querying the query value, first remove the spaces at the beginning and end of the query value and clean up invalid characters, then verify the query value. If the verification passes, directly query the query value and display the query result on the query interface; If the string contains multiple query values, after using the delimiter to separate the query values ​​in the string to form independent query values, remove the leading and trailing spaces of each independent query value and clean up invalid characters, then verify each independent query value, and finally retain the independent query values ​​that pass the verification for subsequent processing steps.

7. The method for querying data under multiple conditions according to claim 6, characterized in that: The verification content includes: First, perform format validation on the query value or independent query value to check whether the format of the query value or independent query value is correct. Then, perform uniqueness check on the query value or independent query value that passes the format validation, remove duplicate query values ​​or independent query values, and finally directly query or retain the query value or independent query value that passes the format validation and is unique.

8. The method for querying data under multiple conditions according to claim 1, 2 or 3, characterized in that: In the third step, when traversing and querying the independent query values ​​in the temporary array, an exception capture mechanism is set for the query operation of each independent query value. When a query exception is captured, the independent query value corresponding to the query exception, the type of the exception, and the time when the exception occurred are first recorded. Then, it is determined whether the type of the exception is a recoverable exception. If it is a recoverable exception, the query operation of the independent query value is re-executed after a preset time, and the query result of the successful retry is stored in the temporary table. If it is an unrecoverable exception, the query operation of the independent query value is skipped and marked as an abnormal value, and the next independent query value is queried. After all independent query values ​​are queried, the number and type of abnormal values ​​are counted and an abnormal record is generated.

9. The method for querying data under multiple conditions according to claim 1, 2 or 3, characterized in that: In the fourth step, when the query result table is displayed on the query interface, the query result table is paged or grouped, specifically including: Paging: Take an independent query value and its query result as a record, and divide all records in the content area into multiple pages. Each page contains a fixed number of records. Grouping processing: Take an independent query value and its query result as a record. First, classify according to the category of the independent query value or query result, and then group all records in the content area, and put records of the same type into one group.

10. A system for a method for querying data under multiple conditions according to claim 1, 2 or 3, characterized in that: The system includes a query data reading preprocessing module, a query result storage module, a multi-value condition query module, a query result display module, a space cleaning and log recording module; The query data reading preprocessing module is used to execute the first and second steps of the method, first reading a string consisting of query values ​​inputted from the query interface, splitting the string into independent query values ​​based on a delimiter, then creating a temporary array and storing the independent query values, and finally passing the temporary array storing the independent query values ​​to the multi-value condition query module; The multi-value condition query module is used to execute the third step of the method to traverse and query the independent query values ​​in the temporary array, call the system database query language to query the independent query values ​​in the temporary array one by one under the same condition, and notify the query result storage module that the query is complete after the query results of all independent query values ​​are stored in the temporary table; The query result storage module is used to execute the creation of the temporary table in the third step of the method, and after the multi-value condition query module completes the query, transfer the temporary table storing the query results of all independent query values ​​and the temporary array storing the independent query values ​​to the query result display module; The query result display module is used to execute the fourth step of the method, first creating a display table including a header area and a content area, then filling the header area with a string, and then filling the content area with independent query values ​​and their query results in the order of traversing the independent query values, and then passing the query result table to the query interface. After the query result table is displayed on the query interface, the query result display module then transmits a query result table display completion signal to the space cleaning and logging module; The space cleaning and logging module is used to execute the fifth step of the method. After confirming that the query result table is successfully displayed on the query interface, the temporary array and temporary table are cleared to release system space, and the operating parameters of each module during this query process are recorded to generate an operation log.

Citation Information

Patent Citations

  • Database-based data index and query optimization system and method

    CN119088800A