forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostgresCastOperation.java
More file actions
41 lines (31 loc) · 1.02 KB
/
PostgresCastOperation.java
File metadata and controls
41 lines (31 loc) · 1.02 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
package sqlancer.postgres.ast;
import sqlancer.postgres.PostgresCompoundDataType;
import sqlancer.postgres.PostgresSchema.PostgresDataType;
public class PostgresCastOperation implements PostgresExpression {
private PostgresExpression expression;
private PostgresCompoundDataType type;
public PostgresCastOperation(PostgresExpression expression, PostgresCompoundDataType type) {
if (expression == null) {
throw new AssertionError();
}
this.expression = expression;
this.type = type;
}
@Override
public PostgresDataType getExpressionType() {
return type.getDataType();
}
@Override
public PostgresConstant getExpectedValue() {
return expression.getExpectedValue().cast(type.getDataType());
}
public PostgresExpression getExpression() {
return expression;
}
public PostgresDataType getType() {
return type.getDataType();
}
public PostgresCompoundDataType getCompoundType() {
return type;
}
}