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

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


public class PGDeleteTest3 extends PGTest {

    public void test_0() throws Exception {
        String sql = "DELETE FROM tasks WHERE status = 'DONE' RETURNING *;";

        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 PGExportParameterVisitorTest 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);

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

public class PGDeleteTest4 extends PGTest {

    public void test_0() throws Exception {
        String sql = "DELETE FROM films WHERE producer_id IN (SELECT id FROM producers WHERE 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

                     "    , \"algModuleRule.algmMaxRatio\" text, \"algModuleRule.objectType\" text" + //
                     "    , \"cateRule.id\" text, \"cateRule.name\" text, \"cateRule.assembleType\" text" + //
                     "    , \"cateRule.algmIds\" text, \"cateRule.algmRatio\" text, \"cateRule.algmMaxRatio\" text" + //
                     "    , \"appObject.id\" text,\"appObject.name\" text, \"appObject.beanId\" 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

                     "    product_no integer," + //
                     "    name text," + //
                     "    price numeric DEFAULT 9.99" + //
                     ");";

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

    public void test_0() throws Exception {
        String sql = "DELETE FROM tasks WHERE CURRENT OF c_tasks;";

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

    public void test_0() throws Exception {
        String sql = "select \"xxx\"::varchar as xx from xxx;";

        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 fromUserId, toMemberId, rank, tag " + //
                     "from cnres.function_get_re_cni_myali_acion_fct0(?) " + //
                     "as (fromUserId character varying(128), toMemberId character varying(128), rank numeric, tag character varying(128))";

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

    public void test_0() throws Exception {
        String sql = "INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets') RETURNING did;";

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

    public void test_0() throws Exception {
        String sql = "INSERT INTO films (code, title, did, date_prod, kind) VALUES ('T_601', 'Yojimbo', 106, '1961-06-16', 'Drama');";

        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.