mondrian.rolap
Class SqlTupleReader

java.lang.Object
  extended by mondrian.rolap.SqlTupleReader
All Implemented Interfaces:
TupleReader
Direct Known Subclasses:
HighCardSqlTupleReader

public class SqlTupleReader
extends Object
implements TupleReader

Reads the members of a single level (level.members) or of multiple levels (crossjoin).

Allows the result to be restricted by a TupleConstraint. So the SqlTupleReader can also read Member.Descendants (which is level.members restricted to a common parent) and member.children (which is a special case of member.descendants). Other constraints, especially for the current slicer or evaluation context, are possible.

Caching

When a SqlTupleReader reads level.members, it groups the result into parent/children pairs and puts them into the cache. In order that these can be found later when the children of a parent are requested, a matching constraint must be provided for every parent.

Since:
Nov 11, 2005
Author:
av
 

Nested Class Summary
(package private) static class SqlTupleReader.WhichSelect
          Description of the position of a SELECT statement in a UNION.
 
Nested classes/interfaces inherited from interface mondrian.rolap.TupleReader
TupleReader.MemberBuilder
 
Field Summary
protected  TupleConstraint constraint
           
(package private)  int maxRows
           
(package private)  List<mondrian.rolap.SqlTupleReader.Target> targets
           
 
Constructor Summary
SqlTupleReader(TupleConstraint constraint)
           
 
Method Summary
 void addLevelMembers(RolapLevel level, TupleReader.MemberBuilder memberBuilder, List<RolapMember> srcMembers)
          Adds a hierarchy to retrieve members from.
 Object getCacheKey()
          Returns an object that uniquely identifies the Result that this TupleReader would return.
 int getEnumTargetCount()
           
(package private)  int getMaxRows()
           
protected  void prepareTuples(DataSource dataSource, List<List<RolapMember>> partialResult, List<List<RolapMember>> newPartialResult)
           
 List<RolapMember> readMembers(DataSource dataSource, List<List<RolapMember>> partialResult, List<List<RolapMember>> newPartialResult)
          Performs the read.
 List<RolapMember[]> readTuples(DataSource jdbcConnection, List<List<RolapMember>> partialResult, List<List<RolapMember>> newPartialResult)
          Performs the read.
(package private)  void setMaxRows(int maxRows)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constraint

protected final TupleConstraint constraint

targets

List<mondrian.rolap.SqlTupleReader.Target> targets

maxRows

int maxRows
Constructor Detail

SqlTupleReader

public SqlTupleReader(TupleConstraint constraint)
Method Detail

addLevelMembers

public void addLevelMembers(RolapLevel level,
                            TupleReader.MemberBuilder memberBuilder,
                            List<RolapMember> srcMembers)
Description copied from interface: TupleReader
Adds a hierarchy to retrieve members from.

Specified by:
addLevelMembers in interface TupleReader
Parameters:
level - level that the members correspond to
memberBuilder - used to build new members for this level
srcMembers - if set, array of enumerated members that make up this level

getCacheKey

public Object getCacheKey()
Description copied from interface: TupleReader
Returns an object that uniquely identifies the Result that this TupleReader would return. Clients may use this as a key for caching the result.

Specified by:
getCacheKey in interface TupleReader

getEnumTargetCount

public int getEnumTargetCount()
Returns:
number of targets that contain enumerated sets with calculated members

prepareTuples

protected void prepareTuples(DataSource dataSource,
                             List<List<RolapMember>> partialResult,
                             List<List<RolapMember>> newPartialResult)

readMembers

public List<RolapMember> readMembers(DataSource dataSource,
                                     List<List<RolapMember>> partialResult,
                                     List<List<RolapMember>> newPartialResult)
Description copied from interface: TupleReader
Performs the read.

Specified by:
readMembers in interface TupleReader
Parameters:
dataSource - source for reading tuples
partialResult - partially cached result that should be used instead of executing sql query
newPartialResult - if non-null, return the result of the read; note that this is a subset of the full return list
Returns:
a list of RolapMember

readTuples

public List<RolapMember[]> readTuples(DataSource jdbcConnection,
                                      List<List<RolapMember>> partialResult,
                                      List<List<RolapMember>> newPartialResult)
Description copied from interface: TupleReader
Performs the read.

Specified by:
readTuples in interface TupleReader
Returns:
a list of RolapMember[]

getMaxRows

int getMaxRows()

setMaxRows

void setMaxRows(int maxRows)

SourceForge.net_Logo