Search in sources :

Example 1 with EscapedCharStringLiteral

use of io.crate.sql.tree.EscapedCharStringLiteral in project crate by crate.

the class TestStatementBuilder method testEscapedStringLiteral.

@Test
public void testEscapedStringLiteral() {
    String input = "this is a triple-a:\\141\\x61\\u0061";
    String expectedValue = "this is a triple-a:aaa";
    Expression expr = SqlParser.createExpression(Literals.quoteEscapedStringLiteral(input));
    EscapedCharStringLiteral escapedCharStringLiteral = (EscapedCharStringLiteral) expr;
    assertThat(escapedCharStringLiteral.getRawValue(), is(input));
    assertThat(escapedCharStringLiteral.getValue(), is(expectedValue));
}
Also used : SubqueryExpression(io.crate.sql.tree.SubqueryExpression) SubscriptExpression(io.crate.sql.tree.SubscriptExpression) ParameterExpression(io.crate.sql.tree.ParameterExpression) ArrayComparisonExpression(io.crate.sql.tree.ArrayComparisonExpression) Expression(io.crate.sql.tree.Expression) ComparisonExpression(io.crate.sql.tree.ComparisonExpression) NegativeExpression(io.crate.sql.tree.NegativeExpression) EscapedCharStringLiteral(io.crate.sql.tree.EscapedCharStringLiteral) Test(org.junit.Test)

Aggregations

ArrayComparisonExpression (io.crate.sql.tree.ArrayComparisonExpression)1 ComparisonExpression (io.crate.sql.tree.ComparisonExpression)1 EscapedCharStringLiteral (io.crate.sql.tree.EscapedCharStringLiteral)1 Expression (io.crate.sql.tree.Expression)1 NegativeExpression (io.crate.sql.tree.NegativeExpression)1 ParameterExpression (io.crate.sql.tree.ParameterExpression)1 SubqueryExpression (io.crate.sql.tree.SubqueryExpression)1 SubscriptExpression (io.crate.sql.tree.SubscriptExpression)1 Test (org.junit.Test)1