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
This interface is for JOOQ INTERNAL USE only. Do not reference directly
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 |
RenderContext |
formatIndentEnd()
Stop indenting subsequent SQL by one level (two characters), if
Settings.isRenderFormatted() is set to true
This is the same as calling formatIndentEnd(int) with a
parameter of 2 |
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
This is the same as calling formatIndentStart(int) with a
parameter of 2 |
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
The default print margin is 80 . |
RenderContext |
formatSeparator()
Render a new line character (only if
Settings.isRenderFormatted()
is set to true ), or a whitespace separator character
otherwise |
boolean |
inline()
Whether bind variables should be inlined, rather than rendered as
'?' |
RenderContext |
inline(boolean inline)
Set the new context value for
inline() |
RenderContext |
keyword(String keyword)
Append a SQL keyword to the context's contained
StringBuilder
Use this to have your SQL keyword rendered in RenderKeywordStyle
(upper or lower case) |
RenderContext |
literal(String literal)
Append some (quoted) literal to the context's contained
StringBuilder |
boolean |
namedParams()
Whether bind variables should be rendered as named parameters:
:1, :2, :custom_name
or as JDBC bind variables ? |
RenderContext |
namedParams(boolean renderNamedParams)
Set the new context value for
namedParams() |
String |
nextAlias()
Return a new alias that is unique for the scope of one query.
|
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)
Recurse rendering
|
RenderContext |
sql(String sql)
Append some SQL to the context's contained
StringBuilder |
declareFields, declareFields, declareTables, declareTables, nextIndex, peekIndex, subquery, subquery
getConnection, getData, getData, getDataSource, getDialect, getSchemaMapping, getSettings, setConnection, setData, setDataSource
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(char sql)
StringBuilder
RenderContext sql(int sql)
StringBuilder
RenderContext sql(QueryPart part)
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
otherwiseRenderContext 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
boolean inline()
'?'
RenderContext inline(boolean inline)
inline()
boolean qualify()
RenderContext qualify(boolean qualify)
qualify()
boolean namedParams()
:1, :2, :custom_name
or as JDBC bind variables
?
RenderContext namedParams(boolean renderNamedParams)
namedParams()
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 dialectsCopyright © 2013. All Rights Reserved.