当前位置: 首页>>代码示例>>Java>>正文


Java SelectExpressionItem.getAlias方法代码示例

本文整理汇总了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;
				}
			}
		}
	}
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:21,代码来源:AddAliasesVisitor.java

示例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());
    }

}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:9,代码来源:SelectDeParser.java

示例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());
		}
	}
}
 
开发者ID:coastland,项目名称:gsp-dba-maven-plugin,代码行数:13,代码来源:ViewAnalyzer.java

示例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());
    }

}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:8,代码来源:SelectDeParser.java

示例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);
}
 
开发者ID:obidea,项目名称:semantika,代码行数:14,代码来源:SelectItemHandler.java

示例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
}
 
开发者ID:obidea,项目名称:semantika,代码行数:9,代码来源:UserQueryHandler.java

示例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);
}
 
开发者ID:valdasraps,项目名称:resthub,代码行数:16,代码来源:CheckSelectParser.java

示例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;
}
 
开发者ID:diennea,项目名称:herddb,代码行数:50,代码来源:SQLAggregator.java


注:本文中的net.sf.jsqlparser.statement.select.SelectExpressionItem.getAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。