[#6575] Enhance plain SQL templating language documentation with parsing rules

This commit is contained in:
lukaseder 2017-09-19 12:42:03 +02:00
parent c171288cb0
commit aab5d07ca1
11 changed files with 306 additions and 0 deletions

View File

@ -5975,6 +5975,34 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -6373,6 +6373,34 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -9456,6 +9456,33 @@ Field<String> c = val("c");
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>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -6674,6 +6674,34 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -7329,6 +7329,34 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -8239,6 +8239,34 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -8636,6 +8636,34 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin
// argument "count" is repeated twice: \------------------+----------|---------------------/ |
// argument "string" is used only once: \-----------------------------/]]></java><html>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -8768,6 +8768,34 @@ Field<String> c = val("c");
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>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -9041,6 +9041,34 @@ Field<String> c = val("c");
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>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -9265,6 +9265,34 @@ Field<String> c = val("c");
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>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>

View File

@ -9400,6 +9400,33 @@ Field<String> c = val("c");
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>
<h3>Parsing rules</h3>
<p>
When processing these plain SQL templates, a mini parser is run that handles things like
</p>
<ul>
<li>String literals</li>
<li>Quoted names</li>
<li>Comments</li>
<li>JDBC escape sequences</li>
</ul>
<p>
The above are recognised by the templating engine and contents inside of them are ignored when replacing numbered placeholders and/or bind variables. For instance:
</p>
</html><java><![CDATA[query(
"SELECT /* In a comment, this is not a placeholder: {0}. And this is not a bind variable: ? */ title AS `title {1} ?` " +
"-- Another comment without placeholders: {2} nor bind variables: ?
"FROM book " +
"WHERE title = 'In a string literal, this is not a placeholder: {3}. And this is not a bind variable: ?'
);]]></java><html>
<p>
The above query does not contain any numbered placeholders nor bind variables, because the tokens that would otherwise be searched for are contained inside of comments, string literals, or quoted names.
</p>
</html></content>
</section>