dk.eobjects.metamodel.query.Query.from()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中dk.eobjects.metamodel.query.Query.from方法的一些代码示例,展示了Query.from的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.from方法的具体详情如下:
包路径:dk.eobjects.metamodel.query.Query
类名称:Query
方法名:from

Query.from介绍

暂无

代码示例

代码示例来源:origin: dk.eobjects.metamodel/MetaModel-querypostprocessor

@Override
public DataSet materializeMainSchemaTable(Table table,
    Column[] columns, int maxRows) {
  DataContext dc = getDataContext(table);
  Query q = new Query().select(columns).from(table);
  if (maxRows >= 0) {
    q.setMaxRows(maxRows);
  }
  return dc.executeQuery(q);
}

代码示例来源:origin: dk.eobjects.datacleaner/DataCleaner-core

/**
 * Convenience method to create a base query for matrix values based on the
 * configured columns (where the other columns are of interest).
 */
protected Query getBaseQuery() {
  if (_columns.length > 0) {
    Table table = _columns[0].getTable();
    Query q = new Query().select(table.getColumns()).from(table);
    return q;
  }
  return null;
}

代码示例来源:origin: dk.eobjects.datacleaner/DataCleaner-core

Query q = new Query().select(selectItem).selectCount().from(
    _column.getTable()).where(
    new FilterItem(items.toArray(new FilterItem[items.size()])))

代码示例来源:origin: dk.eobjects.datacleaner/DataCleaner-core

/**
 * Convenience method to create a base query for matrix values based on a
 * specific column (where only the columns content is of interest).
 */
protected Query getBaseQuery(Column column) {
  return new Query().from(column.getTable()).select(
      new SelectItem(column)).selectCount().groupBy(column);
}

代码示例来源:origin: dk.eobjects.commons/MetaModel

private List<Query> splitQueryBasedOnSubQueries(int fromItemIndex) {
  Query subQuery = _query.getFromClause().getItem(fromItemIndex)
      .getSubQuery();
  QuerySplitter subQuerySplitter = new QuerySplitter(_dataContext,
      subQuery);
  subQuerySplitter.setMaxRows(_maxRows);
  List<Query> splitQueries = subQuerySplitter.splitQuery();
  List<Query> result = new ArrayList<Query>(splitQueries.size());
  for (Query splitQuery : splitQueries) {
    Query newQuery = _query.clone();
    FromClause fromClause = newQuery.getFromClause();
    String alias = fromClause.getItem(fromItemIndex).getAlias();
    fromClause.removeItem(fromItemIndex);
    newQuery.from(new FromItem(splitQuery).setAlias(alias));
    result.add(newQuery);
  }
  return result;
}

代码示例来源:origin: dk.eobjects.metamodel/MetaModel-jdbc

private List<Query> splitQueryBasedOnSubQueries(int fromItemIndex) {
  Query subQuery = _query.getFromClause().getItem(fromItemIndex)
      .getSubQuery();
  QuerySplitter subQuerySplitter = new QuerySplitter(_dataContext,
      subQuery);
  subQuerySplitter.setMaxRows(_maxRows);
  List<Query> splitQueries = subQuerySplitter.splitQuery();
  List<Query> result = new ArrayList<Query>(splitQueries.size());
  for (Query splitQuery : splitQueries) {
    Query newQuery = _query.clone();
    FromClause fromClause = newQuery.getFromClause();
    String alias = fromClause.getItem(fromItemIndex).getAlias();
    fromClause.removeItem(fromItemIndex);
    newQuery.from(new FromItem(splitQuery).setAlias(alias));
    result.add(newQuery);
  }
  return result;
}

代码示例来源:origin: dk.eobjects.datacleaner/DataCleaner-core

@Override
protected List<IMatrix> getResultMatrices() {
  ArrayList<IMatrix> result = new ArrayList<IMatrix>();
  for (int i = 0; i < _columns.length; i++) {
    Column column = _columns[i];
    Map<String, Long> valueMap = _repeatedValues.get(column);
    MatrixBuilder mb = new MatrixBuilder();
    mb.addColumn(column.getName() + " count");
    mb.addColumn(column.getName() + " %");
    for (Entry<String, Long> entry : valueMap.entrySet()) {
      Long repeatCount = entry.getValue();
      String value = entry.getKey();
      int repeatPercentage = (int) (repeatCount * 100 / _totalCount);
      if (repeatPercentage >= _significanceRate) {
        MatrixValue[] matrixValues = mb.addRow(value, repeatCount,
            repeatPercentage + "%");
        matrixValues[0].setDetailSource(new Query().from(
            column.getTable()).select(_columns).where(
            new FilterItem(new SelectItem(column),
                OperatorType.EQUALS_TO, value)));
      }
    }
    if (!mb.isEmpty()) {
      mb.sortColumn(0, MatrixBuilder.DESCENDING);
      result.add(mb.getMatrix());
    }
  }
  return result;
}

