本文整理了Java中dk.eobjects.metamodel.query.Query.getFromClause
方法的一些代码示例,展示了Query.getFromClause
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getFromClause
方法的具体详情如下:
包路径:dk.eobjects.metamodel.query.Query
类名称:Query
方法名:getFromClause
暂无
代码示例来源:origin: dk.eobjects.commons/MetaModel
/**
* Examines a query and extracts an array of FromItem's that refer
* (directly) to tables (hence Joined FromItems and SubQuery FromItems are
* traversed but not included).
*
* @param q
* the query to examine
* @return
*/
public static FromItem[] getTableFromItems(Query q) {
List<FromItem> result = new ArrayList<FromItem>();
List<FromItem> items = q.getFromClause().getItems();
for (FromItem item : items) {
result.addAll(getTableFromItems(item));
}
return result.toArray(new FromItem[result.size()]);
}
代码示例来源:origin: dk.eobjects.metamodel/MetaModel-jdbc
private Integer getSubQueryFromItemIndex() {
List<FromItem> fromItems = _query.getFromClause().getItems();
for (int i = 0; i < fromItems.size(); i++) {
Query subQuery = fromItems.get(i).getSubQuery();
if (subQuery != null) {
if (isSplittable(subQuery)) {
return i;
}
}
}
return null;
}
代码示例来源:origin: dk.eobjects.commons/MetaModel
private Integer getSubQueryFromItemIndex() {
List<FromItem> fromItems = _query.getFromClause().getItems();
for (int i = 0; i < fromItems.size(); i++) {
Query subQuery = fromItems.get(i).getSubQuery();
if (subQuery != null) {
if (isSplittable(subQuery)) {
return i;
}
}
}
return null;
}
代码示例来源:origin: dk.eobjects.commons/MetaModel
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Query) {
Query that = (Query) obj;
EqualsBuilder eb = new EqualsBuilder();
eb.append(this.getMaxRows(), that.getMaxRows());
eb.append(this.getSelectClause(), that.getSelectClause());
eb.append(this.getFromClause(), that.getFromClause());
eb.append(this.getWhereClause(), that.getWhereClause());
eb.append(this.getGroupByClause(), that.getGroupByClause());
eb.append(this.getHavingClause(), that.getHavingClause());
eb.append(this.getOrderByClause(), that.getOrderByClause());
return eb.isEquals();
}
return false;
}
代码示例来源:origin: dk.eobjects.commons/MetaModel
public StringBuilder toStringNoAlias() {
StringBuilder sb = new StringBuilder();
if (_column != null) {
Table table = _column.getTable();
if (table != null && _query != null) {
String alias = _query.getFromClause().getAlias(table);
if (alias == null) {
alias = table.getQuotedName();
}
sb.append(alias);
sb.append(".");
}
sb.append(_column.getQuotedName());
}
if (_expression != null) {
sb.append(_expression);
}
if (_subQueryFromItem != null && _subQuerySelectItem != null) {
if (_subQueryFromItem.getAlias() != null) {
sb.append(_subQueryFromItem.getAlias() + '.');
}
sb.append(_subQuerySelectItem.getSuperQueryAlias());
}
if (_function != null) {
sb.insert(0, _function + "(");
sb.append(")");
}
return sb;
}
代码示例来源:origin: dk.eobjects.commons/MetaModel
Table table = _column.getTable();
if (table != null && _query != null) {
String alias = _query.getFromClause().getAlias(table);
if (alias == null) {
alias = table.getQuotedName();
代码示例来源:origin: dk.eobjects.metamodel/MetaModel-jdbc
public String rewriteQuery(JdbcDataContextStrategy strategy, Query query) {
query = beforeRewrite(strategy, query);
StringBuilder sb = new StringBuilder();
sb
.append(rewriteSelectClause(strategy, query, query
.getSelectClause()));
sb.append(rewriteFromClause(strategy, query, query.getFromClause()));
sb.append(rewriteWhereClause(strategy, query, query.getWhereClause()));
sb.append(rewriteGroupByClause(strategy, query, query
.getGroupByClause()));
sb
.append(rewriteHavingClause(strategy, query, query
.getHavingClause()));
sb.append(rewriteOrderByClause(strategy, query, query
.getOrderByClause()));
return sb.toString();
}
代码示例来源:origin: dk.eobjects.commons/MetaModel
public String rewriteQuery(JdbcDataContextStrategy strategy, Query query) {
query = beforeRewrite(strategy, query);
StringBuilder sb = new StringBuilder();
sb
.append(rewriteSelectClause(strategy, query, query
.getSelectClause()));
sb.append(rewriteFromClause(strategy, query, query.getFromClause()));
sb.append(rewriteWhereClause(strategy, query, query.getWhereClause()));
sb.append(rewriteGroupByClause(strategy, query, query
.getGroupByClause()));
sb
.append(rewriteHavingClause(strategy, query, query
.getHavingClause()));
sb.append(rewriteOrderByClause(strategy, query, query
.getOrderByClause()));
return sb.toString();
}
代码示例来源:origin: dk.eobjects.metamodel/MetaModel-querypostprocessor
public DataSet executeQuery(Query query) throws MetaModelException {
Set<DataContext> dataContexts = new HashSet<DataContext>();
List<FromItem> items = query.getFromClause().getItems();
for (FromItem item : items) {
List<FromItem> tableFromItems = MetaModelHelper
代码示例来源: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
public DataSet executeQuery(Query query) {
List<SelectItem> selectItems = query.getSelectClause().getItems();
List<FromItem> fromItems = query.getFromClause().getItems();
List<FilterItem> whereItems = query.getWhereClause().getItems();
List<SelectItem> whereSelectItems = query.getWhereClause()
代码示例来源:origin: dk.eobjects.metamodel/MetaModel-querypostprocessor
public DataSet executeQuery(Query query) {
List<SelectItem> selectItems = query.getSelectClause().getItems();
List<FromItem> fromItems = query.getFromClause().getItems();
List<FilterItem> whereItems = query.getWhereClause().getItems();
List<SelectItem> whereSelectItems = query.getWhereClause()
代码示例来源: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.metamodel/MetaModel-jdbc
List<FromItem> fromItems = _query.getFromClause().getItems();
for (FromItem fromItem : fromItems) {
if (fromItem.getTable() != null) {
代码示例来源: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
List<FromItem> fromItems = _query.getFromClause().getItems();
for (FromItem fromItem : fromItems) {
if (fromItem.getTable() != null) {
内容来源于网络,如有侵权,请联系作者删除!