本文整理汇总了Java中com.taobao.tddl.optimizer.core.expression.ISelectable.isSameName方法的典型用法代码示例。如果您正苦于以下问题:Java ISelectable.isSameName方法的具体用法?Java ISelectable.isSameName怎么用?Java ISelectable.isSameName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.optimizer.core.expression.ISelectable
的用法示例。
在下文中一共展示了ISelectable.isSameName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
@Override
public void build() {
super.build();
if (this.getDuplicateUpdateColumns() != null) {
for (ISelectable s : this.getDuplicateUpdateColumns()) {
ISelectable res = null;
for (Object obj : table.getColumnsReferedForParent()) {
ISelectable querySelected = (ISelectable) obj;
if (s.isSameName(querySelected)) { // 尝试查找对应的字段信息
res = querySelected;
break;
}
}
if (res == null) {
throw new IllegalArgumentException("column: " + s.getColumnName() + " is not existed in "
+ table.getName());
}
s.setTableName(res.getTableName());
s.setDataType(res.getDataType());
s.setAutoIncrement(res.isAutoIncrement());
}
convertTypeToSatifyColumnMeta(this.getDuplicateUpdateColumns(), this.getDuplicateUpdateValues());
}
}
示例2: findColumnFromOtherNode
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
/**
* 从select列表中查找字段
*/
protected ISelectable findColumnFromOtherNode(ISelectable c, QueryTreeNode other) {
if (c == null) {
return c;
}
if (c instanceof IBooleanFilter && ((IBooleanFilter) c).getOperation().equals(OPERATION.CONSTANT)) {
return c;
}
ISelectable res = null;
for (ISelectable selected : other.getColumnsSelected()) {
boolean isThis = false;
if (c.getTableName() != null) {
boolean isSameName = c.getTableName().equals(other.getAlias())
|| c.getTableName().equals(selected.getTableName());
if (other.isSubQuery() && other.getSubAlias() != null) {
isSameName |= c.getTableName().equals(other.getSubAlias());
}
if (!isSameName) {
continue;
}
}
if (IColumn.STAR.equals(c.getColumnName())) {
return c;
}
// 若列别名存在,只比较别名
isThis = c.isSameName(selected);
if (isThis) {
if (res != null) {
// 说明出现两个ID,需要明确指定TABLE
throw new IllegalArgumentException("Column: '" + c.getFullName() + "' is ambiguous by exist ["
+ selected.getFullName() + "," + res.getFullName() + "]");
}
res = selected;
}
}
return res;
}
示例3: build
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
@Override
public void build() {
if (this.table != null) {
table.build();
}
if ((this.getColumns() == null || this.getColumns().isEmpty())
&& (this.getValues() == null || this.getValues().isEmpty())) {
return;
}
if (columns == null || columns.isEmpty()) { // 如果字段为空,默认为所有的字段数据的,比如insert所有字段
columns = OptimizerUtils.columnMetaListToIColumnList(this.getTableMeta().getAllColumns(),
this.getTableMeta().getTableName());
}
if (columns.size() != values.size()) {
if (!columns.isEmpty()) {
throw new IllegalArgumentException("The size of the columns and values is not matched."
+ " columns' size is " + columns.size() + ". values' size is "
+ values.size());
}
}
for (ISelectable s : this.getColumns()) {
ISelectable res = null;
for (Object obj : table.getColumnsReferedForParent()) {
ISelectable querySelected = (ISelectable) obj;
if (s.isSameName(querySelected)) { // 尝试查找对应的字段信息
res = querySelected;
break;
}
}
if (res == null) {
throw new IllegalArgumentException("column: " + s.getColumnName() + " is not existed in either "
+ table.getName() + " or select clause");
}
}
convertTypeToSatifyColumnMeta(this.getColumns(), this.getValues());
}
示例4: findColumnFromOtherNode
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
/**
* 从select列表中查找字段
*/
public ISelectable findColumnFromOtherNode(ISelectable c, QueryTreeNode other) {
if (c == null) {
return c;
}
if (c instanceof IBooleanFilter && ((IBooleanFilter) c).getOperation().equals(OPERATION.CONSTANT)) {
return c;
}
ISelectable res = null;
for (ISelectable selected : other.getColumnsSelected()) {
boolean isThis = false;
if (c.getTableName() != null) {
boolean isSameName = c.getTableName().equals(other.getAlias())
|| c.getTableName().equals(selected.getTableName());
if (other.isSubQuery() && other.getSubAlias() != null) {
isSameName |= c.getTableName().equals(other.getSubAlias());
}
if (!isSameName) {
continue;
}
}
if (IColumn.STAR.equals(c.getColumnName())) {
return c;
}
// 若列别名存在,只比较别名
isThis = c.isSameName(selected);
if (isThis) {
if (res != null) {
// 说明出现两个ID,需要明确指定TABLE
throw new IllegalArgumentException("Column: '" + c.getFullName() + "' is ambiguous by exist ["
+ selected.getFullName() + "," + res.getFullName() + "]");
}
res = selected;
}
}
return res;
}