By default this uses "smart" parsing, which is aware of ordinary SQL syntax. A + * ':' or '?' character that appears inside a single-quoted string literal ('...'), + * a double-quoted identifier ("..."), a line comment (-- ...) or a block comment + * (/* ... */) is treated as regular SQL text and does not need to be escaped. + * PostgreSQL-style casts (::type) are recognized and left untouched. Only a '?' or + * ':name' occurring in ordinary SQL is treated as a bind variable.
+ * + *The legacy behavior can be requested by passing {@code useSmartParsing=false} + * to the constructor. In that mode no smart parsing is done, and the SQL is simply + * scanned for ':' and '?' characters. If the SQL needs to include an actual ':' or + * '?' character in that mode, use two of them ('::' or '??'), and they will be + * replaced with a single ':' or '?'.
* * @author garricko */ @@ -36,7 +46,22 @@ public class MixedParameterSql { private final String sqlToExecute; private final Object[] args; + /** + * Parse the SQL using the default "smart" parsing. Equivalent to calling + * {@link #MixedParameterSql(String, List, Map, boolean)} with {@code true}. + */ public MixedParameterSql(String sql, List