|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.rolap.SqlContextConstraint
public class SqlContextConstraint
limits the result of a Member SQL query to the current evaluation context. All Members of the current context are joined against the fact table and only those rows are returned, that have an entry in the fact table.
For example, if you have two dimensions, "invoice" and "time", and the current context (e.g. the slicer) contains a day from the "time" dimension, then only the invoices of that day are found. Used to optimize NON EMPTY.
The TupleConstraint
methods may silently ignore calculated
members (depends on the strict
c'tor argument), so these may
return more members than the current context restricts to. The
MemberChildren methods will never accept calculated members as parents,
these will cause an exception.
Field Summary | |
---|---|
(package private) List<Object> |
cacheKey
|
Constructor Summary | |
---|---|
SqlContextConstraint(RolapEvaluator evaluator,
boolean strict)
Creates a SqlContextConstraint. |
Method Summary | |
---|---|
void |
addConstraint(SqlQuery sqlQuery,
RolapCube baseCube)
Called from LevelMembers: restricts the SQL resultset to the current context. |
void |
addLevelConstraint(SqlQuery sqlQuery,
RolapCube baseCube,
AggStar aggStar,
RolapLevel level)
Will be called once for the level that contains the children of a Member.Children query. |
void |
addMemberConstraint(SqlQuery sqlQuery,
RolapCube baseCube,
AggStar aggStar,
List<RolapMember> parents)
Adds parents to the current
context and restricts the SQL resultset to that new context. |
void |
addMemberConstraint(SqlQuery sqlQuery,
RolapCube baseCube,
AggStar aggStar,
RolapMember parent)
Called from MemberChildren: adds parent to the current
context and restricts the SQL resultset to that new context. |
Object |
getCacheKey()
Returns a key that becomes part of the key for caching the result of the SQL query. |
Evaluator |
getEvaluator()
|
MemberChildrenConstraint |
getMemberChildrenConstraint(RolapMember parent)
When the members of a level are fetched, the result is grouped by into parents and their children. |
protected boolean |
isJoinRequired()
Returns whether a join with the fact table is required. |
static boolean |
isValidContext(Evaluator context)
|
static boolean |
isValidContext(Evaluator context,
boolean disallowVirtualCube,
Level[] levels)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
List<Object> cacheKey
Constructor Detail |
---|
SqlContextConstraint(RolapEvaluator evaluator, boolean strict)
evaluator
- Evaluatorstrict
- defines the behaviour if the evaluator context
contains calculated members. If true, an exception is thrown,
otherwise calculated members are silently ignored. The
methods MemberChildrenConstraint.addMemberConstraint(mondrian.rolap.sql.SqlQuery, mondrian.rolap.RolapCube, mondrian.rolap.aggmatcher.AggStar, RolapMember)
and
MemberChildrenConstraint.addMemberConstraint(mondrian.rolap.sql.SqlQuery, mondrian.rolap.RolapCube, mondrian.rolap.aggmatcher.AggStar, java.util.List)
will
never accept a calculated member as parent.Method Detail |
---|
public static boolean isValidContext(Evaluator context)
public static boolean isValidContext(Evaluator context, boolean disallowVirtualCube, Level[] levels)
context
- evaluation contextdisallowVirtualCube
- if true, check for virtual cubeslevels
- levels being referenced in the current context
public void addMemberConstraint(SqlQuery sqlQuery, RolapCube baseCube, AggStar aggStar, RolapMember parent)
parent
to the current
context and restricts the SQL resultset to that new context.
addMemberConstraint
in interface MemberChildrenConstraint
sqlQuery
- the query to modifybaseCube
- base cube for virtual membersaggStar
- Aggregate star, if we are reading from an aggregate table,parent
- the parent member that restricts the returned childrenpublic void addMemberConstraint(SqlQuery sqlQuery, RolapCube baseCube, AggStar aggStar, List<RolapMember> parents)
parents
to the current
context and restricts the SQL resultset to that new context.
addMemberConstraint
in interface MemberChildrenConstraint
sqlQuery
- the query to modifybaseCube
- base cube for virtual membersaggStar
- Aggregate table, or null if query is against fact tableparents
- list of parent members that restrict the returned children.public void addConstraint(SqlQuery sqlQuery, RolapCube baseCube)
addConstraint
in interface TupleConstraint
sqlQuery
- the query to modifybaseCube
- base cube for virtual cube constraintsprotected boolean isJoinRequired()
public void addLevelConstraint(SqlQuery sqlQuery, RolapCube baseCube, AggStar aggStar, RolapLevel level)
MemberChildrenConstraint
addLevelConstraint
in interface MemberChildrenConstraint
addLevelConstraint
in interface TupleConstraint
sqlQuery
- the query to modifybaseCube
- base cube for virtual membersaggStar
- Aggregate table, or null if query is against fact tablelevel
- the level that contains the childrenpublic MemberChildrenConstraint getMemberChildrenConstraint(RolapMember parent)
TupleConstraint
The returned MemberChildrenConstraint must be one that would have returned the same children for the given parent as the MemberLevel query has found for that parent.
If null is returned, the parent/children will not be cached (but the level/members still will be).
getMemberChildrenConstraint
in interface TupleConstraint
public Object getCacheKey()
SqlConstraint
getCacheKey
in interface SqlConstraint
public Evaluator getEvaluator()
getEvaluator
in interface TupleConstraint
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |