Large result set suppression method and system

By applying the predefined maximum row value in the data query request and identifying and intercepting SQL statement objects, the lack of security and flexibility of the large result set suppression scheme in the prior art is solved, effectively controlling the database query results is achieved, and the application stability and response speed are improved.

CN119669260APending Publication Date: 2025-03-21CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411737103.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

The existing large result set suppression scheme has insufficient security and flexibility, especially in a hybrid application environment, which cannot provide a unified query control strategy, and mainly relies on the application layer for overwriting, and does not implement constraints on the size of the query result set from the underlying connection pool level.

Method used

By responding to the user's data query trigger signal, the user's data query request is collected and the structured query language statement object is identified in the filter event adapter. Then, the predefined maximum row value is applied to the identified SQL statement object and the transmission is performed to ensure that the returned result data does not exceed the limit number of rows. The maximum row value can be a preset value or dynamically generated based on the memory usage of the currently to be executed service.

Benefits of technology

It realizes efficient control of database query results, avoids large result sets caused by unreasonable query conditions, reduces memory consumption and garbage collection frequency, improves application response time and stability, and provides flexible query result size control, ensuring the rational use of system resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669260A_ABST
    Figure CN119669260A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a large result set suppression method and system, and belongs to the technical field of data query. The method comprises the following steps: acquiring a data query request of a user in response to a data query trigger signal of the user; based on the data query request, performing structured query language statement object recognition in a corresponding filtering event adapter; applying a predetermined maximum row value to the identified structured query language statement object, and executing structured query language statement object transmission applying the predetermined maximum row value; and returning the result data of the corresponding number based on the predetermined maximum row value. According to the scheme, a large result set generated due to unreasonable query conditions is avoided, the memory consumption and the garbage collection frequency are reduced, and the application stability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query technology, and in particular to a large result set suppression method and a large result set suppression system. Background Art

[0002] In Java applications, database access and data query operations are usually managed through database connection pools (components used to manage database connections) to improve connection reuse and resource utilization efficiency. Druid (a widely used database connection pool) is a widely used database connection pool that provides rich functions such as connection management, SQL (Structured Query Language) parsing and execution monitoring, and is often used to manage connections between Java applications and databases. However, in the actual development process, when using persistence layer frameworks such as MyBatis (a persistence layer framework) and Hibernate (an object-relational mapping framework for the Java language), or directly querying data through JDBC (Java database connection), it is possible to trigger the return of a large amount of data due to unreasonable query conditions (such as WHERE conditions are empty or incorrect filter parameters are set). This situation causes the result set (data set returned by the query) to be too large, occupying a large amount of memory resources, triggering the Java virtual machine (the basic environment for running Java programs) to frequently perform garbage collection, thereby seriously affecting the response time and stability of the application.

[0003] In the existing solutions, MyBatis interceptor (a component used to intercept and modify SQL) is usually used to intercept and rewrite SQL queries to limit the number of rows of data returned. However, this method has two obvious defects: first, rewriting SQL statements will change the original syntax, sometimes causing syntax check failures and affecting the correct execution of SQL; second, for queries that do not use MyBatis (such as directly using Hibernate or JDBC to operate the database), the solution lacks consistency and cannot provide a unified query control strategy, so it is less applicable in mixed application environments. In addition, the existing solution mainly relies on the application layer (the upper logic of the application) for rewriting, and does not implement constraints on the size of the query result set from the underlying connection pool level, so it is still insufficient in terms of security and flexibility. Based on the problems existing in the existing solution, it is necessary to propose a new large result set suppression solution. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a large result set suppression method and system to at least solve the problems of insufficient security and flexibility in existing large result set suppression solutions.

[0005] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a large result set suppression method, including: in response to a user's data query trigger signal, collecting the user's data query request; based on the data query request, identifying the structured query language statement object in the corresponding filtering event adapter; applying a predetermined maximum row value to the identified structured query language statement object, and executing the structured query language statement object transmission to which the predetermined maximum row value is applied; wherein the maximum row value is a preset value or a generated value based on the memory usage of the current service to be executed; and returning a corresponding number of result data based on the predetermined maximum row value.

