本文整理汇总了Java中mondrian.olap.Query类的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Query类属于mondrian.olap包,在下文中一共展示了Query类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDatasource
import mondrian.olap.Query; //导入依赖的package包/类
@Override
public JRDataSource createDatasource() throws JRException
{
JRDataSource dataSource = null;
String queryStr = getQueryString();
if (connection != null && queryStr != null)
{
if (log.isDebugEnabled())
{
log.debug("MDX query: " + queryStr);
}
Query query = connection.parseQuery(queryStr);
result = connection.execute(query);
logResult();
dataSource = new JRMondrianDataSource(dataset, result);
}
return dataSource;
}
示例2: MondrianOlap4jCellSetMetaData
import mondrian.olap.Query; //导入依赖的package包/类
MondrianOlap4jCellSetMetaData(
MondrianOlap4jStatement olap4jStatement,
Query query)
{
this.olap4jStatement = olap4jStatement;
this.query = query;
for (final QueryAxis queryAxis : query.getAxes()) {
axesMetaData.add(
new MondrianOlap4jCellSetAxisMetaData(
this, queryAxis));
}
filterAxisMetaData =
new MondrianOlap4jCellSetAxisMetaData(
this, query.getSlicerAxis());
}
示例3: JRMondrianResult
import mondrian.olap.Query; //导入依赖的package包/类
public JRMondrianResult(Result result)
{
this.result = result;
JRMondrianFactory factory = new JRMondrianFactory();
Query query = result.getQuery();
Axis[] resultAxes = result.getAxes();
axes = new JRMondrianAxis[resultAxes.length];
for (int i = 0; i < resultAxes.length; i++)
{
AxisOrdinal ordinal = AxisOrdinal.StandardAxisOrdinal.forLogicalOrdinal(i);
axes[i] = new JRMondrianAxis(resultAxes[i], query.getMdxHierarchiesOnAxis(ordinal), factory);
}
}
示例4: testSlicerAxisDoesNotGetNonEmptyApplied
import mondrian.olap.Query; //导入依赖的package包/类
public void testSlicerAxisDoesNotGetNonEmptyApplied() {
propSaver.set(
MondrianProperties.instance().EnableNonEmptyOnAllAxis, true);
String mdxQuery = "select from [Sales]\n"
+ "where [Time].[1997]\n";
Query query = getConnection().parseQuery(mdxQuery);
TestContext.assertEqualsVerbose(mdxQuery, query.toString());
}
示例5: executeQuery
import mondrian.olap.Query; //导入依赖的package包/类
protected Result executeQuery(String mdx, Connection connection) {
Query query = connection.parseQuery(mdx);
query.setResultStyle(ResultStyle.LIST);
return connection.execute(query);
}
示例6: parseQuery
import mondrian.olap.Query; //导入依赖的package包/类
protected void parseQuery(Query query)
{
QueryAxis[] axes = query.getAxes();
for (QueryAxis axis : axes)
{
IROlapResultAxis jrAxis = new IROlapResultAxis();
((IROlapResult)xmlaResult).addAxis(jrAxis);
Hierarchy[] hierarchies = query.getMdxHierarchiesOnAxis(axis.getAxisOrdinal());
for (Hierarchy hierarchy : hierarchies)
{
boolean addMeasures = false;
IROlapHierarchy jrHierarchy = new IROlapHierarchy(hierarchy.getName());
if (hierarchy.getName().equals("Measures"))
{
addMeasures = true;
}
jrHierarchy.setHierarchyUniqueName( hierarchy.getUniqueName() );
Level[] levels = hierarchy.getLevels();
for (Level level : levels)
{
IROlapHierarchyLevel jrLevel = new IROlapHierarchyLevel(level.getName(), level.getDepth());
jrHierarchy.addHierarchyLevel(jrLevel);
}
jrAxis.addHierarchy(jrHierarchy);
// Add axis tubles for measures...
if (addMeasures)
{
Set<Member> memberSet = query.getMeasuresMembers();
IROlapMemberTuple tuple = new IROlapMemberTuple();
Iterator iter = memberSet.iterator();
while (iter.hasNext())
{
Member m = (Member)iter.next();
JRXmlaMember member = new JRXmlaMember(m.getName(), m.getUniqueName(), m.getDimension().getName(), m.getLevel().getName(), m.getDepth());
tuple.addMember(member);
}
jrAxis.addTuple(tuple);
}
}
}
}
示例7: getQuery
import mondrian.olap.Query; //导入依赖的package包/类
/**
* @return the query
*/
public Query getQuery() {
return query;
}
示例8: setQuery
import mondrian.olap.Query; //导入依赖的package包/类
/**
* Sets the query. Automatically calls <code>{@link #setDirty}(true)</code>.
*/
public void setQuery(Query query) {
this.query = query;
setDirty();
}
示例9: getBaseCubeCollection
import mondrian.olap.Query; //导入依赖的package包/类
Collection<RolapCube> getBaseCubeCollection(final Query query) {
return query.getBaseCubes();
}
示例10: newCellSet
import mondrian.olap.Query; //导入依赖的package包/类
public MondrianOlap4jCellSet newCellSet(
MondrianOlap4jStatement olap4jStatement,
Query query)
{
return new MondrianOlap4jCellSetJdbc4(olap4jStatement, query);
}
示例11: MondrianOlap4jCellSetJdbc4
import mondrian.olap.Query; //导入依赖的package包/类
public MondrianOlap4jCellSetJdbc4(
MondrianOlap4jStatement olap4jStatement,
Query query)
{
super(olap4jStatement, query);
}
示例12: newCellSet
import mondrian.olap.Query; //导入依赖的package包/类
public MondrianOlap4jCellSet newCellSet(
MondrianOlap4jStatement olap4jStatement,
Query query)
{
return new MondrianOlap4jCellSetJdbc3(olap4jStatement, query);
}
示例13: MondrianOlap4jCellSetJdbc3
import mondrian.olap.Query; //导入依赖的package包/类
public MondrianOlap4jCellSetJdbc3(
MondrianOlap4jStatement olap4jStatement, Query query)
{
super(olap4jStatement, query);
}
示例14: executeQuery
import mondrian.olap.Query; //导入依赖的package包/类
Result executeQuery(String mdx, Connection connection) {
Query query = connection.parseQuery(mdx);
return connection.execute(query);
}
示例15: testCallingLoadColumnsInAddCollapsedColumnOrAddzSpecialCollapsedColumn
import mondrian.olap.Query; //导入依赖的package包/类
public void
testCallingLoadColumnsInAddCollapsedColumnOrAddzSpecialCollapsedColumn()
throws Exception
{
Logger logger = Logger.getLogger(AggGen.class);
StringWriter writer = new StringWriter();
Appender myAppender = new WriterAppender(new SimpleLayout(), writer);
logger.addAppender(myAppender);
logger.setLevel(Level.DEBUG);
final String trueValue = "true";
// This modifies the MondrianProperties for the whole of the
// test run
MondrianProperties props = MondrianProperties.instance();
// If run in Ant and with mondrian.jar, please comment out this line:
props.AggregateRules.setString("DefaultRules.xml");
props.UseAggregates.setString(trueValue);
props.ReadAggregates.setString(trueValue);
props.GenerateAggregateSql.setString(trueValue);
final RolapConnection rolapConn = (RolapConnection) getConnection();
Query query =
rolapConn.parseQuery(
"select {[Measures].[Count]} on columns from [HR]");
rolapConn.execute(query);
logger.removeAppender(myAppender);
final DataSource dataSource = rolapConn.getDataSource();
Connection sqlConnection = null;
try {
sqlConnection = dataSource.getConnection();
DatabaseMetaData dbmeta = sqlConnection.getMetaData();
JdbcSchema jdbcSchema = JdbcSchema.makeDB(dataSource);
final String catalogName = jdbcSchema.getCatalogName();
final String schemaName = jdbcSchema.getSchemaName();
String log = writer.toString();
Pattern p = Pattern.compile(
"DEBUG - Init: Column: [^:]+: `(\\w+)`.`(\\w+)`"
+ Util.nl
+ "WARN - Can not find column: \\2");
Matcher m = p.matcher(log);
while (m.find()) {
ResultSet rs =
dbmeta.getColumns(
catalogName, schemaName, m.group(1), m.group(2));
assertTrue(!rs.next());
}
} finally {
if (sqlConnection != null) {
try {
sqlConnection.close();
} catch (SQLException e) {
// ignore
}
}
}
}