Method, system and program product for rewriting structured query language (SQL) statements
First Claim
1. A method for rewriting Structured Query Language (SQL) statements:
- receiving a SQL statement having search criteria that include conditions that pertain to a plurality of fields in a plurality of database tables;
creating a table from the SQL statement that lists all possible combinations of the search criteria in the SQL statement, every combination reflecting a subset of information used to determine combined results;
identifying a set of patterns among the all possible combinations of the SQL statement based on the fields referenced in the combinations, and sorting the table based on the set of patterns;
dividing the table into a set of temporary tables based on the sorting;
joining the set of temporary tables with the SQL statement, and generating a new set of temporary tables, each table consisting of results of a search conducted using a separate portion of the SQL statement as joined with the set of temporary tables; and
combining all results from the new set of temporary tables into a single result table.
1 Assignment
0 Petitions
Accused Products
Abstract
Under the present invention, a SQL statement having search criteria is received. Upon receipt, a table that lists all possible combinations of the search criteria is created. From the table, a set of patterns among the possible combinations is identified. Based on these patterns, the table is then sorted. Once sorted, the table is divided into a set of temporary tables based on the set of patterns/sorting operation. The set of temporary tables are then individually joined with the SQL statement and separate searches are conducted. A new set of temporary tables is then generated and populated with results of the separate searches. These result tables are then unioned/combined into a single result table.
-
Citations
24 Claims
-
1. A method for rewriting Structured Query Language (SQL) statements:
-
receiving a SQL statement having search criteria that include conditions that pertain to a plurality of fields in a plurality of database tables; creating a table from the SQL statement that lists all possible combinations of the search criteria in the SQL statement, every combination reflecting a subset of information used to determine combined results; identifying a set of patterns among the all possible combinations of the SQL statement based on the fields referenced in the combinations, and sorting the table based on the set of patterns; dividing the table into a set of temporary tables based on the sorting; joining the set of temporary tables with the SQL statement, and generating a new set of temporary tables, each table consisting of results of a search conducted using a separate portion of the SQL statement as joined with the set of temporary tables; and combining all results from the new set of temporary tables into a single result table. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A system for rewriting Structured Query Language (SQL) statements, comprising:
-
a processor; and a memory, the memory having; a system for receiving a SQL statement having search criteria that include conditions that pertain to a plurality of fields in a plurality of database tables; a system for creating a table from the SQL statement that lists all possible combinations of the search criteria in the SQL statement, every combination reflecting a subset of information used to determine combined results; a system for identifying a set of patterns among the all possible combinations of the SQL statement based on the fields referenced in the combinations, and sorting the table based on the set of patterns; a system for dividing the table into a set of temporary tables based on the set of patterns; a system for joining the set of temporary tables with the SQL statement, and generating a new set of temporary tables, each table containing results of a search conducted using a separate portion of the SQL statement as joined with the set of temporary tables; and a system for combining all results from the new set of temporary tables into a single result table. - View Dependent Claims (10, 11, 12, 13, 14, 15)
-
-
16. A computer system having program product stored thereon for rewriting Structured Query Language (SQL) statements, which when executed, comprises:
-
program code for receiving a SQL statement having search criteria that include conditions that pertain to a plurality of fields in a plurality of database tables; program code for creating a table from the SQL statement that lists all possible combinations of the search criteria in the SQL statement, every combination reflecting a subset of information used to determine combined results; program code for identifying a set of patterns among the all possible combinations of the SQL statement based on the fields referenced in the combinations, and sorting the table based on the set of patterns; program code for dividing the table into a set of temporary tables based on the set of patterns; program code for joining the set of temporary tables with the SQL statement, and generating a new set of temporary tables, each table containing results of a search conducted using a separate portion of the SQL statement as joined with the set of temporary tables; and program code for combining all results from the new set of temporary tables into a single result table. - View Dependent Claims (17, 18, 19, 20, 21, 22)
-
-
23. A method for deploying an application for rewriting Structured Query Language (SQL) statements, comprising:
- providing a computer infrastructure being operable to;
receive a SQL statement having search criteria that include conditions that pertain to a plurality of fields in a plurality of database tables; create a table from the SQL statement that lists all possible combinations of the search criteria in the SQL statement, every combination reflecting a subset of information used to determine combined results; identify a set of patterns among the all possible combinations of the SQL statement based on the fields referenced in the combinations, and sorting the table based on the set of patterns; divide the table into a set of temporary tables based on the set of patterns; join the set of temporary tables with the SQL statement, and generating a new set of temporary tables, each table containing results of a search conducted using a separate portion of the SQL statement as joined with the set of temporary tables; and combine all results from the new set of temporary tables into a single result table.
- providing a computer infrastructure being operable to;
-
24. Computer software embodied in a data storage medium for rewriting Structured Query Language (SQL) statements, the computer software comprising instructions to cause a processor of a computer system to perform the following functions:
-
receive a SQL statement having search criteria; create a table from the SQL statement that lists all possible combinations of the search criteria in the SQL statement; identify a set of patterns among the all possible combinations of the SQL statement, and sorting the table based on the set of patterns; divide the table into a set of temporary tables based on the set of patterns; join the set of temporary tables with the SQL statement, and generating a new set of temporary tables, each table containing results of a search conducted using a separate portion of the SQL statement as joined with the set of temporary tables; and combine all results from the new set of temporary tables into a single result table.
-
Specification