[0006] In an embodiment of the present application, in response to a data query trigger signal from a user, collecting a data query request from a user includes: in response to a data query trigger signal from a user, recovering the data query request signal from the user based on the user end; and transmitting the data query request signal to a database based on a Druid connection pool.

[0007] In an embodiment of the present application, the structured query language statement object is identified in the corresponding filtering event adapter based on the data query request, including: calling the corresponding filtering event adapter based on the Druid connection pool to identify the structured query language query operation to be executed based on the filtering event adapter; in the structured query language query operation to be executed, the corresponding structured query language statement object is intercepted to obtain the corresponding structured query language statement object.

[0008] In an embodiment of the present application, the method also includes determining a maximum row value; the determination rule of the maximum row value is: determine whether there is a maximum row value set by an administrator, and if so, use the maximum row value originally set by the administrator as the determined maximum row value; if there is no maximum row value set by the administrator, generate a corresponding maximum row value based on the current service to be executed, and use the generated maximum row value as the determined maximum row value.

[0009] In an embodiment of the present application, the generating of the corresponding maximum row value based on the current services to be executed includes: determining the memory usage of the services to be executed based on the number and type of the services to be executed; determining the memory margin based on the total memory amount and the memory usage of the services to be executed; and generating the corresponding maximum row value based on the determined memory margin based on the linear relationship between the predetermined memory margin and the maximum row value.

[0010] In an embodiment of the present application, before applying the predetermined maximum row value to the identified structured query language statement object, the method also includes: determining whether there is a user-specified maximum row value in the user's data query request; if there is a user-specified maximum row value, comparing the user-specified maximum row value with the determined maximum row value; if the user-specified maximum row value is less than the determined maximum row value, using the user-specified maximum row value as the new determined maximum row value; if the user-specified maximum row value is not less than the determined maximum row value, maintaining the determined maximum row value.

[0011] In an embodiment of the present application, the method of applying a predetermined maximum row value to an identified structured query language statement object and executing transmission of the structured query language statement object to which the predetermined maximum row value is applied includes: determining whether the predetermined maximum row value complies with preset security rules; if it complies with the preset security rules, applying the determined maximum row value to the identified structured query language statement object to limit the number of rows of query results returned; and transmitting the structured query language statement object to which the predetermined maximum row value is applied to a database based on the JDBC protocol.

[0012] In an embodiment of the present application, the method of returning a corresponding number of result data based on a predetermined maximum row value includes: the database executes a structured query language statement object to which a predetermined maximum row value is applied to obtain a query result; based on a limit number of rows determined by the maximum row value, it is determined whether the query result exceeds the limit number of rows; if the query result exceeds the limit number of rows, the query result exceeding the limit is filtered out, and a query result set containing query results not exceeding the limit number of rows is returned to the user end.

[0013] In an embodiment of the present application, the method further includes: if the number of rows in the query result set reaches a limit number of rows determined by a maximum row value, generating corresponding warning information.

[0014] The second aspect of the present application provides a large result set suppression system, including: a collection unit, which is used to respond to the user's data query trigger signal and collect the user's data query request; a processing unit, which is used to identify the structured query language statement object in the corresponding filtering event adapter based on the data query request; a restriction unit, which is used to apply a predetermined maximum row value to the identified structured query language statement object and execute the structured query language statement object transmission to which the predetermined maximum row value is applied; and a query unit, which is used to return the corresponding number of result data based on the predetermined maximum row value.

[0015] A third aspect of the present application provides a processor configured to execute the above-mentioned large result set suppression method.

[0016] A fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configure the processor to execute the above-mentioned large result set suppression method.

[0017] A fifth aspect of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the large result set suppression method described above.

