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

Examples of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser.parseStatementList()


    public void test_37() throws Exception {
        String sql = "SELECT HOUR('10:05:03');";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT HOUR('10:05:03');", text);
    }
View Full Code Here


    public void test_38() throws Exception {
        String sql = "SELECT NOW(), SLEEP(2), NOW();";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT NOW(), SLEEP(2), NOW();", text);
    }
View Full Code Here

    public void test_39() throws Exception {
        String sql = "SELECT SYSDATE(), SLEEP(2), SYSDATE();";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT SYSDATE(), SLEEP(2), SYSDATE();", text);
    }
View Full Code Here

    public void test_40() throws Exception {
        String sql = "SELECT SUBDATE('2008-01-02', INTERVAL 31 DAY);";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT SUBDATE('2008-01-02', INTERVAL 31 DAY);", text);
    }
View Full Code Here

    public void test_41() throws Exception {
        String sql = "SELECT TIME('2003-12-31 01:02:03.000123');";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT TIME('2003-12-31 01:02:03.000123');", text);
    }
View Full Code Here

    public void test_42() throws Exception {
        String sql = "SELECT SECOND('10:05:03');";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT SECOND('10:05:03');", text);
    }
View Full Code Here

    public void test_43() throws Exception {
        String sql = "SELECT TIMESTAMPADD(MINUTE,1,'2003-01-02');";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT TIMESTAMPADD(MINUTE, 1, '2003-01-02');", text);
    }
View Full Code Here

    public void test_44() throws Exception {
        String sql = "SELECT TIMESTAMPADD(WEEK,1,'2003-01-02');";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT TIMESTAMPADD(WEEK, 1, '2003-01-02');", text);
    }
View Full Code Here

    public void test_45() throws Exception {
        String sql = "SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT TIMESTAMPDIFF(MONTH, '2003-02-01', '2003-05-01');", text);
    }
View Full Code Here

        String sql = "CREATE TABLE lookup" + //
                     "  (id INT, INDEX USING BTREE (id))" + //
                     "  STATS_AUTO_RECALC DEFAULT;"; //

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

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

TOP
Copyright © 2018 www.massapi.com. 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.