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

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

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

Query.clone介绍

暂无

代码示例

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

@Override
protected FromItem clone() {
  FromItem f = new FromItem();
  f._alias = _alias;
  f._join = _join;
  f._table = _table;
  if (_subQuery != null) {
    f._subQuery = _subQuery.clone();
  }
  if (_leftOn != null && _leftSide != null && _rightOn != null
      && _rightSide != null) {
    f._leftSide = _leftSide.clone();
    f._leftOn = _leftOn.clone();
    f._rightSide = _rightSide.clone();
    f._rightOn = _rightOn.clone();
  }
  return f;
}

代码示例来源: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.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-jdbc

@Override
protected Query beforeRewrite(JdbcDataContextStrategy strategy, Query query) {
  query = query.clone();
  if (strategy != null) {
    String identifierQuoteString = strategy.getIdentifierQuoteString();
    if (identifierQuoteString != null) {
      List<SelectItem> selectItems = query.getSelectClause()
          .getItems();
      for (SelectItem item : selectItems) {
        String alias = item.getAlias();
        if (needsQuoting(alias, identifierQuoteString)) {
          item.setAlias(identifierQuoteString + alias
              + identifierQuoteString);
        }
      }
      List<FromItem> fromItems = query.getFromClause().getItems();
      for (FromItem item : fromItems) {
        String alias = item.getAlias();
        if (needsQuoting(alias, identifierQuoteString)) {
          item.setAlias(identifierQuoteString + alias
              + identifierQuoteString);
        }
      }
    }
  }
  return query;
}

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

@Override
protected Query beforeRewrite(JdbcDataContextStrategy strategy, Query query) {
  query = query.clone();
  if (strategy != null) {
    String identifierQuoteString = strategy.getIdentifierQuoteString();
    if (identifierQuoteString != null) {
      List<SelectItem> selectItems = query.getSelectClause()
          .getItems();
      for (SelectItem item : selectItems) {
        String alias = item.getAlias();
        if (needsQuoting(alias, identifierQuoteString)) {
          item.setAlias(identifierQuoteString + alias
              + identifierQuoteString);
        }
      }
      List<FromItem> fromItems = query.getFromClause().getItems();
      for (FromItem item : fromItems) {
        String alias = item.getAlias();
        if (needsQuoting(alias, identifierQuoteString)) {
          item.setAlias(identifierQuoteString + alias
              + identifierQuoteString);
        }
      }
    }
  }
  return query;
}

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

q = _query.clone();
long lowLimit = min + (i * splitInterval);
long highLimit = lowLimit + splitInterval;

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

q = _query.clone();
long lowLimit = min + (i * splitInterval);
long highLimit = lowLimit + splitInterval;

相关文章