[0018] Through the above technical scheme, the scheme of the present invention ensures the efficiency and security of database query response by dynamically intercepting and limiting SQL query results. Specifically, after receiving the user's data query request, the system first identifies and intercepts the SQL statement object through the filter event adapter (FilterEventAdapter), and then applies the preset maxrows value (maximum number of rows limit) to the SQL statement. When executing the query, the maxrows parameter limits the number of returned results, thereby avoiding large result sets caused by unreasonable query conditions, reducing memory consumption and garbage collection frequency, and improving the stability of the application. Through this mechanism, no matter how the user's query requirements change, the system can flexibly control the size of the query results, ensure the rational use of system resources, and avoid affecting the normal service response of the application.

[0019] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0021] Figure 1 A flowchart of the steps of a large result set suppression method according to an embodiment of the present application is schematically shown;

[0022] Figure 2 The system structure diagram of the large result set suppression system according to the embodiment of the present application is schematically shown;

[0023] Figure 3 The internal structure of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0025] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0026] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0027] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations. In addition, it should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components, and models may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0028] Figure 1 The flowchart of the large result set suppression method according to the embodiment of the present application is schematically shown. Figure 1 As shown, in one embodiment of the present application, a large result set suppression method is provided, comprising the following steps:

[0029] Step S10: In response to a data query trigger signal from a user, collecting a data query request from the user.

[0030] Specifically, in response to a data query trigger signal of a user, the user's data query request signal is recovered based on the user end; and the data query request signal is transmitted to the database based on the Druid connection pool.

[0031] In an embodiment of the present invention, when a user initiates a query request, the user end generates a data query request signal. After receiving the signal, the query request is captured and parsed by the application layer component. Then, based on this request signal, the user request is safely and efficiently delivered to the database through the Druid database connection pool. As a commonly used database connection management component in Java applications, the Druid connection pool can realize connection reuse and efficient management between multiple query requests, thereby optimizing performance. The Druid connection pool not only provides optimized control of database connections, but also provides extended functions such as structured query language (hereinafter referred to as SQL) parsing and execution monitoring, and supports fine-grained control of query behavior. By passing requests through the Druid connection pool, it can ensure that queries are efficiently and reliably managed before execution, avoiding frequent creation and destruction of database connections, and improving resource utilization efficiency.

[0032] Furthermore, throughout the entire process, the Druid connection pool plays an important role in resource optimization and data query request management. Through the Druid connection pool, user request signals can be quickly transmitted to the database, and requests can be intercepted and controlled at the connection pool level. This mechanism not only improves the response speed of database queries, but also ensures the security and stability of the connection. Especially in high-concurrency scenarios, the use of the Druid connection pool can effectively relieve pressure and avoid resource waste caused by frequent connection establishment and release.

[0033] Based on the solution of the present invention, by using the Druid connection pool, efficient management of database connections can be achieved, reducing the overhead caused by frequent connections. In addition, by transmitting user data query request signals in the Druid connection pool, the smooth execution of query requests can be effectively guaranteed, reducing the delay and error rate of query requests under high concurrency. This design ensures the stability of the application when processing complex queries or multi-user access, and improves the overall query performance, allowing users to obtain a faster and more reliable query experience.

[0034] Step S20: Based on the data query request, perform structured query language statement object recognition in the corresponding filtering event adapter.

[0035] Specifically, the corresponding filtering event adapter is called based on the Druid connection pool to identify the SQL query operation to be executed based on the filtering event adapter; in the SQL query operation to be executed, the corresponding SQL statement object is intercepted to obtain the corresponding SQL statement object.

[0036] In an embodiment of the present invention, a specific filter event adapter (FilterEventAdapter) is called through the Druid database connection pool to perform refined control on the user's SQL query request. Specifically, when the user's data query request is passed to the database connection pool, the Druid filter event adapter will identify the SQL query operation to be executed. This process ensures that the SQL object can be deeply analyzed and identified before the SQL statement is executed, providing a basis for subsequent control operations. The filter event adapter intercepts the SQL statement object, parses the query content and query logic, and checks it, further ensuring the security and compliance of the query statement.

