/
NikolayIvkin
/
sqlancer2
Обзор
Документация
Войти
/
NikolayIvkin
/
sqlancer2
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/sqlancer/postgres/ast/PostgresConcatOperation.java
37 строк
1 KB
Manuel Rigger
[Postgres] Let getExpectedValue() return null when no PQS implementation is available
25 авг 2020, 14:08
25 авг 2020, 14:08
205b394
Код
Авторство
О чём код?
package sqlancer.postgres.ast; import sqlancer.common.ast.BinaryNode; import sqlancer.postgres.PostgresSchema.PostgresDataType; public class PostgresConcatOperation extends BinaryNode<PostgresExpression> implements PostgresExpression { public PostgresConcatOperation(PostgresExpression left, PostgresExpression right) { super(left, right); } @Override public PostgresDataType getExpressionType() { return PostgresDataType.TEXT; } @Override public PostgresConstant getExpectedValue() { PostgresConstant leftExpectedValue = getLeft().getExpectedValue(); PostgresConstant rightExpectedValue = getRight().getExpectedValue(); if (leftExpectedValue == null || rightExpectedValue == null) { return null; } if (leftExpectedValue.isNull() || rightExpectedValue.isNull()) { return PostgresConstant.createNullConstant(); } String leftStr = leftExpectedValue.cast(PostgresDataType.TEXT).getUnquotedTextRepresentation(); String rightStr = rightExpectedValue.cast(PostgresDataType.TEXT).getUnquotedTextRepresentation(); return PostgresConstant.createTextConstant(leftStr + rightStr); } @Override public String getOperatorRepresentation() { return "||"; } }