Package org.jooq
Interface RenderContext
-
- 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
Queryis 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 classRenderContext.CastModeThe cast mode for bind values.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.Booleancast()Deprecated.- [#3703] - 3.5.0 - Do not use this any longerRenderContext.CastModecastMode()The currently applied cast mode for bind values.RenderContextcastMode(RenderContext.CastMode mode)Set the new cast mode forcastMode().RenderContextcastModeSome(SQLDialect... dialects)Deprecated.- [#3703] - 3.5.0 - Do not use this any longerbooleanformat()The value ofSettings.isRenderFormatted().RenderContextformat(boolean format)Override the value ofSettings.isRenderFormatted().RenderContextformatIndentEnd()Stop indenting subsequent SQL by one level (two characters), ifSettings.isRenderFormatted()is set totrue.RenderContextformatIndentEnd(int indent)Stop indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()is set totrue.RenderContextformatIndentLockEnd()Stop indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()is set totrue.RenderContextformatIndentLockStart()Start indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()is set totrue.RenderContextformatIndentStart()Start indenting subsequent SQL by one level (two characters), ifSettings.isRenderFormatted()is set totrue.RenderContextformatIndentStart(int indent)Start indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()is set totrue.RenderContextformatNewLine()Render a new line character (only ifSettings.isRenderFormatted()is set totrue).RenderContextformatNewLineAfterPrintMargin()Render a new line character (only ifSettings.isRenderFormatted()is set totrue, and theformatPrintMargin(int)has been exceeded).RenderContextformatPrintMargin(int margin)Set a print margin that will be applied to formatted SQL, ifSettings.isRenderFormatted()is set totrue.RenderContextformatSeparator()Render a new line character (only ifSettings.isRenderFormatted()is set totrue), or a whitespace separator character otherwise.booleaninline()Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.RenderContextinline(boolean inline)Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.RenderContextkeyword(java.lang.String keyword)Append a SQL keyword to the context's containedStringBuilder.RenderContextliteral(java.lang.String literal)Append some (quoted) literal to the context's containedStringBuilder.booleannamedParams()Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.RenderContextnamedParams(boolean renderNamedParams)Deprecated.- 3.1.0 - [#2414] - This method should no longer be used.java.lang.StringnextAlias()Return a new alias that is unique for the scope of one query.ParamTypeparamType()Specify, how bind values should be rendered.RenderContextparamType(ParamType paramType)Set the new context value forparamType().java.lang.StringpeekAlias()Peek the next alias that will be generated bynextAlias().booleanqualify()Whether query parts should render qualified names or not.RenderContextqualify(boolean qualify)Sett the new context value forqualify().java.lang.Stringrender()Render the context's underlying SQL statement.java.lang.Stringrender(QueryPart part)Render a query part in a new context derived from this one.RenderContextsql(char sql)Append some SQL to the context's containedStringBuilder.RenderContextsql(double sql)Append some SQL to the context's containedStringBuilder.RenderContextsql(float sql)Append some SQL to the context's containedStringBuilder.RenderContextsql(int sql)Append some SQL to the context's containedStringBuilder.RenderContextsql(long sql)Append some SQL to the context's containedStringBuilder.RenderContextsql(java.lang.String sql)Append some SQL to the context's containedStringBuilder.RenderContextsql(java.lang.String sql, boolean literal)Append some SQL to the context's containedStringBuilder.RenderContextsql(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
java.lang.String peekAlias()
Peek the next alias that will be generated bynextAlias().- Specified by:
peekAliasin interfaceContext<RenderContext>
-
nextAlias
java.lang.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:
nextAliasin interfaceContext<RenderContext>
-
render
java.lang.String render()
Render the context's underlying SQL statement.- Specified by:
renderin interfaceContext<RenderContext>
-
render
java.lang.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:
renderin interfaceContext<RenderContext>
-
keyword
RenderContext keyword(java.lang.String keyword)
Append a SQL keyword to the context's containedStringBuilder.Use this to have your SQL keyword rendered in
RenderKeywordCase.- Specified by:
keywordin interfaceContext<RenderContext>
-
sql
RenderContext sql(java.lang.String sql)
Append some SQL to the context's containedStringBuilder.- Specified by:
sqlin interfaceContext<RenderContext>
-
sql
RenderContext sql(java.lang.String sql, boolean literal)
Append some SQL to the context's containedStringBuilder.Set
literal = trueto indicate that theRenderContextshall not format the argument SQL.- Specified by:
sqlin interfaceContext<RenderContext>
-
sql
RenderContext sql(char sql)
Append some SQL to the context's containedStringBuilder.- Specified by:
sqlin interfaceContext<RenderContext>
-
sql
RenderContext sql(int sql)
Append some SQL to the context's containedStringBuilder.- Specified by:
sqlin interfaceContext<RenderContext>
-
sql
RenderContext sql(long sql)
Append some SQL to the context's containedStringBuilder.- Specified by:
sqlin interfaceContext<RenderContext>
-
sql
RenderContext sql(float sql)
Append some SQL to the context's containedStringBuilder.- Specified by:
sqlin interfaceContext<RenderContext>
-
sql
RenderContext sql(double sql)
Append some SQL to the context's containedStringBuilder.- Specified by:
sqlin 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:
formatin interfaceContext<RenderContext>
-
format
boolean format()
The value ofSettings.isRenderFormatted().- Specified by:
formatin interfaceContext<RenderContext>
-
formatNewLine
RenderContext formatNewLine()
Render a new line character (only ifSettings.isRenderFormatted()is set totrue).- Specified by:
formatNewLinein interfaceContext<RenderContext>
-
formatNewLineAfterPrintMargin
RenderContext formatNewLineAfterPrintMargin()
Render a new line character (only ifSettings.isRenderFormatted()is set totrue, and theformatPrintMargin(int)has been exceeded).- Specified by:
formatNewLineAfterPrintMarginin interfaceContext<RenderContext>
-
formatSeparator
RenderContext formatSeparator()
Render a new line character (only ifSettings.isRenderFormatted()is set totrue), or a whitespace separator character otherwise.- Specified by:
formatSeparatorin 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:
formatIndentStartin interfaceContext<RenderContext>
-
formatIndentStart
RenderContext formatIndentStart(int indent)
Start indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()is set totrue.- Specified by:
formatIndentStartin interfaceContext<RenderContext>
-
formatIndentLockStart
RenderContext formatIndentLockStart()
Start indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()is set totrue.- Specified by:
formatIndentLockStartin 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:
formatIndentEndin interfaceContext<RenderContext>
-
formatIndentEnd
RenderContext formatIndentEnd(int indent)
Stop indenting subsequent SQL by a number of characters, ifSettings.isRenderFormatted()is set totrue.- Specified by:
formatIndentEndin interfaceContext<RenderContext>
-
formatIndentLockEnd
RenderContext formatIndentLockEnd()
Stop indenting subsequent SQL at the same level as the current line, ifSettings.isRenderFormatted()is set totrue.- Specified by:
formatIndentLockEndin 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:
formatPrintMarginin interfaceContext<RenderContext>
-
-
literal
RenderContext literal(java.lang.String literal)
Append some (quoted) literal to the context's containedStringBuilder.- Specified by:
literalin 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:
qualifyin interfaceContext<RenderContext>
-
qualify
RenderContext qualify(boolean qualify)
Sett the new context value forqualify().- Specified by:
qualifyin 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_nameor 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.INDEXEDparameters:
?, ?, ? - As
ParamType.NAMEDparameters:
:1, :2, :custom_name - As
ParamType.INLINEDparameters:
1, 'A', null
- Specified by:
paramTypein interfaceContext<RenderContext>
- As
-
paramType
RenderContext paramType(ParamType paramType)
Set the new context value forparamType().- Specified by:
paramTypein interfaceContext<RenderContext>
-
castMode
RenderContext.CastMode castMode()
The currently applied cast mode for bind values.- Specified by:
castModein interfaceContext<RenderContext>
-
castMode
RenderContext castMode(RenderContext.CastMode mode)
Set the new cast mode forcastMode().- Specified by:
castModein interfaceContext<RenderContext>
-
cast
@Deprecated java.lang.Boolean cast()
Deprecated.- [#3703] - 3.5.0 - Do not use this any longerWhether casting must be applied. The result follows this logic:CastMode result ALWAYStrueNEVERfalseSOMEtrueorfalsedepending on the dialectDEFAULTnull- Specified by:
castin 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.SOMEfor a list of dialects.- Specified by:
castModeSomein interfaceContext<RenderContext>
-
-