public class SqlContext extends Object implements Cloneable
AppendableExt.setContext(java.lang.Object)
and AppendableExt.getContext()
methods.
This class enables the various SqlObject SQL generation methods to behave
differently depending on where they are being used in a query.
Note, users of the sqlbuilder classes may extend this context to pass
through more information as any copying of SqlContexts is done via cloning.
The custom context may be introduced to the current SQL generation context
via the SqlObject.toString(int,SqlContext)
method call.Constructor and Description |
---|
SqlContext() |
Modifier and Type | Method and Description |
---|---|
SqlContext |
clone() |
static SqlContext |
getContext(AppendableExt app)
Gets the current SqlContext from the given AppendableExt, creating one if
necessary.
|
SqlContext |
getParent()
Gets the SqlContext which was in effect before this SqlContext was
"pushed" onto the context stack.
|
Query<?> |
getQuery()
Gets the handle to the immediate wrapping query
|
boolean |
getUseTableAliases() |
boolean |
getUseTableConstraints() |
static void |
popContext(AppendableExt app,
SqlContext context)
Replaces the current SqlContext (checking it against the given
SqlContext) with the parent SqlContext (stored within the new one).
|
static SqlContext |
pushContext(AppendableExt app)
Creates a new SqlContext (cloning current one if available), replaces the
current SqlContext with the new SqlContext, and returns the new
SqlContext.
|
void |
setQuery(Query<?> newQuery)
Sets the handle to the immediate wrapping query
|
void |
setUseTableAliases(boolean newUseTableAliases)
Sets flag indicating whether or not table aliases should be used in the
current SQL generation context.
|
void |
setUseTableConstraints(boolean newUseTableConstraints)
Sets flag indicating whether or not table constraints should be used in
the current SQL generation context.
|
public SqlContext getParent()
public boolean getUseTableAliases()
public void setUseTableAliases(boolean newUseTableAliases)
public boolean getUseTableConstraints()
public void setUseTableConstraints(boolean newUseTableConstraints)
public Query<?> getQuery()
public void setQuery(Query<?> newQuery)
public SqlContext clone()
public static SqlContext getContext(AppendableExt app)
public static final SqlContext pushContext(AppendableExt app)
pushContext
calls should have a
corresponding popContext(com.healthmarketscience.common.util.AppendableExt, com.healthmarketscience.sqlbuilder.SqlContext)
call.public static void popContext(AppendableExt app, SqlContext context)
popContext
calls should come after a corresponding
pushContext(com.healthmarketscience.common.util.AppendableExt)
call.Copyright © 2006–2021 OpenHMS. All rights reserved.