[#6218] Add a section to the manual about the plain SQL templating part

This commit is contained in:
lukaseder 2017-05-15 13:56:17 +02:00
parent 52c86e37fa
commit 6ef0fdf508
11 changed files with 502 additions and 2 deletions

View File

@ -5579,6 +5579,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -5678,6 +5682,42 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
</html></content>
</section>
<section id="bind-values">
<title>Bind values and parameters</title>
<content><html>

View File

@ -5918,6 +5918,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -6017,6 +6021,42 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
</html></content>
</section>
<section id="bind-values">
<title>Bind values and parameters</title>
<content><html>

View File

@ -8703,6 +8703,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -8800,8 +8804,56 @@ create.select(LAST_NAME, COUNT1, COUNT2)
<li>You have to provide consistency when you use variable binding. The number of ? must match the number of variables</li>
<li>Your SQL is inserted into jOOQ queries without further checks. Hence, jOOQ can't prevent SQL injection. </li>
</ul>
</html></content>
</section>
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<p>
For convenience, there is also a <reference class="org.jooq.impl.DSL" anchor="#list-org.jooq.QueryPart...-" title="DSL.list(QueryPart...)"/> API that allows for wrapping a comma-separated list of query parts in a single template argument:
</p>
</html><java><![CDATA[Field<String> a = val("a");
Field<String> b = val("b");
Field<String> c = val("c");
// These two produce the same result:
condition("my_column IN ({0}, {1}, {2}), a, b, c); // Using distinct template arguments
condition("my_column IN ({0})", list(a, b, c)); // Using a single template argument]]></java><html>
</html></content>
</section>
<section id="names">
<title>Names and identifiers</title>

View File

@ -6173,6 +6173,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -6272,6 +6276,42 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
</html></content>
</section>
<section id="bind-values">
<title>Bind values and parameters</title>
<content><html>

View File

@ -6889,6 +6889,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -6988,6 +6992,42 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
</html></content>
</section>
<section id="bind-values">
<title>Bind values and parameters</title>
<content><html>

View File

@ -7688,6 +7688,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -7788,6 +7792,42 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
</html></content>
</section>
<section id="names">
<title>Names and identifiers</title>
<content><html>

View File

@ -8085,6 +8085,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -8185,6 +8189,42 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
</html></content>
</section>
<section id="names">
<title>Names and identifiers</title>
<content><html>

View File

@ -8204,6 +8204,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -8304,6 +8308,54 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<p>
For convenience, there is also a <reference class="org.jooq.impl.DSL" anchor="#list-org.jooq.QueryPart...-" title="DSL.list(QueryPart...)"/> API that allows for wrapping a comma-separated list of query parts in a single template argument:
</p>
</html><java><![CDATA[Field<String> a = val("a");
Field<String> b = val("b");
Field<String> c = val("c");
// These two produce the same result:
condition("my_column IN ({0}, {1}, {2}), a, b, c); // Using distinct template arguments
condition("my_column IN ({0})", list(a, b, c)); // Using a single template argument]]></java><html>
</html></content>
</section>
<section id="names">
<title>Names and identifiers</title>
<content><html>

View File

@ -8457,6 +8457,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -8557,6 +8561,54 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<p>
For convenience, there is also a <reference class="org.jooq.impl.DSL" anchor="#list-org.jooq.QueryPart...-" title="DSL.list(QueryPart...)"/> API that allows for wrapping a comma-separated list of query parts in a single template argument:
</p>
</html><java><![CDATA[Field<String> a = val("a");
Field<String> b = val("b");
Field<String> c = val("c");
// These two produce the same result:
condition("my_column IN ({0}, {1}, {2}), a, b, c); // Using distinct template arguments
condition("my_column IN ({0})", list(a, b, c)); // Using a single template argument]]></java><html>
</html></content>
</section>
<section id="names">
<title>Names and identifiers</title>
<content><html>

View File

@ -8594,6 +8594,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -8694,6 +8698,54 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<p>
For convenience, there is also a <reference class="org.jooq.impl.DSL" anchor="#list-org.jooq.QueryPart...-" title="DSL.list(QueryPart...)"/> API that allows for wrapping a comma-separated list of query parts in a single template argument:
</p>
</html><java><![CDATA[Field<String> a = val("a");
Field<String> b = val("b");
Field<String> c = val("c");
// These two produce the same result:
condition("my_column IN ({0}, {1}, {2}), a, b, c); // Using distinct template arguments
condition("my_column IN ({0})", list(a, b, c)); // Using a single template argument]]></java><html>
</html></content>
</section>
<section id="names">
<title>Names and identifiers</title>
<content><html>

View File

@ -8647,6 +8647,10 @@ Condition condition(String sql, Object... bindings);
// Example: condition("a = {0}", val(1));
Condition condition(String sql, QueryPart... parts);]]></java><html>
<p>
Both the bind value and the query part argument overloads make use of jOOQ's <reference id="plain-sql-templating" title="plain SQL templating language"/>.
</p>
<p>
Please refer to the <reference class="org.jooq.impl.DSL"/> Javadoc for more details. The following is a more complete listing of plain SQL construction methods from the DSL:
</p>
@ -8747,6 +8751,54 @@ create.select(LAST_NAME, COUNT1, COUNT2)
</html></content>
</section>
<section id="plain-sql-templating">
<title>Plain SQL Templating Language</title>
<content><html>
<p>
The <reference id="plain-sql" title="plain SQL API"/>, as documented in the previous chapter, supports a string templating mini-language that allows for constructing complex SQL string content from smaller parts. A simple example can be seen below, e.g. when looking for support for one of PostgreSQL's various vendor-specific operator types:
</p>
</html><code-pair>
<sql><![CDATA[ARRAY[1,4,3] && ARRAY[2,1]]]></sql>
<java><![CDATA[condition("{0} && {1}", array1, array2);]]></java>
</code-pair><html>
<p>
Such a plain SQL template always consists of two things:
</p>
<ul>
<li>The SQL string fragment</li>
<li>A set of <reference class="org.jooq.QueryPart"/> arguments, which are expected to be embedded in the SQL string</li>
</ul>
<p>
The SQL string may reference the arguments by 0-based indexing. Each argument may be referenced several times. For instance, SQLite's emulation of the <code>REPEAT(string, count)</code> function may look like this:
</p>
</html><java><![CDATA[Field<Integer> count = val(3);
Field<String> string = val("abc");
field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
// ^ ^ ^ ^^^^^ ^^^^^^
// | | | | |
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<p>
For convenience, there is also a <reference class="org.jooq.impl.DSL" anchor="#list-org.jooq.QueryPart...-" title="DSL.list(QueryPart...)"/> API that allows for wrapping a comma-separated list of query parts in a single template argument:
</p>
</html><java><![CDATA[Field<String> a = val("a");
Field<String> b = val("b");
Field<String> c = val("c");
// These two produce the same result:
condition("my_column IN ({0}, {1}, {2}), a, b, c); // Using distinct template arguments
condition("my_column IN ({0})", list(a, b, c)); // Using a single template argument]]></java><html>
</html></content>
</section>
<section id="names">
<title>Names and identifiers</title>
<content><html>