-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLiteral.java
More file actions
155 lines (127 loc) · 3.31 KB
/
Copy pathLiteral.java
File metadata and controls
155 lines (127 loc) · 3.31 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
package jaskell.sql;
import jaskell.script.Directive;
import jaskell.script.Parameter;
import java.util.ArrayList;
import java.util.List;
public class Literal extends Predicate implements CouldAlias {
protected Literal(){}
String _literal;
Literal(int value){
_literal = Integer.valueOf(value).toString();
}
Literal(long value){
_literal = Long.valueOf(value).toString();
}
Literal(Number value){
_literal = value.toString();
}
Literal(String value){ _literal = value; }
Literal(Object value){
_literal = String.format("%s", value);
}
@Override
public String script() {
return _literal;
}
@Override
public List<Parameter<?>> parameters() {
return new ArrayList<>();
}
public Alias as(String name){
Alias re = new Alias(name);
re._prefix = this;
return re;
}
public Alias as(Name name){
Alias re = new Alias(name.name());
re._prefix = this;
return re;
}
public Join join(Directive other){
Join re = new Join();
re._prefix = this;
re._join = other;
return re;
}
public Left left(){
Left re = new Left();
re._prefix = this;
return re;
}
public Right right(){
Right re = new Right();
re._prefix = this;
return re;
}
public Full full(){
Full re = new Full();
re._prefix = this;
return re;
}
public Inner inner(){
Inner re = new Inner();
re._prefix = this;
return re;
}
public Cross cross(){
Cross re = new Cross();
re._prefix = this;
return re;
}
public static class Alias extends jaskell.sql.Alias implements Directive, CouldAlias {
Name _name;
Directive _prefix;
Alias(String alias) {
super(alias);
this._name = new Name(alias);
}
Alias(Literal alias) {
super(alias.script());
this._name = new Name(alias.script());
}
public String alias(){
return _name.script();
}
@Override
public String script() {
return String.format("%s AS \"%s\"", _prefix.script(), _name.name().replace("\"", "\\\""));
}
@Override
public List<Parameter<?>> parameters() {
List<Parameter<?>> re = _prefix.parameters();
re.addAll(_name.parameters());
return re;
}
public Join join(Directive other){
Join re = new Join();
re._prefix = this;
re._join = other;
return re;
}
public Left left(){
Left re = new Left();
re._prefix = this;
return re;
}
public Right right(){
Right re = new Right();
re._prefix = this;
return re;
}
public Full full(){
Full re = new Full();
re._prefix = this;
return re;
}
public Inner inner(){
Inner re = new Inner();
re._prefix = this;
return re;
}
public Cross cross(){
Cross re = new Cross();
re._prefix = this;
return re;
}
}
}