Package com.alibaba.druid.sql.dialect.postgresql.parser

Examples of com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser


                     "    product_no integer," + //
                     "    name text," + //
                     "    price numeric CHECK (price > 0)" + //
                     ");";

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());
View Full Code Here


        JdbcUtils.close(reader);
        String[] items = input.split("---------------------------");
        String sql = items[0].trim();
        String expect = items[1].trim();

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());
View Full Code Here

        System.out.println();
        System.out.println();
    }

    void mergValidate(String sql, String expect) {
      PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);

        Assert.assertEquals(1, statementList.size());

        StringBuilder out = new StringBuilder();
View Full Code Here

public class PGSelectIntoTest extends PGTest {
  public void test_0() throws Exception {
    String sql = "SELECT * INTO films_recent FROM films WHERE date_prod >= '2002-01-01';";
   
        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());

View Full Code Here

public class PGDeleteTest5 extends PGTest {

    public void test_0() throws Exception {
        String sql = "DELETE FROM films USING producers  WHERE producer_id = producers.id AND producers.name = 'foo';";

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());
View Full Code Here

public class PGExportParameterVisitorTest1 extends TestCase {
    public void test_pg() throws Exception {
        String sql = "select fname, count(*) from t where fid = 1 group by fname order by 1";

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);

        PGExportParameterVisitor visitor = new PGExportParameterVisitor();
        stmt.accept(visitor);
       
        List<Object> parameters = visitor.getParameters();
View Full Code Here

public class PGSelectTest10 extends PGTest {

    public void test_0() throws Exception {
        String sql = "SELECT nextval('passport_id_seq'::regclass) as id";

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());
View Full Code Here

                     + //
                     "from  cnres.function_select_get_p4p_offer_by_sps('\\'1160160508\\',\\'1085432755\\',\\'971765217\\'')   "
                     + //
                     "     as a(    offerId character varying(256),    offerIds character varying(4000)   )";

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());
View Full Code Here

public class PGSelectForUpdateTest extends PGTest {

    public void test_0() throws Exception {
        String sql = "select pkvalue from dbtpktable where tablename = 'taturvisit' for update";

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());
View Full Code Here

public class PGSelectTest2 extends PGTest {

    public void test_0() throws Exception {
        String sql = "SELECT * FROM t1 NATURAL INNER JOIN t2;";

        PGSQLStatementParser parser = new PGSQLStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement statemen = statementList.get(0);
        print(statementList);

        Assert.assertEquals(1, statementList.size());

View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.