public class DefaultSQLCompositionContext extends Object implements SQLCompositionContext
SQLCompositionContext
implementation.SQLCompositionContext.SQLStatementPreparationException
Constructor and Description |
---|
DefaultSQLCompositionContext(SQLCompositionContext parent)
Constructor with parent composition context.
|
DefaultSQLCompositionContext(SQLContext context)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> |
addExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver) |
SQLCompositionContext |
childContext()
Create a new
SQLCompositionContext as child of this context. |
SQLDialect |
getDialect()
Get the
SQLDialect to use. |
Iterable<com.holonplatform.core.ExpressionResolver> |
getExpressionResolvers() |
SQLContextParametersHandler |
getNamedParametersHandler()
Get the SQL named parameters handler.
|
Optional<SQLCompositionContext> |
getParent()
Get the parent context, if available.
|
SQLValueDeserializer |
getValueDeserializer()
Get the
SQLValueDeserializer of this context. |
SQLValueSerializer |
getValueSerializer()
Get the
SQLValueSerializer of this context. |
SQLStatement |
prepareStatement(String sql)
Prepare given SQL statement, replacing named parameters with the default
? |
<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> |
removeExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver) |
<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> |
resolve(E expression,
Class<R> resolutionType,
com.holonplatform.core.ExpressionResolver.ResolutionContext context) |
void |
trace(String sql)
Trace given SQL statement.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addNamedParameter, create, getContextSequence, isSQLCompositionContext, isStatementCompositionContext, resolve, resolveOrFail
getTypeConverter
public DefaultSQLCompositionContext(SQLContext context)
context
- SQL context (not null)public DefaultSQLCompositionContext(SQLCompositionContext parent)
parent
- Parent context (not null)public Optional<SQLCompositionContext> getParent()
SQLCompositionContext
getParent
in interface SQLCompositionContext
public SQLDialect getDialect()
SQLContext
SQLDialect
to use.getDialect
in interface SQLContext
public SQLValueSerializer getValueSerializer()
SQLContext
SQLValueSerializer
of this context.getValueSerializer
in interface SQLContext
SQLValueSerializer
public SQLValueDeserializer getValueDeserializer()
SQLContext
SQLValueDeserializer
of this context.getValueDeserializer
in interface SQLContext
SQLValueDeserializer
public void trace(String sql)
SQLContext
If tracing is enabled, the SQL statement is logged using the INFO
level, otherwise it is logged
using the DEBUG
level.
trace
in interface SQLContext
sql
- SQL to tracepublic SQLContextParametersHandler getNamedParametersHandler()
SQLCompositionContext
getNamedParametersHandler
in interface SQLCompositionContext
public SQLStatement prepareStatement(String sql)
SQLCompositionContext
?
parameter placeholder.prepareStatement
in interface SQLCompositionContext
sql
- The SQL statement to prepare (not null)SQLStatement
which provides the prepared SQL and the statement parameter definition in the
right order according to the parameters placeholder indexpublic SQLCompositionContext childContext()
SQLCompositionContext
SQLCompositionContext
as child of this context. This context will be setted as parent of the
new context.childContext
in interface SQLCompositionContext
SQLCompositionContext
with this context as parentpublic Iterable<com.holonplatform.core.ExpressionResolver> getExpressionResolvers()
getExpressionResolvers
in interface com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider
public <E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> Optional<R> resolve(E expression, Class<R> resolutionType, com.holonplatform.core.ExpressionResolver.ResolutionContext context) throws com.holonplatform.core.Expression.InvalidExpressionException
resolve
in interface com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler
com.holonplatform.core.Expression.InvalidExpressionException
public <E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> void addExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver)
addExpressionResolver
in interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport
public <E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> void removeExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver)
removeExpressionResolver
in interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport
Copyright © 2019 The Holon Platform. All rights reserved.