[0037] After obtaining the SQL statement object, you can check or adjust the SQL statement according to business needs or security policies, such as setting the maximum number of rows in the query results, reviewing whether the query statement structure is compliant, etc. By intercepting the SQL statement object, the filter event adapter can flexibly handle different types of query requests, thereby avoiding the direct execution of unreasonable or unsafe SQL queries, which is of great significance in improving security and resource management efficiency. Especially in high-concurrency scenarios, this interception mechanism can constrain requests before SQL queries are executed, thereby reducing the load on the database and improving overall response efficiency.

[0038] Based on the solution of the present invention, by using a filtering event adapter in the Druid connection pool to identify and intercept SQL statement objects, the SQL query operation to be executed can be effectively controlled, potential unreasonable queries can be avoided, and resources can be protected. Secondly, by pre-identifying and intercepting SQL statement objects, it can ensure that the executed queries meet business requirements and security policies, and effectively reduce the performance degradation caused by improper queries. In addition, the flexibility of the filtering event adapter enables dynamic adjustment of query strategies in different application scenarios, providing higher adaptability while ensuring security. This mechanism provides a scalable query control method, which enables a more stable and efficient response when dealing with complex query requirements, bringing a better user experience.

[0039] Step S30: applying the predetermined maximum row value to the identified structured query language statement object, and executing transmission of the structured query language statement object to which the predetermined maximum row value is applied.

[0040] Specifically, the rule for determining the maximum row value (hereinafter referred to as the maxrows value) is: determine whether there is a maxrows value set by the administrator. If so, the maxrows value originally set by the administrator is used as the determined maxrows value; if there is no maxrows value set by the administrator, a corresponding maxrows value is generated based on the current service to be executed, and the generated maxrows value is used as the determined maxrows value.

[0041] Furthermore, the generating of the corresponding maxrows value based on the current services to be executed includes: determining the memory usage of the services to be executed based on the number and type of the current services to be executed; determining the memory margin based on the total memory amount and the memory usage of the services to be executed; and generating the corresponding maxrows value based on the determined memory margin based on the linear relationship between the predetermined memory margin and the maxrows value.

[0042] In the embodiment of the present invention, the determination of the maxrows value follows a set of flexible rules to achieve dynamic control of the query result size, thereby meeting security requirements and improving resource utilization efficiency. Check whether there is a maxrows value preset by the administrator. If the administrator has set a fixed maxrows value, use the value directly to ensure that the number of rows of the query result complies with the administrator's security policy and business rules, and avoid returning an overly large result set.

[0043] If there is no preset maxrows value, a suitable maxrows value will be dynamically generated based on the current services to be executed. Specifically, first analyze the number and type of services currently to be executed to estimate the memory usage of these services. Different types of services often have different resource consumption requirements. By comprehensively analyzing the memory usage of the current services to be executed, the current resource load can be grasped in real time. Then, calculate the difference between the total memory and the memory usage of the services to be executed. This difference is the memory margin, which reflects the amount of memory space currently available for other operations.

[0044] Based on the linear relationship between the preset memory margin and the maxrows value, a maxrows value suitable for the current resource situation is further generated. Generally, the larger the memory margin, the larger the query results can be carried, so the maxrows value will be increased accordingly; conversely, when the memory margin is small, the maxrows value is automatically reduced to ensure that memory resources will not be further consumed due to large result sets under high load conditions, thereby ensuring stability. In this way, the size of the query results can be dynamically adjusted according to the real-time status of memory resources, which not only meets the user's query needs, but also avoids the problems of insufficient memory and frequent garbage collection.

