[#8102] Add RenderNameCase.LOWER_IF_UNQUOTED and UPPER_IF_UNQUOTED

This commit is contained in:
lukaseder 2018-12-10 12:45:42 +01:00
parent 5616d60e93
commit 5e780aad31
3 changed files with 17 additions and 5 deletions

View File

@ -22,7 +22,9 @@ import javax.xml.bind.annotation.XmlType;
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="AS_IS"/>
* <enumeration value="LOWER"/>
* <enumeration value="LOWER_IF_UNQUOTED"/>
* <enumeration value="UPPER"/>
* <enumeration value="UPPER_IF_UNQUOTED"/>
* </restriction>
* </simpleType>
* </pre>
@ -34,7 +36,9 @@ public enum RenderNameCase {
AS_IS,
LOWER,
UPPER;
LOWER_IF_UNQUOTED,
UPPER,
UPPER_IF_UNQUOTED;
public String value() {
return name();

View File

@ -469,9 +469,11 @@ class DefaultRenderContext extends AbstractContext<RenderContext> implements Ren
// [#1982] [#3360] ... yet, do quote when an identifier contains special characters
(family == SQLITE && !IDENTIFIER_PATTERN.matcher(literal).matches());
if (RenderNameCase.LOWER == cachedRenderNameCase)
if (RenderNameCase.LOWER == cachedRenderNameCase ||
RenderNameCase.LOWER_IF_UNQUOTED == cachedRenderNameCase && !quote())
literal = literal.toLowerCase(renderLocale(configuration().settings()));
else if (RenderNameCase.UPPER == cachedRenderNameCase)
else if (RenderNameCase.UPPER == cachedRenderNameCase ||
RenderNameCase.UPPER_IF_UNQUOTED == cachedRenderNameCase && !quote())
literal = literal.toUpperCase(renderLocale(configuration().settings()));
if (needsQuote) {

View File

@ -452,11 +452,17 @@ Either &lt;input/> or &lt;inputExpression/> must be provided]]></jxb:javadoc></j
<!-- Render object names, as defined in the database. For instance: schema.TABLE -->
<enumeration value="AS_IS"/>
<!-- Force rendering object names in lower case. For instance: schema.table -->
<!-- Force rendering object names in lower case. For instance: schema."table" -->
<enumeration value="LOWER"/>
<!-- Force rendering object names in upper case. For instance: SCHEMA.TABLE -->
<!-- Force rendering object names in lower case, if unquoted. For instance schema."TABLE" -->
<enumeration value="LOWER_IF_UNQUOTED"/>
<!-- Force rendering object names in upper case. For instance: SCHEMA."TABLE" -->
<enumeration value="UPPER"/>
<!-- Force rendering object names in upper case, if unquoted. For instance SCHEMA."table" -->
<enumeration value="UPPER_IF_UNQUOTED"/>
</restriction>
</simpleType>