-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSQL.java
More file actions
243 lines (190 loc) · 5.06 KB
/
Copy pathSQL.java
File metadata and controls
243 lines (190 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
package jaskell.sql;
import jaskell.script.Directive;
import jaskell.script.Parameter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class SQL {
public static Select select() {
return new Select();
}
public static Select select(String names) {
return new Select(names);
}
public static Select select(String... names) {
return new Select(names);
}
public static Select select(Directive... names) {
return new Select(names);
}
public static Select select(List<Directive> names) {
return new Select(names);
}
public static Insert insert() {
return new Insert();
}
public static Update update(String name) {
return new Update(name);
}
public static Update update(Name name) {
return new Update(name);
}
public static Delete delete() {
return new Delete();
}
public static With with() {
return new With();
}
public static With with(String name) {
return new With(name);
}
public static With with(Name name) {
return new With(name);
}
public static Name n(String name) {
return new Name(name);
}
public static Quot q(String name) {
return new Quot(name);
}
public static List<Quot> qs(String... names) {
return Arrays.stream(names).map(Quot::new).collect(Collectors.toList());
}
public static Literal text(String content) {
return new Literal(content);
}
public static <T> Literal l(T v) {
return new Literal(v);
}
public static Predicate br(Predicate predicate) {
Brackets re = new Brackets();
re._segment = predicate;
return re;
}
public static Parameter p(int index) {
return new JDBCParameter<>(index, Object.class);
}
public static <T> Parameter p(int index, Class<T> cls) {
return new JDBCParameter<>(index, cls);
}
public static Parameter p(String key) {
return new JDBCParameter<>(key);
}
public static <T> Parameter p(String key, Class<T> cls) {
return new JDBCParameter<>(key);
}
public static Parameter p(String placeHolder, int index) {
return new JDBCParameter<>(placeHolder, index, Object.class);
}
public static <T> Parameter p(String placeHolder, int index, Class<T> cls) {
return new JDBCParameter<>(placeHolder, index, cls);
}
public static Parameter p(String placeHolder, String key) {
return new JDBCParameter<>(placeHolder, key);
}
public static <T> Parameter p(String placeHolder, String key, Class<T> cls) {
return new JDBCParameter<>(placeHolder, key, cls);
}
public static And and(Directive left, Directive right) {
And re = new And();
re._left = left;
re._right = right;
return re;
}
public static Or or(Directive left, Directive right) {
Or re = new Or();
re._left = left;
re._right = right;
return re;
}
public static Equal eq(Directive left, Directive right) {
Equal re = new Equal();
re._left = left;
re._right = right;
return re;
}
public static Great gt(Directive left, Directive right) {
Great re = new Great();
re._left = left;
re._right = right;
return re;
}
public static Less lt(Directive left, Directive right) {
Less re = new Less();
re._left = left;
re._right = right;
return re;
}
public static GreateOrEqual ge(Directive left, Directive right) {
GreateOrEqual re = new GreateOrEqual();
re._left = left;
re._right = right;
return re;
}
public static LessOrEqual le(Directive left, Directive right) {
LessOrEqual re = new LessOrEqual();
re._left = left;
re._right = right;
return re;
}
public static NotEqual ne(Directive left, Directive right) {
NotEqual re = new NotEqual();
re._left = left;
re._right = right;
return re;
}
public static Like like(Directive left, Directive right) {
Like re = new Like();
re._left = left;
re._right = right;
return re;
}
public static Not not(Directive directive) {
return new Not(directive);
}
public static Not not() {
return new Not();
}
public static Func func(String name) {
return new Func(name);
}
public static Func func(String name, Directive arg) {
return new Func(name, arg);
}
public static Func func(String name, Directive... args) {
return new Func(name, args);
}
public static Count count() {
return new Count();
}
public static Count count(String name) {
return new Count(name);
}
public static Count count(Name name) {
return new Count(name);
}
public static Sum sum() {
return new Sum();
}
public static Sum sum(String name) {
return new Sum(name);
}
public static Sum sum(Name name) {
return new Sum(name);
}
public static Case _case() {
return new Case();
}
public static Case _case(Directive expr) {
return new Case(expr);
}
public static Coalesce coalesce(String names) {
return new Coalesce(names);
}
public static Coalesce coalesce(String... names) {
return new Coalesce(names);
}
public static Coalesce coalesce(Directive... names) {
return new Coalesce(names);
}
}