public interface RenderContext extends Context<RenderContext>
QueryPart
'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
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()
Deprecated.
- [#3703] - 3.5.0 - Do not use this any longer
|
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)
Deprecated.
- [#3703] - 3.5.0 - Do not use this any longer
|
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 . |
bindValue, declareAliases, declareAliases, declareCTE, declareCTE, declareFields, declareFields, declareTables, declareTables, declareWindows, declareWindows, end, nextIndex, peekIndex, qualifyCatalog, qualifyCatalog, qualifySchema, qualifySchema, start, statement, stringLiteral, stringLiteral, subquery, subquery, visit
String peekAlias()
nextAlias()
.peekAlias
in interface Context<RenderContext>
String nextAlias()
nextAlias
in interface Context<RenderContext>
String render()
render
in interface Context<RenderContext>
String render(QueryPart part)
render
in interface Context<RenderContext>
RenderContext keyword(String keyword)
StringBuilder
.
Use this to have your SQL keyword rendered in RenderKeywordStyle
.
keyword
in interface Context<RenderContext>
RenderContext sql(String sql)
StringBuilder
.sql
in interface Context<RenderContext>
RenderContext sql(String sql, boolean literal)
StringBuilder
.
Set literal = true
to indicate that the
RenderContext
shall not format the argument SQL.
sql
in interface Context<RenderContext>
RenderContext sql(char sql)
StringBuilder
.sql
in interface Context<RenderContext>
RenderContext sql(int sql)
StringBuilder
.sql
in interface Context<RenderContext>
@Deprecated RenderContext sql(QueryPart part)
Context.visit(QueryPart)
insteadRenderContext format(boolean format)
Settings.isRenderFormatted()
.format
in interface Context<RenderContext>
boolean format()
Settings.isRenderFormatted()
.format
in interface Context<RenderContext>
RenderContext formatNewLine()
Settings.isRenderFormatted()
is set to true
).formatNewLine
in interface Context<RenderContext>
RenderContext formatNewLineAfterPrintMargin()
Settings.isRenderFormatted()
is set to true
, and the formatPrintMargin(int)
has
been exceeded).formatNewLineAfterPrintMargin
in interface Context<RenderContext>
RenderContext formatSeparator()
Settings.isRenderFormatted()
is set to true
), or a whitespace separator character
otherwise.formatSeparator
in interface Context<RenderContext>
RenderContext formatIndentStart()
Settings.isRenderFormatted()
is set to true
.
This is the same as calling formatIndentStart(int)
with a
parameter of 2
formatIndentStart
in interface Context<RenderContext>
RenderContext formatIndentStart(int indent)
Settings.isRenderFormatted()
is set to true
.formatIndentStart
in interface Context<RenderContext>
RenderContext formatIndentLockStart()
Settings.isRenderFormatted()
is set to true
.formatIndentLockStart
in interface Context<RenderContext>
RenderContext formatIndentEnd()
Settings.isRenderFormatted()
is set to true
.
This is the same as calling formatIndentEnd(int)
with a
parameter of 2
formatIndentEnd
in interface Context<RenderContext>
RenderContext formatIndentEnd(int indent)
Settings.isRenderFormatted()
is set to true
.formatIndentEnd
in interface Context<RenderContext>
RenderContext formatIndentLockEnd()
Settings.isRenderFormatted()
is set to true
.formatIndentLockEnd
in interface Context<RenderContext>
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 expressionsformatPrintMargin
in interface Context<RenderContext>
RenderContext literal(String literal)
StringBuilder
.literal
in interface Context<RenderContext>
@Deprecated boolean inline()
paramType()
instead.'?'
.@Deprecated RenderContext inline(boolean inline)
paramType(ParamType)
instead.inline()
.boolean qualify()
qualify
in interface Context<RenderContext>
RenderContext qualify(boolean qualify)
qualify()
.qualify
in interface Context<RenderContext>
@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
paramType
in interface Context<RenderContext>
RenderContext paramType(ParamType paramType)
paramType()
.paramType
in interface Context<RenderContext>
RenderContext.CastMode castMode()
castMode
in interface Context<RenderContext>
RenderContext castMode(RenderContext.CastMode mode)
castMode()
.castMode
in interface Context<RenderContext>
@Deprecated Boolean cast()
CastMode | result |
---|---|
ALWAYS |
true |
NEVER |
false |
SOME |
true or false depending on the dialect |
DEFAULT |
null |
cast
in interface Context<RenderContext>
@Deprecated RenderContext castModeSome(SQLDialect... dialects)
RenderContext.CastMode.SOME
for a list of dialects.castModeSome
in interface Context<RenderContext>
Copyright © 2017. All Rights Reserved.