Example output:
$ java -cp target/classes/ com.foundationdb.sql.ParamerDemo "SELECT * FROM USERS WHERE NAME ='BOB' AND ID=123 AND STATUS=TRUE"
pre: SELECT * FROM USERS WHERE NAME ='BOB' AND ID=123 AND STATUS=TRUE
post: SELECT * FROM users WHERE ((name = $1) AND (id = $2)) AND (status = $3)
$1 => BOB (String)
$2 => 123 (Integer)
$3 => true (Boolean)
Extensions:
- Avoiding transformation of clauses outside of the
WHERE
(e.g.SELECT a = 'YES' ...
) - Detecting equivalent values (e.g.
WHERE a = 5 AND b = 5
) - Parameterizing more node types (e.g.
BetweenOperatorNode
)