本文整理汇总了Java中net.sf.jsqlparser.statement.select.WithItem类的典型用法代码示例。如果您正苦于以下问题:Java WithItem类的具体用法?Java WithItem怎么用?Java WithItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WithItem类属于net.sf.jsqlparser.statement.select包,在下文中一共展示了WithItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
@Override
public void visit(Select select) {
SelectDeParser selectDeParser = new SelectDeParser();
selectDeParser.setBuffer(buffer);
ExpressionDeParser expressionDeParser = new ExpressionDeParser(selectDeParser, buffer);
selectDeParser.setExpressionVisitor(expressionDeParser);
if (select.getWithItemsList() != null && !select.getWithItemsList().isEmpty()) {
buffer.append("WITH ");
for (Iterator<WithItem> iter = select.getWithItemsList().iterator(); iter.hasNext();) {
WithItem withItem = iter.next();
withItem.accept(selectDeParser);
if (iter.hasNext()) {
buffer.append(",");
}
buffer.append(" ");
}
}
select.getSelectBody().accept(selectDeParser);
}
示例2: visit
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的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());
}
}
示例3: addExpression
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
/**
* Adds an expression to select statements. E.g. a simple column is an
* expression.
*
* @param select
* @param expr
*/
public static void addExpression(Select select, final Expression expr) {
select.getSelectBody().accept(new SelectVisitor() {
@Override
public void visit(PlainSelect plainSelect) {
plainSelect.getSelectItems().add(new SelectExpressionItem(expr));
}
@Override
public void visit(SetOperationList setOpList) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
@Override
public void visit(WithItem withItem) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
});
}
示例4: addGroupBy
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
/**
* Adds group by to a plain select statement.
* @param select
* @param expr
*/
public static void addGroupBy(Select select, final Expression expr) {
select.getSelectBody().accept(new SelectVisitor() {
@Override
public void visit(PlainSelect plainSelect) {
plainSelect.addGroupByColumnReference(expr);
}
@Override
public void visit(SetOperationList setOpList) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
@Override
public void visit(WithItem withItem) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
});
}
示例5: processSelectBody
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
/**
* select 语句处理
*/
@Override
public void processSelectBody(SelectBody selectBody) {
if (selectBody instanceof PlainSelect) {
processPlainSelect((PlainSelect) selectBody);
} else if (selectBody instanceof WithItem) {
WithItem withItem = (WithItem) selectBody;
if (withItem.getSelectBody() != null) {
processSelectBody(withItem.getSelectBody());
}
} else {
SetOperationList operationList = (SetOperationList) selectBody;
if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
List<SelectBody> plainSelects = operationList.getSelects();
for (SelectBody plainSelect : plainSelects) {
processSelectBody(plainSelect);
}
}
}
}
示例6: WithList
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
final public List WithList() throws ParseException {
ArrayList withItemsList = new ArrayList();
WithItem with = null;
jj_consume_token(K_WITH);
with = WithItem();
withItemsList.add(with);
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 79:
;
break;
default:
jj_la1[50] = jj_gen;
break label_9;
}
jj_consume_token(79);
with = WithItem();
withItemsList.add(with);
}
{if (true) return withItemsList;}
throw new Error("Missing return statement in function");
}
示例7: WithItem
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
final public WithItem WithItem() throws ParseException {
WithItem with = new WithItem();
String name = null;
List selectItems = null;
SelectBody selectBody = null;
name = RelObjectName();
with.setName(name);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 80:
jj_consume_token(80);
selectItems = SelectItemsList();
jj_consume_token(81);
with.setWithItemList(selectItems);
break;
default:
jj_la1[51] = jj_gen;
;
}
jj_consume_token(K_AS);
jj_consume_token(80);
selectBody = SelectBody();
with.setSelectBody(selectBody);
jj_consume_token(81);
{if (true) return with;}
throw new Error("Missing return statement in function");
}
示例8: visit
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
public void visit(Select select) {
SelectDeParser selectDeParser = new SelectDeParser();
selectDeParser.setBuffer(buffer);
ExpressionDeParser expressionDeParser = new ExpressionDeParser(selectDeParser, buffer);
selectDeParser.setExpressionVisitor(expressionDeParser);
if (select.getWithItemsList() != null && !select.getWithItemsList().isEmpty()) {
buffer.append(select.getCommentWith() != null ? select.getCommentWith()+" " : "").append(ExpressionDeParser.LINE_SEPARATOR).append("With ");
for (int i = 0; i < select.getWithItemsList().size(); i++) {
WithItem withItem = (WithItem) select.getWithItemsList().get(i);
buffer.append(withItem);
buffer.append((i < select.getWithItemsList().size() - 1) ? (!"".equals(select.getCommentsComma().get(i)) ? " " + select.getCommentsComma().get(i)+ExpressionDeParser.LINE_SEPARATOR:"")+ "," : "")
.append(ExpressionDeParser.LINE_SEPARATOR).append(" ");
}
}
select.getSelectBody().accept(selectDeParser);
buffer.append(!"".equals(select.getEndComment()) ? " "+select.getEndComment() : "");
}
示例9: visit
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
@Override
public void visit(SubSelect subSelect) {
if (selectVisitor != null) {
for (WithItem item : subSelect.getWithItemsList()) {
item.accept(selectVisitor);
}
subSelect.getSelectBody().accept(selectVisitor);
}
if (subSelect.getPivot() != null) {
subSelect.getPivot().accept(this);
}
}
示例10: visit
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
@Override
public void visit(Select select) {
if (select.getWithItemsList() != null) {
for (WithItem withItem : select.getWithItemsList()) {
withItem.accept(this);
}
}
select.getSelectBody().accept(this);
}
示例11: visit
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
@Override
public void visit(WithItem withItem) {
if (withItem.getSelectBody() != null) {
withItem.getSelectBody().accept(this);
}
if (withItem.getWithItemList() != null) {
withItem.getWithItemList().forEach(s -> s.accept(this));
}
}
示例12: WithList
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
final public List WithList(Select select) throws ParseException {ArrayList withItemsList = new ArrayList();
WithItem with = null;
Token tk = null;
ArrayList commentsComma = new ArrayList();
tk = jj_consume_token(K_WITH);
if (tk.specialToken != null) {
select.setCommentWith(tk.specialToken.image);
}
with = WithItem();
withItemsList.add(with);
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
case COMMA:{
;
break;
}
default:
jj_la1[54] = jj_gen;
break label_9;
}
tk = jj_consume_token(COMMA);
if (tk.specialToken != null) {
commentsComma.add(tk.specialToken.image);
} else {commentsComma.add("");}
with = WithItem();
withItemsList.add(with);
}
select.setCommentsComma(commentsComma);
{if ("" != null) return withItemsList;}
throw new Error("Missing return statement in function");
}
示例13: visit
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
@Override
public void visit(WithItem wi) {
if (wi.getWithItemList() != null) {
for (SelectItem si: wi.getWithItemList()) {
si.accept(this);
}
}
wi.getSelectBody().accept(this);
}
示例14: Select
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
final public Select Select() throws ParseException {
/* @bgen(jjtree) Select */
SimpleNode jjtn000 = new SimpleNode(JJTSELECT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
Select select = new Select();
SelectBody selectBody = null;
List<WithItem> with = null;
try {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case K_WITH:
with = WithList();
break;
default:
jj_la1[68] = jj_gen;
;
}
selectBody = SelectBody();
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
select.setWithItemsList(with);
select.setSelectBody(selectBody);
{
if (true)
return select;
}
} 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");
}
示例15: WithList
import net.sf.jsqlparser.statement.select.WithItem; //导入依赖的package包/类
final public List<WithItem> WithList() throws ParseException {
/* @bgen(jjtree) WithList */
SimpleNode jjtn000 = new SimpleNode(JJTWITHLIST);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
List<WithItem> withItemsList = new ArrayList<WithItem>();
WithItem with = null;
try {
jj_consume_token(K_WITH);
with = WithItem();
withItemsList.add(with);
label_20:
while (true) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 165:
;
break;
default:
jj_la1[90] = jj_gen;
break label_20;
}
jj_consume_token(165);
with = WithItem();
withItemsList.add(with);
}
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
{
if (true)
return withItemsList;
}
} 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");
}