public class RolapUtil extends Object
mondrian.rolap
package.Modifier and Type | Class and Description |
---|---|
(package private) static interface |
RolapUtil.ExecuteQueryHook |
(package private) static class |
RolapUtil.Semaphore
A
Semaphore is a primitive for process synchronization. |
static class |
RolapUtil.TeeWriter
Writes to a string and also to an underlying writer.
|
Modifier and Type | Field and Description |
---|---|
(package private) static org.apache.log4j.Logger |
LOGGER |
static org.apache.log4j.Logger |
MDX_LOGGER |
static org.apache.log4j.Logger |
MONITOR_LOGGER |
static org.apache.log4j.Logger |
PROFILE_LOGGER |
static Comparator |
ROLAP_COMPARATOR
A comparator singleton instance which can handle the presence of
RolapUtilComparable instances in a collection. |
static org.apache.log4j.Logger |
SQL_LOGGER |
static String |
sqlNullLiteral |
static Comparable<?> |
sqlNullValue
Special value represents a null key.
|
static Object |
valueNotReadyException
Special cell value indicates that the value is not in cache yet.
|
Constructor and Description |
---|
RolapUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
alertNonNative(String functionName,
String reason)
Raises an alert that native SQL evaluation could not be used
in a case where it might have been beneficial, but some
limitation in Mondrian's implementation prevented it.
|
static void |
constraintBitkeyForLimitedMembers(Evaluator evaluator,
Member[] members,
RolapCube cube,
BitKey levelBitKey)
Modifies a bitkey so that it includes the proper bits
for members in an array which should be considered
as a limited rollup member.
|
static MondrianDef.Relation |
convertInlineTableToRelation(MondrianDef.InlineTable inlineTable,
Dialect dialect) |
static ExpCompiler |
createDependencyTestingCompiler(ExpCompiler compiler)
Creates a compiler which will generate programs which will test
whether the dependencies declared via
Calc.dependsOn(Hierarchy) are accurate. |
static Evaluator |
createEvaluator(Statement statement)
Creates a dummy evaluator.
|
static ExpCompiler |
createProfilingCompiler(ExpCompiler compiler) |
static SqlStatement |
executeQuery(DataSource dataSource,
String sql,
List<SqlStatement.Type> types,
int maxRowCount,
int firstRowOrdinal,
Locus locus,
int resultSetType,
int resultSetConcurrency,
Util.Functor1<Void,Statement> callback)
Executes a query.
|
static SqlStatement |
executeQuery(DataSource dataSource,
String sql,
Locus locus)
Executes a query, printing to the trace log if tracing is enabled.
|
static Member |
findBestMemberMatch(List<? extends Member> members,
RolapMember parent,
RolapLevel level,
Id.Segment searchName,
MatchType matchType)
Locates a member specified by its member name, from an array of
members.
|
static RolapUtil.ExecuteQueryHook |
getHook()
Sets the query-execution hook used by tests.
|
(package private) static RolapUtil.Semaphore |
getQuerySemaphore()
Gets the semaphore which controls how many people can run queries
simultaneously.
|
static void |
loadDrivers(String jdbcDrivers)
Loads a set of JDBC drivers.
|
static SchemaReader |
locusSchemaReader(RolapConnection connection,
SchemaReader schemaReader)
Wraps a schema reader in a proxy so that each call to schema reader
has a locus for profiling purposes.
|
(package private) static RolapMember |
lookupMember(MemberReader reader,
List<Id.Segment> uniqueNameParts,
boolean failIfNotFound) |
static String |
mdxNullLiteral() |
static void |
reloadNullLiteral() |
static void |
setHook(RolapUtil.ExecuteQueryHook hook) |
static RolapMember |
strip(RolapMember member) |
(package private) static RolapMember[] |
toArray(List<RolapMember> v) |
public static final org.apache.log4j.Logger MDX_LOGGER
public static final org.apache.log4j.Logger SQL_LOGGER
public static final org.apache.log4j.Logger MONITOR_LOGGER
public static final org.apache.log4j.Logger PROFILE_LOGGER
static final org.apache.log4j.Logger LOGGER
public static final Object valueNotReadyException
public static final Comparable<?> sqlNullValue
public static final Comparator ROLAP_COMPARATOR
RolapUtilComparable
instances in a collection.public static final String sqlNullLiteral
public static SchemaReader locusSchemaReader(RolapConnection connection, SchemaReader schemaReader)
connection
- ConnectionschemaReader
- Schema readerpublic static RolapUtil.ExecuteQueryHook getHook()
setHook(mondrian.rolap.RolapUtil.ExecuteQueryHook)
are
synchronized to ensure a memory barrier.public static void setHook(RolapUtil.ExecuteQueryHook hook)
public static String mdxNullLiteral()
public static void reloadNullLiteral()
static RolapMember[] toArray(List<RolapMember> v)
static RolapMember lookupMember(MemberReader reader, List<Id.Segment> uniqueNameParts, boolean failIfNotFound)
public static SqlStatement executeQuery(DataSource dataSource, String sql, Locus locus)
If the query fails, it wraps the SQLException
in a runtime
exception with message
as description, and closes the result
set.
If it succeeds, the caller must call the SqlStatement.close()
method of the returned SqlStatement
.
dataSource
- DataSourcesql
- SQL stringlocus
- Locus of executionpublic static SqlStatement executeQuery(DataSource dataSource, String sql, List<SqlStatement.Type> types, int maxRowCount, int firstRowOrdinal, Locus locus, int resultSetType, int resultSetConcurrency, Util.Functor1<Void,Statement> callback)
If the query fails, it wraps the SQLException
in a runtime
exception with message
as description, and closes the result
set.
If it succeeds, the caller must call the SqlStatement.close()
method of the returned SqlStatement
.
dataSource
- DataSourcesql
- SQL stringtypes
- Suggested types of columns, or null;
if present, must have one element for each SQL column;
each not-null entry overrides deduced JDBC type of the columnmaxRowCount
- Maximum number of rows to retrieve, <= 0 if unlimitedfirstRowOrdinal
- Ordinal of row to skip to (1-based), or 0 to
start from beginninglocus
- Execution context of this statementresultSetType
- Result set type, or -1 to use defaultresultSetConcurrency
- Result set concurrency, or -1 to use defaultpublic static void alertNonNative(String functionName, String reason) throws NativeEvaluationUnsupportedException
functionName
- name of function for which native evaluation
was skippedreason
- reason why native evaluation was skippedNativeEvaluationUnsupportedException
public static void loadDrivers(String jdbcDrivers)
jdbcDrivers
- A string consisting of the comma-separated names
of JDBC driver classes. For example
"sun.jdbc.odbc.JdbcOdbcDriver,com.mysql.jdbc.Driver"
.public static ExpCompiler createDependencyTestingCompiler(ExpCompiler compiler)
Calc.dependsOn(Hierarchy)
are accurate.public static Member findBestMemberMatch(List<? extends Member> members, RolapMember parent, RolapLevel level, Id.Segment searchName, MatchType matchType)
members
- array of members to search fromparent
- parent member corresponding to the member being searched
forlevel
- level of the membersearchName
- member namematchType
- match typepublic static MondrianDef.Relation convertInlineTableToRelation(MondrianDef.InlineTable inlineTable, Dialect dialect)
public static RolapMember strip(RolapMember member)
public static ExpCompiler createProfilingCompiler(ExpCompiler compiler)
static RolapUtil.Semaphore getQuerySemaphore()
public static Evaluator createEvaluator(Statement statement)