本文整理汇总了Java中com.taobao.tddl.optimizer.core.expression.ISelectable.setColumnName方法的典型用法代码示例。如果您正苦于以下问题:Java ISelectable.setColumnName方法的具体用法?Java ISelectable.setColumnName怎么用?Java ISelectable.setColumnName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.optimizer.core.expression.ISelectable
的用法示例。
在下文中一共展示了ISelectable.setColumnName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColumnsSelectedForParent
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
/**
* 列的tablename会设为表别名
*
* @return
*/
public List<ISelectable> getColumnsSelectedForParent() {
List<ISelectable> res = new ArrayList<ISelectable>(this.getColumnsSelected().size());
for (ISelectable s : this.getColumnsSelected()) {
ISelectable a = s.copy();
if (this.getAlias() != null) {
a.setTableName(this.getAlias());
}
if (s.getAlias() != null) {
a.setColumnName(s.getAlias()); // 设置为alias name
a.setAlias(null);
}
res.add(a);
}
return res;
}
示例2: getColumnsReferedForParent
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
/**
* 列的tablename会设为表别名
*
* @return
*/
public List<ISelectable> getColumnsReferedForParent() {
if (this.getAlias() == null) {
return this.getColumnsRefered();
} else {
List<ISelectable> res = new ArrayList<ISelectable>(this.getColumnsRefered().size());
for (ISelectable s : this.getColumnsRefered()) {
ISelectable a = s.copy();
if (this.getAlias() != null) {
a.setTableName(this.getAlias());
}
if (s.getAlias() != null) {
a.setColumnName(s.getAlias()); // 设置为alias name
a.setAlias(null);
}
res.add(a);
}
return res;
}
}
示例3: buildOrderBy
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
@Override
public void buildOrderBy() {
// 如果merge本身没指定order by,则继承子节点的order by
if (this.getNode().getOrderBys() == null || this.getNode().getOrderBys().isEmpty()) {
QueryTreeNode child = (QueryTreeNode) this.getNode().getChild();
if (child.getOrderBys() != null) {
for (IOrderBy o : child.getOrderBys()) {
ISelectable sc = o.getColumn().copy();
if (o.getColumn().getAlias() != null) {
sc.setColumnName(o.getColumn().getAlias());
}
if (child.getAlias() != null) {
sc.setTableName(child.getAlias());
}
this.getNode().orderBy(sc, o.getDirection());
}
}
}
super.buildOrderBy();
// 检查group列是否在select列中
for (IOrderBy order : node.getOrderBys()) {
checkOrderColumnExist(order, (QueryTreeNode) node.getChild());
}
}
示例4: buildOrderBy
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
@Override
public void buildOrderBy() {
// 如果merge本身没指定order by,则继承子节点的order by
if (this.getNode().getOrderBys() == null || this.getNode().getOrderBys().isEmpty()) {
QueryTreeNode child = (QueryTreeNode) this.getNode().getChild();
if (child.getOrderBys() != null) {
for (IOrderBy o : child.getOrderBys()) {
ISelectable sc = o.getColumn().copy();
if (o.getColumn().getAlias() != null) {
sc.setColumnName(o.getColumn().getAlias());
}
if (child.getAlias() != null) {
sc.setTableName(child.getAlias());
}
this.getNode().orderBy(sc, o.getDirection());
}
}
}
super.buildOrderBy();
}