Class Hoist


@Enclosing public class Hoist extends Object
Utility that extracts constants from a SQL query.

Simple use:

final String sql =
"select 'x' from emp where deptno < 10";
final Hoist.Hoisted hoisted =
print(hoisted); // "select ?0 from emp where deptno < ?1"

Calling Hoist.Hoisted.toString() generates a string that is similar to SQL where a user has manually converted all constants to bind variables, and which could then be executed using PreparedStatement.execute(). That is not a goal of this utility, but see [CALCITE-963] Hoist literals.

For more advanced formatting, use Hoist.Hoisted.substitute(Function).

Adjust Hoist.Config to use a different parser or parsing options.