-
- All Superinterfaces:
Context<RenderContext>
,Scope
public interface RenderContext extends Context<RenderContext>
The render context is used for renderingQueryPart
's to SQL.A new render context is instantiated every time a
Query
is rendered.QueryPart
's will then pass the same context to their components- Author:
- Lukas Eder
- See Also:
BindContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
RenderContext.CastMode
The cast mode for bind values.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Boolean
cast()
Deprecated.- [#3703] - 3.5.0 - Do not use this any longerRenderContext.CastMode
castMode()
The currently applied cast mode for bind values.RenderContext
castMode(RenderContext.CastMode mode)
Set the new cast mode forcastMode()
.RenderContext
castModeSome(SQLDialect... dialects)
Deprecated.- [#3703] - 3.5.0 - Do not use this any longerboolean
format()
The value ofSettings.isRenderFormatted()
.RenderContext
format(boolean format)
Override the value ofSettings.isRenderFormatted()
.RenderContext
formatIndentEnd()
Stop indenting subsequent SQL by one level (two characters), ifSettings.isRenderFormatted()
is set totrue
.RenderContext
formatIndentEnd(int indent)
Stop indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()
is set totrue
.RenderContext
formatIndentLockEnd()
Stop indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()
is set totrue
.RenderContext
formatIndentLockStart()
Start indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()
is set totrue
.RenderContext
formatIndentStart()
Start indenting subsequent SQL by one level (two characters), ifSettings.isRenderFormatted()
is set totrue
.RenderContext
formatIndentStart(int indent)
Start indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()
is set totrue
.RenderContext
formatNewLine()
Render a new line character (only ifSettings.isRenderFormatted()
is set totrue
).RenderContext
formatNewLineAfterPrintMargin()
Render a new line character (only ifSettings.isRenderFormatted()
is set totrue
, and theformatPrintMargin(int)
has been exceeded).RenderContext
formatPrintMargin(int margin)
Set a print margin that will be applied to formatted SQL, ifSettings.isRenderFormatted()
is set totrue
.RenderContext
formatSeparator()
Render a new line character (only ifSettings.isRenderFormatted()
is set totrue
), or a whitespace separator character otherwise.boolean
inline()
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.RenderContext
inline(boolean inline)
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.RenderContext
keyword(String keyword)
Append a SQL keyword to the context's containedStringBuilder
.RenderContext
literal(String literal)
Append some (quoted) literal to the context's containedStringBuilder
.boolean
namedParams()
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.RenderContext
namedParams(boolean renderNamedParams)
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.String
nextAlias()
Return a new alias that is unique for the scope of one query.ParamType
paramType()
Specify, how bind values should be rendered.RenderContext
paramType(ParamType paramType)
Set the new context value forparamType()
.String
peekAlias()
Peek the next alias that will be generated bynextAlias()
.boolean
qualify()
Whether query parts should render qualified names or not.RenderContext
qualify(boolean qualify)
Sett the new context value forqualify()
.String
render()
Render the context's underlying SQL statement.String
render(QueryPart part)
Render a query part in a new context derived from this one.RenderContext
sql(char sql)
Append some SQL to the context's containedStringBuilder
.RenderContext
sql(double sql)
Append some SQL to the context's containedStringBuilder
.RenderContext
sql(float sql)
Append some SQL to the context's containedStringBuilder
.RenderContext
sql(int sql)
Append some SQL to the context's containedStringBuilder
.RenderContext
sql(long sql)
Append some SQL to the context's containedStringBuilder
.RenderContext
sql(String sql)
Append some SQL to the context's containedStringBuilder
.RenderContext
sql(String sql, boolean literal)
Append some SQL to the context's containedStringBuilder
.RenderContext
sql(QueryPart part)
Deprecated.- 3.2.0 - [#2666] - UseContext.visit(QueryPart)
instead-
Methods inherited from interface org.jooq.Context
bindValue, declareAliases, declareAliases, declareCTE, declareCTE, declareFields, declareFields, declareTables, declareTables, declareWindows, declareWindows, end, nextIndex, peekIndex, qualifyCatalog, qualifyCatalog, qualifySchema, qualifySchema, quote, quote, scopeEnd, scopeMarkEnd, scopeMarkStart, scopeRegister, scopeStart, start, statement, stringLiteral, stringLiteral, subquery, subquery, subqueryLevel, visit
-
-
-
-
Method Detail
-
peekAlias
String peekAlias()
Peek the next alias that will be generated bynextAlias()
.- Specified by:
peekAlias
in interfaceContext<RenderContext>
-
nextAlias
String nextAlias()
Return a new alias that is unique for the scope of one query. These aliases are sometimes needed when unaliased projections are defined in subqueries, which can lead to syntax errors.- Specified by:
nextAlias
in interfaceContext<RenderContext>
-
render
String render()
Render the context's underlying SQL statement.- Specified by:
render
in interfaceContext<RenderContext>
-
render
String render(QueryPart part)
Render a query part in a new context derived from this one. The rendered SQL will not be appended to this context.- Specified by:
render
in interfaceContext<RenderContext>
-
keyword
RenderContext keyword(String keyword)
Append a SQL keyword to the context's containedStringBuilder
.Use this to have your SQL keyword rendered in
RenderKeywordCase
.- Specified by:
keyword
in interfaceContext<RenderContext>
-
sql
RenderContext sql(String sql)
Append some SQL to the context's containedStringBuilder
.- Specified by:
sql
in interfaceContext<RenderContext>
-
sql
RenderContext sql(String sql, boolean literal)
Append some SQL to the context's containedStringBuilder
.Set
literal = true
to indicate that theRenderContext
shall not format the argument SQL.- Specified by:
sql
in interfaceContext<RenderContext>
-
sql
RenderContext sql(char sql)
Append some SQL to the context's containedStringBuilder
.- Specified by:
sql
in interfaceContext<RenderContext>
-
sql
RenderContext sql(int sql)
Append some SQL to the context's containedStringBuilder
.- Specified by:
sql
in interfaceContext<RenderContext>
-
sql
RenderContext sql(long sql)
Append some SQL to the context's containedStringBuilder
.- Specified by:
sql
in interfaceContext<RenderContext>
-
sql
RenderContext sql(float sql)
Append some SQL to the context's containedStringBuilder
.- Specified by:
sql
in interfaceContext<RenderContext>
-
sql
RenderContext sql(double sql)
Append some SQL to the context's containedStringBuilder
.- Specified by:
sql
in interfaceContext<RenderContext>
-
sql
@Deprecated RenderContext sql(QueryPart part)
Deprecated.- 3.2.0 - [#2666] - UseContext.visit(QueryPart)
insteadRecurse rendering.
-
format
RenderContext format(boolean format)
Override the value ofSettings.isRenderFormatted()
.- Specified by:
format
in interfaceContext<RenderContext>
-
format
boolean format()
The value ofSettings.isRenderFormatted()
.- Specified by:
format
in interfaceContext<RenderContext>
-
formatNewLine
RenderContext formatNewLine()
Render a new line character (only ifSettings.isRenderFormatted()
is set totrue
).- Specified by:
formatNewLine
in interfaceContext<RenderContext>
-
formatNewLineAfterPrintMargin
RenderContext formatNewLineAfterPrintMargin()
Render a new line character (only ifSettings.isRenderFormatted()
is set totrue
, and theformatPrintMargin(int)
has been exceeded).- Specified by:
formatNewLineAfterPrintMargin
in interfaceContext<RenderContext>
-
formatSeparator
RenderContext formatSeparator()
Render a new line character (only ifSettings.isRenderFormatted()
is set totrue
), or a whitespace separator character otherwise.- Specified by:
formatSeparator
in interfaceContext<RenderContext>
-
formatIndentStart
RenderContext formatIndentStart()
Start indenting subsequent SQL by one level (two characters), ifSettings.isRenderFormatted()
is set totrue
.This is the same as calling
formatIndentStart(int)
with a parameter of2
- Specified by:
formatIndentStart
in interfaceContext<RenderContext>
-
formatIndentStart
RenderContext formatIndentStart(int indent)
Start indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()
is set totrue
.- Specified by:
formatIndentStart
in interfaceContext<RenderContext>
-
formatIndentLockStart
RenderContext formatIndentLockStart()
Start indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()
is set totrue
.- Specified by:
formatIndentLockStart
in interfaceContext<RenderContext>
-
formatIndentEnd
RenderContext formatIndentEnd()
Stop indenting subsequent SQL by one level (two characters), ifSettings.isRenderFormatted()
is set totrue
.This is the same as calling
formatIndentEnd(int)
with a parameter of2
- Specified by:
formatIndentEnd
in interfaceContext<RenderContext>
-
formatIndentEnd
RenderContext formatIndentEnd(int indent)
Stop indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()
is set totrue
.- Specified by:
formatIndentEnd
in interfaceContext<RenderContext>
-
formatIndentLockEnd
RenderContext formatIndentLockEnd()
Stop indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()
is set totrue
.- Specified by:
formatIndentLockEnd
in interfaceContext<RenderContext>
-
formatPrintMargin
RenderContext formatPrintMargin(int margin)
Set a print margin that will be applied to formatted SQL, ifSettings.isRenderFormatted()
is set totrue
.The default print margin is
80
. Setting this to zero or a negative value means that no print margin will be applied.The print margin is applied to any of these
QueryParts
:-
Field.in(Field...)
and related expressions
- Specified by:
formatPrintMargin
in interfaceContext<RenderContext>
-
-
literal
RenderContext literal(String literal)
Append some (quoted) literal to the context's containedStringBuilder
.- Specified by:
literal
in interfaceContext<RenderContext>
-
inline
@Deprecated boolean inline()
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used. UseparamType()
instead.Whether bind variables should be inlined, rather than rendered as'?'
.
-
inline
@Deprecated RenderContext inline(boolean inline)
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used. UseparamType(ParamType)
instead.Set the new context value forinline()
.
-
qualify
boolean qualify()
Whether query parts should render qualified names or not.- Specified by:
qualify
in interfaceContext<RenderContext>
-
qualify
RenderContext qualify(boolean qualify)
Sett the new context value forqualify()
.- Specified by:
qualify
in interfaceContext<RenderContext>
-
namedParams
@Deprecated boolean namedParams()
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used. UseparamType()
instead.Whether bind variables should be rendered as named parameters:
:1, :2, :custom_name
or as JDBC bind variables
?
-
namedParams
@Deprecated RenderContext namedParams(boolean renderNamedParams)
Deprecated.- 3.1.0 - [#2414] - This method should no longer be used. UseparamType(ParamType)
instead.Set the new context value fornamedParams()
.
-
paramType
ParamType paramType()
Specify, how bind values should be rendered.- As
ParamType.INDEXED
parameters:
?, ?, ?
- As
ParamType.NAMED
parameters:
:1, :2, :custom_name
- As
ParamType.INLINED
parameters:
1, 'A', null
- Specified by:
paramType
in interfaceContext<RenderContext>
- As
-
paramType
RenderContext paramType(ParamType paramType)
Set the new context value forparamType()
.- Specified by:
paramType
in interfaceContext<RenderContext>
-
castMode
RenderContext.CastMode castMode()
The currently applied cast mode for bind values.- Specified by:
castMode
in interfaceContext<RenderContext>
-
castMode
RenderContext castMode(RenderContext.CastMode mode)
Set the new cast mode forcastMode()
.- Specified by:
castMode
in interfaceContext<RenderContext>
-
cast
@Deprecated Boolean cast()
Deprecated.- [#3703] - 3.5.0 - Do not use this any longerWhether casting must be applied. The result follows this logic:CastMode result ALWAYS
true
NEVER
false
SOME
true
orfalse
depending on the dialectDEFAULT
null
- Specified by:
cast
in interfaceContext<RenderContext>
-
castModeSome
@Deprecated RenderContext castModeSome(SQLDialect... dialects)
Deprecated.- [#3703] - 3.5.0 - Do not use this any longerSet the new cast mode toRenderContext.CastMode.SOME
for a list of dialects.- Specified by:
castModeSome
in interfaceContext<RenderContext>
-
-