public interface RenderContext extends Context<RenderContext>
QueryPart
's to SQL.
A new render context is instanciated every time a Query
is rendered.
QueryPart
's will then pass the same context to their components
BindContext
Modifier and Type | Interface and Description |
---|---|
static class |
RenderContext.CastMode
The cast mode for bind values.
|
Modifier and Type | Method and Description |
---|---|
Boolean |
cast()
Whether casting must be applied.
|
RenderContext.CastMode |
castMode()
The currently applied cast mode for bind values.
|
RenderContext |
castMode(RenderContext.CastMode mode)
Set the new cast mode for
castMode() . |
RenderContext |
castModeSome(SQLDialect... dialects)
Set the new cast mode to
RenderContext.CastMode.SOME for a list of dialects. |
boolean |
format()
The value of
Settings.isRenderFormatted() . |
RenderContext |
format(boolean format)
Override the value of
Settings.isRenderFormatted() . |
RenderContext |
formatIndentEnd()
Stop indenting subsequent SQL by one level (two characters), if
Settings.isRenderFormatted() is set to true . |
RenderContext |
formatIndentEnd(int indent)
Stop indenting subsequent SQL by a number of characters, if
Settings.isRenderFormatted() is set to true . |
RenderContext |
formatIndentLockEnd()
Stop indenting subsequent SQL at the same level as the current line, if
Settings.isRenderFormatted() is set to true . |
RenderContext |
formatIndentLockStart()
Start indenting subsequent SQL at the same level as the current line, if
Settings.isRenderFormatted() is set to true . |
RenderContext |
formatIndentStart()
Start indenting subsequent SQL by one level (two characters), if
Settings.isRenderFormatted() is set to true . |
RenderContext |
formatIndentStart(int indent)
Start indenting subsequent SQL by a number of characters, if
Settings.isRenderFormatted() is set to true . |
RenderContext |
formatNewLine()
Render a new line character (only if
Settings.isRenderFormatted()
is set to true ). |
RenderContext |
formatNewLineAfterPrintMargin()
Render a new line character (only if
Settings.isRenderFormatted()
is set to true , and the formatPrintMargin(int) has
been exceeded). |
RenderContext |
formatPrintMargin(int margin)
Set a print margin that will be applied to formatted SQL, if
Settings.isRenderFormatted() is set to true . |
RenderContext |
formatSeparator()
Render a new line character (only if
Settings.isRenderFormatted()
is set to true ), or a whitespace separator character
otherwise. |
boolean |
inline()
Deprecated.
- 3.1.0 - [#2414] - This method should no longer be used. Use
paramType() instead. |
RenderContext |
inline(boolean inline)
Deprecated.
- 3.1.0 - [#2414] - This method should no longer be used. Use
paramType(ParamType) instead. |
RenderContext |
keyword(String keyword)
Append a SQL keyword to the context's contained
StringBuilder . |
RenderContext |
literal(String literal)
Append some (quoted) literal to the context's contained
StringBuilder . |
boolean |
namedParams()
Deprecated.
- 3.1.0 - [#2414] - This method should no longer be used. Use
paramType() instead. |
RenderContext |
namedParams(boolean renderNamedParams)
Deprecated.
- 3.1.0 - [#2414] - This method should no longer be used. Use
paramType(ParamType) instead. |
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 for
paramType() . |
String |
peekAlias()
Peek the next alias that will be generated by
nextAlias() . |
boolean |
qualify()
Whether query parts should render qualified names or not.
|
RenderContext |
qualify(boolean qualify)
Sett the new context value for
qualify() . |
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 contained
StringBuilder . |
RenderContext |
sql(int sql)
Append some SQL to the context's contained
StringBuilder . |
RenderContext |
sql(QueryPart part)
Deprecated.
- 3.2.0 - [#2666] - Use
Context.visit(QueryPart) instead |
RenderContext |
sql(String sql)
Append some SQL to the context's contained
StringBuilder . |
RenderContext |
sql(String sql,
boolean literal)
Append some SQL to the context's contained
StringBuilder . |
configuration, data, data, data, declareFields, declareFields, declareTables, declareTables, declareWindows, declareWindows, end, nextIndex, peekIndex, start, subquery, subquery, visit
String peekAlias()
nextAlias()
.String nextAlias()
String render()
String render(QueryPart part)
RenderContext keyword(String keyword)
StringBuilder
.
Use this to have your SQL keyword rendered in RenderKeywordStyle
(upper or lower case)
RenderContext sql(String sql)
StringBuilder
.RenderContext sql(String sql, boolean literal)
StringBuilder
.
Set literal = true
to indicate that the
RenderContext
shall not format the argument SQL.
RenderContext sql(char sql)
StringBuilder
.RenderContext sql(int sql)
StringBuilder
.@Deprecated RenderContext sql(QueryPart part)
Context.visit(QueryPart)
insteadRenderContext format(boolean format)
Settings.isRenderFormatted()
.boolean format()
Settings.isRenderFormatted()
.RenderContext formatNewLine()
Settings.isRenderFormatted()
is set to true
).RenderContext formatNewLineAfterPrintMargin()
Settings.isRenderFormatted()
is set to true
, and the formatPrintMargin(int)
has
been exceeded).RenderContext formatSeparator()
Settings.isRenderFormatted()
is set to true
), or a whitespace separator character
otherwise.RenderContext formatIndentStart()
Settings.isRenderFormatted()
is set to true
.
This is the same as calling formatIndentStart(int)
with a
parameter of 2
RenderContext formatIndentStart(int indent)
Settings.isRenderFormatted()
is set to true
.RenderContext formatIndentLockStart()
Settings.isRenderFormatted()
is set to true
.RenderContext formatIndentEnd()
Settings.isRenderFormatted()
is set to true
.
This is the same as calling formatIndentEnd(int)
with a
parameter of 2
RenderContext formatIndentEnd(int indent)
Settings.isRenderFormatted()
is set to true
.RenderContext formatIndentLockEnd()
Settings.isRenderFormatted()
is set to true
.RenderContext formatPrintMargin(int margin)
Settings.isRenderFormatted()
is set to true
.
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 expressionsRenderContext literal(String literal)
StringBuilder
.@Deprecated boolean inline()
paramType()
instead.'?'
.@Deprecated RenderContext inline(boolean inline)
paramType(ParamType)
instead.inline()
.boolean qualify()
RenderContext qualify(boolean qualify)
qualify()
.@Deprecated boolean namedParams()
paramType()
instead. :1, :2, :custom_name
or as JDBC bind variables
?
@Deprecated RenderContext namedParams(boolean renderNamedParams)
paramType(ParamType)
instead.namedParams()
.ParamType paramType()
ParamType.INDEXED
parameters: ?, ?, ?
ParamType.NAMED
parameters: :1, :2, :custom_name
ParamType.INLINED
parameters: 1, 'A', null
RenderContext paramType(ParamType paramType)
paramType()
.RenderContext.CastMode castMode()
RenderContext castMode(RenderContext.CastMode mode)
castMode()
.Boolean cast()
CastMode | result |
---|---|
ALWAYS |
true |
NEVER |
false |
SOME |
true or false depending on the dialect |
DEFAULT |
null |
RenderContext castModeSome(SQLDialect... dialects)
RenderContext.CastMode.SOME
for a list of dialects.Copyright © 2014. All Rights Reserved.