Search in sources :

Example 11 with PGExprParser

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

the class TimestampTest method test_timestamp_with_timezone.

public void test_timestamp_with_timezone() throws Exception {
    String sql = "TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'";
    PGExprParser parser = new PGExprParser(sql);
    SQLTimestampExpr expr = (SQLTimestampExpr) parser.expr();
    System.out.println(expr.toString());
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) SQLTimestampExpr(com.alibaba.druid.sql.ast.expr.SQLTimestampExpr)

Example 12 with PGExprParser

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

the class PolygonTest2 method test_timestamp.

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

Example 13 with PGExprParser

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

the class ArrayTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "cast(xx as varchar(12)[])";
    PGExprParser parser = new PGExprParser(sql);
    SQLExpr expr = parser.expr();
    Assert.assertEquals("CAST(xx AS varchar(12)[])", SQLUtils.toPGString(expr));
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) SQLExpr(com.alibaba.druid.sql.ast.SQLExpr)

Example 14 with PGExprParser

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

the class InetTest method test_timestamp.

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

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