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

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


public class TruncateTest extends PGTest {

    public void test_0() throws Exception {
        String sql = "TRUNCATE bigtable, fattable;";

        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 = "TRUNCATE bigtable, fattable RESTART IDENTITY;";

        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 = "TRUNCATE othertable CASCADE;";

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

    public void test_0() throws Exception {
        String sql = "DROP TABLE films, distributors;";

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

    public void test_0() throws Exception {
        String sql = "INSERT INTO films VALUES ('UA502', 'Bananas', 105, '1971-07-13', 'Comedy', '82 minutes');";

        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" + //
                     ");";

        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

                     ", \"algLable.schemaName\", \"algLable.tableName\", \"algLable.fieldName\"" + //
                     " from cnres.function_select_algmodule_rule() " + //
                     " as a( id text,name text,beanId text, \"algLable.id\" text,\"algLable.name\" text" + //
                     ", \"algLable.schemaName\" text,\"algLable.tableName\" text, \"algLable.fieldName\" text)";

        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 res.restaurant_id, row_number() " + //
                     "over (order by ST_Distance(res.restaurant_point,GeomFromEWKT(?))*111.12 ) as row_id " + //
                     "FROM restaurant res where res.city_id = ? and res.is_delete =false and res.restaurant_id <1000000 limit 10";

        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 t_e_shopcatalog.* " //
                     + "FROM t_e_shopcatalog, r " //
                     + "WHERE t_e_shopcatalog.parentcatalogid = r.catalogid )"
                     + "SELECT * FROM r )rs WHERE 1=1";

        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_3() throws Exception {
        String sql = "            select    memberId ,   offerIds    from cnres.function_select_get_seller_hot_offer_list('\\'-1\\'')    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

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.