[0045] Based on the scheme of the present invention, by setting the maxrows value by the administrator, unified query control can be implemented under the premise of meeting business needs, ensuring that the query results comply with security and resource management policies, and avoiding resource consumption and performance problems caused by improper user operations. At the same time, the administrator can flexibly adjust the value to meet the needs of different business scenarios. In the absence of administrator settings, by dynamically generating the maxrows value, adaptive adjustments can be made according to the current load and memory margin, reflecting a high degree of flexibility and intelligence. When memory resources are sufficient, larger query results are allowed, which improves the integrity of user queries and the efficiency of information acquisition; when the load is high and the memory margin is insufficient, the number of rows returned by the query is automatically reduced, avoiding memory overflow and frequent garbage collection caused by excessively large result sets, thereby maintaining the smooth operation of the application.

[0046] This dynamic and adaptive maxrows value control mechanism not only significantly improves resource utilization, but also enhances robustness in high-concurrency and complex query scenarios. At the same time, the automatically adjusted maxrows solution allows for more flexible response to changes in resource load, avoids manual intervention, and reduces management costs.

[0047] Preferably, before applying the predetermined maxrows value to the identified SQL statement object, the method also includes: determining whether there is a user-specified maxrows value in the user's data query request; if there is a user-specified maxrows value, comparing the user-specified maxrows value with the determined maxrows value; if the user-specified maxrows value is less than the determined maxrows value, using the user-specified maxrows value as the new determined maxrows value; if the user-specified maxrows value is not less than the determined maxrows value, maintaining the determined maxrows value.

[0048] In an embodiment of the present invention, before applying a predetermined maxrows value to an SQL statement object, it is first checked whether the user's data query request contains a user-defined maxrows value. If the user provides this value, a judgment and adjustment is made based on the relationship between the maxrows value specified by the user and the pre-set maxrows value. Specifically, the maxrows value specified by the user is compared with the determined maxrows value: if the user's maxrows value is less than the determined maxrows value, the smaller value provided by the user will be used as the final maxrows value; conversely, if the user's maxrows value is greater than or equal to the determined value, the pre-set maxrows value remains unchanged.

[0049] The core of this mechanism is to balance the dual needs of security and user query flexibility. When the maxrows value specified by the user is less than the preset maxrows value, choosing the smaller value specified by the user means that it can adapt to the specific needs of the user, further reduce the size of the returned result set, and reduce load and memory consumption. This is especially beneficial for resource-sensitive query requirements (such as query data simplification results, real-time applications, etc.). In addition, a smaller maxrows value can also reduce the amount of data transmitted over the network, increase the speed of data return, and bring a faster response experience.

[0050] On the other hand, when the maxrows value requested by the user is greater than or equal to the preset value, security is prioritized and the original maxrows value is maintained. This control method ensures that the operation is always within a safe range, avoiding the risk of memory overflow or performance degradation due to excessive data returned by a single query. Through priority judgment, it is possible to avoid excessive consumption of resources by unreasonable user requests and effectively maintain the stability of the application.

[0051] Specifically, the predetermined maxrows value is applied to the identified SQL statement object, and the SQL statement object transmission to which the predetermined maxrows value is applied is executed, including: determining whether the predetermined maxrows value complies with preset security rules; if it complies with the preset security rules, applying the determined maxrows value to the identified SQL statement object to limit the number of rows of query results returned; and transmitting the SQL statement object to which the predetermined maxrows value is applied to a database based on the JDBC protocol.

[0052] In an embodiment of the present invention, by applying a predetermined maxrows value to an identified SQL statement object, the number of rows of the query result is limited to ensure security and performance. Specifically, before the maxrows value is formally applied, the value is first checked to determine whether it complies with preset security rules. These security rules may include range limits for the maxrows value, real-time load of resources, etc., to ensure that the query operation does not exceed the security limit under any circumstances, and to avoid pressure on memory and processing resources due to an overly large result set.

[0053] Furthermore, once the maxrows value meets the preset security rules, this maxrows value is applied to the SQL statement object to ensure that the query operation will not exceed the row limit when returning the result set. By setting maxrows before SQL execution, the amount of returned data can be actively controlled, which is particularly critical for avoiding problems such as large amounts of data transmission and memory consumption caused by unreasonable queries. Then, based on the JDBC (Java Database Connection) protocol, the SQL statement object with the maxrows value is transmitted to the database to trigger the execution of the SQL query. This transmission method relies on the stability of the JDBC protocol, so that the SQL query operation and the maxrows parameter can be accurately passed to the database execution layer.

