本文整理了Java中org.apache.metamodel.query.Query.clone
方法的一些代码示例,展示了Query.clone
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.clone
方法的具体详情如下:
包路径:org.apache.metamodel.query.Query
类名称:Query
方法名:clone
暂无
代码示例来源:origin: apache/metamodel
@Override
public Query toQuery() {
return _query.clone();
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public Query toQuery() {
return _query.clone();
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
/**
* Clones the query while replacing query parameters with corresponding
* values.
*
* @param values
* @return
*/
public Query cloneWithParameterValues(Object[] values) {
final AtomicInteger parameterIndex = new AtomicInteger(0);
final Query clonedQuery = _query.clone();
replaceParametersInQuery(values, parameterIndex, _query, clonedQuery);
return clonedQuery;
}
代码示例来源:origin: apache/metamodel
/**
* Clones the query while replacing query parameters with corresponding
* values.
*
* @param values
* @return
*/
public Query cloneWithParameterValues(Object[] values) {
final AtomicInteger parameterIndex = new AtomicInteger(0);
final Query clonedQuery = _query.clone();
replaceParametersInQuery(values, parameterIndex, _query, clonedQuery);
return clonedQuery;
}
代码示例来源:origin: datacleaner/DataCleaner
@Override
public Query getOptimizedQuery() {
Query query = _baseQuery;
final Set<Entry<FilterConsumer, FilterOutcome>> entries = _optimizedFilters.entrySet();
if (!entries.isEmpty()) {
// create a copy/clone of the original query
query = query.clone();
for (final Entry<FilterConsumer, FilterOutcome> entry : entries) {
final FilterConsumer consumer = entry.getKey();
final FilterOutcome outcome = entry.getValue();
final Filter<?> filter = consumer.getComponent();
@SuppressWarnings("rawtypes") final QueryOptimizedFilter queryOptimizedFilter =
(QueryOptimizedFilter) filter;
@SuppressWarnings("unchecked") final Query newQuery =
queryOptimizedFilter.optimizeQuery(query, outcome.getCategory());
query = newQuery;
}
}
return query;
}
代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core
/**
* Gets the optimized query.
*
* @return
*/
public Query getOptimizedQuery() {
// if (isOptimizable()) {
// return _baseQuery;
// }
// create a copy/clone of the original query
Query q = _baseQuery.clone();
Set<Entry<FilterConsumer, FilterOutcome>> entries = _optimizedFilters.entrySet();
for (Entry<FilterConsumer, FilterOutcome> entry : entries) {
FilterConsumer consumer = entry.getKey();
FilterOutcome outcome = entry.getValue();
Filter<?> filter = consumer.getComponent();
@SuppressWarnings("rawtypes")
QueryOptimizedFilter queryOptimizedFilter = (QueryOptimizedFilter) filter;
@SuppressWarnings("unchecked")
Query newQuery = queryOptimizedFilter.optimizeQuery(q, outcome.getCategory());
q = newQuery;
}
return q;
}
代码示例来源:origin: apache/metamodel
@Override
protected FromItem clone() {
FromItem f = new FromItem();
f._alias = _alias;
f._join = _join;
f._table = _table;
f._expression = _expression;
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: org.apache.metamodel/MetaModel-core
@Override
protected FromItem clone() {
FromItem f = new FromItem();
f._alias = _alias;
f._join = _join;
f._table = _table;
f._expression = _expression;
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: org.apache.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: apache/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: org.apache.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: apache/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: org.eobjects.analyzerbeans/AnalyzerBeans-core
final Query countQuery = originalQuery.clone();
countQuery.setMaxRows(null);
countQuery.setFirstRow(null);
代码示例来源:origin: datacleaner/DataCleaner
final Query countQuery = originalQuery.clone();
countQuery.setMaxRows(null);
countQuery.setFirstRow(null);
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
@Override
protected Query beforeRewrite(Query query) {
query = query.clone();
JdbcDataContext dataContext = getDataContext();
if (dataContext != null) {
String identifierQuoteString = dataContext.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: apache/metamodel
@Override
protected Query beforeRewrite(Query query) {
query = query.clone();
JdbcDataContext dataContext = getDataContext();
if (dataContext != null) {
String identifierQuoteString = dataContext.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: org.apache.metamodel/MetaModel-jdbc
final Query innerQuery = query.clone();
innerQuery.setFirstRow(null);
innerQuery.setMaxRows(null);
代码示例来源:origin: apache/metamodel
final Query innerQuery = query.clone();
innerQuery.setFirstRow(null);
innerQuery.setMaxRows(null);
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
q = _query.clone();
long lowLimit = min + (i * splitInterval);
long highLimit = lowLimit + splitInterval;
代码示例来源:origin: apache/metamodel
q = _query.clone();
long lowLimit = min + (i * splitInterval);
long highLimit = lowLimit + splitInterval;
内容来源于网络,如有侵权,请联系作者删除!