本文整理了Java中net.sf.jsqlparser.expression.Alias.getName()
方法的一些代码示例,展示了Alias.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Alias.getName()
方法的具体详情如下:
包路径:net.sf.jsqlparser.expression.Alias
类名称:Alias
方法名:getName
暂无
代码示例来源:origin: baomidou/mybatis-plus
/**
* 租户字段别名设置
* <p>tableName.tenantId 或 tableAlias.tenantId</p>
*
* @param table 表对象
* @return 字段
*/
protected Column getAliasColumn(Table table) {
StringBuilder column = new StringBuilder();
if (null == table.getAlias()) {
column.append(table.getName());
} else {
column.append(table.getAlias().getName());
}
column.append(StringPool.DOT);
column.append(tenantHandler.getTenantIdColumn());
return new Column(column.toString());
}
}
代码示例来源:origin: JSQLParser/JSqlParser
/**
* Get name with out without using aliases.
*
* @param aliases
* @return
*/
public String getName(boolean aliases) {
StringBuilder fqn = new StringBuilder();
if (table != null) {
if (table.getAlias() != null && aliases) {
fqn.append(table.getAlias().getName());
} else {
fqn.append(table.getFullyQualifiedName());
}
}
if (fqn.length() > 0) {
fqn.append('.');
}
if (columnName != null) {
fqn.append(columnName);
}
return fqn.toString();
}
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Column tableColumn) {
final Table table = tableColumn.getTable();
String tableName = null;
if (table != null) {
if (table.getAlias() != null) {
tableName = table.getAlias().getName();
} else {
tableName = table.getFullyQualifiedName();
}
}
if (tableName != null && !tableName.isEmpty()) {
buffer.append(tableName).append(".");
}
buffer.append(tableColumn.getColumnName());
}
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(SelectExpressionItem selectExpressionItem) {
if (firstRun) {
if (selectExpressionItem.getAlias() != null) {
aliases.add(selectExpressionItem.getAlias().getName().toUpperCase());
}
} else {
if (selectExpressionItem.getAlias() == null) {
while (true) {
String alias = getNextAlias().toUpperCase();
if (!aliases.contains(alias)) {
aliases.add(alias);
selectExpressionItem.setAlias(new Alias(alias));
break;
}
}
}
}
}
代码示例来源:origin: pagehelper/Mybatis-PageHelper
if (selectExpressionItem.getAlias() != null) {
Column column = new Column(selectExpressionItem.getAlias().getName());
SelectExpressionItem expressionItem = new SelectExpressionItem(column);
selectItems.add(expressionItem);
代码示例来源:origin: pagehelper/Mybatis-PageHelper
aliases.add(alias.getName());
Alias alias = selectExpressionItem.getAlias();
if (alias != null) { // 查询列含有别名时用查询列别名
iterator.set(cloneOrderByElement(orderByElement, alias.getName()));
代码示例来源:origin: baomidou/mybatis-plus
Expression rightExpression = ((BinaryExpression) expression).getRightExpression();
if (joinTable != null && rightExpression instanceof Column) {
if (Objects.equals(((Column) rightExpression).getTable().getName(), table.getAlias().getName())) {
validUseIndex(table, ((Column) rightExpression).getColumnName(), connection);
validUseIndex(joinTable, ((Column) leftExpression).getColumnName(), connection);
代码示例来源:origin: Blazebit/blaze-persistence
private Table findTable(List<Table> tables, String alias) {
for (Table t : tables) {
if (alias.equals(t.getAlias().getName())) {
return t;
}
}
return null;
}
代码示例来源:origin: com.blazebit/blaze-persistence-testsuite-base-jpa
private Table findTable(List<Table> tables, String alias) {
for (Table t : tables) {
if (alias.equals(t.getAlias().getName())) {
return t;
}
}
return null;
}
代码示例来源:origin: com.intoverflow.booster/booster-core
private static void fetchTables(Map<String, Table> tables, FromItem fromItem) {
if (fromItem instanceof Table) {
Alias alias = ((Table) fromItem).getAlias();
if (alias != null) {
tables.put(alias.getName(), (Table) fromItem);
} else {
tables.put(((Table) fromItem).getName(), (Table) fromItem);
}
}
}
代码示例来源:origin: com.manydesigns/portofino-database
private static boolean hasEntityAlias(String entityName, FromItem fromItem) {
return fromItem instanceof net.sf.jsqlparser.schema.Table &&
((net.sf.jsqlparser.schema.Table) fromItem).getName().equals(entityName) &&
fromItem.getAlias() != null &&
!StringUtils.isBlank(fromItem.getAlias().getName());
}
代码示例来源:origin: ManyDesigns/Portofino
private static boolean hasEntityAlias(String entityName, FromItem fromItem) {
return fromItem instanceof net.sf.jsqlparser.schema.Table &&
((net.sf.jsqlparser.schema.Table) fromItem).getName().equals(entityName) &&
fromItem.getAlias() != null &&
!StringUtils.isBlank(fromItem.getAlias().getName());
}
代码示例来源:origin: ontop/ontop
@Override
public void visit(SubSelect subSelect) {
if (subSelect.getAlias() == null || subSelect.getAlias().getName() == null)
throw new InvalidSelectQueryRuntimeException("SUB-SELECT must have an alias", subSelect);
RAExpression current = select(subSelect.getSelectBody());
RelationID aliasId = idfac.createRelationID(null, subSelect.getAlias().getName());
result = RAExpression.alias(current, aliasId, termFactory);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(SubSelect subSelect) {
if (subSelect.getAlias() == null || subSelect.getAlias().getName() == null)
throw new InvalidSelectQueryRuntimeException("SUB-SELECT must have an alias", subSelect);
RAExpression current = select(subSelect.getSelectBody());
RelationID aliasId = idfac.createRelationID(null, subSelect.getAlias().getName());
result = RAExpression.alias(current, aliasId);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core
@Override
public void visit(SelectExpressionItem selectExpr) {
/*
* Here we found a column
*/
if (selectExpr.getAlias() != null) {
columns.add(new Column(selectExpr.getAlias().getName()));
}
else {
selectExpr.getExpression().accept(this);
}
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(SubSelect subSelect) {
if (subSelect.getAlias() == null || subSelect.getAlias().getName() == null)
throw new InvalidSelectQueryRuntimeException("SUB-SELECT must have an alias", subSelect);
relationIndex++;
SelectBody selectBody = subSelect.getSelectBody();
if (!(selectBody instanceof PlainSelect))
throw new UnsupportedSelectQueryRuntimeException("Complex SELECT statements are not supported", selectBody);
RAExpressionAttributes current = select((PlainSelect) selectBody);
RelationID aliasId = idfac.createRelationID(null, subSelect.getAlias().getName());
result = RAExpressionAttributes.alias(current, aliasId);
}
代码示例来源:origin: ontop/ontop
@Override
public void visit(SubSelect subSelect) {
if (subSelect.getAlias() == null || subSelect.getAlias().getName() == null)
throw new InvalidSelectQueryRuntimeException("SUB-SELECT must have an alias", subSelect);
relationIndex++;
SelectBody selectBody = subSelect.getSelectBody();
if (!(selectBody instanceof PlainSelect))
throw new UnsupportedSelectQueryRuntimeException("Complex SELECT statements are not supported", selectBody);
RAExpressionAttributes current = select((PlainSelect) selectBody);
RelationID aliasId = idfac.createRelationID(null, subSelect.getAlias().getName());
result = RAExpressionAttributes.alias(current, aliasId);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core
@Override
public void visit(SubSelect subSelect) {
subSelect.getSelectBody().accept(new ReplaceStarSelectVisitor(true, subSelect.getAlias().getName(), variables));
}
代码示例来源:origin: ontop/ontop
public QuotedID getSelectItemAliasedId(SelectExpressionItem si) {
if (si.getAlias() != null && si.getAlias().getName() != null) {
return idfac.createAttributeID(si.getAlias().getName());
}
else if (si.getExpression() instanceof Column) {
return idfac.createAttributeID(((Column)si.getExpression()).getColumnName());
}
else
throw new InvalidSelectQueryRuntimeException("Complex expression in SELECT must have an alias", si);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
public QuotedID getSelectItemAliasedId(SelectExpressionItem si) {
if (si.getAlias() != null && si.getAlias().getName() != null) {
return idfac.createAttributeID(si.getAlias().getName());
}
else if (si.getExpression() instanceof Column) {
return idfac.createAttributeID(((Column)si.getExpression()).getColumnName());
}
else
throw new InvalidSelectQueryRuntimeException("Complex expression in SELECT must have an alias", si);
}
内容来源于网络,如有侵权,请联系作者删除!