|previous : next|
This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
By default, jOOQ will always generate quoted names for all identifiers (even if this manual omits this for readability). For instance:
SELECT "TABLE"."COLUMN" FROM "TABLE" -- SQL standard style SELECT `TABLE`.`COLUMN` FROM `TABLE` -- MySQL style SELECT [TABLE].[COLUMN] FROM [TABLE] -- SQL Server style
Quoting has the following effect on identifiers in most (but not all) databases:
- It allows for using reserved names as object names, e.g. a table called
"FROM"is usually possible only when quoted.
- It allows for using special characters in object names, e.g. a column called
"FIRST NAME"can be achieved only with quoting.
- It turns what are mostly case-insensitive identifiers into case-sensitive ones, e.g.
"NAME"are different identifiers, whereas
NAMEare not. Please consider your database manual to learn what the proper default case and default case sensitivity is.
renderNameCase settings allow for overriding the name of all identifiers in jOOQ to a consistent style. Possible options are:
ALWAYS: This will quote all identifiers.
EXPLICIT_DEFAULT_QUOTED: This will quote all identifiers, which are not explicitly unquoted using DSL.unquotedName().
EXPLICIT_DEFAULT_UNQUOTED: This will not quote any identifiers, unless they are explicitly quoted using DSL.quotedName().
NEVER: This will not quote any identifiers.
AS_IS: This will generate all names in their proper case.
LOWER: This will transform all names to lower case.
LOWER_IF_UNQUOTED: This will transform all names to lower case if the name is unquoted.
UPPER: This will transform all names to upper case.
UPPER_IF_UNQUOTED: This will transform all names to upper case if the name is unquoted.
The two flags are independent of one another. If your database supports quoted, case sensitive identifiers, then using
UPPER on quoted identifiers may not work.
Settings settings = new Settings() .withRenderQuotedNames(RenderQuotedNames.EXPLICIT_DEFAULT_UNQUOTED) // Defaults to EXPLICIT_DEFAULT_QUOTED .withRenderNameCase(RenderNameCase.LOWER_IF_UNQUOTED); // Defaults to AS_IS
The behaviour of this setting is influenced by the renderLocale setting.