[0054] Step S40: Return the corresponding number of result data based on the predetermined maximum row value.

[0055] Specifically, the database executes an SQL statement object that applies a predetermined maxrows value to obtain a query result; based on the limit number of rows determined by the maxrows value, determines whether the query result exceeds the limit number of rows; if the query result exceeds the limit number of rows, the query result exceeding the limit is filtered out, and a query result set containing the query result and not exceeding the limit number of rows is returned to the user end.

[0056] In an embodiment of the present invention, the number of rows of the database query result is controlled by presetting the maxrows value, thereby effectively limiting the scale of the returned data. Specifically, after the database receives the SQL statement object with the maxrows value, it executes the query operation and obtains the corresponding query result. At this time, the query result set is further screened according to the upper limit of the number of rows determined by the maxrows value to ensure that the number of data rows returned to the user does not exceed the set limit. If the number of rows of the query result exceeds the limit of the maxrows value, the result filtering operation will be automatically performed, and the excess data rows will be removed from the result set, and only the data rows within the row limit will be retained. In this way, the query result set has been controlled by the number of rows before being transmitted to the user end, ensuring that the size of the result set always meets the security and performance requirements. This process does not require manual intervention by the user, and the automatic data screening and control can effectively ensure the rationality of the result set in the background.

[0057] Preferably, the method further comprises: if the number of rows in the query result set reaches a limit number of rows determined by the maxrows value, generating corresponding warning information.

[0058] In an embodiment of the present invention, when the number of rows in the query result set reaches the limit number of rows set by the maxrows value, a corresponding warning message will be automatically generated. This warning mechanism can promptly remind administrators or monitoring tools to pay attention to potential large-scale data requests. Specifically, when the query result just reaches or approaches the maxrows limit value, an early warning is triggered and information is sent to the designated monitoring interface or administrator, indicating that the query may be approaching the safety boundary of the load. This mechanism can help managers monitor the query load in real time and take timely measures, such as adjusting query parameters, optimizing query conditions, or evaluating whether the maxrows value needs to be increased to meet user needs.

[0059] Figure 1 FIG. 1 is a flow chart of a large result set suppression method in one embodiment. It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0060] In one embodiment, Figure 2 As shown, a large result set suppression system is provided, the system comprising: a collection unit, for collecting a user's data query request in response to a user's data query trigger signal; a processing unit, for identifying an SQL statement object in a corresponding filtering event adapter based on the data query request; a restriction unit, for applying a predetermined maxrows value to the identified SQL statement object, and executing the SQL statement object transmission to which the predetermined maxrows value is applied; and a query unit, for returning a corresponding number of result data based on the predetermined maxrows value.

[0061] A third aspect of the present application provides a processor configured to execute the above-mentioned large result set suppression method.

[0062] A fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configure the processor to execute the above-mentioned large result set suppression method.

[0063] A fifth aspect of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the large result set suppression method described above.

[0064] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05 and a memory (not shown in the figure) connected via a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A06. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor A01, a large result set suppression method is implemented. The display screen A04 of the computer device can be a liquid crystal display or an electronic ink display, and the input device A05 of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0065] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0066] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0067] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0068] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0069] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0070] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0071] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0072] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0073] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0074] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A large result set suppression method, characterized in that: The method comprises: In response to a data query trigger signal from a user, collecting a data query request from the user; Based on the data query request, performing structured query language statement object recognition in a corresponding filtering event adapter; Applying a predetermined maximum row value to the identified structured query language statement object, and performing a structured query language statement object transmission to which the predetermined maximum row value is applied; wherein, The maximum row value is a preset value or a generated value based on the memory usage of the current service to be executed; Returns the corresponding number of result data based on the predetermined maximum row value.

