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

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


public class PGDeleteTest 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


                     "    product_no integer," + //
                     "    name text," + //
                     "    price numeric DEFAULT nextval('products_product_no_seq')" + //
                     ");";

        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 void test_0() throws Exception {
        String sql = "INSERT INTO films (code, title, did, date_prod, kind) VALUES"
                     + "    ('B6717', 'Tampopo', 110, '1985-02-10', 'Comedy'), "
                     + "('HG120', 'The Dinner Game', 140, DEFAULT, 'Comedy');";

        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 PGInsertTest3 extends PGTest {

    public void test_0() throws Exception {
        String sql = "INSERT INTO films SELECT * FROM tmp_films WHERE date_prod < '2004-05-07';";

        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 PGSelectTest1 extends PGTest {

    public void test_0() throws Exception {
        String sql = "SELECT * FROM t1 CROSS 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

        String sql = "CREATE TABLE my_first_table (" + //
            "    first_column text," + //
            "    second_column integer" + //
            ");";

        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

                     "    (SELECT sales_person FROM accounts WHERE name = 'Acme Corporation')" + //
                     "    RETURNING *" + //
                     ")" + //
                     "INSERT INTO employees_log SELECT *, current_timestamp FROM upd;";

        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 void test_0() throws Exception {
        String sql = "select    categoryId ,   offerIds    from cnres.function_select_get_spt_p4p_offer_list      ('    1031918   ,    1031919   ,    1037004   ')       as a(categoryId numeric,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 void test_1() throws Exception {
        String sql = "select    memberId ,   offerIds    from cnres.function_select_get_seller_hot_offer_list('\\'gzyyd168\\'')    as a(memberId character varying(20),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 void test_2() throws Exception {
        String sql = "            select    offerId ,   offerIds    from cnres.function_select_get_self_rel_offer_by_behavior      ('    350740   ')       as a(offerId numeric,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

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.