@PlainSQL public interface SQL extends QueryPart
QueryPart
.
Plain SQL query parts can be constructed in a variety of ways from the
DSL
API (DSL.field(String)
, DSL.table(String)
, etc.)
as well as from convenience methods such as for instance
SelectWhereStep.where(String)
. These query parts allow for embedding
simple SQL strings with associated bind variables or nested queryparts.
A simple template language is implemented by such plain SQL query parts, exposing the following features:
expr1
and expr2
at the appropriate locations:
Query part indexes may be referenced multiple times from within
a template.
DSL.field("GROUP_CONCAT(DISTINCT {0} ORDER BY {1} ASC SEPARATOR '-')", expr1, expr2);
DSL.keyword(String)
(e.g. upper-casing, lower-casing, etc.) . The following expression makes use
of embedded keywords in a plain SQL template:
DSL.field("{current_timestamp}");
The following JDBC
escape syntax elements are recognised:
DSL.field("{d '2015-01-01'}");
{d [date literal]}
{t [time literal]}
{ts [timestamp literal]}
{fn [function literal]}
DSL.inline(CharSequence)
, ParamType.INLINED
,
or StatementType.STATIC_STATEMENT
), plain SQL query parts will
discover question marks (?
) at syntactically appropriate
positions (outside of comments, string literals, quoted name literals) and
substitute the appropriate bind value into the template.Copyright © 2016. All Rights Reserved.