net.sf.jsqlparser.expression.Alias.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(375)

本文整理了Java中net.sf.jsqlparser.expression.Alias.<init>()方法的一些代码示例,展示了Alias.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Alias.<init>()方法的具体详情如下:
包路径:net.sf.jsqlparser.expression.Alias
类名称:Alias
方法名:<init>

Alias.<init>介绍

暂无

代码示例

代码示例来源: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: JSQLParser/JSqlParser

@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));
}

代码示例来源:origin: pagehelper/Mybatis-PageHelper

item.setAlias(new Alias(aliasName));
autoItems.add(item);

代码示例来源:origin: pagehelper/Mybatis-PageHelper

/**
 * 包装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发送给abel533@gmail.com协助作者解决!");
  }
  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;
}

代码示例来源:origin: JSQLParser/JSqlParser

throw new ParseException();
return new Alias(name,useAs);

代码示例来源:origin: JSQLParser/JSqlParser

table.setAlias(new Alias(name,useAs));
   break;

代码示例来源:origin: com.github.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: com.github.jsqlparser/jsqlparser

@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));
}

代码示例来源:origin: com.intoverflow.booster/booster-core

@Override
  public void visit(Column column) {
    Table table = column.getTable();
    if (table == null || StringUtils.isBlank(table.getName())) {
      Table t = new Table(tableName);
      if (tableAlias != null) {
        t.setAlias(new Alias(tableAlias, false));
      }
      column.setTable(t);
    }
  }
});

代码示例来源:origin: Quetzal-RDF/quetzal

@Override
public void visit(Table tableName) {
  SelectBody select = cteName2Def.get(tableName.getFullyQualifiedName());
  if (select != null) {
    SubSelect subSelect = new SubSelect();
    subSelect.setSelectBody(select);
    Alias alias;
    if (tableName.getAlias()==null) {
      alias= new Alias(tableName.getFullyQualifiedName(), useASInTableAlias);
    } else {
      alias = tableName.getAlias();
    }
    subSelect.setAlias(alias);
    result = subSelect;
  } else {
    result = tableName;
  }
  
}

代码示例来源:origin: com.hand.hap.cloud/hap-mybatis-mapper-starter

item.setAlias(new Alias(aliasName));
autoItems.add(item);

代码示例来源:origin: com.github.pagehelper/pagehelper

item.setAlias(new Alias(aliasName));
autoItems.add(item);

代码示例来源:origin: com.hand.hap.cloud/hap-mybatis-mapper-starter

/**
 * 包装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发送给abel533@gmail.com协助作者解决!");
  }
  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;
}

代码示例来源:origin: com.github.pagehelper/pagehelper

/**
 * 包装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发送给abel533@gmail.com协助作者解决!");
  }
  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;
}

代码示例来源:origin: com.github.jsqlparser/jsqlparser

throw new ParseException();
return new Alias(name,useAs);

代码示例来源:origin: com.github.jsqlparser/jsqlparser

table.setAlias(new Alias(name,useAs));
   break;

相关文章