Automatic review of SQL statement complexity
AssigneeState Farm Mutual Automobile Insurance Company
InventorsRichard Snyder, Matthew R Anderson, Daniel Galvin
Life of this patent
Estimating the term…
Abstract
A computer-implemented method for automatically reviewing structured query language (SQL) statements comprises the steps of receiving SQL code from a user seeking to access a database, parsing the SQL code to retrieve SQL keywords, mathematical operators, and logical operators, applying a complexity score calculation algorithm to the parsed code, calculating a complexity score, and executing the SQL code on a computing system which stores the database if the complexity score is less than or equal to a threshold. On the other hand, if the complexity score is greater than the threshold, the SQL code may be flagged to be rewritten.
Claims20
A computer-implemented method for automatically reviewing structured query language (SQL) statements, the computer-implemented method comprising, via one or more processors:
- parsing SQL code to retrieve SQL keywords, mathematical operators, and logical operators;
- identifying the version of SQL that was used to create the SQL code;
- detecting pre-SQL-92 code based on a lack of newer SQL statement syntax;
- setting a temporary score if pre-SQL-92 code is detected;
- applying a complexity score calculation algorithm to the parsed SQL code to determine a presence of keywords and operators in the parsed SQL code;
- calculating a complexity score that varies according to a number of occurrences of keywords or operators and a variable complexity factor;
- executing the SQL code on a computing system which stores the database if the complexity score is less than or equal to a first threshold;
- and
- flagging the SQL code to be reviewed by a computer administrator if the complexity score is greater than the first threshold.
A non-transitory computer-readable medium with an executable program stored thereon for automatically reviewing structured query language (SQL) statements, wherein the program instructs a processing element of a computing device to perform the following:
- parsing SQL code to retrieve SQL keywords, mathematical operators, and logical operators;
- identifying the version of SQL that was used to create the SQL code;
- detecting pre-SQL-92 code based on a lack of newer SQL statement syntax;
- setting a temporary score if pre-SQL-92 code is detected;
- applying a complexity score calculation algorithm to the parsed SQL code to determine a presence of keywords and operators in the parsed SQL code;
- calculating a complexity score that varies according to a number of occurrences of keywords or operators and a variable complexity factor;
- executing the SQL code on a computing system which stores the database if the complexity score is less than or equal to a first threshold;
- and
- flagging the SQL code to be reviewed by a computer administrator if the complexity score is greater than the first threshold.
A computing device for automatically reviewing structured query language (SQL) statements, the device comprising:
- a communication element configured to receive and transmit communications to and from a communication network;
- a memory element electronically coupled to the communication element, the memory element configured to store executable instructions;
- and
- a processing element electronically coupled to the communication element and the memory element, the processing element configured to—
- parse SQL code to retrieve SQL keywords, mathematical operators, and logical operators;
- identify the version of SQL that was used to create the SQL code;
- detect pre-SQL-92 code based on a lack of newer SQL statement syntax;
- set a temporary score if pre-SQL-92 code is detected;
- apply a complexity score calculation algorithm to the parsed SQL code to determine a presence of keywords and operators in the parsed SQL code;
- calculate a complexity score that varies according to a number of occurrences of keywords or operators and a variable complexity factor;
- execute the SQL code on a computing system which stores the database if the complexity score is less than or equal to a first threshold;
- and
- flag the SQL code to be reviewed by a computer administrator if the complexity score is greater than the first threshold.
Dependencies are inferred from the claim text.