本文整理汇总了Java中net.sf.jsqlparser.expression.Alias类的典型用法代码示例。如果您正苦于以下问题:Java Alias类的具体用法?Java Alias怎么用?Java Alias使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Alias类属于net.sf.jsqlparser.expression包,在下文中一共展示了Alias类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import net.sf.jsqlparser.expression.Alias; //导入依赖的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.expression.Alias; //导入依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
for (SelectItem item : plainSelect.getSelectItems()) {
item.accept(this);
}
if (itemsExpr.size() > 1) {
BinaryExpression binExpr = createBinaryExpression();
binExpr.setLeftExpression(itemsExpr.get(0).getExpression());
for (int i = 1; i < itemsExpr.size() - 1; i++) {
binExpr.setRightExpression(itemsExpr.get(i).getExpression());
BinaryExpression binExpr2 = createBinaryExpression();
binExpr2.setLeftExpression(binExpr);
binExpr = binExpr2;
}
binExpr.setRightExpression(itemsExpr.get(itemsExpr.size() - 1).getExpression());
SelectExpressionItem sei = new SelectExpressionItem();
sei.setExpression(binExpr);
plainSelect.getSelectItems().clear();
plainSelect.getSelectItems().add(sei);
}
((SelectExpressionItem) plainSelect.getSelectItems().get(0)).setAlias(new Alias(alias));
}
示例3: visit
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
@Override
public void visit(SubSelect subSelect) {
buffer.append("(");
if (subSelect.getWithItemsList() != null && !subSelect.getWithItemsList().isEmpty()) {
buffer.append("WITH ");
for (Iterator<WithItem> iter = subSelect.getWithItemsList().iterator(); iter.hasNext();) {
WithItem withItem = iter.next();
withItem.accept(this);
if (iter.hasNext()) {
buffer.append(",");
}
buffer.append(" ");
}
}
subSelect.getSelectBody().accept(this);
buffer.append(")");
Pivot pivot = subSelect.getPivot();
if (pivot != null) {
pivot.accept(this);
}
Alias alias = subSelect.getAlias();
if (alias != null) {
buffer.append(alias.toString());
}
}
示例4: wrapSetOperationList
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
/**
* 包装SetOperationList
*
* @param setOperationList
* @return
*/
private SelectBody wrapSetOperationList(SetOperationList setOperationList) {
//获取最后一个plainSelect
PlainSelect plainSelect = setOperationList.getPlainSelects().get(setOperationList.getPlainSelects().size() - 1);
PlainSelect selectBody = new PlainSelect();
List<SelectItem> selectItems = getSelectItems(plainSelect);
selectBody.setSelectItems(selectItems);
//设置fromIterm
SubSelect fromItem = new SubSelect();
fromItem.setSelectBody(setOperationList);
fromItem.setAlias(new Alias(WRAP_TABLE));
selectBody.setFromItem(fromItem);
//order by
if (isNotEmptyList(plainSelect.getOrderByElements())) {
selectBody.setOrderByElements(plainSelect.getOrderByElements());
plainSelect.setOrderByElements(null);
}
return selectBody;
}
示例5: visit
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
@Override
public void visit(Table tableName) {
if (tableName == null) {
return;
}
String name = tableName.getName();
if (name != null) {
tableName.setName(CompatibilityUtils.fixMySqlName(name.toLowerCase()));
}
Alias alias = tableName.getAlias();
if (alias != null) {
String aliasName = alias.getName();
if (aliasName != null) {
alias.setName(CompatibilityUtils.fixMySqlName(aliasName.toLowerCase()));
}
}
}
示例6: getEntityAlias
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
protected static Alias getEntityAlias(String entityName, PlainSelect query) {
FromItem fromItem = query.getFromItem();
if (hasEntityAlias(entityName, fromItem)) {
return fromItem.getAlias();
}
if(query.getJoins() != null) {
for(Object o : query.getJoins()) {
Join join = (Join) o;
if (hasEntityAlias(entityName, join.getRightItem())) {
return join.getRightItem().getAlias();
}
}
}
logger.debug("Alias from entity " + entityName + " not found in query " + query);
return null;
}
示例7: wrapSetOperationList
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
/**
* 包装SetOperationList
*
* @param setOperationList
* @return
*/
private static SelectBody wrapSetOperationList(SetOperationList setOperationList) {
// 获取最后一个plainSelect
PlainSelect plainSelect = (PlainSelect)
setOperationList.getSelects().get(setOperationList.getSelects().size() - 1);
PlainSelect selectBody = new PlainSelect();
List<SelectItem> selectItems = getSelectItems(plainSelect);
selectBody.setSelectItems(selectItems);
//设置fromIterm
SubSelect fromItem = new SubSelect();
fromItem.setSelectBody(setOperationList);
fromItem.setAlias(new Alias(WRAP_TABLE));
selectBody.setFromItem(fromItem);
//order by
if (isNotEmptyList(plainSelect.getOrderByElements())) {
selectBody.setOrderByElements(plainSelect.getOrderByElements());
plainSelect.setOrderByElements(null);
}
return selectBody;
}
示例8: wrapSetOperationList
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
/**
* 包装SetOperationList
*
* @param setOperationList
* @return
*/
protected SelectBody wrapSetOperationList(SetOperationList setOperationList) {
//获取最后一个plainSelect
SelectBody setSelectBody = setOperationList.getSelects().get(setOperationList.getSelects().size() - 1);
if (!(setSelectBody instanceof PlainSelect)) {
throw new RuntimeException("目前无法处理该SQL,您可以将该SQL发送给[email protected]协助作者解决!");
}
PlainSelect plainSelect = (PlainSelect) setSelectBody;
PlainSelect selectBody = new PlainSelect();
List<SelectItem> selectItems = getSelectItems(plainSelect);
selectBody.setSelectItems(selectItems);
//设置fromIterm
SubSelect fromItem = new SubSelect();
fromItem.setSelectBody(setOperationList);
fromItem.setAlias(new Alias(WRAP_TABLE));
selectBody.setFromItem(fromItem);
//order by
if (isNotEmptyList(plainSelect.getOrderByElements())) {
selectBody.setOrderByElements(plainSelect.getOrderByElements());
plainSelect.setOrderByElements(null);
}
return selectBody;
}
示例9: wrapSetOperationList
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
/**
* 包装SetOperationList
*
* @param setOperationList
* @return
*/
protected SelectBody wrapSetOperationList(SetOperationList setOperationList) {
//获取最后一个plainSelect
SelectBody setSelectBody = setOperationList.getSelects().get(setOperationList.getSelects().size() - 1);
if (!(setSelectBody instanceof PlainSelect)) {
throw new PageException("目前无法处理该SQL,您可以将该SQL发送给[email protected]协助作者解决!");
}
PlainSelect plainSelect = (PlainSelect) setSelectBody;
PlainSelect selectBody = new PlainSelect();
List<SelectItem> selectItems = getSelectItems(plainSelect);
selectBody.setSelectItems(selectItems);
//设置fromIterm
SubSelect fromItem = new SubSelect();
fromItem.setSelectBody(setOperationList);
fromItem.setAlias(new Alias(WRAP_TABLE));
selectBody.setFromItem(fromItem);
//order by
if (isNotEmptyList(plainSelect.getOrderByElements())) {
selectBody.setOrderByElements(plainSelect.getOrderByElements());
plainSelect.setOrderByElements(null);
}
return selectBody;
}
示例10: handleAlias
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
private static void handleAlias(Map<String, String> aliases, SubSelect subSelect) {
Alias alias = subSelect.getAlias();
if (alias != null) {
String aliasName = alias.getName();
if (aliasName != null) {
/*
FIXME: need to generalize,
ie for when there can be several un-named sub-selects referring
to columns with same names
*/
String tableName = UNNAMED_TABLE;
aliases.put(aliasName.trim().toLowerCase(), tableName.trim().toLowerCase());
}
}
}
示例11: visit
import net.sf.jsqlparser.expression.Alias; //导入依赖的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);
}
示例12: getAliasName
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
private String getAliasName(SelectExpressionItem selectExpressionItem)
{
Alias alias = selectExpressionItem.getAlias();
if (alias != null) {
return removeQuotesIfAny(alias.getName());
}
return ""; //$NON-NLS-1$ // empty alias name
}
示例13: Alias
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
final public Alias Alias() throws ParseException {
/* @bgen(jjtree) Alias */
SimpleNode jjtn000 = new SimpleNode(JJTALIAS);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
String name = null;
boolean useAs = false;
try {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case K_AS:
jj_consume_token(K_AS);
useAs = true;
break;
default:
jj_la1[97] = jj_gen;
;
}
name = RelObjectName();
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
{
if (true)
return new Alias(name, useAs);
}
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{
if (true)
throw (RuntimeException) jjte000;
}
}
if (jjte000 instanceof ParseException) {
{
if (true)
throw (ParseException) jjte000;
}
}
{
if (true)
throw (Error) jjte000;
}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
throw new Error("Missing return statement in function");
}
示例14: getAlias
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
public Alias getAlias() {
return alias;
}
示例15: setAlias
import net.sf.jsqlparser.expression.Alias; //导入依赖的package包/类
public void setAlias(Alias alias) {
this.alias = alias;
}