本文整理汇总了Java中net.sf.jsqlparser.statement.select.SelectExpressionItem.getAlias方法的典型用法代码示例。如果您正苦于以下问题:Java SelectExpressionItem.getAlias方法的具体用法?Java SelectExpressionItem.getAlias怎么用?Java SelectExpressionItem.getAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jsqlparser.statement.select.SelectExpressionItem
的用法示例。
在下文中一共展示了SelectExpressionItem.getAlias方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
@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;
}
}
}
}
}
示例2: visit
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
@Override
public void visit(SelectExpressionItem selectExpressionItem) {
selectExpressionItem.getExpression().accept(expressionVisitor);
if (selectExpressionItem.getAlias() != null) {
buffer.append(selectExpressionItem.getAlias().toString());
}
}
示例3: visit
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
@Override
public void visit(SelectExpressionItem item) {
ColumnParser columnParser = new ColumnParser();
item.getExpression().accept(columnParser);
if (columnParser.isSimple()) {
String columnName = columnParser.getColumnName();
simpleColumnNames.add(columnName);
if(item.getAlias() != null){
aliases.put(columnName, StringUtils.strip(item.getAlias().getName(), "`").toUpperCase());
}
}
}
示例4: visit
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
public void visit(SelectExpressionItem selectExpressionItem) {
selectExpressionItem.getExpression().accept(expressionVisitor);
if (selectExpressionItem.getAlias() != null) {
buffer.append(" ").append(selectExpressionItem.getAlias().toString());
}
}
示例5: visit
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
@Override
public void visit(SelectExpressionItem selectExpressionItem)
{
selectExpressionItem.getExpression().accept(this);
ISqlExpression expression = getExpression();
SqlSelectItem selectItem = new SqlSelectItem(expression);
Alias alias = selectExpressionItem.getAlias();
if (alias != null) {
String aliasName = removeQuotesIfAny(alias.getName());
selectItem.setAliasName(aliasName);
}
mSelectItems.add(selectItem);
}
示例6: getAliasName
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
private String getAliasName(SelectExpressionItem selectExpressionItem)
{
Alias alias = selectExpressionItem.getAlias();
if (alias != null) {
return removeQuotesIfAny(alias.getName());
}
return ""; //$NON-NLS-1$ // empty alias name
}
示例7: visit
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
@Override
public void visit(SelectExpressionItem sei) {
String alias = sei.getAlias() != null ? sei.getAlias().getName() : null;
if (alias != null) {
selectDef.getColumns().add(alias);
} else {
if (sei.getExpression() instanceof Column) {
Column col = (Column) sei.getExpression();
selectDef.getColumns().add(CheckExpressionParser.fixColumnName(col.getColumnName()));
} else {
throw new QueryException("Complex return expressions must have alias defined: %s", sei.getExpression());
}
}
sei.getExpression().accept(expParser);
}
示例8: createOutputColumns
import net.sf.jsqlparser.statement.select.SelectExpressionItem; //导入方法依赖的package包/类
private static Column[] createOutputColumns(List<SelectItem> selectItems, DataScanner wrapped) throws StatementExecutionException {
Column[] columns = new Column[selectItems.size()];
int i = 0;
for (SelectItem item : selectItems) {
boolean done = false;
if (item instanceof SelectExpressionItem) {
SelectExpressionItem sei = (SelectExpressionItem) item;
Expression expression = sei.getExpression();
if (expression instanceof Function) {
Function f = (Function) expression;
String fieldName = f.toString();
if (sei.getAlias() != null && sei.getAlias().getName() != null) {
fieldName = sei.getAlias().getName();
}
if (fieldName == null) {
fieldName = "field" + i;
}
Column aggregated = BuiltinFunctions.toAggregatedOutputColumn(fieldName, f);
if (aggregated != null) {
columns[i] = aggregated;
done = true;
}
} else if (expression instanceof net.sf.jsqlparser.schema.Column) {
net.sf.jsqlparser.schema.Column c = (net.sf.jsqlparser.schema.Column) expression;
String name = c.getColumnName();
boolean found = false;
for (Column co : wrapped.getSchema()) {
if (co.name.equals(name)) {
columns[i] = co;
found = true;
break;
}
}
if (!found) {
throw new StatementExecutionException("cannot find column " + name + " is upstream scanner");
}
done = true;
} else {
throw new StatementExecutionException("unhandled aggregate query selectable item:" + expression);
}
}
i++;
if (!done) {
throw new StatementExecutionException("unhandled aggregate function " + item);
}
}
return columns;
}