Search in sources :

Example 1 with PGExprParser

use of com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser in project druid by alibaba.

the class BoxTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "box '((0,0),(1,1))' + point '(2.0,0)'";
    PGExprParser parser = new PGExprParser(sql);
    SQLBinaryOpExpr binaryExpr = (SQLBinaryOpExpr) parser.expr();
    PGBoxExpr box = (PGBoxExpr) binaryExpr.getLeft();
    PGPointExpr point = (PGPointExpr) binaryExpr.getRight();
    Assert.assertEquals("BOX '((0,0),(1,1))' + POINT '(2.0,0)'", binaryExpr.toString());
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) SQLBinaryOpExpr(com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr) PGPointExpr(com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGPointExpr) PGBoxExpr(com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGBoxExpr)

Example 2 with PGExprParser

use of com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser in project druid by alibaba.

the class CircleTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "circle '((0,0),2)'";
    PGExprParser parser = new PGExprParser(sql);
    PGCircleExpr expr = (PGCircleExpr) parser.expr();
    Assert.assertEquals("circle '((0,0),2)'", expr.toString());
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) PGCircleExpr(com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGCircleExpr)

Example 3 with PGExprParser

use of com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser in project druid by alibaba.

the class MacAddrTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "macaddr '12:34:56:78:90:ab'";
    PGExprParser parser = new PGExprParser(sql);
    PGMacAddrExpr expr = (PGMacAddrExpr) parser.expr();
    Assert.assertEquals("macaddr '12:34:56:78:90:ab'", expr.toString());
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) PGMacAddrExpr(com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGMacAddrExpr)

Example 4 with PGExprParser

use of com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser in project druid by alibaba.

the class BitStringTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "B'101'";
    PGExprParser parser = new PGExprParser(sql);
    SQLBinaryExpr expr = (SQLBinaryExpr) parser.expr();
    Assert.assertEquals("B'101'", SQLUtils.toSQLString(expr, JdbcConstants.POSTGRESQL));
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) SQLBinaryExpr(com.alibaba.druid.sql.ast.expr.SQLBinaryExpr)

Example 5 with PGExprParser

use of com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser in project druid by alibaba.

the class BitsTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "44::bit(10)";
    PGExprParser parser = new PGExprParser(sql);
    PGTypeCastExpr expr = (PGTypeCastExpr) parser.expr();
    System.out.println(expr.toString());
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) PGTypeCastExpr(com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGTypeCastExpr)

Aggregations

PGExprParser (com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser)14 SQLTimestampExpr (com.alibaba.druid.sql.ast.expr.SQLTimestampExpr)2 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)1 SQLBinaryExpr (com.alibaba.druid.sql.ast.expr.SQLBinaryExpr)1 SQLBinaryOpExpr (com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr)1 SQLUnaryExpr (com.alibaba.druid.sql.ast.expr.SQLUnaryExpr)1 PGBoxExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGBoxExpr)1 PGCidrExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGCidrExpr)1 PGCircleExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGCircleExpr)1 PGExtractExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGExtractExpr)1 PGInetExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGInetExpr)1 PGLineSegmentsExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGLineSegmentsExpr)1 PGMacAddrExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGMacAddrExpr)1 PGPointExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGPointExpr)1 PGPolygonExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGPolygonExpr)1 PGTypeCastExpr (com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGTypeCastExpr)1