The first open-source AI-driven tool for automatically generating system-level test cases (also known as fuzzing) for web/enterprise applications. Currently targeting whitebox and blackbox testing of Web APIs, like REST, GraphQL and RPC (e.g., gRPC and Thrift).
This PR enhances the SMTConditionVisitor and related classes to support SQL queries involving multiple tables, table aliases, and conditions with operands in different orders. Specifically, it addresses the following features:
Support for Multiple Tables (JOIN):
The SMTConditionVisitor now supports SQL conditions involving more than one table. For example, it can handle queries like SELECT * FROM users u JOIN products p WHERE u.age > p.min_age.
Support for Table Aliases:
The SMTConditionVisitor and related classes can now handle queries with table aliases. For instance, it supports queries like SELECT * FROM USERS u WHERE u.age > 30.
Support for Conditions with Operands in Different Orders:
The SMTConditionVisitor can now process SQL conditions where the column and literal operands are in reverse order. For example, it supports conditions like SELECT * FROM USERS WHERE 7 = age.
Detailed Changes
SMTConditionVisitor:
Modified to support multiple tables by including a tableAliases map that associates aliases with their corresponding table names.
Enhanced the visit methods to reference columns using the table aliases correctly.
Updated the getColumnReference method to use the correct table name based on the alias provided.
SmtLibGenerator:
Updated the appendQueryConstraints method to pass table aliases to the SMTConditionVisitor.
Adjusted the method to handle the parsing and mapping of table aliases correctly.
Example Adjustments:
Adjusted the example conditions and assertions to support the new features.
Summary
This PR enhances the
SMTConditionVisitor
and related classes to support SQL queries involving multiple tables, table aliases, and conditions with operands in different orders. Specifically, it addresses the following features:Support for Multiple Tables (JOIN):
SMTConditionVisitor
now supports SQL conditions involving more than one table. For example, it can handle queries likeSELECT * FROM users u JOIN products p WHERE u.age > p.min_age
.Support for Table Aliases:
SMTConditionVisitor
and related classes can now handle queries with table aliases. For instance, it supports queries likeSELECT * FROM USERS u WHERE u.age > 30
.Support for Conditions with Operands in Different Orders:
SMTConditionVisitor
can now process SQL conditions where the column and literal operands are in reverse order. For example, it supports conditions likeSELECT * FROM USERS WHERE 7 = age
.Detailed Changes
SMTConditionVisitor:
tableAliases
map that associates aliases with their corresponding table names.visit
methods to reference columns using the table aliases correctly.getColumnReference
method to use the correct table name based on the alias provided.SmtLibGenerator:
appendQueryConstraints
method to pass table aliases to theSMTConditionVisitor
.Example Adjustments: