Search in sources :

Example 6 with PGExprParser

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

the class ExtractTest_Year method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "EXTRACT(YEAR FROM TIMESTAMP '2001-02-16 20:38:40')";
    PGExprParser parser = new PGExprParser(sql);
    PGExtractExpr expr = (PGExtractExpr) parser.expr();
    System.out.println(expr.toString());
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) PGExtractExpr(com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGExtractExpr)

Example 7 with PGExprParser

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

the class CidrTest method test_timestamp.

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

Example 8 with PGExprParser

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

the class LineSegmentsTest method test_timestamp.

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

Example 9 with PGExprParser

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

the class PolygonTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "# '((1,0),(0,1),(-1,0))'";
    PGExprParser parser = new PGExprParser(sql);
    SQLUnaryExpr unaryExpr = (SQLUnaryExpr) parser.expr();
    Assert.assertEquals(SQLUnaryOperator.Pound, unaryExpr.getOperator());
}
Also used : PGExprParser(com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser) SQLUnaryExpr(com.alibaba.druid.sql.ast.expr.SQLUnaryExpr)

Example 10 with PGExprParser

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

the class TimestampTest method test_timestamp.

public void test_timestamp() throws Exception {
    String sql = "TIMESTAMP '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)

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