|
28 | 28 | */ |
29 | 29 | public class WithItem implements SelectBody { |
30 | 30 |
|
31 | | - private String name; |
32 | | - private List<SelectItem> withItemList; |
33 | | - private SelectBody selectBody; |
| 31 | + private String name; |
| 32 | + private List<SelectItem> withItemList; |
| 33 | + private SelectBody selectBody; |
| 34 | + private boolean recursive; |
34 | 35 |
|
35 | | - /** |
36 | | - * The name of this WITH item (for example, "myWITH" in "WITH myWITH AS |
37 | | - * (SELECT A,B,C))" |
38 | | - * |
39 | | - * @return the name of this WITH |
40 | | - */ |
41 | | - public String getName() { |
42 | | - return name; |
43 | | - } |
| 36 | + /** |
| 37 | + * The name of this WITH item (for example, "myWITH" in "WITH myWITH AS |
| 38 | + * (SELECT A,B,C))" |
| 39 | + * |
| 40 | + * @return the name of this WITH |
| 41 | + */ |
| 42 | + public String getName() { |
| 43 | + return name; |
| 44 | + } |
44 | 45 |
|
45 | | - public void setName(String name) { |
46 | | - this.name = name; |
47 | | - } |
| 46 | + public void setName(String name) { |
| 47 | + this.name = name; |
| 48 | + } |
48 | 49 |
|
49 | | - /** |
50 | | - * The {@link SelectBody} of this WITH item is the part after the "AS" |
51 | | - * keyword |
52 | | - * |
53 | | - * @return {@link SelectBody} of this WITH item |
54 | | - */ |
55 | | - public SelectBody getSelectBody() { |
56 | | - return selectBody; |
57 | | - } |
| 50 | + public boolean isRecursive() { |
| 51 | + return recursive; |
| 52 | + } |
58 | 53 |
|
59 | | - public void setSelectBody(SelectBody selectBody) { |
60 | | - this.selectBody = selectBody; |
61 | | - } |
| 54 | + public void setRecursive(boolean recursive) { |
| 55 | + this.recursive = recursive; |
| 56 | + } |
62 | 57 |
|
63 | | - /** |
64 | | - * The {@link SelectItem}s in this WITH (for example the A,B,C in "WITH |
65 | | - * mywith (A,B,C) AS ...") |
66 | | - * |
67 | | - * @return a list of {@link SelectItem}s |
68 | | - */ |
69 | | - public List<SelectItem> getWithItemList() { |
70 | | - return withItemList; |
71 | | - } |
| 58 | + /** |
| 59 | + * The {@link SelectBody} of this WITH item is the part after the "AS" |
| 60 | + * keyword |
| 61 | + * |
| 62 | + * @return {@link SelectBody} of this WITH item |
| 63 | + */ |
| 64 | + public SelectBody getSelectBody() { |
| 65 | + return selectBody; |
| 66 | + } |
72 | 67 |
|
73 | | - public void setWithItemList(List<SelectItem> withItemList) { |
74 | | - this.withItemList = withItemList; |
75 | | - } |
| 68 | + public void setSelectBody(SelectBody selectBody) { |
| 69 | + this.selectBody = selectBody; |
| 70 | + } |
76 | 71 |
|
77 | | - @Override |
78 | | - public String toString() { |
79 | | - return name + ((withItemList != null) ? " " + PlainSelect.getStringList(withItemList, true, true) : "") |
80 | | - + " AS (" + selectBody + ")"; |
81 | | - } |
| 72 | + /** |
| 73 | + * The {@link SelectItem}s in this WITH (for example the A,B,C in "WITH |
| 74 | + * mywith (A,B,C) AS ...") |
| 75 | + * |
| 76 | + * @return a list of {@link SelectItem}s |
| 77 | + */ |
| 78 | + public List<SelectItem> getWithItemList() { |
| 79 | + return withItemList; |
| 80 | + } |
82 | 81 |
|
83 | | - @Override |
84 | | - public void accept(SelectVisitor visitor) { |
85 | | - visitor.visit(this); |
86 | | - } |
| 82 | + public void setWithItemList(List<SelectItem> withItemList) { |
| 83 | + this.withItemList = withItemList; |
| 84 | + } |
| 85 | + |
| 86 | + @Override |
| 87 | + public String toString() { |
| 88 | + return (recursive ? "RECURSIVE " : "") + name + ((withItemList != null) ? " " + PlainSelect.getStringList(withItemList, true, true) : "") |
| 89 | + + " AS (" + selectBody + ")"; |
| 90 | + } |
| 91 | + |
| 92 | + @Override |
| 93 | + public void accept(SelectVisitor visitor) { |
| 94 | + visitor.visit(this); |
| 95 | + } |
87 | 96 | } |
0 commit comments