com.holonplatform.datastore.jdbc.composer

## Interface SQLStatementCompositionContext

- All Superinterfaces:
    com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler, com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider, com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport, com.holonplatform.core.ExpressionResolver.ResolutionContext, SQLCompositionContext, SQLContext
  All Known Implementing Classes:
    DefaultSQLStatementCompositionContext

      public interface SQLStatementCompositionContext
      extends SQLCompositionContext

  A `SQLCompositionContext` extension which supports statement alias generation and inspection.
  Since:
    5.1.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `SQLStatementCompositionContext.AliasMode` Alias handling mode

    - ### Nested classes/interfaces inherited from interface com.holonplatform.datastore.jdbc.composer.SQLCompositionContext

      `SQLCompositionContext.SQLStatementPreparationException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SQLStatementCompositionContext` | `asChild(SQLCompositionContext parent, com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget, SQLStatementCompositionContext.AliasMode aliasMode)` Create a new `SQLStatementCompositionContext` as a child of given `SQLCompositionContext`.
    `static SQLStatementCompositionContext` | `create(SQLContext context, com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget, SQLStatementCompositionContext.AliasMode aliasMode)` Create a new default `SQLStatementCompositionContext`.
    `Optional<String>` | `getAlias(com.holonplatform.core.Path<?> path, boolean useParentContext)` Get the given `path` alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.
    `default Optional<String>` | `getAliasOrRoot(com.holonplatform.core.Path<?> path)` Get the given `path` alias, falling back to query root alias if not available.
    `Optional<String>` | `getRootAlias()` Get the query root path (target) alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.

    - ### Methods inherited from interface com.holonplatform.datastore.jdbc.composer.SQLCompositionContext

      `addNamedParameter, childContext, create, getContextSequence, getNamedParametersHandler, getParent, isSQLCompositionContext, isStatementCompositionContext, prepareStatement, resolve, resolveOrFail`

    - ### Methods inherited from interface com.holonplatform.datastore.jdbc.composer.SQLContext

      `getDialect, getTypeConverter, getValueDeserializer, getValueSerializer, trace`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler

      `resolve`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider

      `getExpressionResolvers`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport

      `addExpressionResolver, addExpressionResolvers, removeExpressionResolver`

- - ### Method Detail

    - #### getRootAlias

          Optional<String> getRootAlias()

      Get the query root path (target) alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.

      The alias will be the explicit alias name if the root path is `Aliasable`, or an auto generated name if alias mode is `SQLStatementCompositionContext.AliasMode.AUTO`.

      Returns:
        the query root path alias, empty if not available

    - #### getAlias

          Optional<String> getAlias(com.holonplatform.core.Path<?> path,
                                    boolean useParentContext)

      Get the given `path` alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.

      The alias will be the explicit alias name if the path is `Aliasable`, or an auto generated name if alias mode is `SQLStatementCompositionContext.AliasMode.AUTO`.

      Parameters:
        `path` - Path for which to get the alias (not null)
        `useParentContext` - Whether to check in parent contexts if an alias is available when not available is current context
      Returns:
        the path alias, empty if not available

    - #### getAliasOrRoot

          default Optional<String> getAliasOrRoot(com.holonplatform.core.Path<?> path)

      Get the given `path` alias, falling back to query root alias if not available.
      Parameters:
        `path` - Path for which to get the alias (not null)
      Returns:
        the path alias, empty if not available

    - #### create

          static SQLStatementCompositionContext create(SQLContext context,
                                                       com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget,
                                                       SQLStatementCompositionContext.AliasMode aliasMode)

      Create a new default `SQLStatementCompositionContext`.
      Parameters:
        `context` - SQL context to use (not null)
        `rootTarget` - Root query target (not null)
        `aliasMode` - Alias handling mode (not null)
      Returns:
        A new `SQLStatementCompositionContext`

    - #### asChild

          static SQLStatementCompositionContext asChild(SQLCompositionContext parent,
                                                        com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget,
                                                        SQLStatementCompositionContext.AliasMode aliasMode)

      Create a new `SQLStatementCompositionContext` as a child of given `SQLCompositionContext`.
      Parameters:
        `parent` - Parent context (not null)
        `rootTarget` - Root query target (not null)
        `aliasMode` - Alias handling mode (not null)
      Returns:
        A new `SQLStatementCompositionContext`

Copyright © 2019 The Holon Platform. All rights reserved.