mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser for postgresql
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.alibaba.druid.bvt.sql.postgresql.expr;
|
||||
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PGTest;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGCidrExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser;
|
||||
|
||||
|
||||
public class CidrTest extends PGTest {
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.alibaba.druid.bvt.sql.postgresql.expr;
|
||||
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PGTest;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGCircleExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser;
|
||||
|
||||
|
||||
public class CircleTest extends PGTest {
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.alibaba.druid.bvt.sql.postgresql.expr;
|
||||
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PGTest;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGInetExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser;
|
||||
|
||||
|
||||
public class InetTest extends PGTest {
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.alibaba.druid.bvt.sql.postgresql.expr;
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PGTest;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGBoxExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGLineSegmentsExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGPointExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser;
|
||||
|
||||
|
||||
public class LineSegmentsTest extends PGTest {
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.alibaba.druid.bvt.sql.postgresql.expr;
|
||||
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PGTest;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLUnaryExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLUnaryOperator;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGMacAddrExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser;
|
||||
|
||||
|
||||
public class MacAddrTest extends PGTest {
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.alibaba.druid.bvt.sql.postgresql.expr;
|
||||
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.PGTest;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGPolygonExpr;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser;
|
||||
|
||||
|
||||
public class PolygonTest2 extends PGTest {
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user