[#3001] Add VisitContext.clausesLength() and queryPartsLength() to indicate the depth of the currently visited QueryPart tree
This commit is contained in:
parent
5d49584e96
commit
c922c07b98
@ -110,6 +110,11 @@ public interface VisitContext {
|
||||
*/
|
||||
Clause[] clauses();
|
||||
|
||||
/**
|
||||
* This is the same as calling {@link #clauses()}<code>.length</code>.
|
||||
*/
|
||||
int clausesLength();
|
||||
|
||||
/**
|
||||
* The most recent {@link QueryPart} that was encountered through
|
||||
* {@link Context#visit(QueryPart)}.
|
||||
@ -136,6 +141,11 @@ public interface VisitContext {
|
||||
*/
|
||||
QueryPart[] queryParts();
|
||||
|
||||
/**
|
||||
* This is the same as calling {@link #queryParts()}<code>.length</code>.
|
||||
*/
|
||||
int queryPartsLength();
|
||||
|
||||
/**
|
||||
* The underlying {@link RenderContext} or {@link BindContext} object.
|
||||
*/
|
||||
|
||||
@ -241,6 +241,11 @@ abstract class AbstractContext<C extends Context<C>> implements Context<C> {
|
||||
return visitClauses.toArray(new Clause[visitClauses.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int clausesLength() {
|
||||
return visitClauses.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QueryPart queryPart() {
|
||||
return visitParts.peekLast();
|
||||
@ -257,6 +262,11 @@ abstract class AbstractContext<C extends Context<C>> implements Context<C> {
|
||||
return visitParts.toArray(new QueryPart[visitParts.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int queryPartsLength() {
|
||||
return visitParts.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Context<?> context() {
|
||||
return AbstractContext.this;
|
||||
|
||||
@ -213,7 +213,7 @@ public class LoggerListener extends DefaultExecuteListener {
|
||||
@Override
|
||||
public void visitEnd(VisitContext context) {
|
||||
if (anyAbbreviations) {
|
||||
if (context.queryParts().length == 1) {
|
||||
if (context.queryPartsLength() == 1) {
|
||||
context.renderContext().sql(" -- Bind values may have been abbreviated for DEBUG logging. Use TRACE logging for very large bind variables.");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user