代码示例来源:origin: dk.eobjects.datacleaner/DataCleaner-core

q.from(new FromItem(table).setAlias("t"));
q.select(columnsToQuery);
SelectItem countAllItem = SelectItem.getCountAllItem();

代码示例来源:origin: dk.eobjects.commons/MetaModel

q.select(primaryColumns.toArray(new Column[primaryColumns.size()]));
q.select(foreignColumns.toArray(new Column[foreignColumns.size()]));
q.from(new FromItem(JoinType.LEFT, relationship));
if (_log.isDebugEnabled()) {
  _log.debug("Setting table data for '" + primaryTable.getName()

代码示例来源:origin: dk.eobjects.metamodel/MetaModel-xml

q.select(primaryColumns.toArray(new Column[primaryColumns.size()]));
q.select(foreignColumns.toArray(new Column[foreignColumns.size()]));
q.from(new FromItem(JoinType.LEFT, relationship));
if (_log.isDebugEnabled()) {
  _log.debug("Setting table data for '" + primaryTableName

代码示例来源:origin: dk.eobjects.commons/MetaModel

private long getRowCount(Query q) {
  q = q.clone();
  SelectItem countAllItem = SelectItem.getCountAllItem();
  if (q.getGroupByClause().getItemCount() > 0) {
    q = new Query().from(new FromItem(q).setAlias("sq")).select(
        countAllItem);
  } else {
    q.getSelectClause().removeItems();
    q.select(countAllItem);
  }
  Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
  Number count = (Number) row.getValue(countAllItem);
  return count.longValue();
}

代码示例来源:origin: dk.eobjects.metamodel/MetaModel-jdbc

private long getRowCount(Query q) {
  q = q.clone();
  SelectItem countAllItem = SelectItem.getCountAllItem();
  if (q.getGroupByClause().getItemCount() > 0) {
    q = new Query().from(new FromItem(q).setAlias("sq")).select(
        countAllItem);
  } else {
    q.getSelectClause().removeItems();
    q.select(countAllItem);
  }
  Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
  Number count = (Number) row.getValue(countAllItem);
  return count.longValue();
}

代码示例来源:origin: dk.eobjects.metamodel/MetaModel-querypostprocessor

ColumnType.VARCHAR);
DataSet dataSet = executeQuery(new Query().select(columnsToQuery)
    .from(table));

代码示例来源:origin: dk.eobjects.commons/MetaModel

SelectItem countAllItem = SelectItem.getCountAllItem();
Query q = new Query().select(foreignColumns).select(
    countAllItem).from(table).groupBy(foreignColumns);
DataSet data = executeQuery(q);
Comparable<Object> comparable = NumberComparator

代码示例来源:origin: dk.eobjects.metamodel/MetaModel-xml

countAllItem).from(table).groupBy(
    foreignColumns);
DataSet data = executeQuery(q);

代码示例来源:origin: dk.eobjects.datacleaner/DataCleaner-core

values[1].setDetailSource(new Query().from(column.getTable())
    .select(_columns).where(
        new FilterItem(new SelectItem(column),
  values[2].setDetailSource(new Query().from(
      column.getTable()).select(_columns).where(
      new FilterItem(new SelectItem(column),

代码示例来源:origin: dk.eobjects.commons/MetaModel

private List<Query> splitQueryBasedOnColumn(Column column) {
  SelectItem maxItem = new SelectItem(FunctionType.MAX, column);
  SelectItem minItem = new SelectItem(FunctionType.MIN, column);
  Query q = new Query().from(column.getTable()).select(maxItem, minItem);
  Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
  long max = ceil((Number) row.getValue(maxItem));

代码示例来源:origin: dk.eobjects.metamodel/MetaModel-jdbc

private List<Query> splitQueryBasedOnColumn(Column column) {
  SelectItem maxItem = new SelectItem(FunctionType.MAX, column);
  SelectItem minItem = new SelectItem(FunctionType.MIN, column);
  Query q = new Query().from(column.getTable()).select(maxItem, minItem);
  Row row = MetaModelHelper.executeSingleRowQuery(_dataContext, q);
  long max = ceil((Number) row.getValue(maxItem));

代码示例来源:origin: dk.eobjects.commons/MetaModel

@Override
  public Query clone() {
    Query q = new Query();
    q.setMaxRows(_maxRows);
    q.getSelectClause().setDistinct(_selectClause.isDistinct());
    for (FromItem item : _fromClause.getItems()) {
      q.from(item.clone());
    }
    for (SelectItem item : _selectClause.getItems()) {
      q.select(item.clone());
    }
    for (FilterItem item : _whereClause.getItems()) {
      q.where(item.clone());
    }
    for (GroupByItem item : _groupByClause.getItems()) {
      q.groupBy(item.clone());
    }
    for (FilterItem item : _havingClause.getItems()) {
      q.having(item.clone());
    }
    for (OrderByItem item : _orderByClause.getItems()) {
      q.orderBy(item.clone());
    }
    return q;
  }
}

相关文章