2. The method according to claim 1, characterized in that The step of collecting the user's data query request in response to the user's data query trigger signal includes: In response to a data query trigger signal from a user, recovering a data query request signal from the user based on the user terminal; The data query request signal is transmitted to the database based on the Druid connection pool.

3. The method according to claim 2, characterized in that The step of identifying a structured query language statement object in a corresponding filtering event adapter based on the data query request includes: Calling a corresponding filtering event adapter based on the Druid connection pool to identify a structured query language query operation to be executed based on the filtering event adapter; In the structured query language query operation to be executed, the corresponding structured query language statement object is intercepted to obtain the corresponding structured query language statement object.

4. The method according to claim 1, characterized in that: The method further includes performing a maximum row value determination; The maximum row value is determined as follows: Determine whether there is a maximum row value set by the administrator. If so, use the maximum row value originally set by the administrator as the determined maximum row value; If there is no maximum row value set by the administrator, a corresponding maximum row value is generated based on the current service to be executed, and the generated maximum row value is used as the determined maximum row value.

5. The method according to claim 4, characterized in that The generating of the corresponding maximum row value based on the current service to be executed includes: Based on the number and type of services currently to be executed, determine the memory usage of the services to be executed; Determine the memory margin based on the total memory and the memory usage of the service to be executed; Based on a linear relationship between a predetermined memory margin and a maximum row value, a corresponding maximum row value is generated based on the determined memory margin.

6. The method according to claim 1, characterized in that Prior to applying the predetermined maximum row value to the identified structured query language statement object, the method further includes: Determine whether the maximum row value specified by the user exists in the user's data query request; If there is a maximum row value specified by the user, compare the maximum row value specified by the user with the determined maximum row value; If the maximum row value specified by the user is less than the determined maximum row value, the maximum row value specified by the user is used as the new determined maximum row value; If the maximum row value specified by the user is not less than the determined maximum row value, the determined maximum row value is maintained.

7. The method according to claim 1, characterized in that The step of applying the predetermined maximum row value to the identified structured query language statement object and performing transmission of the structured query language statement object to which the predetermined maximum row value is applied comprises: Determine whether the predetermined maximum row value meets the preset security rules; If the preset security rules are met, the determined maximum row value is applied to the identified structured query language statement object to limit the number of rows of the query result returned; A structured query language statement object to which a predetermined maximum row value is applied is transmitted to a database based on the JDBC protocol.

8. The method according to claim 1, characterized in that The method of returning the corresponding number of result data based on the predetermined maximum row value includes: The database executes a structured query language statement object to which a predetermined maximum row value is applied to obtain a query result; Based on the limit number of rows determined by the maximum row value, determine whether the query result exceeds the limit number of rows; If the query result exceeds the limit number of rows, the excess query results will be filtered out, and the query result set containing the query results that is not greater than the limit number of rows will be returned to the user end.

9. The method according to claim 8, characterized in that The method further comprises: If the number of rows in the query result set reaches the limit number of rows determined by the maximum row value, a corresponding warning message is generated.

10. A large result set suppression system, characterized in that: The system comprises: A collection unit, configured to collect a user's data query request in response to a user's data query trigger signal; A processing unit, configured to perform structured query language statement object recognition in a corresponding filtering event adapter based on the data query request; a restriction unit, configured to apply a predetermined maximum row value to the identified structured query language statement object, and execute transmission of the structured query language statement object to which the predetermined maximum row value is applied; The query unit is used to return a corresponding number of result data based on a predetermined maximum row value.

11. A processor, characterized in that: The method is configured to execute the large result set suppression method according to any one of claims 1 to 9.

12. A machine-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by a processor, the processor is configured to perform the large result set suppression method according to any one of claims 1 to 9.

13. A computer program product, comprising a computer program, characterized in that The computer program implements the large result set suppression method according to any one of claims 1 to 9 when executed by a processor.