Module org.jooq
Package org.jooq

Interface Context<C extends Context<C>>

    • Method Detail

      • visit

        C visit​(QueryPart part)
         throws DataAccessException
        Visit a QueryPart in the current Context.

        This method is called by certain QueryPart implementations to recursively visit component QueryParts.

        Parameters:
        part - The component QueryPart
        Throws:
        DataAccessException - If something went wrong while visiting the component QueryPart, e.g. when binding a variable
      • start

        C start​(Clause clause)
        TODO [#2667] Properties of these methods: - A clause is always started / ended, even if it isn't rendered or if it's empty!
      • declareFields

        boolean declareFields()
        Whether the current context is rendering a SQL field declaration (e.g. a Field in the SELECT clause of the query).
      • declareFields

        C declareFields​(boolean declareFields)
        Set the new context value for declareFields().
      • declareTables

        boolean declareTables()
        Whether the current context is rendering a SQL table declaration (e.g. a Table in the FROM or JOIN clause of the query).
      • declareTables

        C declareTables​(boolean declareTables)
        Set the new context value for declareTables().
      • declareAliases

        boolean declareAliases()
        Whether the current context is rendering a SQL alias declarations in declareTables() or declareFields() sections.
      • declareAliases

        C declareAliases​(boolean declareTables)
        Whether the current context is rendering a SQL alias declarations in declareTables() or declareFields() sections.
      • declareWindows

        boolean declareWindows()
        Whether the current context is rendering a SQL window declaration (e.g. a WindowDefinition in the WINDOW clause of the query).
      • declareWindows

        C declareWindows​(boolean declareWindows)
        Set the new context value for declareWindows().
      • declareCTE

        boolean declareCTE()
        Whether the current context is rendering a common table expression (e.g. a CommonTableExpression in the WITH clause of the query).
      • declareCTE

        C declareCTE​(boolean declareCTE)
        Set the new context value for declareCTE().
      • subquery

        boolean subquery()
        Whether the current context is rendering a sub-query (nested query).
      • subquery

        C subquery​(boolean subquery)
        Set the new context value for subquery().
      • subqueryLevel

        int subqueryLevel()
        Which level of subqueries we're currently in, starting with 0 for the top level query.
      • scopeStart

        C scopeStart()
        Start a new SELECT scope.
      • scopeMarkStart

        C scopeMarkStart​(QueryPart part)
        Mark the beginning of a scoped query part.
      • scopeRegister

        C scopeRegister​(QueryPart part)
        Register a "special" query part in the scope.
      • scopeMarkEnd

        C scopeMarkEnd​(QueryPart part)
        Mark the end of a scoped query part.
      • scopeEnd

        C scopeEnd()
        End a previous SELECT scope.
      • stringLiteral

        boolean stringLiteral()
        whether the current context is rendering a string literal.
      • stringLiteral

        C stringLiteral​(boolean stringLiteral)
        Set the new context value for stringLiteral().
      • peekIndex

        int peekIndex()
        Peek the next bind index. This won't increment the internal counter, unlike nextIndex().
      • statement

        PreparedStatement statement()
        Retrieve the context's underlying PreparedStatement if available, or null if this traversal does not operate on a PreparedStatement.
      • peekAlias

        String peekAlias()
        Peek the next alias that will be generated by nextAlias().
      • 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.
      • render

        String render()
        Render the context's underlying SQL statement.
      • 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.
      • sql

        C sql​(String sql,
              boolean literal)
        Append some SQL to the context's contained StringBuilder.

        Set literal = true to indicate that the RenderContext shall not format the argument SQL.

      • sql

        C sql​(char sql)
        Append some SQL to the context's contained StringBuilder.
      • sql

        C sql​(int sql)
        Append some SQL to the context's contained StringBuilder.
      • sql

        C sql​(long sql)
        Append some SQL to the context's contained StringBuilder.
      • sql

        C sql​(float sql)
        Append some SQL to the context's contained StringBuilder.
      • sql

        C sql​(double sql)
        Append some SQL to the context's contained StringBuilder.
      • formatSeparator

        C formatSeparator()
        Render a new line character (only if Settings.isRenderFormatted() is set to true), or a whitespace separator character otherwise.
      • formatIndentStart

        C formatIndentStart​(int indent)
        Start indenting subsequent SQL by a number of characters, if Settings.isRenderFormatted() is set to true.
      • formatIndentLockStart

        C formatIndentLockStart()
        Start indenting subsequent SQL at the same level as the current line, if Settings.isRenderFormatted() is set to true.
      • formatIndentEnd

        C formatIndentEnd​(int indent)
        Stop indenting subsequent SQL by a number of characters, if Settings.isRenderFormatted() is set to true.
      • formatIndentLockEnd

        C formatIndentLockEnd()
        Stop indenting subsequent SQL at the same level as the current line, if Settings.isRenderFormatted() is set to true.
      • formatPrintMargin

        C 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. 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:

      • quote

        C quote​(boolean quote)
        Set the new context value for quote().
      • qualify

        boolean qualify()
        Whether query parts should render qualified names or not.
      • qualifySchema

        boolean qualifySchema()
        Whether query parts should render qualified names or not.

        This is the same as qualifySchema().

      • qualifySchema

        C qualifySchema​(boolean qualifySchema)
        Set the new context value for qualifySchema().
      • qualifyCatalog

        boolean qualifyCatalog()
        Whether query parts should render qualified names or not.

        The catalog can only be qualified when qualifySchema() is true as well.

      • qualifyCatalog

        C qualifyCatalog​(boolean qualifyCatalog)
        Set the new context value for qualifyCatalog().

        The catalog can only be qualified when qualifySchema() is true as well.

      • cast

        @Deprecated
        Boolean cast()
        Deprecated.
        - [#3703] - 3.5.0 - Do not use this any longer
        Whether casting must be applied. The result follows this logic:
        CastMode result
        ALWAYS true
        NEVER false
        SOME true or false depending on the dialect
        DEFAULT null